GPU Memory Needed for Local LLMs: A Practical Guide
In this article
To run a local large language model (LLM) comfortably, you need at least 8 GB of GPU memory (VRAM) for a 7B-parameter model with 4-bit quantization, but for 70B models or full precision, you'll need 24 GB or more. The exact amount depends on the model size, quantization level, and context length—here's how to calculate it and what to expect.
Why VRAM Matters for LLMs
LLMs are essentially large matrices of numbers (weights) that get multiplied against your input text. These weights must sit in memory during inference. GPU memory (VRAM) is much faster than system RAM, so fitting the model entirely in VRAM gives the best speed. If the model exceeds VRAM, the system offloads layers to system RAM or disk, which slows generation dramatically—from dozens of tokens per second to a few.
The key metric is memory footprint: the size of the weights plus overhead for activations, KV cache, and CUDA context. For a 7B model with 16-bit weights, that's about 14 GB. With 4-bit quantization, it drops to around 4 GB. But you also need room for the context window (the text you feed in and the model's internal state).
How to Estimate VRAM Requirements
Use this simple formula: VRAM ≈ (parameters × bytes per weight) + (context length × layers × hidden size × 2 bytes). The first part is the weights; the second is the KV cache. For a 7B model in 16-bit (2 bytes per weight), weights are 14 GB. In 4-bit (0.5 bytes), they're 3.5 GB. The KV cache grows with context length—for a 7B model with 4096 context, it's roughly 1-2 GB.
Most people use quantization to shrink weights. Common formats:
- FP16/BF16: 2 bytes per weight, best quality, highest memory.
- INT8: 1 byte per weight, slight quality loss.
- INT4 (e.g., GPTQ, AWQ, GGUF Q4): 0.5 bytes per weight, minimal loss for most tasks.
For a 7B model, that means:
- FP16: ~14 GB VRAM
- INT8: ~7 GB
- INT4: ~4 GB (plus ~2 GB overhead)
Realistic VRAM Budgets by Model Size
Here's a practical guide based on common model families (using GGUF quantization for consumer GPUs):
- 1-3B models (e.g., TinyLlama, Phi-3-mini): 2-4 GB VRAM. Run on almost any GPU from the last 5 years.
- 7-8B models (e.g., Llama 3 8B, Mistral 7B): 6-8 GB VRAM with Q4 quantization. This is the sweet spot for 8 GB cards.
- 13B models: 10-12 GB VRAM with Q4. Needs a 12 GB or 16 GB card.
- 30-34B models: 20-24 GB VRAM with Q4. Requires a 24 GB card like the RTX 3090/4090 or A6000.
- 70B models: 40+ GB VRAM with Q4. Usually requires dual GPUs or a server-grade card.
These numbers assume a context window of 2048-4096 tokens. Larger contexts (e.g., 32K) add several GB.
What Happens If You Don't Have Enough VRAM?
Most LLM software (like Ollama, llama.cpp, or text-generation-webui) will automatically offload layers to CPU RAM. This works but slows generation significantly—you might drop from 30 tokens/sec to 2-5 tokens/sec. If even system RAM is insufficient, the model swaps to disk, which is painfully slow.
You can also use CPU-only inference with no GPU. For a 7B Q4 model, you'll get maybe 1-3 tokens/sec on a modern CPU. That's usable for chat but frustrating for long outputs. GPU acceleration is essential for interactive use.
Choosing the Right GPU for Your Budget
Here's a decision tree based on what you want to run:
- Casual chat with 7B models: Get a GPU with 8 GB VRAM (e.g., RTX 3060, 4060, or older 2070). You'll run Q4 models comfortably.
- Mid-range tasks (13B models, longer context): 12-16 GB VRAM (RTX 4070 Ti, 4080, or used 3080/3090).
- Large models (30B+) or fine-tuning: 24 GB VRAM (RTX 3090/4090, or used A6000).
- 70B models: Consider dual 24 GB GPUs or cloud rental—consumer single cards rarely have enough.
Don't forget: you also need enough system RAM to load the model initially, and a fast SSD for swap if needed.
Common Misconceptions
"I need a top-end GPU to run any LLM." False—even a 4 GB card can run 7B models with aggressive quantization (Q2) or via CPU offloading, just slowly.
"More VRAM always means faster." Not exactly. Once the model fits in VRAM, speed plateaus; a 24 GB card won't be faster than a 16 GB card for a 7B model. The bottleneck becomes compute and memory bandwidth.
"Quantization ruins quality." For most tasks, 4-bit quantization loses less than 1% accuracy. It's fine for chat, coding, and summarization. Only for highly sensitive tasks (e.g., math, nuanced reasoning) might you want 8-bit or FP16.
Practical Steps to Reduce VRAM Usage
- Use GGUF Q4_K_M quantization—best balance of size and quality.
- Set context length to what you actually need (e.g., 2048 instead of 8192).
- Use flash attention if supported (reduces KV cache memory).
- Close other GPU apps (browsers, games) to free VRAM.
- For CPU offloading, set --n-gpu-layers to put as many layers on GPU as fit, leaving the rest on CPU.
Frequently Asked Questions
Can I run a 7B model on 4 GB VRAM?
Yes, but only with 2-bit or 3-bit quantization, or by offloading most layers to CPU. Expect very slow generation (1-3 tokens/sec). For a usable experience, 6 GB is the practical minimum.
Does RAM speed affect LLM performance?
Yes, especially when offloading. If you're using CPU offloading, faster RAM (DDR5 vs DDR4) and dual-channel configuration help. But GPU VRAM is still 10-20x faster than system RAM.
What's the difference between GGUF and GPTQ formats?
GGUF is designed for CPU/GPU hybrid inference (used by llama.cpp and Ollama). GPTQ is GPU-only but faster on NVIDIA cards. Both use 4-bit quantization. For most users, GGUF is simpler and more flexible.
Can I use an AMD or Intel GPU?
Yes, but with caveats. AMD GPUs work with ROCm (Linux) or Vulkan (Windows), but compatibility is spotty. Intel Arc GPUs have some support via SYCL. NVIDIA is the safest choice due to CUDA support.
Is it worth buying a 24 GB GPU just for LLMs?
Only if you plan to run 30B+ models or fine-tune. For 7B-13B models, a 16 GB card is plenty and much cheaper. Consider cloud rental for occasional large-model use.
How much VRAM for fine-tuning?
Fine-tuning requires 2-4x more VRAM than inference. For a 7B model with LoRA, you need at least 12-16 GB. Full fine-tuning needs 24 GB or more. Use quantization and gradient checkpointing to reduce.