Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How Much VRAM for Local LLM? A Practical Guide

· 5 min read · Home Tech

In this article
  1. Why VRAM Matters for LLMs
  2. How Model Size and Quantization Affect VRAM
  3. Choosing VRAM Based on Your Use Case
  4. Common Problems and Solutions
  5. Comparing GPU Options
  6. Costs and Alternatives
  7. Safety and Practical Tips
  8. Frequently Asked Questions

For running a local large language model (LLM), you need at least 8 GB of VRAM for a 7B-parameter model with 4-bit quantization, but for comfortable performance with larger models (13B-70B) or higher precision, 16 GB to 24 GB is recommended. The exact amount depends on the model size, quantization, context length, and whether you use CPU offloading.

Why VRAM Matters for LLMs

When you run an LLM locally, the model weights, KV cache, and intermediate activations must fit in GPU memory (VRAM) for fast inference. If the model exceeds VRAM, the system either fails to load or spills over to system RAM, causing a dramatic slowdown because data must shuttle between CPU and GPU over the PCIe bus. For example, a 7B model in FP16 uses about 14 GB of VRAM, but with 4-bit quantization (e.g., GPTQ or GGUF Q4_K_M), it drops to roughly 4 GB, making it runnable on 8 GB cards.

How Model Size and Quantization Affect VRAM

The primary factor is the number of parameters and the precision (bits per weight). Standard sizes:

  • 7B models (e.g., Llama 2 7B, Mistral 7B): ~14 GB in FP16, ~4 GB in 4-bit, ~6 GB in 8-bit.
  • 13B models (e.g., Llama 2 13B): ~26 GB in FP16, ~7 GB in 4-bit, ~13 GB in 8-bit.
  • 70B models (e.g., Llama 2 70B): ~140 GB in FP16, ~35 GB in 4-bit, ~70 GB in 8-bit.

Quantization reduces precision (e.g., 16-bit to 4-bit) and shrinks the model, but may slightly degrade output quality. The KV cache—which stores attention keys and values—also consumes VRAM, roughly 1-2 GB per 2,000 tokens of context for a 7B model, so longer contexts need more memory.

Choosing VRAM Based on Your Use Case

Here’s a practical breakdown by scenario:

  1. Casual experimentation (8 GB): Run 7B models with 4-bit quantization and short contexts. You can also use CPU offloading for larger models, but expect slow speeds (1-2 tokens per second).
  2. Serious local use (16 GB): Run 13B models in 4-bit or 7B in 8-bit, with longer contexts. This is the sweet spot for most hobbyists.
  3. High-end (24 GB or more): Run 30B-70B models in 4-bit, or 13B in FP16. This is typical for professionals who need higher quality outputs.
  4. Enterprise (48 GB+): Run 70B models in 8-bit or full precision, or multiple models simultaneously.

If you plan to fine-tune or train, add 20-30% more VRAM for optimizer states and gradients.

Common Problems and Solutions

Out of memory (OOM) errors are the most common issue. Solutions include:

  • Use a lower quantization (e.g., 4-bit instead of 8-bit).
  • Reduce the context length (e.g., from 4096 to 2048 tokens).
  • Enable CPU offloading (e.g., with llama.cpp's --n-gpu-layers flag) to offload some layers to RAM.
  • Close other GPU applications (browsers, games) that use VRAM.

Another misconception: more VRAM always means faster. While VRAM capacity prevents swapping, speed depends on GPU compute power (TFLOPS) and memory bandwidth. A 24 GB card with low bandwidth (e.g., RTX 4090 vs. a workstation card) can be slower for token generation than a smaller card with higher bandwidth.

Comparing GPU Options

When choosing a GPU for local LLM, consider these factors:

  • Memory capacity: As discussed, 8-24 GB is typical.
  • Memory bandwidth: Higher bandwidth (e.g., GDDR6X vs. GDDR6) speeds up token generation.
  • Compute capability: Newer architectures (e.g., Ada Lovelace, RDNA 3) have better tensor cores for AI.
  • Software support: NVIDIA cards have the best support (CUDA), while AMD and Intel are catching up with ROCm and OpenVINO.

For example, an RTX 3060 12GB can run 13B models in 4-bit, but an RTX 3090 24GB offers more headroom for larger models or higher precision. For budget builds, used RTX 2080 Ti 11GB or RTX 3060 12GB are popular.

Costs and Alternatives

VRAM is a major cost driver. A new 24 GB GPU (e.g., RTX 4090) is expensive, but used options or cloud services can be cheaper. Alternatives to buying a high-VRAM GPU:

  • CPU-only inference: Run smaller models (e.g., 7B) entirely on CPU with 16-32 GB of RAM. Slower, but works.
  • Cloud GPUs: Rent time on services like RunPod or Lambda Labs for occasional heavy tasks.
  • Distillation: Use smaller models (e.g., 3B) that fit in 4-6 GB VRAM and still perform well for specific tasks.

Remember that VRAM is not the only cost—power consumption and cooling also matter. A 450W GPU may require a larger PSU and better case airflow.

Safety and Practical Tips

When upgrading or building a PC for LLM use, follow these safety guidelines:

  • Unplug the PC and ground yourself before opening the case to avoid static damage.
  • Never open a power supply—it contains high-voltage capacitors.
  • Overclocking or undervolting can cause instability and may void warranty; only do it if you understand the risks.
  • Ensure your PSU has enough wattage and the correct PCIe power connectors for the GPU.
  • Install the latest GPU drivers and use software like CUDA or ROCm as needed.

Frequently Asked Questions

Can I run a 7B LLM on 4GB VRAM?

Yes, with heavy quantization (e.g., 4-bit) and a small context window (e.g., 512 tokens), some 7B models can fit in 4GB. However, performance will be slow, and you may need to offload some layers to CPU. For a smoother experience, 8GB is recommended.

Does more VRAM improve output quality?

Not directly. VRAM capacity only determines whether the model fits. Output quality depends on model size, quantization, and training. However, with more VRAM you can use larger models or higher precision, which often improves quality.

What is the minimum VRAM for Llama 3 8B?

Llama 3 8B in 4-bit quantization requires about 5-6 GB of VRAM, plus overhead for context. So 8 GB is the practical minimum. In 8-bit, you'd need around 9-10 GB, so 12 GB or more is safer.

Can I use system RAM as extra VRAM?

Yes, with CPU offloading (e.g., in llama.cpp or oobabooga), you can offload layers to system RAM. But this drastically slows down inference because RAM bandwidth is much lower than VRAM. It's only viable for small models or when speed isn't critical.

Is 16GB VRAM enough for local LLMs?

Yes, 16GB is enough for most hobbyists. It can run 13B models in 4-bit, 7B in 8-bit, and even 30B models with aggressive quantization and CPU offloading. For 70B models, you'd need 24GB or more.

Should I buy a GPU with more VRAM or faster memory?

For LLM inference, both matter. More VRAM lets you run bigger models, while faster memory (bandwidth) speeds up token generation. If you plan to run 13B models, a 16GB card with high bandwidth (e.g., RTX 4080) is better than a 24GB card with lower bandwidth (e.g., RTX 3090) for speed, but the latter can handle larger models.