Files
hermes-config/skills/mlops/inference/llama-cpp/references/vram-sizing.md
T
2026-07-12 10:17:17 -04:00

64 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# VRAM Budget & Model Sizing Guide
## Formula for Q4_K_M
VRAM ≈ params_in_billions × 0.58 + context_vram (13 GB for 8K32K context)
**Tight fit check:** If a model loads but crashes on the first prompt, it's VRAM-starved. Drop one size tier.
## Model Size Reference
Approximate VRAM at **Q4_K_M** (Ollama default):
| Params | Weight size | Total VRAM | Fits in |
|--------|-------------|-----------|---------|
| 1B3B | 0.61.8 GB | 23 GB | Any GPU |
| 7B8B | 45 GB | 57 GB | 6 GB+, comfortable on 8 GB |
| 12B14B | 79 GB | 912 GB | 11 GB+ |
| 22B24B | 1214 GB | 1417 GB | 16 GB+ |
| 32B35B | 1821 GB | 2024 GB | 24 GB |
| 70B72B | 3842 GB | 4248 GB | 48 GB+ or dual GPU |
## Quant Upsizing
| Quant | Multiplier | 7B model | 14B model | 34B model |
|-------|-----------|----------|-----------|-----------|
| Q2_K | ×0.33 | 2.3 GB | 4.6 GB | 11.2 GB |
| Q3_K_M | ×0.40 | 2.8 GB | 5.6 GB | 13.6 GB |
| Q4_K_M | ×0.58 | 4.1 GB | 8.1 GB | 19.7 GB |
| Q5_K_M | ×0.68 | 4.8 GB | 9.5 GB | 23.1 GB |
| Q6_K | ×0.80 | 5.6 GB | 11.2 GB | 27.2 GB |
| Q8_0 | ×1.00 | 7.0 GB | 14.0 GB | 34.0 GB |
## Known-Good GPU Combos
| GPU | VRAM | Best LLM (Q4_K_M) | Best Vision |
|-----|------|--------------------|-------------|
| RTX 3060 | 12 GB | qwen2.5:14b or mistral-nemo:12b | llava:13b or llava-llama3:8b |
| RTX 2080 Ti | 11 GB | qwen2.5:14b (tight) or mistral-nemo:12b | llava:13b (tight) or llava-llama3:8b |
| RTX 3090 | 24 GB | qwen2.5:32b or llama3:70b (Q3) | llava:34b or llama3.2-vision:11b |
| RTX 4090 | 24 GB | Same as 3090 | Same |
| RTX 4070 | 12 GB | Same as 3060 | Same |
## Ollama GPU Investigation
When the user asks "what's using my GPU":
1. `nvidia-smi` — all GPU processes with PIDs and VRAM usage
2. `ps -p <PID> -o pid,args --no-headers` — which model and port each process runs
3. `curl -s http://localhost:11434/api/ps | python3 -m json.tool` — Ollama model details, quant, expiry
4. `journalctl -u ollama --since "5 min ago" --no-pager` — recent Ollama activity
The `expires_at` field tells when Ollama auto-unloads (default 5 min idle).
## Removing Stale llama.cpp Server
```bash
kill <PID>
rm -rf /path/to/build /path/to/model.gguf
sudo systemctl stop llama-server 2>/dev/null
sudo systemctl disable llama-server 2>/dev/null
sudo rm /etc/systemd/system/llama-server.service
sudo systemctl daemon-reload
```