vLLM CUDA Graph Capture OOM: Startup Fix & Tuning
Fix vLLM Capturing CUDA graphs OOM errors during startup. Separate weight and KV cache reservation from graph memory with --enforce-eager tests.
vLLM OOMs during CUDA graph capture when weight shards plus the pre-allocated KV cache fill almost all allowed VRAM, leaving less free memory than the graph-capture pool and PyTorch workspace require for larger batch shapes. Isolate graph capture with --enforce-eager first, confirm no competing process holds memory via nvidia-smi, then reduce --gpu-memory-utilization or cap graph capture batch shapes.
- Symptom
INFO 11-25 18:04:11 [model_runner.py:1492] Capturing CUDA graphs (batch_size=256, shapes=[1, 2, 4, 8, 16, 24, 32, 64, 128, 256]) Traceback (most recent call last): File "/usr/local/lib/python3.12/dist-packages/vllm/worker/model_runner.py", line 1538, in capture_model graph_runner.capture(**capture_inputs) torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 512.00 MiB. GPU 0 has a total capacity of 79.15 GiB of which 318.00 MiB is free. Including non-PyTorch memory, this process has 78.81 GiB memory in use.- Root cause
- CUDA graph capture pool allocations and PyTorch workspace buffers exceeded remaining free HBM after weights and pre-allocated KV cache blocks were reserved.
- Recommended fix
- Run nvidia-smi to verify no stale Python worker or sidecar holds memory on the GPU.
- How Denpex helps
- Denpex investigates vLLM CUDA Graph Capture OOM: Startup Fix & Tuning using the evidence you provide or your connected workload collects. Earlier rank, host or application evidence is needed to distinguish an initiating failure from a downstream report.
What this failure is
A startup torch.OutOfMemoryError raised inside vllm/worker/model_runner.py during capture_model after model loading and memory profiling completed.
Is this what broke your run? Paste your log.
You're reading about vLLM CUDA Graph Capture OOM: Startup Fix & Tuning. Paste your own traceback and relevant evidence for an investigation of your workload, with a next action or a specific missing fact. A reference entry does not establish your cause. No account or card for the free diagnosis. Review data handling before submitting sensitive logs.
Before uploading, review cloud data handling and local options.
Upload your log file. Large files are processed in your browser. Only selected evidence is submitted when you run diagnosis.
Why it happens (the mechanism)
vLLM profiles peak activation memory and commits the remaining budget under --gpu-memory-utilization to KV cache blocks before recording CUDA graphs across capture batch shapes (for example batch sizes 1 through 256). Extra non-PyTorch allocations, custom attention workspaces, or tight headroom cause capture_model to fail by a few hundred MiB.
What you'll observe
- vLLM loads all model shards cleanly and crashes inside Capturing CUDA graphs at startup
- nvidia-smi or the PyTorch allocator error shows less than 1 GiB free while CUDA graph capture requests another block
Common symptoms and what they mean
Check possible explanations against the incident evidence. A matching symptom alone does not establish its cause.
| Symptom | Possible explanation |
|---|---|
| Capturing CUDA graphs ... torch.OutOfMemoryError: CUDA out of memory | CUDA graph capture pool allocations and PyTorch workspace buffers exceeded remaining free HBM after weights and pre-allocated KV cache blocks were reserved. |
| GPU 0 has a total capacity of ... of which ... MiB is free during capture_model | CUDA graph capture pool allocations and PyTorch workspace buffers exceeded remaining free HBM after weights and pre-allocated KV cache blocks were reserved. |
Which systems are affected
- vLLM V0 and V1 inference workers using default CUDA graph capture
- Single-GPU and tensor-parallel serving replicas with high --gpu-memory-utilization
How to confirm this is the problem
Use this checklist to test the hypothesis against a small reproduction. No single line proves the root cause, so preserve the preceding events and compare one variable at a time.
- ✓Verify clean startup without --enforce-eager through Capturing CUDA graphs finished and run a concurrent multi-batch completion test.
Root cause
- CUDA graph capture pool allocations and PyTorch workspace buffers exceeded remaining free HBM after weights and pre-allocated KV cache blocks were reserved.
The fix and how to prevent it
How to fix it
- Run nvidia-smi to verify no stale Python worker or sidecar holds memory on the GPU.
- Run one startup test with --enforce-eager to prove weights, KV cache, and eager forward execution fit cleanly when graph capture is disabled.
- Lower --gpu-memory-utilization slightly (for example from 0.90 to 0.85 or 0.82) or cap --max-num-seqs and graph capture batch sizes so graph recording keeps 1 GiB to 2 GiB of headroom.
- If serving long contexts near hardware limits, lower --max-model-len or enable FP8/AWQ quantization so graph capture does not compete with the last megabytes of HBM.
Step-by-step remediation
- 1Run nvidia-smi to verify zero stray processes occupy device VRAM before vLLM starts.
- 2Launch the same model once with --enforce-eager to confirm non-graph allocations fit cleanly.
- 3Lower --gpu-memory-utilization or cap --max-num-seqs, remove --enforce-eager, and verify graph capture completes.
How to prevent it
- Test worst-case --max-num-seqs and graph capture settings in staging against the exact model, quantization, and driver stack
- Reserve explicit unallocated VRAM headroom instead of pushing --gpu-memory-utilization above 0.92 on multi-batch shapes
Save this diagnosis and catch the next crash automatically
All root cause, fix, and prevention steps above are free to read. Create a free account with any email or GitHub to keep your saved diagnosis history across the encyclopedia and run cloud checks, or use a work email below for the 30-day Team evaluation. No card required.
Or start a 30-day free Team trial (work email)
Verified work email unlocks all 14 fleet diagnostic tools, Slack alerts, and team history for 30 days. No card and no automatic charge.
Searchable error signature
INFO 11-25 18:04:11 [model_runner.py:1492] Capturing CUDA graphs (batch_size=256, shapes=[1, 2, 4, 8, 16, 24, 32, 64, 128, 256])
Traceback (most recent call last):
File "/usr/local/lib/python3.12/dist-packages/vllm/worker/model_runner.py", line 1538, in capture_model
graph_runner.capture(**capture_inputs)
torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 512.00 MiB. GPU 0 has a total capacity of 79.15 GiB of which 318.00 MiB is free. Including non-PyTorch memory, this process has 78.81 GiB memory in use.Use this text as a lookup key in logs and upstream issue trackers. It is not presented as a captured customer log. Confirm the cause from your own preceding events, versions, configuration and the cited references.
Diagnose your own log automatically
The root cause and fix steps above stay free. Create a free account to analyze full job logs, attribute the first failed rank, and keep saved incident history.
Sign up free. Analyze your cluster logsNo credit card. Daily allowance follows verified trust tier. Instant access.
Why the recommended fix works
Testing --enforce-eager separates graph capture overhead from true weight overflow, while reducing --gpu-memory-utilization or max capture batch shapes leaves contiguous memory outside the static KV pool for CUDA graph pools.
Code examples
nvidia-smi --query-gpu=index,memory.used,memory.free --format=csv
vllm serve YOUR_MODEL --enforce-eager
vllm serve YOUR_MODEL --gpu-memory-utilization 0.85 --max-num-seqs 64This snippet illustrates the entry-specific check. Verify the installed versions, permissions, target and workload context before using it. A command or API example is not proof of recovery.
Best practices by model family
| Model / Stack | Recommendation | Notes |
|---|---|---|
| Isolation check | Test --enforce-eager on the exact launch | Confirms whether graph capture alone pushes memory over the edge. |
| Production headroom | Lower --gpu-memory-utilization to 0.85 or cap --max-num-seqs | Preserves CUDA graph capture latency gains without startup OOM. |
With the fix vs without the fix
| Dimension | With the fix | Without the fix |
|---|---|---|
| Startup OOM triage | Eager control run plus headroom or capture shape tuning | Raising --gpu-memory-utilization toward 0.99 and still failing graph capture |
| Deployment readiness | Validated startup plus peak batch traffic | Production pods crash-looping on graph recording |
Diagnostic note
“Contrary to instinct, raising --gpu-memory-utilization can make CUDA graph capture WORSE when weights and KV cache eat the margin before capture_model records larger batch shapes. Lowering utilization slightly often resolves the OOM while keeping graphs enabled.”
Diagnose this failure in VS Code
Select the traceback or open the failed terminal, then run Denpex locally to inspect matched failure patterns, supporting evidence and next checks without uploading the log. Verify recommendations against your workload before changing production.
Install the free VS Code extensionvLLM errors in context
vLLM failures cross request, model, KV cache, worker, kernel and host boundaries. The hub compares common signatures and evidence checks that help distinguish possible causes.
Compare related vllm errorsRelated failures to investigate next
Frequently asked questions
Questions engineers and on-call staff commonly ask about this failure.
Why does raising --gpu-memory-utilization not always fix vLLM CUDA graph capture OOM?
Should I leave --enforce-eager enabled permanently in production?
Don't just read the fix, diagnose your run
The encyclopedia explains documented failure patterns. Denpex investigates your logs, configuration and stack, shows the supporting evidence, and asks for missing details when needed.
Related Inference errors
DeepGEMM rejects FP8 block-scaled weights with Unknown SF transformation on an unsupported architecture
Inference · high
SGLang NCCL Error and Multi-Node Timeout
Inference · high
SGLang torch.OutOfMemoryError: CUDA out of memory
Inference · high
vLLM NCCL P2P Hang and Timeout in Tensor Parallelism
Inference · high