A JOURNAL OF ARTIFICIAL INTELLIGENCE
my ai daily

vLLM Out of Memory Fix: KV Cache, Flags & OOM Preemption

In vLLM 0.34.0+, extensible KV cache already defaults to 1.0 VRAM—so blindly raising --gpu-memory-utilization fails. Here is how to decode startup OOM tracebacks and tune --max-model-len, --kv-cache-dtype fp8, and --max-num-seqs.

AI-generated editorial illustration of a matte-black anodized aluminum and smoked-glass GPU memory manifold housing glowing cyan block trays, warm amber conduits, and a brushed-brass pressure regulator valve.
AI-generated illustration / my ai dailyIllustrative image.

THE STORY IN THREE POINTS

  • Immediate fix order for vLLM 0.34.0+: read the exact kv_cache_planning.py error first, then set --max-model-len auto (or cap explicitly), switch to --kv-cache-dtype fp8 to halve KV memory, and reduce --max-num-seqs to shrink CUDA graph and activation overhead.
  • Why legacy --gpu-memory-utilization advice backfires: vLLM 0.34.0 enables extensible KV cache by default on CUDA and ROCm, defaulting utilization to 1.0 (0.92 when disabled)—while shared GPUs running sidecar agents should cap at 0.88.
  • Runtime preemption spikes: vLLM V1 defaults to RECOMPUTE preemption when concurrent requests exhaust the cache pool, so alert on vllm:kv_cache_usage_perc (<85%–90%) and vllm:num_preemptions_total before tail latency degrades.

Immediate fix order for vLLM CUDA out-of-memory crashes

A vLLM server crashes with an out-of-memory (OOM) error whenever the sum of model weights, runtime activation buffers, CUDA graph capture pools, and the pre-allocated Key-Value (KV) cache exceeds physical GPU VRAM. To stabilize startup immediately on modern builds, inspect the exact traceback line first and apply flags in strict priority order: pass --max-model-len auto (or pin an explicit ceiling matching real prompts), lower --max-num-seqs to curb concurrent sequence and warmup overhead, and add --kv-cache-dtype fp8 to cut KV cache consumption roughly in half compared to BF16, as verified against vLLM 0.34.0 in Lium’s November 23 troubleshooting guide.

Avoid copy-pasting outdated blog snippets that blindly crank --gpu-memory-utilization to 0.95 or 0.98. In current vLLM V1 releases, memory planning runs dynamically after warmup, so forcing higher fractions often does nothing for startup errors while starving sidecar processes during multi-hour traffic.

Decoding the two main vLLM 0.34.0 startup OOM tracebacks

Before touching launch flags, separate the two opposite failures emitted by vllm/v1/core/kv_cache_planning.py, documented by Lium and Spheron Network’s preemption guide. If vLLM prints No available memory for the cache blocks, zero VRAM remained for KV cache after weights, activations, and CUDA graphs loaded—meaning lowering --max-num-seqs alone cannot save startup until you load quantized weights (AWQ, GPTQ, or FP8) or expand across cards with --tensor-parallel-size.

By contrast, if the error reads KV cache is needed, which is larger than available KV cache memory, your weights loaded cleanly but reserving enough cache blocks for one full-length sequence at the checkpoint’s native max_seq_len exceeded remaining VRAM. That second failure fixes cleanly by capping --max-model-len or enabling --kv-cache-dtype fp8. A third pattern—healthy startup followed by mid-run slowdowns and RECOMPUTE warnings—means concurrent load exhausted the KV pool, requiring tighter --max-num-seqs and --max-num-batched-tokens bounds.

Why raising --gpu-memory-utilization fails in vLLM 0.34.0+

In vLLM 0.34.0, the extensible KV cache is enabled by default on both CUDA and ROCm devices. Instead of reserving a static pre-warmup fraction upfront, vLLM captures CUDA graphs first and sizes KV cache memory dynamically from whatever free device memory remains afterward. As Lium documents, whenever extensible KV cache is active and --gpu-memory-utilization is omitted, vLLM already defaults to 1.0 (and 0.92 when disabled).

Consequently, when logs report that extensible KV cache already claimed all available VRAM, bumping --gpu-memory-utilization yields zero extra headroom. Conversely, on shared nodes running metrics exporters, telemetry agents, or co-located containers, leaving utilization near 0.95–1.0 triggers unpredictable mid-run CUDA OOMs; DevOpsBeast recommends capping shared cards at 0.88 while saving 0.90–0.92 for dedicated endpoints.

Tuning --max-model-len, FP8 KV cache, and --max-num-seqs

Modern checkpoints ship with 128K to 1M token context definitions, forcing vLLM to reserve large contiguous KV cache slots unless constrained. If production prompts never exceed 16K or 32K tokens, pass an explicit cap such as --max-model-len 32768—remembering that uppercase 16K parses as 16,384 tokens while lowercase 16k parses as 16,000 in vLLM 0.34.0—or pass --max-model-len auto to let the planner choose the longest safe window automatically.

Pairing a realistic context cap with --kv-cache-dtype fp8 halves KV storage per token with negligible accuracy loss on Hopper, Ada Lovelace, and Blackwell GPUs; on older Ampere cards such as the RTX 3090 or A100 lacking native FP8 tensor acceleration, check kernel support in your build or rely on context and concurrency limits instead. Equally critical, Spheron highlights that CUDA graph capture memory scales with --max-num-seqs outside the KV pool—so dropping --max-num-seqs from 256 down to 32 or 64 on a 24GB or 48GB GPU frees substantial warmup buffers, as in vllm serve Qwen/Qwen3.8-27B --max-model-len 32768 --max-num-seqs 32 --kv-cache-dtype fp8 --gpu-memory-utilization 0.90.

Monitoring vLLM V1 RECOMPUTE preemption under concurrency

Surviving startup does not protect an endpoint from memory exhaustion under live multi-tenant bursts. In vLLM V1, whenever active concurrent requests fill every KV cache block, the scheduler defaults to RECOMPUTE preemption rather than CPU memory swapping because recomputing evicted attention states on modern GPUs beats PCIe transfer latency (Spheron). However, each eviction discards computed prefixes and causes sharp tail-latency spikes across queued users.

Prevent silent thrashing by scraping vLLM’s Prometheus counters before users complain. Alert when vllm:kv_cache_usage_perc sustains peaks above 85% to 90% and treat any steady climb in vllm:num_preemptions_total as a trigger to tighten --max-num-seqs, enable FP8 KV caching, or add tensor-parallel GPUs.

When weights fill VRAM: quantization, TP sharding, and engine choice

When model weights consume nearly all available VRAM before KV blocks are planned, flag tuning hits a physical floor. Pull an AWQ, GPTQ, or FP8 weight checkpoint, shard layers across cards via --tensor-parallel-size, or check how continuous batching and prefix caching trade off across engines in our SGLang vs. vLLM throughput comparison and Ollama vs. vLLM production concurrency guide.

Clusters running massive trillion-parameter MoE agents or strict low-latency SLAs can also pair serving tuning with disaggregated storage architectures and lossless drafting covered in our DeepSeek DeepInfer serving guide, DualPath disaggregated KV-cache report, and speculative decoding explainer.

Sources: vLLM Out of Memory Fix (Checked on vLLM 0.34.0)|Lium ↗ vLLM gpu_memory_utilization Guide: Fix Low Throughput and OOM|Spheron Network ↗ vLLM GPU Memory Utilization Tuning|DevOpsBeast ↗ vLLM Official Documentation|vLLM Project ↗

THE BROADER CONTEXT · FRONTIER LABS DOSSIER

Explore full product specifications, pricing analysis, and continuous coverage in the Frontier Labs Desk Hub and Others Dossier. Independent benchmarks available on the AI Intelligence Index and Coding Agents Leaderboard.

02The next story

News

Ollama Context Length: Why It Caps at 4K & How to Fix It

Ollama silently locks context at 4,096 tokens on machines under 24 GiB VRAM—and setting OLLAMA_NUM_CTX or passing num_ctx to /v1/chat/completions does nothing. Here is the OLLAMA_CONTEXT_LENGTH fix and how to verify it with ollama ps.

ComfyUI Out of Memory Fix: DynamicVRAM & Batch Leaks

ComfyUI’s 2026 DynamicVRAM and AIMDO allocator made pre-March --lowvram flags useless—introducing second-run non-OOM crashes, WSL Shared GPU memory locks, and HostBuffer errors. Here is the symptom-by-symptom CLI and BatchPipe fix.

Best Local LLM for Coding: Picks by 16GB, 24GB & 64GB

Autocomplete-only models crash inside Cline, Aider, and OpenCode. Filtering strictly for native Ollama tool calling and permissive open weights yields clear November 2026 picks across 16GB, 24GB/32GB, and 64GB+ workstations.

Follow your curiosity.

EXPLORE THE ARCHIVESOURCES & CONTEXT INCLUDED