Cutting long-context TTFT on private GPUs with vLLM and SGLang

Running open-weights models on your own GPU nodes looks easy right after you spin up a single vLLM container and send a "hello world" curl request.
Then real agent workloads arrive with 16K to 32K input tokens (giant system prompts, tool schemas, retrieved RAG chunks, multi-turn conversation histories) and multiple concurrent users, and suddenly Time To First Token (TTFT) shoots past 5 seconds while decode tokens stutter every time a new long prompt enters prefill.
Over the last few months running private inference clusters on both vLLM and SGLang, four specific tuning levers made almost all the difference for our latency and GPU memory efficiency.
1. Prefix caching (RadixAttention / Automatic Prefix Caching)
In agent platforms and multi-turn chat, requests are shockingly repetitive. Ten consecutive turns in the same agent session share the exact same 4,000-token system prompt + tool definitions + first N turns of history. Without prefix caching, the GPU recomputes the exact same KV cache for those shared tokens on every single turn.
SGLang's RadixAttention (and vLLM's automatic prefix caching) keeps KV cache blocks indexed in a radix tree across requests in GPU memory. As long as your gateway keeps the static prefix byte-identical (do not inject a dynamic Current time: 14:23:05 timestamp on line 1 of the system prompt - put volatile fields at the end!), cache hit rates on multi-turn agent traffic jump dramatically and long-context TTFT drops from seconds to a fraction of a second.

2. Chunked prefill to stop head-of-line blocking
When one request arrives with a 32K-token prompt, naive continuous batching lets that single massive prefill monopolize the GPU for hundreds of milliseconds, freezing token generation for every other active streaming user sharing that replica.
Enabling chunked prefill slices huge prefills into bounded token chunks (e.g. 2K to 4K tokens per iteration) and interleaves them with ongoing decode steps. The 32K request takes roughly the same total prefill time, while everyone else's inter-token latency (ITL) stays smooth instead of freezing mid-sentence.
3. PagedAttention memory headroom
GPU VRAM budgeting is a balancing act between KV cache capacity and batch concurrency. If you set --gpu-memory-utilization too low, you leave precious KV cache blocks unused and trigger premature request queuing or preemption. Set it too high without leaving headroom for CUDA graph capture and activations, and you OOM right during a traffic spike.
We benchmarked each model + quantization combo under realistic mixed prompt lengths (short 500-token turns alongside 32K contexts) and tuned max-num-seqs and max-num-batched-tokens together rather than trusting defaults.
4. FP8 and AWQ quantization tradeoffs
Moving from BF16 to FP8 (on Hopper/Ada GPUs with native FP8 Tensor Cores) or AWQ INT4 cut model weight footprint roughly in half, freeing huge chunks of VRAM for KV cache so we could hold way more concurrent long-context sessions and warm prefix trees per GPU.
One caution: never flip quantization on blindly for tool-calling agents. We always ran our structured JSON / tool-calling eval set before promoting a quantized checkpoint. On some smaller models, aggressive 4-bit quantization barely moved general chat quality yet noticeably increased malformed JSON tool arguments, whereas FP8 held up much closer to BF16.

Getting self-hosted inference fast is mostly about respecting KV cache locality and stopping giant prefills from starving active streams. Once those pieces are tuned, private clusters stop feeling like a compromise compared to hosted APIs.
Share this article
Reactions