InferScale: GPU-Native KV Injection & Chunked RoPE for vLLM Serving

InferScale colocates a GPU-native Jasper semantic vector index with a pre-RoPE key-value store to inject precomputed fact states directly into vLLM via its KV-connector interface. Across Llama-3.1-8B, Mistral-7B, Qwen2.5-7B, and Qwen3-14B on LoCoMo, InferScale cuts query-to-first-token latency by 1.7x-8.2x over Mem0 and delivers a 13.3x engine TTFT speedup at 400 retrieved facts.
InferScale: GPU-Native KV Injection & Chunked RoPE for vLLM Serving: InferScale colocates a GPU-native Jasper semantic vector index with a pre-RoPE key-value store to inject precomputed fact states directly into vLLM via its KV-connector interface. Across Llama-3.1-8B, Mistral-7B, Qwen2.5-7B, and Qwen3-14B on LoCoMo, InferScale cuts query-to-first-token latency by 1.7x-8.2x over Mem0 and delivers a 13.3x engine TTFT speedup at 400 retrieved facts. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.
- 13.3x Faster Engine TTFT at Scale: Scaling retrieval from 5 to 400 facts keeps engine TTFT at 16-25 ms on Llama-3.1-8B versus 327 ms for Mem0.
- GPU-Resident Jasper Semantic Index: Moving retrieval off CPU Qdrant onto colocated GPU memory cuts Llama-3.1-8B median QTFT from 117 ms to 83 ms, and KV injection drops it to 55 ms.
- Context-Window Encoding (w = 50): Encoding facts alongside up to 50 preceding conversation turns restores pronoun and coreference context, lifting LoCoMo accuracy from 37.22% (w=0) to 58.30% on Mistral-7B.
- Zero Engine Forks via vLLM KV-Connector: Stores pre-RoPE keys and values keyed by fact_id, rotating keys on demand via Chunked RoPE without modifying core vLLM attention kernels.
import { createAgent } from '@smoke-monkey/harness';// Orchestrate personalized agent memory against a vLLM InferScale KV-connector endpointconst agent = createAgent({agentId: 'inferscale-memory-agent',provider: 'openai-compatible',baseUrl: 'http://127.0.0.1:8000/v1',model: 'meta-llama/Llama-3.1-8B-Instruct',workspacePath: process.cwd(),mcpServers: {kvMemory: {command: 'npx',args: ['-y', '@smoke-monkey/mcp-kv-memory', '--backend', 'inferscale-jasper'],env: {INFERSCALE_CONTEXT_WINDOW: '50',INFERSCALE_KV_MODE: 'gpu_resident',VLLM_KV_CONNECTOR: 'InferScaleConnector',},},},permissions: {read_file: 'allow',write_file: 'ask',run_command: 'ask',},});async function main() {const result = await agent.run('Retrieve top-50 user facts via GPU Jasper index, inject rotated KV blocks, and verify TTFT under 60ms.');console.log('Agent Summary:', result.summary);}main().catch(console.error);
Watch: Related Video Guides
How KV Cache Speeds Up LLMs for Faster AI Models on GPUs
How the vLLM inference engine works?
What Is InferScale and Why Does Prefix Caching Fail Personalized Agents?
InferScale (arXiv:2607.27090) is a GPU-native memory serving system that pairs a colocated Jasper vector index with a persistent pre-RoPE key-value store to inject retrieved conversation facts directly into vLLM's attention cache. By eliminating serving-time fact prefill, InferScale achieves 1.7x-8.2x query-to-first-token (QTFT) speedups over Mem0 across 7B-14B models.
Standard prefix caching in vLLM or SGLang requires an identical leading token sequence. In personalized RAG and long-term agent memory, each request retrieves a dynamic subset and permutation of facts, invalidating prefix hashes and forcing quadratic prefill recomputation (O((m+q)^2)) on every turn.
| Model (LoCoMo Benchmark) | InferScale vs Mem0 (k=50) | InferScale vs Mem0 (k=400) | InferScale vs Jasper+PI (k=400) | InferScale Host-KV Engine TTFT (k=50) |
|---|---|---|---|---|
| Llama-3.1-8B | 2.1x faster QTFT | 3.0x faster QTFT | 2.5x faster QTFT | 19.68 ms (vs 88.91 ms CacheBlend) |
| Mistral-7B-v0.3 | 2.2x faster QTFT | 5.7x faster QTFT | 5.5x faster QTFT | 19.33 ms (vs 90.61 ms CacheBlend) |
| Qwen2.5-7B | 1.7x faster QTFT | 3.9x faster QTFT | 3.5x faster QTFT | 19.30 ms (vs 88.40 ms CacheBlend) |
| Qwen3-14B | 2.1x faster QTFT | 8.2x faster QTFT | 8.3x faster QTFT | 30.77 ms (vs 120.97 ms CacheBlend) |
How Context-Window Encoding and Chunked RoPE Preserve Accuracy
Encoding extracted facts in isolation (w = 0) strips pronouns and antecedent context, dropping Mistral-7B accuracy on LoCoMo from 64.35% down to 37.22%. InferScale resolves this offline and online through two mechanisms:
- Context-Window Encoding (w preceding turns): During offline ingestion, InferScale prepends up to w = 50 preceding conversation turns before the target fact during prefill, then retains only the fact tokens' pre-RoPE keys and values while discarding the window states. Stored KV size depends strictly on the fact's token length, lifting LoCoMo accuracy at k = 50 to 60.26% on Llama-3.1-8B (vs 63.25% Mem0) and 58.30% on Mistral-7B.
- Positional Composition via Chunked RoPE: Because rotary embeddings encode relative offset via
(R_a q)^T (R_b k) = q^T R_{b-a} k, InferScale stores pre-RoPE keysk_preand appliesk_serve = R_p k_preat serving time for contiguous offsetb_i = s + sum_{j<i} c_j, bypassing cross-fact recomputation completely. - GPU-Resident vs Host-Pinned Placement: For Llama-3.1-8B on LoCoMo, per-conversation persistent Fact KVs require 5,225.97 MB alongside a 13.50 MB Jasper graph. Keeping Fact KVs in pinned host DRAM drops VRAM pressure while still beating CacheBlend's 15% recomputation path (92.70 ms vs 128.88 ms QTFT).
Memory-Budget Rule for Pre-RoPE KV Caching
Calculate persistent fact storage using S_fact = 2 * L * c * h_kv * d * b bytes. Models with aggressive Grouped-Query Attention (such as Mistral-7B at 2,410 MB per LoCoMo conversation vs Llama-3.1-8B at 5,226 MB) double your GPU-resident fact capacity.
Reproducible KV Capacity & Latency Profiling Script
Before deploying pre-RoPE fact injection on single-GPU or multi-GPU vLLM workers, calculate exact memory capacity and verify vLLM KV-connector readiness locally:
# Compute persistent pre-RoPE fact storage footprint for Llama-3.1-8B vs Qwen2.5-7B
python3 - << 'EOF'
configs = [
("Llama-3.1-8B (BF16)", 32, 8, 128, 2),
("Qwen2.5-7B (BF16)", 28, 4, 128, 2),
("Qwen3-14B (BF16)", 40, 8, 128, 2),
]
tokens_per_fact = 32
facts_stored = 10000
for name, L, h_kv, d, bytes_per_elem in configs:
per_fact_kb = (2 * L * tokens_per_fact * h_kv * d * bytes_per_elem) / 1024
total_gb = (per_fact_kb * facts_stored) / (1024 * 1024)
print(f"{name:22s} | {per_fact_kb:7.1f} KiB/fact | 10k facts = {total_gb:.2f} GB")
EOFFrequently Asked Questions
Q:Does InferScale require modifying vLLM attention kernels or fine-tuning the LLM?
No. InferScale integrates through vLLM's standard KV-connector interface using the unmodified serving model weights for both offline Context-Window Encoding and online serving.
Q:Why does InferScale store keys before RoPE instead of post-RoPE keys?
Post-RoPE keys bake in fixed absolute token positions from offline encoding. Storing pre-RoPE keys allows Chunked RoPE to rotate each retrieved fact into contiguous serving positions dynamically on the GPU.
Q:How fast is InferScale when scaling retrieved facts from 5 to 400?
On Llama-3.1-8B, engine time-to-first-token increases only from 16 ms (5 facts) to 25 ms (400 facts), yielding a 13.3x speedup over Mem0's 327 ms engine TTFT.
Q:What happens if precomputed fact KV states exceed available GPU VRAM?
InferScale supports a host-resident mode that keeps the lightweight 13.5 MB Jasper semantic index and fact-ID map on GPU while storing pre-RoPE Fact KVs in pinned host DRAM and transferring only top-k facts over PCIe.
Related Alternatives & Comparisons
Related Architecture Guides
View all guidesBest Open Source Coding Agents in 2026: Free, Local & Fully Hackable Harnesses
MCP Server Security Best Practices: Hardening Model Context Protocol Agents in 2026
Open Source Coding Agent Harness: Build a Forkable, Local AI Engineering Runtime
Build with Smoke Monkey Harness
Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.