Running DeepSeek-R1 8B Locally With Ollama
DeepSeek-R1-Distill-Llama-8B brings DeepSeek-R1 chain-of-thought reasoning to an 8B footprint that runs offline on a single 8 GB GPU or 16 GB laptop. With 32 layers, 8 KV heads and a 128K context window, it outputs explicit <think> reasoning traces before answering math, logic and debugging prompts.
Run ollama run deepseek-r1:8b to pull the 4-bit GGUF (~4.9 GB download, ~6.7 GB VRAM at 8K context). Because reasoning models emit longer <think> blocks, set num_ctx to at least 8192 so long derivations do not truncate.
# Pull and launch DeepSeek-R1 8B (~4.9 GB download, ~6.7 GB VRAM at 8K)
ollama run deepseek-r1:8b
# Larger distilled variants if you have 16–24 GB VRAM:
# ollama run deepseek-r1:14b
# ollama run deepseek-r1:32bfrom openai import OpenAI
client = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")
res = client.chat.completions.create(
model="deepseek-r1:8b",
messages=[{"role": "user", "content": "Prove why sqrt(2) is irrational in 4 concise steps."}],
temperature=0.6,
)
print(res.choices[0].message.content)curl http://localhost:11434/api/chat -d '{
"model": "deepseek-r1:8b",
"messages": [{"role": "user", "content": "Debug a race condition in async JS."}],
"options": {"num_ctx": 8192},
"stream": false
}'Memory Needed per Quantization
| Quantization | Weights | Total at 8K | Fits on |
|---|---|---|---|
| FP16 | 16.0 GB | 18.4 GB | Mac Studio 128GB, Mac Studio 64GB, RTX 4090, RTX 5090 |
| Q4_K_M | 4.8 GB | 6.7 GB | Mac mini 24GB, Mac Studio 128GB, Mac Studio 64GB, RTX 4060, RTX 4060 Ti 16GB, RTX 4070, RTX 4090, RTX 5090 |
| Q5_K_M | 5.7 GB | 7.6 GB | Mac mini 24GB, Mac Studio 128GB, Mac Studio 64GB, RTX 4060, RTX 4060 Ti 16GB, RTX 4070, RTX 4090, RTX 5090 |
| Q8_0 | 8.5 GB | 10.5 GB | Mac mini 24GB, Mac Studio 128GB, Mac Studio 64GB, RTX 4060 Ti 16GB, RTX 4070, RTX 4090, RTX 5090 |
MIT License Summary
MIT License permits unrestricted commercial use, modification and distillation (built on Llama 3.1 8B base architecture). Review the official repository license at huggingface.co/deepseek-ai/….