In agentic workflows, prefill latency and prefix caching matter more than raw tok/s. We benchmark SGLang RadixAttention vs vLLM PagedAttention and APC.
In early LLM serving, benchmarks prioritized generation throughput—raw tokens per second across synthetic batches. In 2026, the rise of agentic loops, autonomous coding assistants, and multi-turn RAG has rendered raw decoding speed an incomplete operational metric.
Modern agentic workflows—such as ReAct tool execution, multi-agent debate, and iterative code generation—spend 85% to 95% of GPU cycles in the prefill phase. These systems repeatedly transmit massive, shared prompt contexts: system prompts, structured API schemas, environment states, and execution histories. For an agent executing a twelve-turn debugging session over a 16,000-token context, generating a 50-token tool call should never require reprocessing the preceding 15,950 tokens from scratch.
Under these demands, Time-To-First-Token (TTFT), prefill latency, and Key-Value (KV) cache reuse determine viability. When an engine reuses precomputed KV caches for overlapping prefixes, TTFT drops from seconds to single-digit milliseconds, liberating bandwidth and expanding concurrency.
This shift centers on two open-source inference engines: vLLM, powered by PagedAttention and Automatic Prefix Caching (APC), and SGLang, architected around RadixAttention and structured execution trees. This benchmark evaluates both engines across agentic and RAG workloads, dissecting memory managers, lookup mechanics, fragmentation behavior, and operational trade-offs in 2026 production environments.
Architectural Divergence: PagedAttention vs. RadixAttention
The latency delta between vLLM and SGLang under agentic workloads stems from how each engine allocates, stores, and retrieves the KV cache in GPU memory.
PagedAttention (vLLM): Fixed Block Paging
┌────────────────────────────────────────────────────────┐
│ Logical Token Stream: [0..15] [16..31] [32..47] ... │
└──────────────┬─────────────────────────┬───────────────┘
▼ ▼
┌────────────────────────────────────────────────────────┐
│ Block Table: Block 0 -> Phys 104, Block 1 -> Phys 42 │
│ Hash: H_k = SHA256(H_{k-1} || Tokens[k*B : (k+1)*B-1]) │
│ Eviction: Block-level Least Recently Used (LRU) │
└────────────────────────────────────────────────────────┘
RadixAttention (SGLang): Token-Level Radix Tree (Trie)
┌────────────────────────────────────────────────────────┐
│ Root Node: "System Prompt + Tool Specs" (0..1420) │
└──────────────┬─────────────────────────┬───────────────┘
│ (Branch A: Tool Result) │ (Branch B: Alt)
▼ ▼
Node 1: [1421..2180] Node 2: [1421..2195]
│ │
▼ ▼
Node 3: [2181..2640] Node 4: [2196..2710]
vLLM: PagedAttention and APC
vLLM resolved external memory fragmentation by partitioning each sequence's KV cache into fixed-size physical blocks, typically 16 or 32 tokens.
With Automatic Prefix Caching (APC) enabled, vLLM maintains a prefix hash table. For each block $k$, vLLM computes a hash chained with the prior block:
H_k = Hash(H_{k-1} || Tokens[k * B : (k + 1) * B - 1])
Where $B$ is block size (16 or 32 tokens) and $H_k$ is the physical block key.
This mechanism introduces two structural penalties in agentic loops:
- Block-Boundary Alignment Penalty: Prefix caching only succeeds for full, sealed blocks. If a system instruction spans 1,550 tokens with block size 32, exactly 48 blocks (1,536 tokens) are cached. The trailing 14 tokens spill into an unsealed block and must be recomputed during prefill alongside new prompt data.
- Coarse-Grained Eviction: vLLM evicts cache at the block level via LRU. In branching scenarios, the block table suffers internal fragmentation when partially filled terminal blocks cannot be reclaimed without evicting the entire sequence.
SGLang: RadixAttention and Trie Management
SGLang manages the KV cache as a dynamic Radix Tree (Trie) over the token vocabulary:
- Exact Token-Level Match: If an incoming prompt matches an existing prefix up to token position 1,548, SGLang reuses all 1,548 tokens directly from the tree, regardless of power-of-two boundaries or block limits.
- Tree-Aware Eviction (Radix-LRU): When GPU memory is constrained, SGLang recursively evicts leaf nodes based on access timestamps while preserving ancestor nodes (common system prompts and tool schemas).
- Dynamic Branching: When reasoning paths diverge (such as Tree-of-Thought search), SGLang forks a child node at the divergence point. Sibling paths share the parent node's physical KV cache with zero data duplication.
Caching Mechanics in Multi-Turn Agentic Loops
Consider a ReAct agent trace over three sequential turns:
Turn 1: [System: 1,200 tok] + [Tools: 800 tok] + [Task: 150 tok]
Total: 2,150 tokens. Output: [Tool Call A: 45 tokens]
Turn 2: [Turn 1 Context: 2,195 tok] + [Tool A Result: 620 tok]
Total: 2,815 tokens. Output: [Tool Call B: 52 tokens]
Turn 3: [Turn 2 Context: 2,867 tok] + [Tool B Result: 1,450 tok]
Total: 4,317 tokens. Output: [Final Answer: 110 tokens]
Under vLLM (block_size=32, APC enabled):
- Turn 1 processes 2,150 tokens, committing 67 blocks (2,144 tokens) to cache. The trailing 6 tokens remain unsealed.
- Turn 2 submits 2,815 tokens. vLLM matches 67 blocks (2,144 tokens). The 6 trailing tokens from Turn 1 plus the tool output and new tokens (671 tokens) undergo full prefill.
- Over twelve turns, unaligned residues and block-table re-indexing accumulate significant recomputation overhead.
Under SGLang (RadixAttention):
- Turn 1 indexes the full 2,195 tokens in the radix tree after decoding.
- Turn 2 matches exactly 2,195 tokens. Prefill executes only on the newly appended 620 tokens of tool output. Zero boundary penalty is incurred.
- The KV cache hit rate approaches the theoretical maximum dictated by prompt overlap.
Figure 1: Architectural and benchmark overview for vLLM vs. SGLang in 2026: Benchmarking RadixAttention vs. PagedAttention for Local Agents & RAG.
Empirical Benchmarks: 2026 Testbed and Results
We evaluated both engines on an enterprise cluster:
- Hardware: 8x NVIDIA H100 80GB SXM5 GPUs (NVLink 4, 900 GB/s); Dual AMD EPYC 9654 (192 cores, 1.5 TB DDR5).
- Environment: Ubuntu 24.04 LTS, CUDA 12.8, PyTorch 2.6.
- Engine Builds: vLLM v0.7.3 (Chunked Prefill, APC,
block_size=32, FlashAttention-3) vs. SGLang v0.4.4 (RadixAttention, FlashInfer,--schedule-policy lru, chunked prefill). - Target Models:
Qwen3.8-72B-Instruct(FP8 W8A8) andLlama-4-70B-Instruct (Maverick)(BF16, TP=4).
Workload 1: Multi-Turn ReAct Agent (12 Sequential Turns)
Simulating an enterprise agent resolving GitHub issues: base prompt of 1,850 tokens (24 tool definitions), initial problem statement of 420 tokens, and 12 iterative tool cycles (200 to 1,800 tokens per turn). Context expands from 2,270 to 15,480 tokens.
| Metric | vLLM (APC) | SGLang (Radix) | Delta / Speedup |
|---|---|---|---|
| Turn 1 TTFT (Cold) | 142 ms | 138 ms | +2.8% (Equivalent) |
| Turn 4 TTFT (4.2k Context) | 88 ms | 24 ms | 3.66x Faster |
| Turn 8 TTFT (9.1k Context) | 164 ms | 31 ms | 5.29x Faster |
| Turn 12 TTFT (15.5k Context) | 276 ms | 42 ms | 6.57x Faster |
| Average Cache Hit Rate | 71.4% | 94.8% | +23.4% Hit Rate |
| Total Session Wall Time | 14.82 s | 8.12 s | 1.82x Overall Speedup |
| GPU Memory Overhead | 4.8 GB | 2.1 GB | -56.2% Metadata Footprint |
Under SGLang, TTFT remains flat across expanding turns because prefill only processes the delta between tool output and the next step. vLLM experiences escalating TTFT due to block alignment mismatches and prefix hash validation overhead on deeper context lengths.
Workload 2: Tree-of-Thought (ToT) Agentic Search
A reasoning benchmark where a 4,096-token root prompt branches into 16 independent trajectories, each exploring 4 speculative steps with intermediate pruning.
| Benchmark Metric | vLLM v0.7.3 | SGLang v0.4.4 | Advantage |
|---|---|---|---|
| Average TTFT per Branch | 198 ms | 44 ms | 4.50x SGLang |
| Aggregate Prefill Throughput | 12,410 tok/s | 28,950 tok/s | 2.33x SGLang |
| Peak VRAM Consumption (KV) | 52.4 GB | 26.8 GB | 48.8% Memory Reduction |
| Eviction Thrashing Frequency | 14 events | 0 events | SGLang Radix-LRU Stability |
Because all 16 branches share ancestry in the radix tree, SGLang allocates the root prompt once. Sibling branches fork from parent nodes with zero memory duplication. In vLLM, concurrent queues duplicate boundary blocks, triggering premature evictions.
Workload 3: High-Concurrency Enterprise RAG Serving
64 concurrent streams querying 10 shared documentation blocks (3,500 tokens each), with user queries (150 tokens) routed across documents with high temporal locality.
| Metric (64 Concurrency) | vLLM (APC) | SGLang (Radix) | Analysis |
|---|---|---|---|
| Median TTFT (p50) | 112 ms | 38 ms | SGLang 2.94x lower latency |
| Tail Latency (p99 TTFT) | 540 ms | 162 ms | SGLang eliminates tail spikes |
| Normalized Prefill Tok/s | 18,200 | 24,600 | FlashInfer prefill efficiency |
| Sustained System Throughput | 48.2 req/s | 61.4 req/s | SGLang +27.3% total capacity |
| KV Cache Fragmentation | 22.4% | 6.1% | Fixed block size wastes space in vLLM |
SGLang's Radix-LRU eviction keeps frequently accessed corpus documents pinned in memory, while vLLM's block-level LRU frequently evicts terminal blocks under memory pressure.
Architectural Deep-Dive: Chunked Prefill Mechanics
vLLM's Chunked Prefill interleaves prefill and decode phases within the same scheduling step, preventing compute-heavy prefills from starving latency-sensitive decoding tokens.
While chunking a 4,096-token prefill into 512-token increments maintains stable inter-token decoding latencies, it does not reduce the total computational work required; it merely distributes prefill execution over time. If an engine recomputes 800 tokens of an unaligned prefix across twelve turns, chunking mitigates latency spikes for concurrent requests, but the agent still incurs cumulative execution delay and memory bandwidth drain.
In contrast, SGLang combines chunked prefill with exact token-level prefix preservation. By ensuring that only true deltas reach the prefill kernel, SGLang reduces total FLOPs before scheduling begins:
Computational Work Comparison per Turn:
vLLM: [Cached Blocks: N*B] + [Recomputed Tail: <B] + [New Input Tokens]
SGLang: [Cached Trie Nodes: Exact Tokens] + [New Input Tokens]
Hardware Portability and Ecosystem Maturity
While SGLang demonstrates clear performance superiority in prefix-heavy workloads, architectural choices require balancing algorithmic efficiency against operational maturity.
| Evaluation Dimension | vLLM in 2026 | SGLang in 2026 |
|---|---|---|
| Prefix Caching Architecture | Block-based APC (PagedAttention v2) | Token-level Radix Tree (RadixAttention) |
| Optimal Workload Profile | Batch serving, streaming, diverse prompts | Multi-turn agents, RAG, Tree-of-Thought |
| Hardware Support Spectrum | NVIDIA CUDA, AMD ROCm, AWS Neuron, Intel Gaudi, TPU | NVIDIA CUDA (primary), AMD ROCm (maturing) |
| Distributed Scaling | Megatron-style TP/PP, Pipeline, Ray, Multi-Node | Tensor Parallelism, Data Parallelism, Multi-Node |
| Framework Integrations | Industry default: Ollama, LiteLLM, vLLM Router | Native SGLang DSL, LiteLLM, OpenAI API compatible |
| Ecosystem Stability | Exceptional; massive contributor base | Rapidly accelerating; agile core team |
vLLM remains the enterprise standard for general-purpose model serving, supporting diverse accelerators including AMD MI300X, Intel Gaudi 3, and Google TPUs. Organizations with heterogeneous infrastructure or non-repetitive batch inference find vLLM's mature toolchain compelling.
SGLang optimizes aggressively for modern LLM interaction patterns. Its custom kernel integration via FlashInfer, paired with RadixAttention, delivers an optimal runtime for autonomous agent swarms, coding assistants, and complex RAG applications on NVIDIA hardware.
Technical Recommendations for 2026 Deployments
- Deploy SGLang for Autonomous Agents and Coding Copilots: For sequential tool loops, expanding chat contexts, or speculative reasoning branches, SGLang provides 3.5x to 6.5x lower TTFT and halves KV-cache memory consumption.
- Deploy vLLM for Heterogeneous Hardware and Non-Prefix Batching: When serving workloads with minimal prefix sharing—such as independent single-turn requests, batch summarization, or AMD ROCm / AWS Neuron deployments—vLLM's hardware support and mature scheduler make it the preferred choice.
- Tune Block Size in vLLM APC: If operating vLLM in an agentic environment, tune
block_sizeto 16 rather than 32. While smaller blocks double block-table metadata, they halve the unsealed boundary penalty from 16 to 8 tokens per turn. - Monitor KV Cache Hit Rate as a Primary KPI: In production agentic systems, tracking tokens-per-second without prefix cache hit rates obscures bottlenecks. A 5% improvement in prefix cache hit rate consistently delivers greater user responsiveness than a 20% increase in raw decoding throughput.
In 2026, the performance bottleneck of intelligent systems has migrated from generation to prefill. By replacing rigid block-paging models with dynamic, tree-structured cache topologies, SGLang's RadixAttention establishes the architectural benchmark for low-latency agentic execution.