Free | No tracking | Every fact with a source|German and English

Error / Memory

vLLM: The model's max seq len is larger than the maximum number of tokens that can be stored in KV cache / No available memory for the cache blocks (context does not fit in the VRAM)

vLLM won't start because after loading the model there isn't enough graphics memory left for the context cache (KV cache).

The message

ValueError: The model's max seq len (32768) is larger than the maximum number of tokens that can be stored in KV cache (15424). Try increasing `gpu_memory_utilization` or decreasing `max_model_len` when initializing the engine.

Affects: vLLM

Why is this happening?

vLLM reserves a fixed share of the VRAM (--gpu-memory-utilization, default 0.92). Whatever is left after the model weights becomes the KV cache, and at least one request with the full context length must fit there. Without --max-model-len, vLLM uses the maximum context length from the model config, often 32768 tokens or more. If almost nothing is left, for example because another program is using the graphics card, you get "No available memory for the cache blocks" instead.

How to fix it

  1. Limit the context length, for example vllm serve <modell> --max-model-len 8192. With --max-model-len auto, vLLM chooses the largest length that fits in memory.
  2. Give vLLM a little more VRAM: --gpu-memory-utilization 0.95. Write the options with hyphens; --gpu_memory_utilization with underscores is not recognized on the command line.
  3. Close other programs that are using the graphics card (for example Ollama, ComfyUI, or a second vLLM instance). vLLM counts occupied memory at startup. Start multiple instances on one card one after another, each only after the previous one has finished loading.
  4. Use a smaller or quantized model. If you have multiple graphics cards, you can split the model with --tensor-parallel-size 2.
  5. If you start vLLM from Python, set the same values when creating it: LLM(model="<modell>", max_model_len=8192, gpu_memory_utilization=0.95).

Set up from scratch again

If it still doesn’t work after that, a fresh setup step by step often helps:

Terms for this

Similar errors

Sources

Checked on Oct 27, 2026. Didn't help? Ask in the forum and name the graphics card, program, and the full message.