MiniPIC: Flexible Position-Independent Caching in <100LOC

Nathan Ordonez, Thomas ParnellNeurIPS 2026

TL;DR

LLM serving engines waste massive compute re-processing recurring documents or code files whenever they appear in different orders or after different prompts. MiniPIC unlocks position-independent KV caching in vLLM with fewer than 100 lines of core engine changes—boosting prefill throughput by 49% and slashing time-to-first-token by up to 100×, all by cleanly separating positional math from cached memory.

What Problem Does This Paper Address?

Imagine you’re running a Retrieval-Augmented Generation (RAG) system or an AI agent. Every request stuffs recurring chunks of text—retrieved Wikipedia articles, tool definitions, or code files (which the authors call spans)—into the prompt.

Modern inference engines like vLLM speed up inference using prefix caching: they save the model's intermediate Key-Value (KV) memory blocks so they don't have to recompute them. There’s a catch, though. Prefix caching hashes each block together with everything that came before it. If User A asks about [Doc 1, Doc 2] and User B asks about [Doc 2, Doc 1], or uses a slightly different system prompt, Doc 2 is treated as a complete cache miss.

Even if you bypass the hash check, modern LLMs use Rotary Position Embeddings (RoPE), which "bake" a token's exact sequence position into its Key (K) vector before saving it to the KV cache. If Doc 2 was cached starting at token 100, and another concurrent user needs it at token 500, the shared physical GPU memory cannot hold both rotations at once. Existing Position-Independent Caching (PIC) workarounds either move KV caches off-GPU (incurring slow host-to-device transfers) or build massive, complex memory-duplication and block-repositioning subsystems right into the heart of the inference server.

Methods

The authors ask a refreshing systems design question: What is the absolute minimum the inference server needs to do, and what can be left to the orchestration layer? MiniPIC solves this with two core ingredients and a scheduling trick:

  1. Position-Free KV Cache: Instead of rotating Key vectors before caching them, MiniPIC stores unrotated Keys in GPU memory. When an attention kernel runs, it loads the unrotated Key tile into fast SRAM and applies RoPE on-the-fly using each request's specific logical positions. Now, dozens of concurrent requests can read the exact same physical memory block at wildly different prompt offsets without conflict.
  2. User-Controlled Cache Primitives: Rather than bloating vLLM with custom chunk managers, MiniPIC exposes three token-level primitives to the user/orchestrator:
  3. Block-aligned padding: Pads spans to fit vLLM's fixed memory block boundaries (e.g., 16 tokens).
  4. SSEP (Span Separator): Placed at the start of a span, telling vLLM's block hasher to reset the hash chain so the span can be cached independently of whatever came before it.
  5. PDEP (Prompt Depend): Placed before a final query/task instruction, forcing the hash to depend on the entire preceding prompt to prevent false cache hits.
  6. Interleaved Span-Prefill Scheduling (ISPS): Instead of prefilling all missing spans, waiting at a synchronization barrier, and then running final prompts, ISPS submits mini-batches of deduplicated span prefills right ahead of their parent queries in a single FIFO stream, keeping the GPU continuously saturated.

Datasets

MiniPIC is evaluated (no training is performed, using the Llama-3-8B-based Tulu3-block-ft model) on two standard question-answering benchmarks, plus synthetic microbenchmarks:

  • 2WikiMultihopQA (2Wiki): 12,576 samples for main throughput tests (each containing 10 retrieved documents of ~100 tokens), plus a 3,200-sample subset for cache-capacity sweeps.
  • Natural Questions (NQ): First 3,200 samples used alongside 2Wiki to test cache residency under long-generation pressure.

No new benchmarks are introduced; dataset formatting follows prior PIC literature (SPNL).

Key Insights and Ideas

  • Positional KV caches cause cascading systems complexity: Trying to fix RoPE mismatches in shared memory forces engines to copy blocks, eating up memory bandwidth and creating cyclic copy dependencies when concurrent batches overlap. Moving RoPE inside the attention kernel eliminates this entire class of bugs at the root.
  • Extreme minimalism ("Alignment"): Outside of the modular Triton attention kernel (266 LOC), MiniPIC touches only 78 lines of core vLLM code (only 61 of which are new functionality). Yet those three simple token primitives are expressive enough to reproduce multiple distinct PIC algorithms—including Block-Attention, EPIC, and Prompt Cache—simultaneously on the same server.
  • Free CPU Offloading Compatibility: Because cached blocks have no baked-in positions, vLLM’s native GPU-to-CPU memory offloading works out-of-the-box without tracking or adjusting token offsets.

Key Results

Tested on an NVIDIA H100 GPU against baseline vLLM and SPNL (a state-of-the-art in-engine PIC system that copies and re-rotates blocks):

  • 49% Higher Prefill Throughput: On 2Wiki, MiniPIC with ISPS reaches 48.01 samples/s, beating baseline vLLM (32.21 samples/s) by 1.49× and SPNL (36.14 samples/s) by 33%. Interleaved scheduling alone accounts for an 8.9% speedup over barriered batching.
  • Up to 100× Faster TTFT: As cached document counts scale up to 64, vanilla vLLM suffers quadratic latency growth, whereas MiniPIC drops Time-To-First-Token by up to two orders of magnitude and beats SPNL by avoiding memory-copy overhead.
Time To First Token (TTFT) vs Document Count
  • 4.21× Faster High-Concurrency Reuse: When 64 concurrent requests reuse 64 shuffled spans, MiniPIC finishes the batch 4.21× faster than SPNL at identical cache hit rates (99.2%).
  • Low Cold-Cache Tax: Recomputing RoPE inside the attention kernel when there are zero span cache hits reduces throughput by just 5.7% compared to vanilla vLLM.
  • CPU Offload Rescue: When generating up to 512 output tokens at high concurrency (max_num_seqs=1024), KV cache pressure drops 2Wiki span hit rates to 14%; flipping on 40 GB of native CPU offload restores 100% span hits.

Limitations and Future Work

  • RoPE-Specific: MiniPIC is tailored for RoPE-based transformers; architectures using ALiBi or NoPE require different handling.
  • Trusting the Orchestrator: Because validation is kept out of the engine, misplacing padding or SSEP/PDEP tokens in the client layer can silently cause false cache hits. Furthermore, padding and marker tokens remain visible to the model (not masked out), and the accuracy impact of this visibility wasn't ablated.
  • Eviction Under Pressure: Under heavy generation workloads, cached spans can be evicted before their parent queries execute if concurrency isn't tuned or backed by CPU offload. Pairing MiniPIC with smarter, chunk-aware eviction policies and decode-time sparse attention are promising next steps.

Summary updated

Abstract

Retrieval-augmented and agentic workloads repeatedly prefill recurring predictable structured inputs (which we call "spans") such as documents and code files. Yet, prefix caching in engines such as vLLM cannot reuse their KV entries unless they share identical prefixes with another request, while Position-Independent Caching (PIC) implementations within production-grade inference servers typically either require substantial server code changes or keep KV state outside the server, incurring host-to-device transfer overhead. We present Minimalistic PIC (MiniPIC): a minimal, flexible and fast vLLM design built from two ingredients: a positional-encoding-free KV cache and user-controlled cache-reuse primitives. MiniPIC stores unrotated K vectors in the KV cache, applies RoPE to K tiles inside attention using per-request logical positions, and exposes three user-facing and token-level primitives: block-aligned padding, SSep, and PDep, that modify hashing behavior and effective block-level causal attention structure. With fewer than 100 lines of core-engine changes plus a custom attention backend, these primitives are sufficient to realize multiple PIC methods, including Block-Attention, EPIC, and Prompt Cache, within the same running vLLM instance, while natively integrating with KV cache CPU offload implementations. On 2WikiMultihopQA, MiniPIC with interleaved scheduling improves prefill throughput by 49% over baseline vLLM, reduces cached-span time-to-first-token by up to two orders of magnitude, and incurs only a 5.7% reduction in no-span throughput.
BibTeX
@inproceedings{ordonez2026minipic,
  author = {Nathan Ordonez and Thomas Parnell},
  title = {{MiniPIC: Flexible Position-Independent Caching in <100LOC}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=bLPv1lSYrI},
}
Figure