New Tool Radar

Local AI

Set How Much GPU Memory vLLM May Use with –gpu-memory-utilization

Control vLLM VRAM use with --gpu-memory-utilization: the 0.90 default, when to raise it, and when to lower it.

Schematic with three steps: Start with the default; Raise it when a model barely fits; Lower it when the GPU is shared.

vLLM pre-allocates GPU memory for weights and KV cache when it starts. The –gpu-memory-utilization flag sets the share of VRAM it may reserve, with 0.90 as the default, and tuning it decides whether a model fits or crashes with an out-of-memory error.

What you need

  • vLLM installed on a Linux machine with an NVIDIA GPU
  • A model to serve, and its rough weight size
  • nvidia-smi for checking VRAM use

Step 1: Start with the default

Run vllm serve meta-llama/Llama-3.2-3B-Instruct with no memory flag. The default –gpu-memory-utilization 0.90 reserves 90 percent of VRAM for vLLM, leaving headroom for CUDA context overhead.

Step 2: Raise it when a model barely fits

If the model just misses fitting, add –gpu-memory-utilization 0.95. That reclaims a few percent of VRAM for weights and cache, at the cost of less headroom for other GPU work.

Step 3: Lower it when the GPU is shared

If other processes use the same GPU, add –gpu-memory-utilization 0.80. Also cap the context with –max-model-len, since vLLM pre-allocates KV cache for the full context length even for short requests.

Worked example: fit a 3B model on a shared card

The table below is a synthetic example. The default of 0.90 and the raise and lower values come from the cited vLLM setup guide; the card is illustrative.

Setting Value When to use it
Default 0.90 Single user, dedicated GPU
Tight fit 0.95 Model barely fits
Shared GPU 0.80 Other processes use the card

Expected result (UNTESTED). the server starts without an out-of-memory error and serves requests, with nvidia-smi showing VRAM use near the chosen share. This check was not run live; the flag values come from the cited vLLM setup guide.

Limits

  • The flag is a share of total VRAM, not an absolute size.
  • Raising it too far risks CUDA out-of-memory errors from context overhead.
  • Context length also drives KV cache size; cap it with –max-model-len.
  • Weights should use no more than about 70 percent of GPU memory, leaving the rest for KV cache.

Sources

See all