From c9fafa94d933a61bd3d0d5513c61d8433f4d32a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20W=C3=A5reus?= Date: Sat, 5 Sep 2026 09:34:40 +0000 Subject: [PATCH] Add memory design space insight and three dr reports --- brain/inbox/dr/2026-09-05/kv-reuse-serving.md | 486 ++++++++++++++ .../latent-reasoning-agent-memory.md | 412 ++++++++++++ .../inbox/dr/2026-09-05/weights-ssm-memory.md | 407 ++++++++++++ ...y-is-a-state-placement-and-access-trade.md | 601 ++++++++++++++++++ 4 files changed, 1906 insertions(+) create mode 100644 brain/inbox/dr/2026-09-05/kv-reuse-serving.md create mode 100644 brain/inbox/dr/2026-09-05/latent-reasoning-agent-memory.md create mode 100644 brain/inbox/dr/2026-09-05/weights-ssm-memory.md create mode 100644 brain/insights/llm-memory/memory-is-a-state-placement-and-access-trade.md diff --git a/brain/inbox/dr/2026-09-05/kv-reuse-serving.md b/brain/inbox/dr/2026-09-05/kv-reuse-serving.md new file mode 100644 index 0000000..bc42e80 --- /dev/null +++ b/brain/inbox/dr/2026-09-05/kv-reuse-serving.md @@ -0,0 +1,486 @@ +--- +title: "The underlying problem: how can a language model hold and use more information than its token context window allows? Research ALL families of memory mechanisms beyond in-context tokens: (1) cross-request KV-cache reuse in serving systems (SGLang RadixAttention, PromptCache, CacheBlend, vLLM prefix caching, Anthropic/OpenAI context caching APIs) as practical persistence of compressed state across requests; (2) weights as memory: fine-tuning and context distillation as lossy compression, LoRA adapters as swappable memory cartridges, test-time training and Titans (Google 2025) learning-to-memorize at test time, memory layers with product-key lookup (Meta Memory Layers at Scale); (3) fixed-size-state sequence models: Mamba, S4, xLSTM, RWKV where the hidden state IS a constant-size compressed memory, what information theory says about lossy state vs lossless attention access, and hybrid attention+SSM models; (4) reasoning directly over latent embeddings instead of decoded tokens: Meta Large Concept Model, Coconut chain-of-continuous-thought, byte latent transformer, diffusion LLMs iterating over latent states; (5) external episodic memory systems for agents (Mem0, Zep/Graphiti knowledge graphs, Letta/MemGPT lineage, sleep-time compute) and what they still store as text; (6) information-theoretic and empirical limits: what fixed-size state provably cannot preserve, measured retrieval-vs-reasoning degradation, and which approaches work on frozen open-weight models today versus requiring training. Include concrete benchmark numbers, compression ratios, and production maturity." +generated_at: 2026-09-05T08:21:28.884424443+00:00 +strategy: deep-agent-v1 +effort: deep +planner_model: "z-ai/glm-5.2" +worker_model: "deepseek/deepseek-v4-flash" +writer_model: "z-ai/glm-5.2" +--- + +# Beyond the Context Window: A Systematic Comparison of Memory Mechanisms for Language Model Inference + +## Abstract + +This report catalogs and compares mechanisms by which language models persist, compress, and retrieve information beyond their token context window. The admitted evidence covers one family in depth — cross-request KV-cache reuse in serving systems and proprietary API context caching — with concrete throughput, latency, cost, and cache-hit-rate measurements across production and research systems. SGLang's RadixAttention achieves up to 6.4× throughput over baseline inference systems [S2], while vLLM prefix caching delivers 254% higher output throughput and 78% lower time-to-first-token on Qwen3-32B [S13]. Anthropic and OpenAI offer API-level context caching with 90% cost reductions on cache reads [S31, S40]. CacheBlend extends reuse beyond prefix-only matching by selectively recomputing 5–18% of tokens, achieving 2.2–3.3× TTFT reduction with negligible quality loss [S21, S29]. The evidence register does not contain sources for five other planned mechanism families — weights as memory, fixed-size-state sequence models, latent embedding reasoning, external episodic memory, and information-theoretic limits — and these gaps are reported as limitations. + +## Research Question + +How can a language model hold and use more information than its token context window allows? The research plan specified six families of memory mechanisms: (1) cross-request KV-cache reuse in serving systems, (2) weights as memory via fine-tuning and context distillation, (3) fixed-size-state sequence models, (4) reasoning over latent embeddings, (5) external episodic memory for agents, and (6) information-theoretic and empirical limits. The admitted evidence addresses family (1) and its API-level counterparts with strong coverage. Families (2)–(6) lack admitted sources and are treated as open gaps. + +## Method + +Evidence was gathered from official API documentation, arXiv papers, technical blogs, GitHub repositories, and third-party benchmark reports. Each source was assigned an admission score based on provenance type (peer-reviewed paper, official documentation, or technical blog) and relevance to the research question. Sources scoring above the admission threshold were retained. Claims are cited inline with source markers [S#]. Where vendor blogs report performance numbers, the limitation is noted. No code was executed; all numbers are transcribed from published sources. + +## Conceptual Background + +Language model inference proceeds in two phases. During **prefill**, the model processes the input prompt and computes key-value (KV) tensors for each attention layer. During **decode**, the model generates output tokens autoregressively, attending to the cached KV tensors from prefill. The prefill step is compute-bound and often the dominant cost for long prompts; decode is memory-bandwidth-bound. + +A **KV cache** stores the key and value tensors produced during prefill. If a subsequent request shares the same prompt prefix, the cached tensors can be reused, skipping recomputation of that prefix. This is the basis of **prefix caching**. The **cache hit rate** — the fraction of input tokens served from cache rather than recomputed — directly determines latency and cost savings [S14]. + +**RadixAttention**, introduced by SGLang, organizes KV caches in a radix tree that enables automatic reuse of any shared prefix across requests [S1, S2]. This contrasts with simple single-request caching, which discards KV tensors after each request completes. RadixAttention generalizes prefix caching to arbitrary request trees, including multi-turn conversations where each turn shares a prefix with the previous turn. + +**Time-to-first-token (TTFT)** measures the latency from request submission to the first decoded token. Because prefill is the slowest part of a request, cache hits that skip prefill produce large TTFT reductions — 30–80% in typical deployments [S40]. + +| Term | Definition | +|---|---| +| KV cache | Key-value tensors computed during prefill; stored for reuse across decode or across requests | +| Prefill | Forward pass over the input prompt; compute-bound, dominates latency for long inputs | +| Cache hit rate | Fraction of input tokens served from reused KV cache rather than recomputed | +| Prefix caching | Reuse of KV cache for the leading shared prefix of a prompt | +| RadixAttention | SGLang's radix-tree-based automatic cross-request prefix cache reuse | +| TTFT | Time-to-first-token; latency from request to first generated output token | +| Non-prefix KV reuse | Reuse of cached KV blocks at arbitrary positions, not just the prefix | +| TTL | Time-to-live for cached content before eviction; resets on access in some APIs | + +## Findings + +### Cross-Request KV-Cache Reuse in Serving Systems + +#### SGLang RadixAttention + +SGLang's RadixAttention stores KV caches in a radix tree indexed by token sequences. When a new request arrives, the tree is traversed to find the longest matching prefix; matched KV tensors are reused and only the unmatched suffix is computed. SGLang reports up to 5× higher throughput than Guidance and vLLM on Llama-7B and Mixtral-8x7B [S1], and up to 6.4× over state-of-the-art inference systems in its paper [S2]. The 6.4× figure includes contributions from both RadixAttention and compressed finite-state-machine decoding; the isolated cache-reuse contribution is not reported. + +On H100 hardware with ShareGPT workloads, SGLang achieves 16,215 tokens/second versus vLLM's 12,553 — a 29% throughput advantage — with TTFT of 79ms versus 103ms (23% faster) [S4]. For multi-turn agentic workloads with 60%+ prefix overlap, RadixAttention delivers 75–95% cache hit rates [S3]. On a single H100 with Llama-3.3-70B-Instruct, first-request TTFT is 280–320ms, dropping to 80–120ms for subsequent cached requests — approximately a 3× reduction [S3]. + +A direct head-to-head on DeepSeek-R1-Distill-Llama-70B with 7k context shows SGLang RadixAttention completing in 4.287s versus 5.093s for fresh context (~20% speedup) and 4.572s for vLLM's cache (~10% advantage over vLLM APC) [S5]. Across broader benchmarks, RadixAttention cache hit rates range from 50% to nearly 99% [S8]. + +SGLang is deployed on over 400,000 GPUs in production at xAI, NVIDIA, AMD, and LinkedIn [S4], though this claim originates from a commercial blog without independent verification. + +#### SGLang HiCache: Hierarchical KV Caching + +SGLang HiCache extends KV cache storage beyond GPU memory to CPU RAM, disk, and remote storage backends (3FS, Mooncake). HiCache achieves up to 6× throughput improvement and up to 80% TTFT reduction [S7]. On DeepSeek-R1-671B with Mooncake, cache hits produce an 84% TTFT reduction [S7]. On Qwen3-Coder-480B with 3FS, integrating HiCache raised cache hit rate from 40% to 80%, doubled inference throughput, and reduced session-average TTFT by 56% [S7]. + +#### vLLM Automatic Prefix Caching + +vLLM implements automatic prefix caching (APC), which reuses KV tensors for shared prompt prefixes without explicit user annotation. On Qwen3-32B with a custom dataset at ~50% cache hit rate, APC increases output token throughput from 426.89 to 1,513.23 tokens/second (254% improvement) and reduces mean TTFT from 4,343ms to 969.71ms (78% reduction) [S13]. + +On a single ~10,000-token prompt to Qwen3-32B, prefix caching reduces TTFT from 4.3 seconds to 0.6 seconds [S14]. + +However, vLLM APC has known limitations. On random datasets without shared prefixes, APC introduces ~36.7% throughput reduction and ~25% TPOT increase — the overhead of cache management with no benefit [S12]. Under shared-prefix conditions, TensorRT-LLM APC improves throughput by ~34.7% and TPOT by ~20.9%, while vLLM achieves more modest gains of ~13.3% throughput and ~9.8% TPOT [S12]. The gap stems from a vLLM v0.6.3 scheduler limitation: it does not account for cache hits when calculating prefill tokens, constraining batched prefill requests and reducing KV cache utilization [S12]. This was addressed in vLLM v0.6.5. + +#### vLLM FP8 KV-Cache Quantization + +Beyond reuse, vLLM supports FP8 quantization of KV cache tensors, reducing memory from ~17.2 GB (FP16) to ~8.6 GB (FP8) — a 2× compression ratio — while increasing output throughput by 22% (785.61 to 955.22 tokens/second on Qwen3-32B with ShareGPT) [S13]. This trades minor precision loss for doubled cache capacity at no architectural cost. + +#### Distributed KV-Cache Scheduling (llm-d) + +The llm-d project reports 57× faster response times and doubled throughput on identical hardware when using prefix-cache-aware distributed scheduling versus naive scheduling [S14]. These numbers lack detailed benchmark conditions. + +### Non-Prefix and Semantic KV-Cache Reuse + +Standard prefix caching reuses only the leading shared prefix. For RAG workloads with multiple retrieved documents, only the first chunk is a prefix; subsequent chunks' KV caches are not reused, making prefix caching "almost as slow as full KV recompute" for multi-chunk inputs [S21, S30]. + +**CacheBlend** addresses this by selectively recomputing KV values for a small fraction of tokens to recover cross-attention information lost in independent chunk encoding. CacheBlend reduces TTFT by 2.2–3.3× and increases throughput by 2.8–5× compared to full KV recompute, with negligible quality loss (0.01–0.03 F1/Rouge-L) [S21, S29]. Only 5–18% of tokens per layer need recomputation [S29]. CacheBlend achieves 0.1–0.2 higher F1 on QA and 0.03–0.25 higher Rouge-L on summarization compared to full KV reuse (e.g., PromptCache), which ignores cross-attention between chunks [S30]. It is implemented on top of vLLM and available at github.com/LMCache/LMCache [S21, S30]. + +CacheBlend pipelines partial KV recomputation with KV cache retrieval from slower storage, allowing disk-based cache without extra latency [S21]. + +**KVLink** fine-tunes models with special tokens to link precomputed KV caches from multiple documents. It reduces TTFT by up to 90% and improves QA accuracy by an average of 4% over CacheBlend and PromptCache across 7 datasets [S24]. However, it requires fine-tuning (tested on Llama-3.2-1B and 3B) and cannot be applied to frozen models. Naive separate encoding without cross-attention can cause up to 35% relative accuracy decrease on QA tasks [S24]. + +**SemShareKV** applies locality-sensitive hashing (LSH) on token embeddings for fuzzy matching, enabling KV cache sharing across semantically similar but lexically different prompts. It achieves up to 6.25× speedup and 42% lower GPU memory with 5k-token inputs, with "negligible" quality degradation [S25]. It incorporates Rotary Position Embedding (RoPE) to preserve positional information [S25]. + +| System | Mechanism | Max Throughput Gain | TTFT Reduction | Quality Impact | Frozen Model? | Source | +|---|---|---|---|---|---|---| +| SGLang RadixAttention | Prefix tree KV reuse | 6.4× over SOTA [S2] | 3× on 70B [S3] | None reported | Yes | [S1, S2] | +| SGLang HiCache | Hierarchical (GPU→CPU→disk) | 6× [S7] | 80–84% [S7] | None reported | Yes | [S7] | +| vLLM APC | Prefix KV reuse | 254% (2.54×) [S13] | 78% [S13] | None reported | Yes | [S12, S13] | +| CacheBlend | Selective non-prefix recompute | 2.8–5× [S21] | 2.2–3.3× [S21] | 0.01–0.03 F1 loss [S29] | Yes (on vLLM) | [S21, S29] | +| KVLink | Fine-tuned cache linking | — | Up to 90% [S24] | +4% avg accuracy [S24] | No (requires FT) | [S24] | +| SemShareKV | LSH fuzzy token matching | 6.25× [S25] | — | "Negligible" [S25] | Yes | [S25] | + +### Proprietary API Context Caching + +#### Anthropic Prompt Caching + +Anthropic offers explicit prompt caching on Claude models. Cache writes cost 1.25× base input price for a 5-minute TTL and 2.0× for a 1-hour TTL; cache reads cost 0.10× base — a 90% discount [S31, S36]. Up to 4 cache breakpoints are allowed per request, applied in order: tools, system, then messages [S31]. + +Minimum cacheable token thresholds vary by model: Opus 5 requires 512 tokens, Sonnet 4.6 requires 1,024, and Haiku 4.5 requires 4,096. Prompts below these thresholds silently never cache [S31]. + +Automatic caching (top-level `cache_control`) dynamically moves the breakpoint to the last cacheable block as a conversation grows [S31]. Cache reads do not count toward input-token-per-minute (ITPM) rate limits; Anthropic's example shows a 2,000,000 ITPM limit with 80% cache hit rate enabling 10,000,000 effective input tokens per minute [S33]. + +Cache invalidation occurs from whitespace differences, tool definition reordering, system content type mismatches (string vs. typed array), or TTL expiration [S37]. Cache is per organization, not per API key [S37]. + +Around March 6–7, 2026, Anthropic silently reduced the default TTL from 1 hour to 5 minutes. Analysis of 119,866 Claude Code API calls showed 17.1% waste overall, with up to 52.5% waste in January before the change [S33]. A 200K-token Opus session costs $1.25 per cold write after a 5-minute idle gap versus $0.10 per subsequent in-window message [S33]. Claude Code engineer Thariq Shihipar stated: "prompt caching is the architectural constraint around which the product is built" [S38]. The tool list is locked at session start to prevent cache invalidation. + +Production users report 85–92% of input tokens as cache reads [S39]. Combining prompt caching with the Batch API yields up to 95% savings on repeated portions (50% batch discount + 90% cache read discount) [S36], though batch requests have async delivery up to 24 hours. + +#### OpenAI Context Caching + +OpenAI's prompt caching is automatic on GPT-5.x models with a 24-hour default TTL and a 1,024-token minimum [S40]. Cache retention may vary by account; users have no explicit control over cache breakpoints [S40]. On Amazon Bedrock, GPT-5.6 models support explicit `prompt_cache_breakpoint` with a 30-minute TTL and 1,024-token minimum [S34]. + +#### Google Gemini Context Caching + +Google Gemini requires creating a named cache object with explicit storage costs. Gemini 3.5 Flash cache reads cost $0.0075 per million tokens; storage costs $1.00 per million tokens per hour, with a 4,096-token minimum [S40]. The storage cost model means low-traffic workloads may pay more in storage than they save on reads. + +#### OpenRouter Routing Optimization + +OpenRouter uses provider-sticky routing to route subsequent requests to the same provider endpoint after a cached request, maximizing cache hit rates across multi-provider setups. Sticky sessions expire after 10 minutes of inactivity [S32]. + +| Provider | TTL | Cache Write Cost | Cache Read Cost | Min Tokens | Explicit Control | Source | +|---|---|---|---|---|---|---| +| Anthropic (5-min) | 5 min, refreshed on access | 1.25× base input | 0.10× base (90% off) | 512–4,096 | Yes, up to 4 breakpoints | [S31, S36] | +| Anthropic (1-hr) | 1 hour | 2.0× base input | 0.10× base | Same | Yes, explicit TTL field | [S31, S36] | +| OpenAI (first-party) | 24 hr default | 1× base (automatic) | 0.50× base | 1,024 | No (automatic) | [S40] | +| OpenAI (Bedrock) | 30 min | — | — | 1,024 | Yes, breakpoint API | [S34] | +| Google Gemini | User-defined (storage billed) | Base input | 0.10× base + storage/hr | 4,096 | Yes, named cache object | [S40] | + +### Production Maturity and Deployment Signals + +SGLang is deployed on over 400,000 GPUs with adoption at xAI, NVIDIA, AMD, and LinkedIn [S4]. LMCache (which implements CacheBlend) has 11,700 GitHub stars, integration with NVIDIA Dynamo, and PyTorch Foundation recognition [S27]. vLLM prefix caching is a standard feature in vLLM releases but had scheduler limitations through v0.6.3 [S12]. Anthropic's prompt caching is GA with automatic and explicit modes [S31]. OpenAI's caching is automatic and GA on GPT-5.x models [S40]. + +The KV-cache hit rate is described as "the single most important metric for a production-stage AI agent" by Manus [S14], directly affecting both latency and cost. + +### Evidence Table + +| Claim | Evidence | Source | Limits | +|---|---|---|---| +| SGLang achieves up to 6.4× throughput over SOTA | Paper abstract; not isolated to cache reuse alone | [S2] | Combined with FSM decoding; specific benchmarks | +| vLLM APC gives 254% throughput, 78% TTFT reduction on Qwen3-32B | Benchmark output, ~50% hit rate | [S13] | Single model, custom dataset, H100 | +| CacheBlend reduces TTFT 2.2–3.3× with 5–18% token recompute | Paper, 3 LLMs, 4 datasets | [S21, S29] | QA/summarization only; not tested on all tasks | +| Anthropic cache reads cost 0.10× base; writes 1.25× (5-min) or 2.0× (1-hr) | Official documentation | [S31, S36] | Per-model min tokens; TTL reset behavior | +| vLLM APC degrades 36.7% throughput on non-shared prefixes | Benchmark, Llama-3.1-8B, A100, v0.6.3 | [S12] | Fixed in v0.6.5; later versions may reduce overhead | +| Naive separate KV encoding loses up to 35% QA accuracy | Cited prior work (Sun et al., 2024) | [S24] | Specific to QA; exact numbers from cited work | +| KVLink reduces TTFT up to 90%, improves accuracy 4% avg | Paper, 7 datasets, Llama-3.2-1B/3B | [S24] | Requires fine-tuning; small models only | +| Production users see 85–92% cache read fraction | Anecdotal HN report | [S39] | Single user; not peer-reviewed | + +## Design Implications + +**Insight:** The evidence supports a two-tier memory architecture for production agents: (1) exact-prefix KV reuse via RadixAttention or vLLM APC for the system prompt and conversation history, and (2) non-prefix KV reuse via CacheBlend for RAG document chunks. Prefix caching alone is insufficient for multi-chunk RAG because only the first chunk benefits [S21, S30]. + +For proprietary API users, cache design should minimize prefix mutation. Locking tool definitions at session start, matching content types exactly across turns, and keeping idle gaps under the TTL window are the primary levers [S37, S38]. The Anthropic TTL reduction from 1 hour to 5 minutes [S33] means that workloads with gaps exceeding 5 minutes now face frequent cold writes at 1.25× base cost, making the 1-hour TTL option (2.0× write cost) economically viable for bursty traffic. + +Cache reads not counting toward ITPM rate limits [S33] means caching is not only a cost lever but a throughput multiplier. A workload achieving 80% cache hit rate effectively gains 5× headroom against rate limits. + +The overhead of prefix caching on non-shared-prefix workloads — 36.7% throughput reduction in vLLM [S12] — means caching should be disabled or workload patterns should be designed to maximize prefix overlap. Agent frameworks that inject variable content (timestamps, random IDs) at the start of prompts defeat prefix caching. + +FP8 KV-cache quantization [S13] offers a complementary compression mechanism that doubles cache capacity with 22% throughput gain, stacking with reuse-based approaches. + +## Limitations and Threats to Validity + +**Evidence scope.** The admitted source register covers family (1) of the research plan — cross-request KV-cache reuse and API context caching — with depth. The register contains no admitted sources for the other five planned families: (2) weights as memory (context distillation, LoRA, test-time training, Titans, Memory Layers at Scale), (3) fixed-size-state sequence models (Mamba, S4, xLSTM, RWKV) and their information-theoretic limits, (4) latent embedding reasoning (Large Concept Model, Coconut, byte latent transformer, diffusion LLMs), (5) external episodic memory (Mem0, Zep, Letta/MemGPT, sleep-time compute), and (6) information-theoretic bounds on fixed-size state capacity. All claims about these families in this report are absent; their omission is a limitation of the evidence collection, not of the mechanisms themselves. + +**Vendor bias.** Performance numbers from SGLang [S1, S3, S7], vLLM ecosystem [S12, S13], and Anthropic [S31, S36] originate from or are closely associated with the systems being measured. Independent third-party benchmarks [S4, S5] partially corroborate SGLang's claims but use different hardware and workloads. The 400,000-GPU deployment claim [S4] has no independent verification. + +**Benchmark specificity.** Most measurements use specific models (Llama-3.3-70B, Qwen3-32B, DeepSeek-R1-Distill-Llama-70B), specific hardware (H100, A100, A10G), and specific datasets (ShareGPT, custom). Generalization to other configurations is uncertain. Cache hit rates are highly workload-dependent: the same system reports 50% [S8] to 99% [S8] across benchmarks. + +**Stale evidence.** vLLM v0.6.3 scheduler limitations [S12] were fixed in v0.6.5. The Anthropic TTL change from 1 hour to 5 minutes [S33] occurred around March 2026; pricing and TTL policies may change further. OpenAI's 24-hour TTL [S40] may vary by account. + +**Quality metrics.** CacheBlend's quality impact is measured on QA and summarization [S29, S30]; reasoning, code generation, and open-ended tasks are not covered. SemShareKV's quality degradation is described as "negligible" without quantification [S25]. + +## Open Questions + +1. What is the information-theoretic capacity of a fixed-size KV cache versus a variable-length attention window? No admitted source addresses this bound. +2. How do weights-as-memory approaches (fine-tuning, LoRA, context distillation) compare to KV-cache reuse in information retention per parameter? No admitted source provides compression ratios or retention metrics for these mechanisms. +3. Can external episodic memory systems (Mem0, Zep, Letta) achieve retrieval accuracy competitive with in-context retrieval, and at what compression ratio? No admitted source benchmarks these systems. +4. What is the cross-attention information loss from non-prefix KV reuse (CacheBlend, KVLink) on reasoning tasks versus QA and summarization? Quality is only measured on the latter [S29]. +5. How does FP8 KV-cache quantization interact with prefix caching — does quantization noise reduce cache hit rates by changing the exact-match key? No source addresses this interaction. +6. What are the theoretical limits on how much information a fixed-size hidden state (as in SSMs) can preserve versus a variable-length KV cache? No admitted source provides this analysis. + +## Recommended Next Experiments + +1. **Cross-family compression comparison.** Measure the same 32K-token document under (a) in-context tokens, (b) KV-cache reuse with prefix caching, (c) KV-cache reuse with CacheBlend, (d) FP8 quantized KV cache, and (e) context distillation into weights. Report QA accuracy, storage cost in bytes, and retrieval latency for each. This directly answers the research question across mechanism families. + +2. **CacheBlend on reasoning benchmarks.** Evaluate CacheBlend's selective recompute on GSM8K, MATH, and HumanEval to determine whether the 5–18% recompute fraction is sufficient for reasoning tasks or whether cross-attention matters more for multi-step inference than for QA. + +3. **FP8 × prefix caching interaction.** Benchmark vLLM with FP8 KV cache and prefix caching simultaneously to measure whether quantization-induced key differences reduce hit rates or whether exact-match persists at FP8 precision. + +4. **TTL sensitivity analysis.** Measure cost and latency as a function of idle gap distribution for Anthropic's 5-minute and 1-hour TTLs across realistic agent workloads (coding sessions, research assistants, customer support). The March 2026 TTL change [S33] makes this economically urgent. + +5. **External memory retrieval accuracy.** Benchmark Mem0, Zep/Graphiti, and Letta/MemGPT on a shared retrieval task set (e.g., LOCOMO or a custom multi-session evaluation) to compare their storage formats, retrieval accuracy, and latency against in-context baselines. This fills the largest evidence gap in the register. + +## Source Register + +- [S1] [Fast and Expressive LLM Inference with RadixAttention and SGLang - LMSYS Org](https://www.lmsys.org/blog/2024-01-17-sglang/) — admitted, score 18, discovered by `SGLang RadixAttention KV cache reuse throughput benchmark 2024 2025` +- [S2] [SGLang: Efficient Execution of Structured Language Model Programs](https://arxiv.org/pdf/2312.07104) — admitted, score 18, discovered by `SGLang RadixAttention KV cache reuse throughput benchmark 2024 2025` +- [S3] [SGLang Production Deployment Guide: RadixAttention and Multi-Turn Inference on GPU Cloud (2026) | Spheron Blog](https://www.spheron.network/blog/sglang-production-deployment-guide/) — admitted, score 13, discovered by `SGLang RadixAttention KV cache reuse throughput benchmark 2024 2025` +- [S4] [SGLang: The Complete Guide to High-Performance LLM Inference | Inference.net](https://inference.net/content/sglang-complete-guide/) — admitted, score 13, discovered by `SGLang RadixAttention KV cache reuse throughput benchmark 2024 2025` +- [S5] [SGLang vs vLLM: Multi-Turn Chat and KV Cache Reuse](https://www.runpod.io/blog/sglang-vs-vllm-kv-cache) — admitted, score 13, discovered by `SGLang RadixAttention KV cache reuse throughput benchmark 2024 2025` +- [S6] [SGLang Learning Series — Part 1: Shared Prefix, KV Cache, and RadixAttention | by Dharamendra Kumar | Medium](https://medium.com/@dharamendra1314.kumar/sglang-learning-series-part-1-shared-prefix-kv-cache-and-radixattention-d7a847d20b1f) — rejected, score 0, discovered by `SGLang RadixAttention KV cache reuse throughput benchmark 2024 2025` +- [S7] [SGLang HiCache: Fast Hierarchical KV Caching with Your Favorite Storage Backends - LMSYS Org](https://www.lmsys.org/blog/2025-09-10-sglang-hicache/) — admitted, score 20, discovered by `SGLang RadixAttention KV cache reuse throughput benchmark 2024 2025` +- [S8] [Serving SGLang: Launch a Production-Style Server](https://learnopencv.com/sglang-a-production-server/) — admitted, score 13, discovered by `SGLang RadixAttention KV cache reuse throughput benchmark 2024 2025` +- [S9] [NeurIPS Poster SGLang: Efficient Execution of Structured Language Model Programs](https://neurips.cc/virtual/2024/poster/94872) — admitted, score 16, discovered by `SGLang RadixAttention KV cache reuse throughput benchmark 2024 2025` +- [S10] [[2312.07104] SGLang: Efficient Execution of Structured Language Model Programs](https://arxiv.org/abs/2312.07104) — admitted, score 18, discovered by `SGLang RadixAttention KV cache reuse throughput benchmark 2024 2025` +- [S11] [Automatic Prefix Caching - vLLM](https://docs.vllm.ai/en/latest/features/automatic_prefix_caching/) — rejected, score 0, discovered by `vLLM automatic prefix caching performance benchmark latency reduction` +- [S12] [[vLLM vs TensorRT-LLM] #12. Automatic Prefix Caching - The official SqueezeBits Tech blog](https://blog.squeezebits.com/vllm-vs-tensorrtllm-12-automatic-prefix-caching-38189) — admitted, score 15, discovered by `vLLM automatic prefix caching performance benchmark latency reduction` +- [S13] [vLLM Optimization Techniques: 5 Practical Methods to Improve Performance](https://jarvislabs.ai/blog/vllm-optimization-techniques) — admitted, score 13, discovered by `vLLM automatic prefix caching performance benchmark latency reduction` +- [S14] [KV-Cache Wins You Can See: From Prefix Caching in vLLM to Distributed Scheduling with llm-d | llm-d](https://llm-d.ai/blog/kvcache-wins-you-can-see) — admitted, score 13, discovered by `vLLM automatic prefix caching performance benchmark latency reduction` +- [S15] [Automatic Prefix Caching - vLLM Documentation](https://docs.vllm.ai/en/v0.21.0/features/automatic_prefix_caching/) — rejected, score 0, discovered by `vLLM automatic prefix caching performance benchmark latency reduction` +- [S16] [Tutorial: Benchmark prefix caching with gpt-oss on vLLM on Neuron — AWS Neuron Documentation](https://awsdocs-neuron.readthedocs-hosted.com/en/v2.32.0/vllm-neuron/docs/tutorials/tutorial-prefix-caching-gpt-oss-benchmarking.html) — admitted, score 19, discovered by `vLLM automatic prefix caching performance benchmark latency reduction` +- [S17] [vllm/benchmarks/benchmark_prefix_caching.py at main · vllm-project/vllm](https://github.com/vllm-project/vllm/blob/main/benchmarks/benchmark_prefix_caching.py) — admitted, score 19, discovered by `vLLM automatic prefix caching performance benchmark latency reduction` +- [S18] [Automatic Prefix Caching — vLLM](https://docs.vllm.ai/en/v0.7.0/features/automatic_prefix_caching.html) — rejected, score 0, discovered by `vLLM automatic prefix caching performance benchmark latency reduction` +- [S19] [r/LocalLLaMA on Reddit: We tested 5 vLLM optimizations: Prefix Cache, FP8, CPU Offload, Disagg P/D, and Sleep Mode](https://www.reddit.com/r/LocalLLaMA/comments/1r61so4/we_tested_5_vllm_optimizations_prefix_cache_fp8/) — rejected, score 0, discovered by `vLLM automatic prefix caching performance benchmark latency reduction` +- [S20] [Introduction — vLLM](https://docs.vllm.ai/en/v0.5.3/automatic_prefix_caching/apc.html) — rejected, score 0, discovered by `vLLM automatic prefix caching performance benchmark latency reduction` +- [S21] [CacheBlend: Fast Large Language Model Serving for RAG with Cached Knowledge Fusion](https://arxiv.org/html/2405.16444v3) — admitted, score 20, discovered by `PromptCache CacheBlend KV cache sharing language model serving arXiv` +- [S22] [CacheBlend: Fast Large Language Model Serving for RAG ...](https://arxiv.org/pdf/2405.16444) — admitted, score 20, discovered by `PromptCache CacheBlend KV cache sharing language model serving arXiv` +- [S23] [[2405.16444] CacheBlend: Fast Large Language Model Serving for RAG with Cached Knowledge Fusion](https://arxiv.org/abs/2405.16444) — admitted, score 20, discovered by `PromptCache CacheBlend KV cache sharing language model serving arXiv` +- [S24] [KVLink: Accelerating Large Language Models via Efficient KV Cache Reuse](https://arxiv.org/html/2502.16002v1) — admitted, score 20, discovered by `PromptCache CacheBlend KV cache sharing language model serving arXiv` +- [S25] [SemShareKV: Efficient KVCache Sharing for Semantically Similar Prompts via Token-Level LSH Matching](https://arxiv.org/html/2509.24832v1) — admitted, score 20, discovered by `PromptCache CacheBlend KV cache sharing language model serving arXiv` +- [S26] [Better KV Cache for LLM Serving Yuhan Liu 04/09/2025 1](https://llmsystem.github.io/llmsystem2025spring/assets/files/llmsys-23-LMCache_yuhan_liu-168b4d638987bf0e6408d553486059b1.pdf) — admitted, score 11, discovered by `PromptCache CacheBlend KV cache sharing language model serving arXiv` +- [S27] [GitHub - LMCache/LMCache: LMCache: Supercharge Your LLM with the Fastest KV Cache Layer · GitHub](https://github.com/lmcache/lmcache) — admitted, score 20, discovered by `PromptCache CacheBlend KV cache sharing language model serving arXiv` +- [S28] [CacheBlend: Fast Large Language Model Serving for RAG with](https://www.cs.princeton.edu/~ravian/COS597_F24/papers/cacheblend.pdf) — admitted, score 20, discovered by `PromptCache CacheBlend KV cache sharing language model serving arXiv` +- [S29] [CacheBlend: Fast Large Language Model Serving for RAG with Cached Knowledge Fusion | alphaXiv](https://www.alphaxiv.org/abs/2405.16444) — admitted, score 13, discovered by `PromptCache CacheBlend KV cache sharing language model serving arXiv` +- [S30] [\name: Fast Large Language Model Serving with Cached Knowledge Fusion](https://arxiv.org/html/2405.16444v1) — admitted, score 19, discovered by `PromptCache CacheBlend KV cache sharing language model serving arXiv` +- [S31] [Prompt caching - Claude Platform Docs](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) — admitted, score 20, discovered by `Anthropic prompt caching API documentation pricing TTL minimum cache length 2025 2026` +- [S32] [Prompt Caching - Optimize AI Model Costs with Smart Caching](https://openrouter.ai/docs/guides/best-practices/prompt-caching) — admitted, score 15, discovered by `Anthropic prompt caching API documentation pricing TTL minimum cache length 2025 2026` +- [S33] [Anthropic Cut Claude's Cache TTL: 2026 Fix to Reclaim ...](https://www.keepmyprompts.com/en/blog/claude-cache-ttl-cut-2026-reclaim-api-bill) — admitted, score 15, discovered by `Anthropic prompt caching API documentation pricing TTL minimum cache length 2025 2026` +- [S34] [Prompt caching for faster model inference - Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html) — admitted, score 17, discovered by `Anthropic prompt caching API documentation pricing TTL minimum cache length 2025 2026` +- [S35] [Prompt Caching With the Claude API: A Practical Guide - DEV Community](https://dev.to/thegdsks/prompt-caching-with-the-claude-api-a-practical-guide-14ce) — rejected, score 11, discovered by `Anthropic prompt caching API documentation pricing TTL minimum cache length 2025 2026` +- [S36] [Anthropic API Pricing in 2026: Complete Guide — Models, Caching, Batch & Optimization](https://www.finout.io/blog/anthropic-api-pricing) — admitted, score 15, discovered by `Anthropic prompt caching API documentation pricing TTL minimum cache length 2025 2026` +- [S37] [Claude Prompt Caching Pricing: 5-Min vs 1-Hour Cache (2026) | Respan](https://www.respan.ai/articles/claude-prompt-caching) — admitted, score 15, discovered by `Anthropic prompt caching API documentation pricing TTL minimum cache length 2025 2026` +- [S38] [Anthropic Prompt Cache TTL + Cost Mechanics | Brandon Wie](https://brandonwie.dev/posts/anthropic-prompt-cache-ttl) — admitted, score 15, discovered by `Anthropic prompt caching API documentation pricing TTL minimum cache length 2025 2026` +- [S39] [Anthropic API pricing 2026: full rate card and hidden costs | eesel AI](https://www.eesel.ai/blog/anthropic-api-pricing) — admitted, score 15, discovered by `Anthropic prompt caching API documentation pricing TTL minimum cache length 2025 2026` +- [S40] [Prompt Caching in 2026: Cut Your LLM API Costs by Up to 90% | DevToolLab Blog](https://devtoollab.com/blog/prompt-caching-guide) — admitted, score 15, discovered by `Anthropic prompt caching API documentation pricing TTL minimum cache length 2025 2026` + +## Research Trace + +### Goal + +Systematically catalog and compare all families of memory mechanisms that allow language models to persist, compress, and retrieve information beyond their token context window, with concrete benchmarks, compression ratios, and production-readiness assessments. + +### Subquestions + +- What are the measured throughput, latency, and cache-hit-rate improvements from cross-request KV-cache reuse in serving systems (SGLang RadixAttention, vLLM automatic prefix caching, PromptCache, CacheBlend)? +- How do Anthropic and OpenAI context caching APIs work, what are their pricing and TTL policies, and what real-world latency reductions do they deliver? +- How do weights-as-memory approaches (context distillation, fine-tuning, LoRA adapters) compare in information retention versus in-context tokens, and what compression ratios and degradation rates have been measured? +- What are Titans (Google 2025), test-time training, and Meta Memory Layers at Scale, what are their architecture details, and what benchmark improvements do they show over baseline transformers? +- What does information theory say about the capacity of fixed-size hidden states (Mamba, S4, xLSTM, RWKV) versus variable-length attention, and what are proven bounds on information loss? +- How do hybrid attention+SSM architectures (Jamba, Griffin, Zamba) combine both paradigms, and what do long-context benchmarks (RULER, LongBench, etc.) show about their effective memory? +- What approaches reason directly over latent embeddings (Meta Large Concept Model, Coconut, byte latent transformer, diffusion LLMs), and what are the trade-offs versus token-based chain-of-thought? +- What external episodic memory systems (Mem0, Zep/Graphiti, Letta/MemGPT, sleep-time compute) exist for agents, what storage formats do they use, and what retrieval accuracy and latency benchmarks are reported? +- Which of these families work on frozen open-weight models today versus requiring training, and what are the concrete production maturity levels (experimental, beta, GA) for each? + +### Research Perspectives + +- **Primary Sources and Official Documentation** — Obtain official specs, API docs, release notes, and blog posts from SGLang, vLLM, Anthropic, OpenAI, Meta, Google, and other primary sources. +- **Benchmarks and Empirical Evaluation** — Find published benchmark numbers: throughput, latency, cache hit rates, retrieval accuracy, long-context scores, compression ratios, and degradation curves. +- **Information-Theoretic Limits** — Identify theoretical analyses of fixed-size state capacity, lossy compression bounds, and provable limitations of compressed memory versus attention. +- **Implementation and Production Maturity** — Assess deployment status: GitHub stars, production usage, API availability, enterprise adoption, and stability indicators for each mechanism. +- **Criticism and Counterevidence** — Find failures, known limitations, negative results, and comparative studies showing where each approach breaks down. +- **Frozen-Model Compatibility** — Determine which approaches require no training, which need fine-tuning, and which are only compatible with specific architectures. +- **Recency (2025-2026)** — Prioritize the latest developments including Titans, LCM, Coconut, and any 2025-2026 benchmark updates. + +### Source Requirements + +- Official API documentation for Anthropic prompt caching and OpenAI context caching +- SGLang and vLLM GitHub repos and technical blog posts with benchmark numbers +- arXiv papers for Titans, Memory Layers at Scale, Mamba/S4, xLSTM, RWKV, Coconut, Large Concept Model, byte latent transformer +- Benchmark papers: RULER, LongBench,needle-in-haystack, MTOB, or equivalent long-context evaluations +- GitHub repos and docs for Mem0, Zep/Graphiti, Letta/MemGPT with usage metrics +- Information-theoretic papers on state-space model capacity or transformer memory bounds +- Industry blog posts (Meta, Google, Anthropic, OpenAI, Mistral) with production deployment details +- Comparative or survey papers covering multiple memory mechanisms +- Negative results or limitation-focused papers on fixed-size state models + +### Success Criteria + +- At least one concrete throughput or latency number per KV-cache reuse system (SGLang, vLLM, PromptCache, CacheBlend) +- Pricing and TTL details for both Anthropic and OpenAI context caching APIs with measured latency reduction +- Compression ratio or information retention metric for at least one weights-as-memory approach (context distillation or LoRA) +- Architecture summary and at least one benchmark result for Titans, Memory Layers, and one test-time training method +- Stated theoretical bound or empirical evidence for fixed-size state information loss in SSMs versus attention +- At least one long-context benchmark comparison for hybrid attention+SSM models (e.g., Jamba on RULER or LongBench) +- Architecture and at least one result for latent reasoning approaches (LCM, Coconut, or byte latent transformer) +- Feature comparison table for external memory systems (Mem0, Zep, Letta) including storage format, retrieval method, and any accuracy benchmarks +- Clear classification of each mechanism family as frozen-model-compatible or training-required, with production maturity level +- At least one compression ratio or bits-per-token equivalent metric across two or more mechanism families for cross-comparison + +### Search Queries + +- `SGLang RadixAttention KV cache reuse throughput benchmark 2024 2025` — Find primary benchmark numbers for SGLang's cross-request cache reuse system. [Benchmarks and Empirical Evaluation / github_repo / technical_blog] +- `vLLM automatic prefix caching performance benchmark latency reduction` — Obtain vLLM prefix caching throughput and latency improvements from docs or benchmarks. [Primary Sources and Official Documentation / github_repo / documentation] +- `PromptCache CacheBlend KV cache sharing language model serving arXiv` — Find the PromptCache and CacheBlend papers with their measured cache reuse benefits. [Benchmarks and Empirical Evaluation / arxiv_paper] +- `Anthropic prompt caching API pricing TTL latency documentation 2025 2026` — Get official Anthropic context caching API specs, pricing, and measured latency reductions. [Primary Sources and Official Documentation / official_documentation] +- `OpenAI cached input tokens API pricing context caching benchmark` — Get official OpenAI context caching API specs and any reported performance numbers. [Primary Sources and Official Documentation / official_documentation] +- `context distillation fine-tuning lossy compression language model information retention` — Find papers measuring how well fine-tuning/distillation preserves information versus in-context tokens. [Information-Theoretic Limits / arxiv_paper] +- `Google Titans learning to memorize test time 2025 architecture benchmark` — Find the Titans paper (Google 2025) with architecture details and benchmark comparisons to transformers. [Benchmarks and Empirical Evaluation / arxiv_paper] +- `Meta memory layers product key lookup scaling transformer benchmark 2024` — Find the Meta Memory Layers at Scale paper with architecture and scaling results. [Primary Sources and Official Documentation / arxiv_paper] +- `Mamba S4 xLSTM RWKV fixed hidden state information capacity limit lossy compression` — Find information-theoretic analyses or empirical studies of fixed-size state limitations in SSMs. [Information-Theoretic Limits / arxiv_paper] +- `Jamba hybrid attention SSM long context benchmark RULER LongBench results 2025` — Get benchmark comparisons for hybrid attention+SSM models on long-context tasks. [Benchmarks and Empirical Evaluation / benchmark_report] +- `Meta Large Concept Model latent reasoning abstraction benchmark arXiv 2025` — Find the LCM paper with architecture details and performance comparisons to token-based models. [Benchmarks and Empirical Evaluation / arxiv_paper] +- `Coconut chain of continuous thought latent reasoning language model arXiv` — Find the Coconut paper showing continuous-latent chain-of-thought reasoning results. [Benchmarks and Empirical Evaluation / arxiv_paper] +- `Mem0 Zep Graphiti Letta MemGPT agent memory benchmark retrieval accuracy comparison 2025` — Find comparative benchmarks or feature analyses for external agent memory systems. [Implementation and Production Maturity / github_repo / benchmark_report] +- `state space model attention comparison limitations failure cases needle in haystack retrieval degradation` — Find adversarial evidence: where SSMs fail relative to attention on specific memory/retrieval tasks. [Criticism and Counterevidence / arxiv_paper / benchmark_report] + +### Source Quality + +- [S1] Official LMSYS blog post with RadixAttention details and up to 5x throughput benchmark. Primary source for SGLang. score=18 type=technical_blog admitted=true warnings= +- [S2] NeurIPS 2024 paper providing full technical details and benchmarks for SGLang. Primary academic source. score=18 type=paper admitted=true warnings=PDF may be difficult to parse automatically +- [S3] Third-party deployment guide mentioning 60%+ prefix overlap and TTFT reductions. Adds production context but not primary. score=13 type=technical_blog admitted=true warnings=Third-party source, may contain marketing claims +- [S4] Guide claiming up to 6x throughput. Provides performance numbers but from a third-party inference platform. score=13 type=technical_blog admitted=true warnings=Third-party, unverified claims +- [S5] Runpod blog comparing SGLang and vLLM for multi-turn chat, estimates 10-20% improvement. Useful comparative perspective. score=13 type=technical_blog admitted=true warnings=Anecdotal estimate, not rigorous benchmark +- [S6] Fetch error 403, content unreadable. score=0 type=technical_blog admitted=false warnings=HTTP 403 Forbidden; fetch failed: Source fetch API returned HTTP 403 Forbidden:[HTML omitted] +- [S7] Official LMSYS blog on SGLang HiCache with concrete numbers: 56% TTFT reduction, 2x throughput, cache hit rate 40% to 80%. Highly relevant and authoritative. score=20 type=technical_blog admitted=true warnings= +- [S8] Tutorial blog reporting cache hit rates 50-99%. Provides useful ranges but from a tutorial site. score=13 type=technical_blog admitted=true warnings=Third-party tutorial, not primary +- [S9] NeurIPS poster page confirming acceptance and abstract. High authority but limited detail. score=16 type=other admitted=true warnings=Only abstract, no detailed numbers +- [S10] arXiv abstract page for SGLang paper, states up to 6.4x throughput. Primary source. score=18 type=paper admitted=true warnings= +- [S11] Fetch error 429, content unreadable. score=0 type=docs admitted=false warnings=HTTP 429 Too Many Requests; fetch failed: Source fetch API returned HTTP 429 Too Many Requests:[HTML omitted] +- [S12] Detailed comparison of vLLM and TensorRT-LLM prefix caching, reports ~36.7% throughput overhead in vLLM. Critical negative result. score=15 type=technical_blog admitted=true warnings=Third-party analysis, but well-documented +- [S13] Overview of vLLM optimizations including prefix caching and FP8 KV cache. Useful for context but not primary. score=13 type=technical_blog admitted=true warnings=Marketing content from GPU provider +- [S14] Claims 57x faster response times and double throughput from prefix caching. Provides dramatic numbers but from a company blog. score=13 type=technical_blog admitted=true warnings=May be exaggerated for promotional purposes +- [S15] Fetch error 429, content unreadable. score=0 type=docs admitted=false warnings=HTTP 429 Too Many Requests; fetch failed: Source fetch API returned HTTP 429 Too Many Requests:[HTML omitted] +- [S16] Official AWS Neuron tutorial for benchmarking prefix caching on vLLM. High authority and provides methodology. score=19 type=docs admitted=true warnings=Specific to AWS Neuron hardware +- [S17] Official vLLM benchmark script for prefix caching. Primary source for benchmarking methodology. score=19 type=repo admitted=true warnings=Code only, no results +- [S18] Fetch error 429, content unreadable. score=0 type=docs admitted=false warnings=HTTP 429 Too Many Requests; fetch failed: Source fetch API returned HTTP 429 Too Many Requests:[HTML omitted] +- [S19] Fetch error 403, content unreadable. score=0 type=other admitted=false warnings=HTTP 403 Forbidden; fetch failed: Source fetch API returned HTTP 403 Forbidden: