Manuscript Offprint

arXiv:2610.08378

Lachesis: Lifetime-Aware KV Cache Placement for Agent Serving across HBM and High-Bandwidth Flash

Jaehoon Yang, Jeongmin Lee, Haneul Park, Seung Yul Lee, Nam Sung Kim, Jae W. Lee

Jaehoon Yang

Seoul National University

Seoul, Republic of Korea

jaehoon.yang@snu.ac.kr

Seung Yul Lee

Seoul National University

Seoul, Republic of Korea

triomphant1@snu.ac.kr

Jeongmin Lee

KAIST

Daejeon, Republic of Korea

jeongminl@kaist.ac.kr

Nam Sung Kim

University of Illinois,

Urbana-Champaign

Urbana, IL, USA

nam.sung.kim@gmail.com

Haneul Park

University of Illinois,

Urbana-Champaign

Urbana, IL, USA

hnpark2@illinois.edu

Jae W. Lee

Seoul National University

Seoul, Republic of Korea

jaewlee@snu.ac.kr

Abstract

Large language model (LLM) serving is increasingly dominated by agentic workloads, in which agents and their subagents accumulate context as KV cache across many requests, consuming substantial memory. High-bandwidth flash (HBF) is a promising solution, providing an order of magnitude greater capacity at HBM-class read bandwidth, but its finite write endurance is the key limiting factor. Our key insight is that KV cache should be placed across HBM and HBF by its lifetime. Placing shorter-lived data in HBM lets HBM absorb more of an agent run's writes and sends less of them to HBF. As the lifetime of KV cache in agentic serving is dictated by the harness, the program that orchestrates the agents, we analyze its behavior and identify three axes along which lifetime diverges, temporal, structural, and inter-worker. Guided by these observations, we present Lachesis, a lifetime-aware KV cache placement layer between the agent harness and the serving engine. At write time, it places each segment in HBM or HBF according to its lifetime, and frees its blocks once the segment is no longer read. In trace-driven simulation, Lachesis extends HBF lifetime by 1.19−3.13×1.19-3.13\times over HBM-first placement, reaching 3.3–12.2 device-years. Even under continuous 24×724\times7 operation at the full load a tight SLO admits, HBF outlasts its five-year warranty on the multi-agent trace.

1 Introduction

LLM serving is shifting toward agentic workloads, in which an agent works on a single user task over many LLM requests and spawns sub-agents that run concurrently alongside it [55]. Whereas a conventional request holds one context for the duration of one request, an agent holds the context it has accumulated so far in the session as KV cache, and that KV cache can stay live well beyond the request that wrote it, in some cases until the session ends (Figure 1, top left). Together with the sub-agents a session spawns, this longer lifetime pushes the volume of KV cache live at one time far beyond that of conventional serving. The pressure this KV cache puts on an accelerator's high-bandwidth memory (HBM) forces a deployment to add accelerators or serve fewer sessions at once, either of which raises the hardware cost of a served request [14, 23, 41].

High-bandwidth flash (HBF) is emerging as a promising class of memory for LLM inference, offering an order of magnitude greater capacity than HBM with HBM-class sequential read bandwidth [38]. That capacity absorbs the added pressure and brings the cost of a served request back down. The key limiting factor for HBF, however, is write endurance. NAND flash tolerates only a finite number of program/erase (P/E) cycles, so a DRAM-like role that absorbs a large volume of writes can wear it out in a fraction of HBF's required service life. Early HBF designs therefore confine HBF to read-only data such as model weights and shared-prefix KV caches [14, 20, 29]. As KV caches are a dominant source of serving-time memory pressure in agentic and large-batch workloads [25, 26, 36], recent works extend HBF to dynamically generated KV cache and select what to write to it, mainly by its read-to-write ratio [23, 33, 47].

Unlike prior work, which selects KV cache for HBF by its read-to-write ratio [23], we select it by its lifetime. When HBF is used alongside HBM, every KV block a session writes lands in one of the two tiers, and only the bytes that land in HBF spend endurance. HBF therefore lasts longer the more of a session's writes HBM absorbs. The volume HBM absorbs over a period is its capacity multiplied by the number of times each block is reclaimed when the KV cache it holds is discarded. Placing shorter-lived KV blocks in HBM therefore lets HBM absorb more of a session's writes and sends less of them to HBF, which requires knowing a block's lifetime before it is written.

In agentic serving, KV lifetime is set by the agent harness, the program that orchestrates the session [5, 24, 37, 46], so we analyze how the harness manages it. Depending on how it structures the session and the sub-agents it spawns, the harness keeps some KV cache for the whole session and

Figure

Figure 1. Top left: the read window of a conventional request, and of an agent session. Left: the three axes along which context-segment lifetimes differ. Right: Lachesis's two placement paths.

discards the rest partway through. It makes that decision for KV in groups, so each group shares one lifetime. We call such a group a context segment and the point at which it is discarded a context boundary.

Our analysis shows that segment lifetimes diverge along three axes of session structure, shown in the left panel of Figure 1. The temporal axis follows the turns of a session, one opened by each user message. When the next message arrives, the harness strips the reasoning generated within the turn and carries only its output forward. The reasoning segment holds 66–83% of the KV the turn writes yet lives only one turn, whereas the output segment lives 7.6–17.2× longer. The structural axis follows delegation within a turn. A lead agent may, depending on the harness, delegate subtasks to sub-agents, each running in its own context. When a sub-agent returns, the harness discards its segment and keeps only its result. Sub-agent segments produce most of the KV written within the turn, while the lead-agent segment lives 4.0–6.1× longer. The temporal and structural boundaries are both predetermined and known to the harness. On those two axes the short-lived segment, which takes large portion of writes, can therefore be placed in HBM at the write and freed the moment the boundary arrives. The third axis, inter-worker, follows the workers that carry out those subtasks, whose lifetimes differ by when each completes. That completion time is not fixed in advance, and worker lifetimes spread by 3.7–23.6× between p10 and p90, so segments of one class carry significantly different lifetimes. Our key observation is that their relative order can be predicted at spawn time from the record the harness uses to build each worker’s context. Placement can thus be decided before the KV is written along all three axes.

We present Lachesis, a lifetime-aware KV cache placement layer that decides which KV reaches HBF before a segment is written (§4). Lachesis places along two paths (Figure 1, right). The deterministic path covers the temporal and structural axes, where the harness knows whether a segment is discarded at the boundary or retained past it. A short-lived context segment has priority for HBM, and a long-lived context segment is placed in HBF. The predictive path covers the inter-worker axis, where no context boundary separates one worker's segment from another's. Lachesis predicts each segment's lifetime at spawn, ranks the segments shortest-first, and admits as many as HBM has room for, placing the rest in HBF. Lifetime is tracked entirely in Lachesis, and the serving engine sees it only through two calls. The first allocates a KV block from the tier Lachesis specifies, HBM or HBF, so every placement decision of either path is issued as one allocation. The second frees the blocks of a segment whose lifetime has ended, at the boundary the harness reports. Across agent traces replayed through a simulated two-tier memory system, Lachesis extends HBF lifetime by 1.19–3.13× over HBM-first placement, which allocates in HBM while it has a free block and in HBF otherwise (§5). At a tight service-level objective (SLO) under continuous 24×7 operation, HBF outlasts a five-year warranty on the multi-agent trace.

In summary, this paper makes the following contributions:

• We show that the context an agent session accumulates divides into segments of differing lifetime along three axes, temporal, structural, and inter-worker, and that a segment’s lifetime can be determined before it is written.

  • We design Lachesis, a lifetime-aware KV cache placement layer between the agent harness and the serving engine. Its deterministic path places the segments the harness marks as short-lived in HBM, and its predictive path admits the workers predicted to be shortest-lived, so that less KV reaches HBF and its endurance lasts longer.

  • We evaluate Lachesis against HBM-first placement and show that it extends HBF lifetime by 1.19–3.13×, and that HBF then outlasts a five-year warranty on the multi-agent trace at a tight SLO. A session writes the same KV volume under either policy; Lachesis admits the shortest-lived segments to HBM and frees each at its boundary, so the same HBM capacity absorbs more of that volume and less of it reaches flash.

References (21)