Troubleshooting

vLLM out of memory: fix KV cache errors

A vLLM out of memory error almost always means the model weights left too little room for the KV cache. vLLM reports it at start-up as "No available memory for the cache blocks" or as a max seq len that needs more KV cache than is available. Lower --max-model-len, lower --max-num-seqs, quantize weights or the KV cache, or add GPUs with tensor parallelism.

NEURAMESH / COMPUTE FIELD NOTES00 / 10

The exact errors and what they mean

vLLM sizes its KV cache at start-up and fails early if it cannot fit. In vLLM 0.34.0, the current release on 24 November 2026, the two main messages are "ValueError: No available memory for the cache blocks." and "ValueError: To serve at least one request with the model's max seq len (40960), (5.62 GiB KV cache is needed, which is larger than the available KV cache memory (3.10 GiB). Based on the available memory, the estimated maximum model length is 22528." The numbers in the second message are an example.

The first means the weights, activations and CUDA graphs used everything; nothing is left for the cache. The second means there is some cache, but not enough to hold one request at the full context length. Helpfully, it tells you the longest context that would fit.

Where the extensible KV cache is off, a third message appears when other processes already hold memory: "Free memory on device … on startup is less than desired GPU memory utilization". A plain torch.OutOfMemoryError during serving is rarer and usually comes from a large prefill batch rather than the cache.

The exact errors and what they mean
MessageMeaningFirst fix
No available memory for the cache blocksWeights and overhead filled the GPUQuantize, add GPUs or a bigger GPU
To serve at least one request with the model's max seq lenContext too long for the cacheSet --max-model-len to the estimate
Free memory on device … on startup is less thanAnother process holds memoryStop it or lower the utilization cap
torch.OutOfMemoryError while servingActivation spike from a large batchLower --max-num-batched-tokens

References: vLLM v0.34.0 source: v1/core/kv_cache_planning.py · vLLM v0.34.0 source: v1/worker/utils.py

How vLLM divides GPU memory

GPU memory goes to four things: model weights, activations for the current batch, CUDA graphs, and the KV cache. Weights are fixed: parameters times bytes per parameter. Qwen3-8B has about 8.19 billion parameters stored in bfloat16, so its weights take about 16.4 GB. Whatever remains after weights, activations and graphs becomes KV cache.

The KV cache grows with context. Per token it holds 2 × layers × KV heads × head dimension × bytes. Qwen3-8B’s config lists 36 layers, 8 KV heads and a head dimension of 128, which gives 147,456 bytes per token in bfloat16, about 4.5 GiB for one 32,768-token sequence. On a 24 GB card that leaves room for very few long requests. The LLM VRAM requirements guide walks through more models.

At start-up vLLM logs the result as "GPU KV cache size: N tokens, Maximum concurrency for M tokens per request: X". Read that line on every deploy: it is the capacity you actually got.

References: Qwen3-8B config.json on Hugging Face · Qwen3-8B model card on Hugging Face · vLLM v0.34.0 source: v1/core/kv_cache_utils.py

gpu-memory-utilization works differently now

Older guides tell you to raise --gpu-memory-utilization to 0.95. Check your version first. In current vLLM on CUDA and ROCm, the extensible KV cache is the default: vLLM sizes the cache from memory actually free after CUDA graph capture and warm-up, and gpu_memory_utilization defaults to 1.0. The docs say to leave it unset unless you need headroom, because any value below 1.0 takes memory away from the KV cache.

Set it below 1.0 only for memory vLLM cannot measure: another process on the same GPU, unified-memory devices, weight updates in reinforcement learning, or KV connectors with their own buffers. Where the extensible cache is not used, the default is 0.92 and the value is the fraction of device memory vLLM takes.

kv_cache_memory_bytes sets the cache size directly and, per the config reference, ignores gpu_memory_utilization when set. Use it when you need the same capacity on every replica.

References: vLLM optimization and tuning · vLLM v0.34.0 source: config/cache.py

Fixes for vLLM out of memory, in order

Cap the context. --max-model-len defaults to the model’s configured maximum, which may be far longer than your traffic needs. Set it to your real longest request, or to the estimate in the error. The config reference also accepts -1 or auto, which picks the largest length that fits.

Cap concurrency. --max-num-seqs limits sequences per batch and --max-num-batched-tokens limits tokens per scheduler step; lowering them reduces cache demand and activation peaks. The conserving-memory guide lists max_model_len and max_num_seqs together as the way to cut context and batch memory.

Shrink what you store. A quantized checkpoint cuts weights, as LLM quantization for inference explains, and --kv-cache-dtype fp8 halves the cache compared with 16-bit. Reduce CUDA graph memory with smaller cudagraph_capture_sizes or turn graphs off with --enforce-eager, at a speed cost. For multimodal models, limit_mm_per_prompt reserves less memory for images and video you do not accept.

Spread the model. --tensor-parallel-size splits weights across GPUs, leaving each with more room for cache. See vLLM tensor parallelism.

References: vLLM v0.34.0 source: config/model.py · vLLM conserving memory · vLLM quantized KV cache

Out of cache under load: preemption

A server that starts fine can still run short when many long requests arrive. vLLM does not crash; it preempts requests and recomputes them later. The optimization guide shows a warning that a sequence group "is preempted by PreemptionMode.RECOMPUTE mode because there is not enough KV cache space".

Frequent preemption hurts latency. The guide’s advice: leave gpu_memory_utilization unset or raise it, lower max_num_seqs or max_num_batched_tokens, or raise tensor_parallel_size. Watch the preemption count in vLLM’s Prometheus metrics and alert on it.

References: vLLM optimization and tuning

Symptom, check and fix table

Change one flag at a time and restart. Read the KV cache size line after each change.

Symptom, check and fix table
SymptomLikely causeCheckFix
No available memory for the cache blocksWeights fill the GPUWeight size vs GPU memoryQuantize, TP, or bigger GPU
Max seq len needs more KV cacheContext set too longEstimated length in the error--max-model-len or auto
Free memory on startup is less thanAnother process on the GPUnvidia-smi process listStop it, or set a lower cap
Starts, then preemption warningsToo many concurrent long requestsPreemption metricLower --max-num-seqs, add GPUs
OOM during a large prefillActivation spikePrompt lengths at failureLower --max-num-batched-tokens
Low concurrency in the start-up logCache small after weightsKV cache size line--kv-cache-dtype fp8

References: vLLM v0.34.0 source: v1/core/kv_cache_planning.py · vLLM v0.34.0 source: v1/worker/utils.py · vLLM optimization and tuning · vLLM conserving memory

Prevent it before you go live

Set --max-model-len deliberately, from your traffic, not the model card. Load-test with the longest prompts you accept and your target concurrency, using the method in benchmark LLM inference. Record the KV cache size and maximum concurrency from the start-up log for each GPU type you deploy on.

Run one vLLM instance per GPU set unless you have a reason not to. The cache is sized once after warm-up, so a second process that allocates later can push the first into errors.

References: vLLM optimization and tuning

When the answer is more GPU memory

If the weights alone exceed the card, no flag will help. A 70-billion-parameter model in bfloat16 needs about 140 GB for weights, more than an 80 GB H100 and nearly all of a 141 GB H200 before any cache. Estimate first with the VRAM calculator.

If the weights fit but the cache is small, more memory buys concurrency directly. Moving from a 48 GB L40S to an 80 GB H100, or to a 141 GB H200, adds tens of gigabytes of KV cache for the same model.

References: NVIDIA H100 specifications · NVIDIA L40S specifications · NVIDIA H200 specifications

Checklist and next step

Read which error you got. Check nvidia-smi for other processes. Leave gpu_memory_utilization unset on current vLLM unless you share the GPU. Set --max-model-len to real traffic. Lower --max-num-seqs. Try fp8 KV cache and quantized weights. Add tensor parallelism or a larger GPU when weights dominate.

Once you know the memory you need, NeuraMesh rents GPUs by the hour. Choose the GPU, count, plan, hours and region on rent GPUs and you receive a confirmed quotation before you pay.

NeuraMesh prices for these GPUs

NeuraMesh prices per GPU-hour in USD, excluding taxes, as of 2026-11-27. Live prices are on the rental pages.
GPUMemoryData centerValue
RTX 409024 GB$0.46$0.40
L40S48 GB$1.26$0.54
A10080 GB$1.56$0.98
H10080 GB$2.88$2.00

Every order is confirmed in a quotation before you pay. See all GPU prices.

Questions readers ask

How do I fix vLLM out of memory errors?

Lower --max-model-len to the length your traffic needs, lower --max-num-seqs, use a quantized model or --kv-cache-dtype fp8, and split the model with --tensor-parallel-size. On current vLLM, leave gpu_memory_utilization unset unless another process shares the GPU.

Should I set gpu-memory-utilization to 0.95?

Not on current vLLM with CUDA. The extensible KV cache makes the default 1.0 there, and the docs say a lower value takes memory away from the KV cache. Older versions defaulted to a fraction, so check your version before copying advice.

What does "No available memory for the cache blocks" mean?

After loading weights, profiling activations and capturing CUDA graphs, nothing was left for the KV cache. Quantize the model, reduce graph capture, split it across GPUs, or use a GPU with more memory.

How much KV cache does one request need?

Per token it is 2 × layers × KV heads × head dimension × bytes per value. For Qwen3-8B in bfloat16 that is 147,456 bytes per token, about 4.5 GiB for a 32,768-token sequence.

Does max-num-seqs reduce memory?

It caps how many sequences run in one batch, which lowers peak KV cache demand and per-request buffers. It reduces throughput under heavy load, so set it from measured traffic rather than guessing.

Sources and editorial notes

Primary documentation reviewed November 24, 2026. Provider descriptions reflect published documentation. Recommendations are our analysis; worked figures are illustrative unless explicitly stated otherwise. No independent provider benchmark or uptime ranking is claimed.

Read the editorial policy.

Need this GPU? Rent it from NeuraMesh: choose a GPU and plan, get a confirmed quotation, and pay only when you approve. See pricing.