AgentKV is a high-throughput LLM KV cache management architecture designed to eliminate redundant prefill compute in collaborative multi-agent pipelines.
By exploiting the group-additive properties of Rotary Positional Embeddings (Delta-RoPE), AgentKV enables instant, bit-for-bit accurate Key-Value cache reuse at arbitrary sequence positions without re-running transformer layers.
In multi-agent systems (such as CrewAI, LangGraph, AutoGen, and modular subagent swarms), worker agents routinely share large, identical context blocks:
- 1,500+ token tool definitions and function-calling schemas
- Long system prompt instructions and shared governance rubrics
- Shared codebases or retrieved RAG reference documentation
However, each agent begins with an agent-specific prefix at sequence offset 0 (for example: Agent 1: Architect, Agent 2: Senior Implementer, Agent 3: Code Reviewer).
Existing state-of-the-art inference engines (vLLM, SGLang, TensorRT-LLM) rely on Radix Tree Automatic Prefix Caching (APC):
- Cache lookup starts strictly from token position 0.
- Any variation in prefix tokens invalidates cache matching for all subsequent tokens.
- Every downstream agent is forced to re-prefill the entire 1,500+ token tool schema from scratch.
- On consumer hardware like the NVIDIA GeForce RTX 3060 12GB (360 GB/s memory bandwidth), this redundant compute saturates the GPU and stalls agent responsiveness.
AgentKV decouples positional encoding from raw prompt prefix alignment using two mathematical properties:
Transformers apply positional embeddings solely to Query and Key tensors. Value vectors contain zero positional encoding. A cached Value tensor at position
Rotary Positional Embedding (RoPE) rotates Key coordinate pairs by an angle
By trigonometric angle addition:
Key Result: Rotating an already-computed Key cache block from sequence offset
Evaluated on Qwen 2.5 7B Instruct (AWQ / Marlin W4A16 GEMM kernel, 32 layers, hidden dimension 3584, 28/4 GQA):
| Metric | Full Prefill (Radix Miss) | Delta-RoPE In-Place Rotation | Improvement |
|---|---|---|---|
| Compute Cost (1,500 tok) | 22.118 TeraFLOPs | 147.456 MegaFLOPs | 149,995x fewer FLOPs |
| Rotation Kernel Time | ~1,105.9 ms | 0.28 ms | 3,949x faster |
| Float64 Analytical Error | Reference | 7.257e-13 | Machine precision |
| Attention Output Cosine Sim | Reference | 0.999931 | Zero degradation |
Simulating a 5-agent team sharing a 1,500-token tool specification:
| Agent Role | Unique Prefix | Shared Tool Chunk | Radix APC TTFT | AgentKV TTFT | Speedup |
|---|---|---|---|---|---|
| Agent 1 (Architect) | 150 tok | 1,500 tok (Init) | 1,253.4 ms | 1,253.4 ms | 1.00x |
| Agent 2 (Implementer) | 350 tok | 1,500 tok (Delta=+200) | 1,423.0 ms | 317.3 ms | 4.48x |
| Agent 3 (Reviewer) | 80 tok | 1,500 tok (Delta=-70) | 1,194.4 ms | 88.8 ms | 13.46x |
| Agent 4 (Security Auditor) | 220 tok | 1,500 tok (Delta=+70) | 1,312.4 ms | 206.7 ms | 6.35x |
| Agent 5 (Test Runner) | 110 tok | 1,500 tok (Delta=-40) | 1,220.2 ms | 114.6 ms | 10.65x |
| Cumulative Pipeline | 8,685 Total Tokens | 6,000 Redundant Tokens Saved | 6,403.5 ms (6.40s) | 1,980.8 ms (1.98s) | 3.23x Pipeline (7.08x TTFT) |
The repository includes a Swiss-designed, interactive hardware telemetry dashboard and vector math sandbox:
-
Interactive Delta-RoPE Coordinate Sandbox: Live unit circle visualizer with customizable
$\Delta$ angle slider. - Side-by-Side Prefill Race: Real-time simulation of GPU SM core utilization (Radix APC vs. AgentKV).
- Multi-Agent Pipeline Telemetry: Cumulative token savings and TTFT breakdown.
To run locally:
python -m http.server 8089Then navigate to http://localhost:8089.
Verify the analytical group identity with standard Python and NumPy:
python verify_rope.pyExpected output:
========================================================================
AGENTKV / DELTA-ROPE MATHEMATICAL PROOF & REPRODUCIBILITY VERIFICATION
========================================================================
[1] Generating synthetic Key representations for 1500 tokens...
- Original Position m: 120 .. 1619
- Target Position m': 320 .. 1819 (Delta: +200)
[2] Computing Baseline (Full recalculation at position m')...
- Computed in 101.881 ms
[3] Computing AgentKV (Delta-RoPE transformation of cached Key k_m)...
- Transformed in 107.487 ms
[4] Numerical Invariance Audit (Bit-for-Bit Validation):
- Maximum Absolute Error (Float64): 7.257e-13
- Mean Absolute Error (Float64): 4.101e-15
- Mathematical Identity Status: PASSED (Exact Analytical Group Identity)
[5] FLOP Compute Complexity Comparison (32-Layer 7B Model):
- Full Transformer Prefill: 25.519 TeraFLOPs
- Delta-RoPE Rotation: 516.096 MegaFLOPs
- Raw Arithmetic Cut: 49,445x Fewer Operations
- 32-Layer Key Cache Size: 328.1 MB (FP16)
- RTX 3060 Memory Bandwidth: 360 GB/s (Bus saturation latency < 0.5ms)
========================================================================
VERDICT: 100% BIT-FOR-BIT REPRODUCIBLE (7.26e-13 max float64 error)
========================================================================
Test the in-place tensor rotation kernel with PyTorch:
python test_kernel.pyReproduce the 5-agent empirical latency benchmark:
python benchmark.pyAgentKV/
├── assets/ # Architectural diagrams and telemetry assets
├── index.html # Interactive visualizer and live prefill race
├── kernel.py # PyTorch Delta-RoPE in-place rotation reference kernel
├── test_kernel.py # PyTorch numerical precision unit test
├── verify_rope.py # Zero-dependency NumPy proof and FLOP benchmark
├── benchmark.py # Multi-agent RTX 3060 empirical benchmark reproduction
└── README.md # Architecture overview and mathematical proof
If you use or reference AgentKV in your research or inference infrastructure:
@article{neve2026agentkv,
title={AgentKV: Arbitrary-Position Key-Value Cache Reuse for Multi-Agent LLMs via Delta-RoPE},
author={Neve, Sharvin},
year={2026}
}