Q4_K_M quantization such as Qwen 2.5/3.5 3B–4B, Llama 3.2 3B, Microsoft Phi-4-mini, or Qwen2.5-Coder 3B.Searching for the best local LLM for 8GB RAM often leads to frustrating trial and error. Many generic tutorials copy recommendations for 7B or 8B models without mentioning that your operating system, browser, and terminal already reserve gigabytes of memory. Once the model weights and active KV cache fill your remaining RAM, your laptop starts swapping to SSD and generation speed drops to a crawl.

The Real 8 GB RAM Budget (Before Picking Any Model)
Total installed RAM is never equal to free AI memory. On a typical student Windows 11 or Ubuntu desktop laptop:
- Operating system + background services: ~2.0–3.0 GB
- Browser tabs / code editor / PDF reader: ~1.0–1.5 GB
- Safe headroom remaining for LLM weights + KV cache: ~3.5–4.8 GB
Because every generated token also requires KV-cache memory that scales with context length, leaving at least 1 GB of free buffer prevents sudden freezes. Check our complete LLM RAM & VRAM requirements guide for the exact math.
Top Local LLMs for 8 GB RAM Laptops
| Model | Parameters | Approx. Q4 File Size | Best Student / Dev Use Case | Ollama Command |
|---|---|---|---|---|
| Llama 3.2 3B | 3B | ~2.0 GB | Fast everyday chat, summarizing lecture PDFs | ollama run llama3.2:3b |
| Qwen 2.5 3B / 3.5 4B | 3B–4B | ~1.9–2.6 GB | Instruction following, structured logic, multilingual | ollama run qwen2.5:3b |
| Microsoft Phi-4-mini | ~3.8B | ~2.5 GB | Reasoning density on tight memory budgets | ollama run phi4-mini |
| Qwen2.5-Coder 3B | 3B | ~1.9 GB | Debugging Python/C++ errors and quick scripts | ollama run qwen2.5-coder:3b |
| Qwen2.5-Coder 1.5B | 1.5B | ~1.0 GB | Instant VS Code tab autocomplete alongside IDE | ollama run qwen2.5-coder:1.5b |
Which Models Should You Choose by Task?
1. Best All-Around Chat & Study Assistant: Qwen 3B–4B or Llama 3.2 3B
If you want balanced writing quality, clean markdown formatting, and reliable question answering without choking background apps, Llama 3.2 3B and Qwen 2.5 3B stay around 2 GB on disk and leave plenty of breathing room on 8 GB systems.
2. Best Reasoning Per Megabyte: Phi-4-mini
Microsoft’s Phi-mini family is explicitly designed for high reasoning density under constrained parameter counts. When an 8 GB laptop is already running an IDE or browser tabs, Phi-4-mini fits cleanly without forcing system slowdown.
3. Best Coding Companion on 8 GB RAM: Qwen2.5-Coder 1.5B & 3B
If your main goal is programming homework or debugging stack traces offline, pick Qwen2.5-Coder 3B for chat or 1.5B for lightweight autocomplete. Compare more setups in our best local LLMs for coding guide.
Why Large 7B/8B and Q8 Models Fail on 8 GB Laptops
A 7B model compressed to Q4_K_M needs ~4.4 GB strictly for weights—before your prompt context even grows. Attempting Q8_0 pushes that same 7B model past 7.5 GB, guaranteeing disk swap or an out-of-memory error. Stick strictly to Q4_K_M or Q4_0; read our GGUF quantization guide to see the full size breakdown.
5 Optimization Tips for 8 GB Inference
- Install Ollama cleanly using our how to run an LLM locally walkthrough.
- Close Chrome/Edge tabs and Electron apps before starting heavy sessions.
- Limit context length to
2048or4096tokens in a customModelfileso KV cache never balloons—instructions in our Ollama out of memory fix. - Unload idle models between switches with
keep_alive: 0. - If you lack a discrete GPU entirely, read our CPU-only LLM setup tips.
Frequently Asked Questions
Can I run a 7B model on 8 GB RAM at all?
Only under tight conditions—such as a minimal Linux terminal session, Q4_K_M or Q3_K_M quantization, and a small num_ctx of 2048. For smooth daily work alongside a browser or code editor, 3B–4B models are far more practical.
Which tool uses less memory on 8 GB RAM: Ollama or LM Studio?
Ollama runs as a lightweight background CLI daemon with lower graphical memory overhead than Electron-based desktop apps, making it ideal when every megabyte matters.
How do I check if my 8 GB laptop is swapping to SSD?
Open Task Manager on Windows or run htop / free -h on Linux while generating text. If physical RAM reaches 95%+ and generation drops to 1–2 tokens per second, lower your context length or switch to a 1.5B–3B model.