DeepSeekBeginner30 min7 sections

Run DeepSeek-R1 Locally with Ollama

DeepSeek's reasoning model rivals GPT-4 on math and code. Run the distilled 7B/14B/32B variants on consumer hardware in 30 minutes.

MyAIHardware EditorialUpdated May 19, 2026
Run DeepSeek-R1 Locally with Ollama

Before you start

  • Ollama already installed and working (see our Ollama install tutorials)
  • GPU with 8+ GB VRAM (for 7B), 16+ GB (for 14B), or 24+ GB (for 32B)
  • 30 GB free disk for the larger variants

Required hardware

  • NVIDIA RTX 4090 24GB

    Best for 32B variant

    Amazon
  • NVIDIA RTX 4070 12GB optional

    Fine for 7B/14B

    Amazon
Step 01

What DeepSeek-R1 actually is

DeepSeek-R1 is the first open-weights reasoning model that competes with OpenAI o1. Like o1 it does chain-of-thought reasoning explicitly, it 'thinks out loud' inside <think>...</think> tags before answering. On math and code benchmarks the full 671B model matches o1-preview, and the distilled variants (Qwen-7B/14B/32B and Llama-8B/70B fine-tunes) get 60–90% of that quality at a fraction of the size.

For a home user, you almost certainly want a distilled variant. The full 671B model is a 400 GB download that needs eight H100s to serve. The 32B distill fits on a single RTX 4090, runs at ~25 tokens/sec, and solves problems that vanilla Llama 3.1 70B cannot touch.

Note

Ollama tags 'deepseek-r1' refer to the distilled variants. The full 671B is 'deepseek-r1:671b' and is rarely the right choice for local hardware.

Step 02

Step 1: Pick the right distill for your VRAM

The distilled DeepSeek-R1 variants are based on different base models: the 1.5B and 7B are Qwen2.5-Math fine-tunes, the 8B is a Llama 3.1 fine-tune, the 14B/32B are Qwen2.5 fine-tunes, and the 70B is a Llama 3.3 fine-tune. Pick the largest one that fits in your VRAM with about 2 GB of headroom for KV cache. Below that line the model goes to CPU and you lose 90% of your speed.

bash
# 8 GB VRAM
ollama pull deepseek-r1:7b      # ~4.7 GB, base Qwen 2.5 Math

# 12 GB VRAM
ollama pull deepseek-r1:8b      # ~4.9 GB, base Llama 3.1
ollama pull deepseek-r1:14b     # ~9 GB, base Qwen 2.5

# 24 GB VRAM
ollama pull deepseek-r1:32b     # ~20 GB, base Qwen 2.5

# 48 GB+ VRAM (dual 3090/4090)
ollama pull deepseek-r1:70b     # ~43 GB, base Llama 3.3
Step 03

Step 2: Run it and see the reasoning

DeepSeek-R1 is most interesting on prompts where vanilla LLMs hallucinate. Try a math word problem, a coding edge case, or a logic puzzle. You'll see the model dump its raw chain-of-thought between <think> tags before giving the final answer. The thinking is usually 3-10x longer than the answer, that's the model doing its job.

bash
ollama run deepseek-r1:14b

>>> A car traveled 60 km in 50 minutes, then 30 km in 25 minutes. 
... If it then accelerates uniformly and covers another 40 km in 20 minutes, 
... what's the average speed over the entire trip?

# Watch it think out loud, then commit to an answer.
Step 04

Step 3: Hide the thinking output (optional)

For some use cases, like wiring DeepSeek into an app, you want only the final answer, not the thinking. The model surrounds reasoning in <think>...</think> blocks, so strip those in your client code, or set a system prompt that asks it to suppress them. Note that suppressing thinking degrades quality, only do this when the consumer of the output truly cannot handle the chain-of-thought.

python
import re, requests

resp = requests.post("http://localhost:11434/api/generate", json={
    "model": "deepseek-r1:14b",
    "prompt": "What's 23 * 47?",
    "stream": False,
}).json()

text = resp["response"]
# Strip the thinking block
final_answer = re.sub(r"<think>.*?</think>", "", text, flags=re.DOTALL).strip()
print(final_answer)
Step 05

Step 4: Performance expectations

DeepSeek-R1's chain-of-thought is part of the output, which means a typical answer is 3-5x more tokens than a non-reasoning model. So if your hardware does 30 tok/s on Llama 3.1 8B, expect the same hardware to feel like 10 tok/s on DeepSeek-R1 8B because each answer needs 3x more tokens. This is the right tradeoff for hard problems and the wrong tradeoff for chitchat. Switch back to a non-reasoning model for casual use.

Tip

A good default: keep both `deepseek-r1:14b` and `llama3.1:8b` loaded. Route hard problems to R1, route everything else to Llama. Open WebUI lets you pick per-conversation.

Step 06

Step 5: Where DeepSeek-R1 shines (and where it doesn't)

Strong: multi-step math, code with constraints (write me a function that handles X, Y, Z), planning, logic puzzles, debugging, anything where you'd reach for o1 in ChatGPT. Weak: long creative writing (the thinking gets in the way), simple recall tasks (a 14B reasoning model still has a 14B model's knowledge), and translation. Pair it with a generalist model for best results.

Step 07

Optional: serve R1 to Continue or Aider for coding

Both Continue (VS Code) and Aider (CLI) support Ollama out of the box. Point them at your local DeepSeek-R1 install and you have a free, private alternative to GitHub Copilot. The 32B variant on a 4090 is genuinely competitive with paid services for greenfield code, and far better at debugging tricky bugs because of the reasoning step.

json
// In Continue's config.json:
{
  "models": [
    {
      "title": "DeepSeek-R1 32B",
      "provider": "ollama",
      "model": "deepseek-r1:32b",
      "apiBase": "http://localhost:11434"
    }
  ]
}

Tags

#deepseek#reasoning#r1#ollama

Stuck? Share your build?

Hundreds of homelabbers are working through these same tutorials in our community. Drop your config, ask the hard question, or show off what you built.

Join the discussion

Stay Ahead of the AI Curve

Get weekly AI hardware news, benchmark updates, and deals in your inbox. Founding-subscriber list, be one of the first.

&check; No spam&check; Weekly digest&check; Unsubscribe anytime