Skip to content

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.

Quick answer

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.
Inference#vllm#cuda-graph#cuda-oom#model-runner#inference

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.

Live diagnosis, no signup

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.

training_logs.txt
No log to hand? Try one:

Upload your log file. Large files are processed in your browser. Only selected evidence is submitted when you run diagnosis.

3 free cloud diagnoses per day

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.

SymptomPossible explanation
Capturing CUDA graphs ... torch.OutOfMemoryError: CUDA out of memoryCUDA 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_modelCUDA 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

  1. 1Run nvidia-smi to verify zero stray processes occupy device VRAM before vLLM starts.
  2. 2Launch the same model once with --enforce-eager to confirm non-graph allocations fit cleanly.
  3. 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.

Use your company email, for example alex@yourcompany.com.

Who qualifies?

Company email domains activate the free 30-day Team evaluation (up to 50 diagnoses a day) after an email and domain check, whatever mail provider you use. If we cannot verify your domain automatically, support reviews it: write to support@denpex.com. Free local diagnosis in the editor extension needs no account.

Using a personal email (Gmail, Outlook, Naver, QQ) or solo cluster? Create a free $0 account (no work email required) to save 7-day history and unlock AI fallback, or send a cluster crash log for a live walkthrough.
Already have an account? Sign in

Searchable error signature

search key
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 logs

No 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

snippet
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 64

This 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 / StackRecommendationNotes
Isolation checkTest --enforce-eager on the exact launchConfirms whether graph capture alone pushes memory over the edge.
Production headroomLower --gpu-memory-utilization to 0.85 or cap --max-num-seqsPreserves CUDA graph capture latency gains without startup OOM.

With the fix vs without the fix

DimensionWith the fixWithout the fix
Startup OOM triageEager control run plus headroom or capture shape tuningRaising --gpu-memory-utilization toward 0.99 and still failing graph capture
Deployment readinessValidated startup plus peak batch trafficProduction 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 extension

vLLM 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 errors

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?
Because vLLM allocates nearly all of the target utilization fraction into KV cache blocks right before CUDA graph capture runs, leaving little unreserved room for PyTorch allocator peaks or non-PyTorch graph workspace memory.
Should I leave --enforce-eager enabled permanently in production?
Use --enforce-eager as a diagnostic control. In production, decode latency improves with CUDA graphs enabled, so prefer modest headroom or capped capture batch sizes.

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.