Skip to content

Operator task guide

How to fix vLLM CUDA graph capture OOM and startup crashes

After loading weights and profiling KV cache, vLLM captures CUDA graphs for discrete decode batch sizes so small-batch steps avoid Python kernel-launch overhead. Each captured graph retains workspace memory and can push tight GPU allocations into CUDA OOM right before the server reports ready.

Run a single controlled launch with --enforce-eager to isolate whether graph capture caused the OOM or kernel crash. If eager mode starts cleanly, trim capture batch sizes or slightly reduce --gpu-memory-utilization rather than disabling graphs permanently unless memory requires it.

Reviewed . Reference guidance is not a diagnosis of your workload.

Step-by-step method

  1. 1

    Confirm the OOM occurred during graph capture rather than weight loading

    Inspect the exact traceback and startup timestamp. Graph-capture OOMs appear after weight loading and KV block calculation, inside capture_model or cudagraph_wrapper calls.

    grep -n -iE 'Capturing CUDA graphs|cudagraph|enforce-eager|OutOfMemoryError' vllm.log
  2. 2

    Run an --enforce-eager control to isolate graph memory overhead

    Launch the exact same model and sequence settings with --enforce-eager. If startup succeeds, you have proved CUDA graph capture workspace exceeded remaining HBM headroom.

    vllm serve YOUR_MODEL --enforce-eager --max-model-len 16384 --gpu-memory-utilization 0.88
  3. 3

    Tune CUDA graph capture sizes or piecewise mode

    Instead of keeping eager mode permanently (which lowers small-batch decode throughput), constrain max capture size or tune --compilation-config capture sizes supported by your vLLM version, and inspect headroom.

    # Inspect supported compilation and CUDA graph flags for your installed vLLM release
    vllm serve --help | grep -iE 'cudagraph|compilation|enforce-eager'
  4. 4

    Compare decode latency and peak memory against eager mode

    Benchmark both eager mode and tuned graph capture at production concurrency to verify peak HBM stays clear of OOM while meeting inter-token latency targets.

CUDA graph startup failure branches

Signals, meanings and actions for how to fix vllm cuda graph capture oom and startup crashes.
SignalWhat it meansNext action
OOM happens during Capture CUDA graphs; --enforce-eager boots cleanlyGraph capture workspace exceeded remaining HBM headroom.Trim capture batch sizes or slightly adjust --gpu-memory-utilization.
Crash persists with --enforce-eager enabledWeights, activations, or an attention kernel failed independently of CUDA graphs.Investigate weight/KV capacity or CUDA_LAUNCH_BLOCKING=1 kernel errors.
Startup hangs or takes 10+ minutes inside graph captureFirst-run torch.compile / Inductor compilation or slow IPC.Check torch.compile cache persistence and verify /tmp and shm headroom.
Illegal memory access inside captured graph replayKernel bug or dynamic shape violation during graph execution.Reproduce with --enforce-eager and CUDA_LAUNCH_BLOCKING=1.

Evidence checklist

  • Startup log lines from weight load through graph capture
  • Comparison run with --enforce-eager
  • vLLM, PyTorch, and CUDA versions
  • --gpu-memory-utilization and --compilation-config flags
  • nvidia-smi peak memory before crash

Common mistakes

Raising --gpu-memory-utilization to 0.99 to fix graph OOM

When graph workspace sits outside KV blocks or co-resident contexts consume memory, 0.99 leaves zero safety margin.

Leaving --enforce-eager on in latency-sensitive production blindly

Disabling CUDA graphs increases CPU launch overhead on small decode batches; benchmark ITL first.

Assuming every startup crash is CUDA graph capture

Always inspect the traceback line to separate weight loading, KV profiling, and graph capture.

Frequently asked questions

Why does vLLM run out of memory during CUDA graph capture after loading weights?

CUDA graph capture pre-allocates static memory pools and captures multiple batch-size execution graphs after weights and KV cache sizing complete, pushing borderline HBM usage over 100%.

How much performance does --enforce-eager cost in vLLM?

Eager mode adds Python/CUDA kernel launch overhead, which primarily slows down small-batch decode inter-token latency. Large prefill-bound batches see less impact.

How can I reduce CUDA graph memory without disabling graphs completely?

Limit maximum captured batch sizes via vLLM compilation/CUDA graph configuration flags for your installed release, or use piecewise CUDA graph modes where supported.

Why does CUDA graph capture hang on the very first run?

If torch.compile is enabled alongside graph capture, Triton and Inductor compile kernels on cold start. Persist the compilation cache across container restarts.

Live diagnosis, no signup

Upload your GPU log. Find what happened first.

Get the likely cause, supporting evidence, and next safe steps with the same cloud reasoning used by paid plans. A crash the engine recognizes is answered in seconds, then checked by an independent AI review that updates this page when it finishes. A crash it does not recognize waits for the AI's own answer, which can take a few minutes. No account, card, or installation. Logs are masked at Denpex API ingress and are not saved to account history.

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

Try Denpex for 30 days. FREE.

No credit card. No automatic subscription. See whether Denpex helps with an incident you already understand.

Start your free 30-day Team evaluation

Up to 50 diagnoses a day for 30 days. Verify your work email to activate an eligible company evaluation, then replay a resolved incident and compare the evidence and next steps with your team's confirmed cause.

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.

Apply the method to your incident

Use the three free diagnoses to review your error and relevant evidence. Keep reference guidance separate from the cause and recovery status of your own workload.

Diagnose your incident