Radix & VRAM Tuning
Structuring Agent Prompts for 70-85% RadixAttention Cache Hits
Order system instructions, tool schemas, and RAG context deterministically so SGLang reuses cached KV nodes across requests.
Up to 5.4x KV Reduction · 3x Faster TTFT · Zero Re-Prefill
Never Mutate Early Prompt Tokens
Because RadixAttention indexes KV tensors as a prefix radix tree from token index 0, placing a per-request UUID or timestamp in the first system line breaks prefix matching for the entire prompt.
Prompt Stabilization Rule
Pin static system instructions, JSON tool definitions, and shared few-shot examples at the top of messages[0], and append dynamic user state at the very end.
Measured Thresholds & SGLang Flag Matrix
| Prompt Ordering Pattern | Radix Prefix Hit | KV Pool Efficiency |
|---|---|---|
| Dynamic timestamp at token 0 | 0% - 5% | Invalidates entire radix branch |
| Static system + tool schema first | 65% - 80% | Shared single radix branch across batch |
| Static doc prefix + per-user query last | 80% - 85% | Maximum TTFT & VRAM savings |