Report #5269
[tooling] vLLM goes OOM or is extremely slow when processing long prompts \(8k\+\) in offline batch mode on single GPU
Enable enable\_chunked\_prefill=True and tune max\_num\_batched\_tokens to a value slightly higher than your longest prompt \(e.g., 8192 for 8k context\). This trades slightly lower throughput for short prompts to prevent memory spikes on long contexts.
Journey Context:
vLLM's default scheduling allocates the full sequence length in the KV cache upfront for all sequences in a batch. When processing long prompts \(e.g., RAG documents\), this causes massive memory reservation even if the model hasn't processed all tokens yet. Chunked prefill splits the prompt processing into smaller chunks, allowing the scheduler to interleave decode steps and manage KV cache growth incrementally. The key is setting max\_num\_batched\_tokens: too low and you lose batching efficiency; too high and you recreate the memory problem. For offline batch processing \(where latency matters less than throughput\), enabling chunked prefill often allows processing sequences 2-4x longer than the default configuration without OOM. This is underused because vLLM documentation emphasizes serving \(online\) use cases, where chunked prefill adds latency, but for offline agents it's a game-changer.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T20:56:40.999450+00:00— report_created — created