Can I Run DeepSeek-R1-Distill-Qwen-32B on NVIDIA RTX 4090 (24GB)?
DeepSeek-R1-Distill-Qwen-32B at Q4_K_M (19.88 GB weights) fits inside the RTX 4090's 23.5 GB usable GDDR6X budget at 8K context (22.88 GB total), hitting ~37.6 tok/s with zero CPU spill.
Interactive VRAM & Speed Simulator
Toggle quantization precision and drag context length to inspect real-time GPU residency on RTX 4090 24GB.
Estimated Total VRAM
Est. Decode Speed
Fast Interactive
Weights + Buffer
KV Cache: 2.00 GB (FP16)
CUDA Layer Residency
0.62 GB free headroom
100% resident in CUDA memory — zero CPU spill.
llama-cli -hf bartowski/DeepSeek-R1-Distill-Qwen-32B-GGUF:Q4_K_M -ngl 99 -c 8192 -fa on
Quantization Comparison Table (8K Context)
Static GGUF footprint breakdown across Q4_K_M through FP16 on RTX 4090 24GB.
| Quant | Weights | Total VRAM (8K) | GPU Layers | Est. Speed | Status | Practical Notes |
|---|---|---|---|---|---|---|
| Q4_K_M
Recommended
4.85 bpw | 19.88 GB | 22.88 GB | 64/64 | 37.6 tok/s | Smooth | Fits 100% in CUDA memory (0.6 GB headroom). |
| Q5_K_M 5.7 bpw | 23.37 GB | 26.36 GB | 56/64 | 9.2 tok/s | Partial Offload | Fits 56/64 layers on GPU; remaining layers spill to system RAM over PCIe. |
| Q6_K 6.6 bpw | 27.06 GB | 30.05 GB | 48/64 | 4.7 tok/s | Partial Offload | Fits 48/64 layers on GPU; remaining layers spill to system RAM over PCIe. |
| Q8_0 8.5 bpw | 34.85 GB | 37.84 GB | 37/64 | 2.3 tok/s | Partial Offload | Fits 37/64 layers on GPU; remaining layers spill to system RAM over PCIe. |
| FP16 16 bpw | 65.60 GB | 68.59 GB | 20/64 | OOM | OOM | Requires 68.59 GB vs 23.5 GB usable CUDA memory; too large to run practically. |
One-Click Launch Commands (Ollama & llama.cpp)
Pre-tuned flags for NVIDIA RTX 4090 (24GB) using optimal -ngl 99 and 8K context.
ollama run deepseek-r1:32b
OLLAMA_FLASH_ATTENTION=1 OLLAMA_KV_CACHE_TYPE=q8_0 OLLAMA_NUM_CTX=8192 ollama run deepseek-r1:32b
llama-cli -hf bartowski/DeepSeek-R1-Distill-Qwen-32B-GGUF:Q4_K_M \ -ngl 99 -c 8192 -fa on --cache-type-k q8_0 --cache-type-v q8_0
llama-server -hf bartowski/DeepSeek-R1-Distill-Qwen-32B-GGUF:Q4_K_M \ -ngl 99 -c 8192 -fa on --host 127.0.0.1 --port 8080
Context Window & Memory Bottleneck Analysis
- KV Cache per 4K Tokens (FP16)
- +1.00 GB / 4K
- Max Smooth Context (Q4_K_M)
- 8K
- Hardware Memory Bus
- 1008 GB/s
At Q4_K_M with 8K FP16 context, weights (19.88 GB), KV cache (2.00 GB), and the 0.99 GB CUDA workspace buffer consume 22.88 GB, leaving just 0.62 GB of headroom before hitting 23.5 GB. Because DeepSeek-R1 32B's 64 layers consume 1.00 GB per 4K tokens in FP16 KV cache, pushing context to 16K (4.00 GB KV) immediately overflows 24 GB VRAM unless KV cache quantization is enabled.
Key Bottleneck Signals
- FP16 KV cache grows at 1.00 GB per 4K tokens (2.00 GB at 8K, 4.00 GB at 16K, 8.00 GB at 32K).
- Max Smooth context with default FP16 KV cache is 8,192 tokens; 12K+ spills layers onto system RAM over PCIe.
- Enabling --cache-type-k q8_0 --cache-type-v q8_0 cuts KV cache VRAM in half (~0.50 GB per 4K), stretching Q4_K_M cleanly to 16K–24K.
- DeepSeek-R1 emits verbose <think> chains before answering, so monitor context length on multi-file prompts.
Recommended Optimizations
- Pass -fa on --cache-type-k q8_0 --cache-type-v q8_0 in llama.cpp to unlock 16K+ context inside 24 GB VRAM.
- Close browser hardware acceleration or desktop GPU monitors if free VRAM dips below 23.0 GB on Windows/Linux.
- Stick to Q4_K_M; Q5_K_M (23.37 GB weights alone) overflows 24 GB immediately and drops speed below 6 tok/s.
Frequently Asked Questions
Can an RTX 4090 24GB run DeepSeek-R1 32B without spilling to system RAM? +
Yes, in Q4_K_M quantization (19.88 GB weights). At 8K context with FP16 KV cache, total VRAM usage is 22.88 GB out of 23.5 GB usable GDDR6X, keeping all 64 transformer layers on GPU at ~37.6 tok/s.
What happens if I try Q5_K_M or Q6_K of DeepSeek-R1 32B on the RTX 4090? +
Q5_K_M weights alone require 23.37 GB (26.36 GB total at 8K), forcing ~10 layers onto system RAM over PCIe and cutting throughput down to ~5–6 tok/s.
How can I reach 16K+ context on RTX 4090 for long DeepSeek-R1 thinking blocks? +
Set OLLAMA_FLASH_ATTENTION=1 and OLLAMA_KV_CACHE_TYPE=q8_0 (or -fa on --cache-type-k q8_0 --cache-type-v q8_0 in llama.cpp). Cutting KV memory in half keeps 16K context inside 23.5 GB.
Is RTX 4090 faster than an Apple M4 Pro 48GB for DeepSeek-R1 32B? +
Yes for decode speed: the RTX 4090's 1,008 GB/s GDDR6X bus achieves ~37.6 tok/s in Q4_K_M, nearly 4x faster than M4 Pro (273 GB/s, ~9.7 tok/s), though M4 Pro can hold 64K context smoothly.
Compare Related Hardware & Models
Explore alternative GPUs for DeepSeek-R1 32B or other open-weight models benchmarked on RTX 4090 24GB.