此頁面有繁體中文版本。

This page is also available in English.

静态图 NPU 服务中的 KV 缓存分配

Managing host-tier cache eviction directly preserves available accelerator capacity by regulating data movement against allocation demands. Available NPU Memory adjusts as dynamic allocation draws resources while reclaimer and offloading processes cycle cache between tiers. In illustrative Plays, Available NPU Memory falls from 604.2 to 517.5 on average at step 50 when raising the offload threshold, demonstrating how retention policies shape shared accelerator headroom.

Machinations diagram of KV Cache Allocation in Static-Graph NPU Serving: Available NPU Memory, Host KV Memory, Active NPU Cache, Offload Threshold Lever, Restoration Bandwidth Lever, Recomp Penalty, Offload Threshold Lever rate, Restoration Bandwidth Lever rateMachinations diagram of KV Cache Allocation in Static-Graph NPU Serving: Available NPU Memory, Host KV Memory, Active NPU Cache, Offload Threshold Lever, Restoration Bandwidth Lever, Recomp Penalty, Offload Threshold Lever rate, Restoration Bandwidth Lever rate

主要收获

  • Setting Offload Threshold Lever to 6 leaves Available NPU Memory at 517.5 units on average at step 50 compared to 604.2 units at the baseline setting of 3.
  • Increasing Restoration Bandwidth Lever from 2 to 4 elevates Available NPU Memory to 611.1 units on average at step 50 instead of 604.2 units.
  • Accelerator capacity drains when host restoration channels stall and force context recomputation, so checking return bandwidth is essential before raising offload limits.
  • Available NPU Memory diverges later in execution between threshold settings, shifting from 757.1 units at step 8 down to 517.5 units at step 50 under higher offload pressure.

Does offloading cache free up accelerator memory?

Teams serving multi-model agents must constantly balance caching inactive context against recomputing tokens when accelerator pools tighten. In this playable model, Available NPU Memory reaches 604.2 units on average at step 50 under baseline settings, but altering memory controls changes that reserve significantly. The numbers presented here are illustrative values derived from repeated plays across fifty cycles of cache transfers.

When managing complex multi-agent execution graphs, choosing how aggressively to offload inactive context blocks to host memory determines whether worker instances suffer starvation. One might expect that pushing data off the device always preserves accelerator room, but in this model higher threshold settings actually drain capacity faster by triggering costly recomputation cycles.

How do the cache control levers shift capacity?

The Offload Threshold Lever sets how aggressively inactive context blocks move into host storage. In the baseline setting, this lever sits at 3, leaving Available NPU Memory at 604.2 units at step 50. Increasing this lever to 6 drops the remaining pool to 517.5 units at step 50 on average.

Early in execution, the two configurations track closely together. At step 1 both settings average 794.6 units of free memory. By step 8 the baseline shows 759.4 units while the setting of 6 drops to 757.1 units, before diverging much further late in the Play.

The Restoration Bandwidth Lever dictates the maximum rate for restoring stored context from host memory back into device memory. Starting at a baseline value of 2, the accelerator holds 604.2 units of memory at step 50. Raising the restoration bandwidth setting to 4 lifts that outcome to 611.1 units at step 50.

This lever creates noticeable divergence early in processing. At step 3 the baseline setting of 2 shows 783.8 units while the higher bandwidth of 4 registers 784 units. By step 8 the baseline registers 759.4 units whereas the expanded bandwidth level preserves 760.8 units of device headroom.

How do the cache pools push on one another?

The playable model tracks balance across three primary stores: Available NPU Memory, Host KV Memory, and Active NPU Cache. Dynamic request traffic brings bursts of agent activity that prompt the NPU Allocator to draw capacity away from unallocated space into active context blocks. Once active contexts complete their tasks, the Memory Reclaimer replenishes available capacity.

When active context blocks become idle, the Offload Processor shuttles them out into host storage based on dynamic rates governed by the Offload Threshold Lever. Later, when agents demand those contexts again, the Cache Restorer attempts to draw them back into active device memory according to limits set by the Restoration Bandwidth Lever.

Bottlenecks create systemic friction throughout the execution pipeline. If stored context cannot return quickly enough because transfer bandwidth is saturated, the Recomputation Engine intervenes to regenerate context directly on the device. That recomputation creates extra strain recorded in Recomp Penalty, which accelerates memory consumption and drains the accelerator pool.

What does this mean for memory management?

In this model, expanding transfer bandwidth reliably preserves device space, while raising the offload threshold proves counterproductive. Pushing higher volumes into host tiers without adequate return bandwidth forces the system into recomputation. That dynamic shows why tuning host migration cannot be solved by simply evicting blocks more aggressively.

Planners should look at restoration pipelines before attempting to offload larger chunks of active cache. In this model, preserving 611.1 units of memory requires matching data transfers to bandwidth realities rather than triggering recomputation penalties. Monitoring transfer pressure protects system capacity far better than aggressive caching policies.

该模型遗漏了什么?

This playable model uses fixed time steps and static initial allocations, starting Available NPU Memory at 800 units, Host KV Memory at 100 units, and Active NPU Cache at 100 units. It also assumes constant baseline transfer rates and simplified conversion stages between stores. All capacity units and traffic bursts are illustrative model values rather than direct operational metrics.

Real systems are more complicated than any model. The diagram abstracts memory management into closed loops between three designated pools without tracking physical hardware constraints or complex context hierarchies. It relies entirely on predetermined conversion blocks and constant baseline thresholds.

这个话题从何而来?

This playable model was inspired by the research paper titled Recompute or Restore? Host-Tier KV for Multi-Model Agent Workflows on a Static-Graph NPU Serving Stack, published by arXiv on 13 November 2026. The findings, numbers, and structural interactions explored in this essay represent the model's own illustrative scenario.

您能自己测试这些权衡吗?

You can explore these balance dynamics directly by adjusting the control levers inside the playable model. Test different values for both the offload threshold and restoration bandwidth to observe how device capacity fluctuates across repeated cycles.

模型的组成部分

它提出的问题: 在多模型智能体执行期间,管理主机层键值(KV)缓存驱逐与重新计算如何影响可用加速器内存的资源池?

可用 NPU 内存 · 资源池
Holds unallocated memory capacity available on the NPU accelerator.
主机 KV 内存 · 资源池
Stores offloaded KV cache blocks in host system RAM.
Active NPU Cache · 资源池
Holds active KV cache blocks currently occupying NPU memory.
卸载阈值杠杆 · 杠杆
Adjusts how aggressively inactive KV cache blocks are offloaded to host RAM.
恢复带宽杠杆 · 杠杆
Sets the maximum host-to-NPU restoration rate per step.
Recomp Penalty · 寄存器
Computes NPU memory strain caused by recomputation cycles.
Offload Threshold Lever rate · 寄存器
Calculates dynamic offload rate from threshold lever.
Restoration Bandwidth Lever rate · 寄存器
Calculates dynamic restoration rate from bandwidth lever.
Active NPU Cache rate · 寄存器
Register: Active NPU Cache rate
Request Traffic · 来源
Generates incoming agent context request bursts.
Memory Reclaimer · 来源
Reclaims available NPU memory when contexts complete or offload.
Offload Processor · 转换器
Offloads inactive cache blocks from NPU memory to host RAM.
Cache Restorer · 转换器
Restores offloaded host cache back into active NPU memory.
Recomputation Engine · 转换器
Recomputes context when restoration bandwidth is insufficient.
NPU Allocator · 转换器
Allocates available NPU memory to active context execution.
Host Eviction · 消耗点
Evicts host cache when host memory capacity limits are reached.

假设与限制

  • 数值容量和带宽值仅供说明。
  • One step of Play represents a single context allocation and transfer cycle.
  • Available NPU Memory decreases through Occupy and increases via Reclaim.

带有说明性数值的教学模型;每次游玩都是一个情境,而不是预测 (Forecast)。

来源

感谢 arXiv 允许使用其开放获取的互操作性。

关于此模型

Machinations 使用 AI 从公开来源 (Source) 制作这些模型,每一个都是一个教学情境 (Scenario):其数字是为模型选择的说明性值,而不是测量或预测 (Forecast)。 您可以 在社区 (Community) 中打开此图表 (Diagram) 以重混并更改它。

分享此模型
浏览 Economic Zeitgeist