Agentic coding tasks: workload profile and block storage KV-cache offloading applicability

October 9, 2026

Back to all posts

Repeated prefill problem and possible caching solution

Basic inference service (for example, vllm-based) is semi-stateless by default: every request (even the same, repeated later) is expected to be processed from scratch every time (full prefill and decode stages). When an LLM serves a request, it first runs the prefill stage: the model processes the entire input context in a single forward pass, computing the key and value tensors for every token, which are stored in GPU-resident KV cache. This is why time-to-first-token grows as prompts get longer. Next processing stage - decoding - starts after prefill stage is complete, and a model starts to emit one token at a time. Prefill is compute-bound, and its cost grows with the length of a context.

As an example, this hits agentic workloads in a very particular way. A coding agent does not send independent questions — it sends the same conversation over and over, slightly longer each time. Round N is round N−1 plus several hundred tokens: e.g. one bash command and its output. A significant amount of requests shares 95–100% of their context with something the server had already computed minutes earlier.

vLLM addresses this with automatic prefix caching: KV blocks computed once are reused when a later request starts with the same prefix. The limit is capacity, not logic. Those reusable blocks sit in HBM, competing with model weights and with a KV cache of every request currently decoding. As soon as the server is loaded enough to form a queue — which is exactly the regime where performance matters — blocks belonging to earlier paused sessions are evicted to make room for active ones. When the agent returns with the next round of an earlier paused session, the prefix it needs is no longer there, and the server pays for a full prefill, again.

So the problem is not that prefill is expensive. The problem is that the work was already done and then discarded because of a lack of space. More sophisticated KV cache offloading tooling keeps those evicted blocks in a cheaper tier — RAM or block storage — and streams them back into HBM instead of recomputing them.

This is a field, where products like LMCache and Mooncake play their role: they provide additional tiers of storage (in addition to HBM memory) to cache and reuse KV blocks:

  • First storage tier outside HBM is RAM - and the one that runs out. The working set is not a constant: it is concurrent sessions × session length × average context size, and each session holds its share until the task is done. RAM is capped by the board's DIMM slots, bought per node, and private to that node — a session routed to another GPU starts cold, which is exactly what load balancing does.
  • Second tier is a block storage: local or remote. A modest NVMe array holds tens of terabytes at a fraction of the cost per gigabyte, and it scales by adding drives rather than upgrading every inference server. And a remote array adds what RAM cannot offer at any price: one pool of blocks visible to every inference node. The cost is latency — the measurements below show how much of it reaches the user.

Our xiRAID Opus storage is what makes that latency affordable. A conventional kernel storage stack would erase the benefit — interrupt-driven I/O, a bounce buffer in host RAM, a software RAID layer. Instead, a user-space NVMe driver in polling mode keeps latency predictable under many parallel retrievals, and a native NVMe-oF target is GPUDirect-capable end to end, so a block requested by LMCache moves from the drives into GPU memory without ever landing in host RAM.

And such KV-caching block storage tier could be used alone or as a part of semi-distributed caching system.

Our experiment

In theory, KV caching technology could significantly optimize inference tasks, but we need to answer some questions before deploying additional software and hardware to the inference service:

  • Does the workload justify a cache tier at all? Which properties of a request traffic make KV reuse pay off, how do we measure them, and what hit ratio does this workload actually reach?
  • How much RAM would this workload need? Cache per token, per session and per node — the numbers that determine when a memory tier stops fitting on the board, and how many parallel sessions a given amount of RAM can carry.
  • What does a block tier cost in terms of performance? Is is even comparable with RAM-based offloading? In our example we compare xiRAID Opus-based block storage tier against RAM tier, to see how much of the storage-level penalty is still visible where the user is standing.

To check whether is it possible to answer these questions, we made a step beyond simple infrastructure measurements:

  • We select a non-synthetic workload - agentic coding.
  • We deploy and use a local inference service, which could be run in 3 different configurations:
    1. Simple configuration with a typical in-GPU KV cache, without external tiers. It should be the fastest without a significant load on it, and the slowest under load, when GPU memory resources are exhausted.
    2. Configuration with a memory-based KV caching tier. This one should provide us the best performance under load, but is limited with a local RAM size.
    3. Configuration with a block-based remote storage, using our xiRAID Opus storage engine, which gives us fast RAID0 and remote NVMe-oF target to connect to.

The first evaluation step is to run some “synthetic” measurements: we use a simple and suitable tool (LMCache provided), generate specific amount of data with it, take care about memory configuration and request sizing, push a set of requests to our inference service (in several offloading configurations), and see the best synthetic numbers we can get.

As a next and most important step, we run the same real workload 3 times, using inference service configurations above. We make sure our workload is comparable in terms of tasks, parallel sessions, and cache traffic volume. Then we compare workload results and metrics to get a real-life picture of different caching tier types applicability.

Main goal is to compare RAM backend (which is always the best tier provided after HBM memory) and a fast remote block-based backend, and to check whether it is at least near in terms of performance.

Another important considerations:

  • Remote backend and inference server are connected using 400 Gbs RDMA-capable fabric.
  • On the inference server we make sure that GPUDirect functionality is supported between Mellanox network interface and GPUs: no data is processed in RAM on transfer, - it is directly transferred using DMA over PCIe hierarchy.

Two steps above give us an understanding of:

  • “production-level” conditions that must be met and parameters to be monitored;
  • real workload profile in terms of bit and bytes, and metrics which can show us that a KV-offloading really plays the role.

And certainly we can see the real applicability of a block storage tier, which can helpful in situations, when we do not have enough RAM to spare.

Note about workloads and their KV cache offloading compatibility

KV cache offloading is not a universal technique to optimize inference service performance. We should always consider corresponding request traffic characteristics: especially context and workload.

Request context we need

KV cache data reuse does not really suits short user “dialogs” with an LLM: several short questions, getting an answer to the ultimate question of life, the universe and everything - on the system level it produces a dead amount of MBytes, which will continue lying on the cache storage tier, waiting for a reuse which will never come.

For an successful KV offloading strategy, we need something else:

  • “Chat“ session, its amount of prompt-response rounds should be relatively big (10, 100, …).
  • Session context size should be relatively long, and has a tendency to grow.
  • It’s nice to have small changes of context size between rounds/LLM interactions - in this case, cache reuse ratio will be high.
  • It’s very promising, when a session spans tens of minutes or hours, with pauses between rounds bigger than seconds. A continuous burst of rounds keeps data in GPU memory and prevents a KV cache from being evicted, blocking its reuse from a backend.

Our agentic coding really suits such pattern: we feed a set of coding tasks (in our example, from swe-bench-lite dataset) using an agentic tool, with a long sessions, and possibly high cache reuse ratio.

Workload intensity we need

Another sad but true fact - KV cache offloading infrastructure is not something you need by default to make everything better, even if you have a suitable workload type. To make such optimizations work, our inference system should be congested.

A rule of a thumb: we should see a inference requests queue present (in our example these requests are from different code solving sessions). We have a request queue ← requests are “fighting” for HBM resources ← there is not enough GPU memory for every request ← reusable KV blocks will be pushed out of memory ← KV blocks will be reused from a backend.

Once you see your system congested - you will have an every bit of KV cache reuse advantage.

And to achieve such state in our experiment, we use a corresponding set of parallel agents working on a set of coding tasks (we tune their count until we will see requests in the waiting queue).

Note about RAM KV offloading backend

Now we can identify a suitable workload type and achieve a state, when our KV cache offloading optimization should work. But what kind and size of storage tier do we need?

First choice is RAM KV offloading tier, and for your own infrastructure such tier could be the only one. But you can be limited with available and required RAM size, which depends on:

  • How many parallel problem-solving sessions do we have;
  • How long each session lasts (do you have long test suites or human interaction?);
  • Average context size of a session;
  • Cache size per token.

It is always important to remember that our cached data become useless at the moment the code task is solved, so nobody should expect to hoard all the cache bytes for a long time.

The simple rule to evaluate tier requirements:

  1. Your sessions are short-living, and you have plenty of RAM to store a context for an amount of parallel session supported for your infrastructure → use RAM offloading.
  2. You are limited with RAM, your sessions are long (do you have separate congested queue to run app tests on a hardware?) → you can use some kind of block storage, local or remote.

In our experiment, we consider ourselves RAM-limited and evaluate and compare it with a block-based tier. But it is certain that such design decision to use it is not a default one, and not for every system and workload.

Measurements and results

Below you can see an overview of our experiment: our environment, basic synthetic measurement and real workload metrics, details and tier comparison.

Environment we use

Servers, hardware and network

Component Characteristics
Inference server
  • AMD EPYC 9654 96-core
  • RAM 1TB
  • 2x NVIDIA H100 GPUs, 80GB
  • 1x400 GbE, Connect-X7
Storage server
  • AMD EPYC 9654 32-core
  • RAM 256 GB
  • NVMe PASCARI 2.56 TB x8
Network 400 GbE fabric

Software and AI model

Component Software Notes
Inference stack vLLM 0.24.0
  • tensor-parallel-size 2
  • model-len 262144
KV cache offloading engine LMCache 0.5.0
  • LMcache chunk size: 256
  • “Cpu memory” LMcache offloading tier: 300GB tier
  • “GPUDirect” LMCache offloading tier: GDS buffer size 16384, local NVMe-of resource mount
Storage engine xiRAID Opus 1.3.0
  • RAM used: 32 GB
  • CPU cores used: 16
  • Drives used: NVMe PASCARI 2.56 TB x8
  • RAID0 published over NVMe-oF, 128 KB chunk, 4K block, 19 TB total

Workload generation and dataset used

Component Software Note
Agentic tool mini-swe-agent 55 agents, each solves 10 tasks one by one
Dataset swe-bench-lite  

Below you can see an architecture overview and a data path used in our experiments - with 2 KV cache offloading configurations (non-caching configuration is not shown):

Architecture overview - 1 Architecture overview - 2

Note that KV cache offloading architectures are not limited to the shown above. Moreover, the real KV cache magic comes with multiple inference nodes and/or storage endpoints, for example:

  • Multiple inference nodes communicating with a single centralized KV cache management instance (e.g LMCache), with a unified cache storage.
  • Multiple inference nodes with an individual interconnected cache storage with separate backend volumes, but with an ability of KV data sharing.

Synthetic measurements

We definitely do not oppose the idea, that synthetic measurements are useful - they just show only an ideal part of a whole picture. We have used scripts provided by LMCache project to generate synthetic requests with different context sizes (ranging from 1000 tokens to 260000) to see what gain can be achieved with different KV cache offloading configurations (RAM-based, block-based over GPUDirect), compared to a request processing without any caching (default vLLM configuration).

TTFTs for synthetic requests of different context sizes, with different offloading methods, ranging from 0 to 260000 tokens

TTFTs for synthetic requests of different context sizes, with different offloading methods, ranging from 0 to 260000 tokens

Note that a small bump at 140000 tokens is expected - at the moment GPU memory allows us, we were sending multiple parallel requests of the same size instead of a single huge one. It has own side effects on TTFT (the bump shown), but allow us to utilize memory and keep amount of data to fetch relatively stable.

On the graph above we can see that any type of offloading in our environment can provide a significant gain compared with non-offloaded request processing. When our cache hit is near 100%, especially starting from 5000 tokens context, it is always better to have KV cache offloading tooling in the specific inference infrastructure. And the difference in the TTFT became significant starting from 60000 tokens.

Both offloading methods are not radically different from each other in terms if TTFT, as we can see on the next graph (same graph as above, but with non-offloaded measurments removed):

TTFTs for synthetic requests of different context sizes, with different offloading methods, specifically for RAM-based and remote block-based (“GPUDirect”) offloading

TTFTs for synthetic requests of different context sizes, with different offloading methods, specifically for RAM-based and remote block-based (“GPUDirect”) offloading

From the data above:

  • We can see, that there is no significant difference between TTFTs for RAM-based offloading and remote block-based offloading configurations. Average additional “price“ to fetch data from a remote storage is 0.17s (+27% to a memory-based offloading time).
  • We should take into account, that small contexts sizes (<5000 tokens) are not fully suitable for KV cache offloading, in case we have multiple parallel requests running: we do not have any guarantee that it will be better that recalculating our data from scratch, and we see a significant throughput drop, either with memory-based or block-based offloading.

So, such synthetic tests give us an ideal picture:

  • What can be achieved - in terms of TTFT differences.
  • Where is lower possible border of applicability, in terms of context size, for specific infrastructure:
    • with a request context < 5000 tokens caching gain is not guaranteed.
    • in the range of 5000 … 60000 tokens, we can see the effects or KV-caching (x2 - x3 faster TTFT).
    • with a request context > 60000 tokens, speed up becomes even more significant (x10 - x20 faster).

Now we should get a second part of the picture - how does this ideal picture maps to the real workload - our agentic coding example?

Parameters of a real workload

With the same inference service infrastructure (and different modes of KV cache offloading), we ran a set of parallel coding tasks, executed one by one by a group of simple coding agents. Before the experiment we have found a suitable amount of parallel agents: 55.

Such amount of parallel agent sessions allows us to see vLLM requests queue - in this situation KV-cache offloading starts working, but we will not see ideal TTFTs (compared to what we had in “ideal“ synthetic measurements). It is better to investigate wall time difference to solve the task and generation throughput time difference (in tokens/second).

We run a same set of tasks 3 times, with different KV cache offloading configurations, using a same amount of agents.

During our inference runs we collect vLLM logs with corresponding statistics, analyze these logs to extract metrics and compile corresponding graph reports. Surprisingly, logs provide enough information to see the whole picture - you do not really require separate metrics collector (but it is certainly useful to make sure system is running within required conditions).

But are we really able to compare our inference runs?

Multiple inference runs for the same task set are not really deterministic - we are not using a same algorithm to solve a task within exact same time. And the other worrying question - are we really offloading the same amount of data to the KV caching backends?

Below is the table with inference run parameters comparison:

Operation type No offloading RAM-based offloading GPUDirect-based offloading Difference (RAM vs GPUdirect)
Trajectories (sessions) 477 480 475  
Http requests (“rounds”) 29696 29363 29778 1.4%
KV store operations - 44052 (22025 unique) 45084 (22542 unique) 2.2%
KV retrieval operations - 42018 (21009 unique) 42794 (21397 unique) 1.8%
Unique request IDs 29282 29398 29834 1.4%

As we see, our analyzed logs are not very different in terms of requests, KV store and KV retrieve operations. And what about data amount transferred between vLLM and KV storage backend?

KV cache operaiton RAM-based offloading GPUDirect-based offloading
Min store request size, MB 12 12
Max store request size, MB 372 372
Average store request size, MB 21.35 21.53

Within a relatively similar store request amount, we have a similar statistics for request sizing.

KV cache operation RAM-based offloading GPUDirect-based offloading
Min retrieval request size, GB 0.12 0.12
Max retrieval request size, GB 2.48 2.41
Average retrieval request size, GB 0.651 0.635

And same picture we see for KV block retrieval requests - two inference runs are not radically different in terms of request amount and data volume transferred to/from storage.

Requests amount and wall time to solve all tasks

We have 55 agents, each solving 10 tasks one by one. What wall time to solve all problems could we achieve, using different KV offloading configurations? Below we can see a graph, which helps us to answer this question, with 3 separate code problem-solving sessions plotted on the same timeline (axis X):

Requests amount and wall time to solve all tasks - 1

Original data for a graph above was cleaned up: we are interested only in a state, in which we have GPU memory utilization > 80% with a requests present in a queue. Below you can see wall times for periods of an intensive workload, whose processing performance could be optimized by caching, with different KV cache offloading methods enabled:

Offloading type Wall clock Note
No offloading 2h 26m 32s 241% - obviously much longer that with a memory-based offloading. Each request is processed slower, because it is processed from scratch
Memory-based offloading 1h 0m 51s 100% - this is a best offloading we can achieve, when we have enough RAM
Remote block-based offloading with GPUDirect 1h 10m 41s 116% - not a huge difference compared to a memory-based mode, also much better than to recalculate everything. Looks promising if we are limited with RAM

Our infrastructure can handle 30-40 parallel requests at a time, every other request (15-25) is waiting in a queue. Here is a comparison of generation throughput for the same offloading configurations, in tokens/second, for a same period of time:

Requests amount and wall time to solve all tasks - 2

Again we can see, that a specific workload is faster with KV cache offloading: our generation throughput is significantly higher (see blue and red graphs), compared with non-offloaded configuration (green graph).

Request context sizing

As we know from a synthetic test above, KV cache offloading is effective when request context size exceeds a specific limit (>5000 tokens). To get our real context sizes for coding tasks, we again analyze our vLLM logs - below you can see a result in a form of a distribution histogram. All request sizes are group into buckets, so we can see what context sizes are the most popular in our workload.

Data below was taken from RAM-based offloading run - these values are not affected by an offloading type, results for a block-based run are similar.

Distribution of a context sizes for coding task requests (“turns“) - RAM-backed example

Distribution of a context sizes for coding task requests (“turns“) - RAM-backed example

In the next table we can see some statistic for our request sizes. Again should be noted, that variation in request size does not depend on offloading type.

Request context characteristic Value, tokens (RAM-offloading) Value, tokens (GPUDirect-offloading) Note
Minimal size 1308 1308 Contains a minimal initial coding task + rules for a vllm to solve a coding problem
Maximum size 54789 60219  
Average size 14934 14896  
Median size 13272 13253  

And these are good news for us! Most our requests have a size >5000 tokens, so we definitely should have positive KV-cache offloading effect. For an average request context size, we should have: 14934 tokens * 96 KB = 1.36 GB KV-cache stored on a backend (or prefilled again).

Bad news are that our coding tasks are not complex enough - the more steps we need to solve a problem, the larger the context, the more gain we can get using offloading.

These numbers also allow us to calculate a rough estimate: minimal size of a KV-cache storage backend:

Name Value
Maximum context size from our RAM-offloaded example ~55000 tokens
KV cache stored on the storage backend for a single code solving session 55000 * 96 KB = 5.03 GB
Parallel task coding sessions (based on maximum requests, which could be processed in parallel) 55 agents running, each solves 1 coding task
Storage required, at least 276 GB

Note, that our 2 GPUs are not limited with 55 parallel code task solving sessions - more can be executed, with just more requests staying in the waiting queue. In this situation an average TTFT will rise, but generation throughput should be the same (and better than raw one without any offloading).

KV cache effectiveness

Another question worth investigating is a KV cache hit ratio for our coding tasks - and we have all required numbers in vLLM logs, we just need to extract and process them. Below you can see corresponding distribution histogram (requests with different cache hits are distributed to a set of buckets). This distribution is similar to all our KV-offloaded inference runs. This is overall cache hit - LMCache-backed + vLLM-internal one.

Requests/rounds distributed by their cache hit ratio (RAM-backed example)

Requests/rounds distributed by their cache hit ratio (RAM-backed example)

Name Value, RAM-backed run Value, GPUDirect-backed run
Requests/rounds count analyzed 29398 29834
Average hit ratio 94.57% 94.61%
Median hit ratio 97.27% 97.25%

We see, that a huge amount of requests (73% out of 29363 total rounds in the first example) backed by a KV cache has 95-100% hit rate. We can see that coding tasks are a good candidate for inference process optimization using KV cache offloading.

Context round-to-round changes which provides us with a high cache hit ratio

But why do we have such a high cache hit ratio? The answer is hidden in the specifics of our code task context, and to quantify it, we should refer to the recorded sessions/trajectories, and analyze the context changes between rounds.

Name In tokens In % to the context In tokens In % to the context
  RAM-backed example GPUDirect-backed example
Requests/rounds registered in trajectories/sessions 28945 - 29045 -
Average turns per session 60 - 61 -
Average context growth per round 345 4.7% 351 4.7%
Median context growth per round 241 1.9% 248 1.9%
Minimal context growth per round 52 0.1% 52 0.1%
Maximum context growth per round 4942 181% 5049 186%
KV cache effectiveness

As you see, an average content growth on the next round is just 4.7%! Without any caching functionality enabled, on each turn you should recompute (prefill) the whole context, including these additional 4.7%.

And to emphasize, that such small changes are not worth recalculating whole context from scratch, here is an example of tool request response, which produces our average addition of 345 tokens. This is just a single step in solving specific coding problem by an agent:

**Assistant thought (previous turn, instruction from the prev. request):**
```
Great! I've reproduced the issue. Now let me analyze the problem more carefully. Looking at the error traceback and the code, the issue is in the logic of the `is_upper` method. Let me examine exactly what indices are being accessed:
```
**Command(s) run:**
```bash
python3 -c "
import sympy
A = sympy.zeros(4, 2)
print('Matrix shape:', A.shape)
print('Indices being checked:')
for i in range(1, A.rows):
    for j in range(i):
        print(f'  [{i}, {j}]')
"
```


**Tool observation (this is what got added to the next request):**
```
0

/testbed/sympy/core/basic.py:3: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
  from collections import Mapping
/testbed/sympy/plotting/plot.py:28: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
  from collections import Callable
Matrix shape: (4, 2)
Indices being checked:
  [1, 0]
  [2, 0]
  [2, 1]
  [3, 0]
  [3, 1]
  [3, 2]

```

Backend-backed vs GPU-resident KV cache

Above we can see an overall cache hit, using several caching options. Now it’s time to find a way distinguish their effects. Another vLLM log metric with a misleading name “Inference engine computed tokens“ can help us with that.

Below we can see a distribution graph for a requests/rounds, which have some GPU-resident cache already present in a GPU memory (no backend fetch needed):

Name Value, RAM-backed example Value, GPUDirect-backed example
Requests/rounds count analyzed 29398 29834
Average amount of gpu-persistent tokens 5826 5970
Median amount of gpu-persistent tokens 272 288
Maximum amount of gpu-persistent tokens 51616 60160
Distribution for cache-per-tokens amount resident in GPU memory, with RAM-based offloading present

Distribution for cache-per-tokens amount resident in GPU memory, with RAM-based offloading present

This distribution graph shows us a work of the caching function provided by vLLM itself, in a presence of a memory-based offloading tier. Note that this graph is log-scaled.

First peak is the interesting one: 60.4% (17770) of requests/rounds are landing in the first bucket: KV cache for these requests was fully evicted from a GPU memory. Only the minimal shared context survives (our 272 tokens), basically the part of the system message (see below) + some technical parts of a template. Everything else should be loaded from a KV cache backend, or recalculated from scratch.

You are a helpful assistant that can interact with a computer shell to solve programming tasks.

--- <pr_description>
Consider the following PR description:

Only a single request has 0 “token cache” persisted in the GPU memory - the very first one, which populated the system message prefix cache.

KV cache data sizes and backend fetching operations

Next thing to be quantized is an amount of data which to be loaded from a KV caching backend. To investigate these numbers, we have the vLLM log metric called “need_to_load“.

Thanks to the combined work of caching mechanisms (LMCache-based and internal), 38% of requests/round already have everything they need in the GPU memory. Other 62% requests need a data fetch from a KV cache backend, and you can see the corresponding distribution graph below describing data fetch sizing.

Name Value, in tokens Value, in MB/GB (cache per token = 96 KB) Value, in tokens Value, in tokens
  RAM-backed exmaple GPUDirect-backed example
Requests/rounds that do not need cache loading 11181 (38% ot 29398 total) - 11241 (37.8% ot 29834 total) -
Requests/rounds that requires data loading 18217 (62% ot 29398 total) - 17946 (60% ot 29834 total) -
Minimum amount of a cache to load 16 1.5 MB 16 1.5 MB
Average amount of a cache to load 14129 1.29 GB 13748 1.26 GB
Median amount of a cache to load 12528 1.15 GB 12272 1.12 GB
Maximum amount of a cache to load 54256 4.96 GB 52720 4.83 GB
Distribution for requests with a specific amount of data to be loaded from KV-cache tier, RAMbacked example

Distribution for requests with a specific amount of data to be loaded from KV-cache tier, RAMbacked example

Note that the numbers above are load intensity-dependent. The more load we apply to the inference service, the more cache is loaded from a backend, and the less data survives for a long time in the GPU memory (except the minimal 272-token prefix mentioned above).

  • We could pull up to 5 GB from a storage backend per inference request, with an average request size of 1.3 GB.
  • Our data-to-load range is within 1k - 60k tokens (this is specific for our task set complexity, model internal performance and agent logic complexity). As we know from our synthetic measurements, we certainly get a low to medium performance gain in that range.

Above we have request and data amounts, which are calculated by a top-level vLLM engines routines. At the same time, logs give us additional hint about per-GPU data flow (remember, we use 2 GPUs, so we have 2 low-level cache fetches for each inference request).

Below we compare low-level data retrieval requests sizing for per-GPU operations.

Retrieval request size metric Request to a RAM backend, GB Request to a remote block-based backend with GPUDirect, GB
Average 0.65 0.64
Median 0.57 0.56
Max 2.48 2.41

We do not see significant difference of a backend request sizing between offloading methods - amount of data to be loaded does not depend on a backend type. What is important:

  • Average retrieval request to load data from a backend: 0.65 GB (remember that in our configuration with 2 cards we need 2 fetches).
  • Maximum retrieval request size is 2.48 GB.

Conclusions

Above you can see a relatively simple steps, which can be a foundation for KV-cache applicability analysis for your inference service, your contexts and workload intensity. Our example above shows, what useful performance metrics of a inference could be extracted from logs and trajectories, using a set of real agentic coding tasks and two different KV-cache offloading configurations:

  • We did a basic evaluation of potential limits and opportunities provided by KV cache offloading using simple synthetic tests. These results have a limited value, characterize only a specific inference service environment, and help us to understand what is expected from an inference system: what optimization options and gains do we have for specific context sizes and configurations.
  • We show, that it is relatively simple to extract required metrics from vLLM logs produced under a real workload, with an additional help of client-side session data. Such metrics can help us to check a real offloading applicability and cache performance, using non-synthetic workload data. We can obtain a quantitative performance profile, including:
    • Average and maximum requests sizing;
    • Context size changes between inference rounds;
    • Amount of token's cache to be loaded, storage requests sizing and storage system throughput.
    • Cache hits distribution.
    • Context growth characteristics.
    • Work distribution between build-in caching and external caching tiers.
  • We see a practical result: our block-based xiRAID Opus storage can be definitely considered as an offloading tier for our workload, and does not radically different compared with the fastest RAM-based tier: 1h 10m against 1h 01m on wall clock, while solving everything from scratch without external KV-caching takes 2h 26m.
  • We found a boundary, which defines our preferences in KV cache backend selection: in our example, 55 agents were generating 276 GB minimum, which barely did not exceeded our configured RAM tier limitation (300 GB). A slight change in problem solving process (e.g. long tests sequences), more agents with additional coding tasks - this equilibrium breaks, RAM tier will no longer be able to keep the working set, eviction starts, and overall system performance drops. An this is where a block tier stops being a compromise. A memory tier stops at the board's DIMM slots, is bought per server, competes for host memory bandwidth with everything else running on that box, and is private to that node. An NVMe pool is effectively unbounded and costs a fraction per gigabyte: it grows by adding drives and is visible to the whole farm of inference servers, so a session rescheduled onto a free GPU still finds its prefix. The pool can be built from remote NVMe drives, from the drives already sitting in the GPU nodes, or from both.
  • Surprisingly, computed_tokens metric become very important in real-world benchmarks - to push to the maximum, we should try to tune workload conditions up to the point it becomes near minimum system prefix cache (our example is 272 tokens). In such state you will minimize internal vLLM caching effects. But on the other side, combined work of internal and external “caching tiers“ is the real and a profitable mode, which brings significant overall increase in terms of time and token throughput, which could not be achieved with vLLM-only functionality.
  • TTFT was a great parameter for synthetics tests, but in a real life it is polluted with a queue waiting time. And token throughput + wall times can be more prominent to compare different inference system configurations.
  • As a downside, we can clearly see that our simple agent tool, coding tasks and task-specific guidelines does not consume enough tokens (only < 60k) to get a maximum effect of KV-cache offloading (which is predicted by our synthetic tests to be massive above 60k tokens).

Great thing is that such KV-cache applicability evaluation is not a very complex task - you already have most of the required information in a vLLM logs. The only step required is to process them using a suitable data processing tooling.