How to Run DeepSeek R1 Locally with Ollama in 30 Minutes
Why R1 is worth running locally
DeepSeek R1 is a reasoning model. Before it answers, it works through the problem step by step and shows you that thinking trace. That makes it far stronger than a same-size chat model on math, code, and multi-step logic, though it is also slower and more verbose. You trade tokens and patience for answers you can check.
The May 2025 update, R1-0528, sharpened it further. On AIME 2024 it scores 91.4%, up from 79.8% for the original R1 and within a point of OpenAI o3 at 91.6%. It also posts 87.5% on AIME 2025, 81.0% on GPQA Diamond, and 73.3% on LiveCodeBench. Running it locally has three concrete payoffs: your prompts never leave your machine, you pay nothing per token once the download finishes, and the model stays available when the hosted API is down or rate-limited. The weights are MIT-licensed, so commercial use is allowed.
What you are actually downloading
"DeepSeek R1" on Ollama is a family, not one model. The full model is a 671-billion-parameter mixture-of-experts system, with 37 billion parameters active per token. That is the model behind the headline scores, and it needs roughly 404 GB of disk in 4-bit form: server hardware, not a laptop. What most people run instead is a distilled version: smaller dense models trained on reasoning data from the full R1, ranging from 1.5B to 70B parameters. The default ollama run deepseek-r1 now pulls the 8B distill, updated to the R1-0528 weights.
Pick a size that fits your hardware
These are 4-bit (Q4_K_M) downloads, so size and memory need track each other. A rough rule: allow about 0.6 GB per billion parameters, plus room for context.
| Ollama tag | Download | Memory target | Best for |
|---|---|---|---|
deepseek-r1:1.5b | 1.1 GB | 4 GB RAM, no GPU needed | Testing, old laptops |
deepseek-r1:7b | 4.7 GB | 8 GB VRAM or 16 GB RAM | Quick math and logic |
deepseek-r1:8b | 5.2 GB | 8 GB VRAM or 16 GB RAM | Best small all-rounder |
deepseek-r1:14b | 9.0 GB | 12-16 GB VRAM | Stronger reasoning |
deepseek-r1:32b | 20 GB | 24 GB VRAM | Strongest single-GPU option |
deepseek-r1:70b | 43 GB | 48 GB+ VRAM, multi-GPU | Near full-model quality |
deepseek-r1:671b | 404 GB | Server-class, multi-GPU | The real R1 |
If you are unsure where your machine lands, start with the 8B model. It fits an 8 GB GPU and shows the same visible thinking trace as the bigger versions. For a more precise memory estimate, our guide to how much VRAM you need to run an LLM locally walks through the calculation.
Step 1: Install Ollama
Ollama is a single binary that downloads models, runs them, and serves a local API on http://localhost:11434:
# Linux
curl -fsSL https://ollama.com/install.sh | sh
# macOS (Homebrew)
brew install --cask ollama
# Windows: download the installer from ollama.com/download
Check the install with ollama --version. On Linux the installer also starts the service. On macOS and Windows, launch the Ollama app once so the service runs in the background.
Step 2: Pull and run DeepSeek R1
One command downloads the model and opens a chat session:
ollama run deepseek-r1:8b
The first run downloads about 5.2 GB. After that, the same command starts chatting immediately. Try a problem that needs working, not recall:
>>> A train leaves station A at 60 km/h and another leaves station B, 300 km apart, at 90 km/h towards each other. When do they meet?
You will see a <think> block first, the model's reasoning trace, followed by the final answer. That trace is the whole point of R1: you can read how it got there and catch it when it goes wrong. To run a different size, swap the tag, for example ollama run deepseek-r1:14b. Check your downloads with ollama list, and free disk space with ollama rm deepseek-r1:7b.
Step 3: Tune the settings that matter
Two settings change R1's behaviour more than anything else. The first is temperature: DeepSeek recommends 0.6 for R1, since higher values make the reasoning wander and lower values make it rigid. The second is context length. Ollama defaults to a 4K-token context window, and R1's long thinking traces eat into it fast. For hard problems, raise it when you start the model:
ollama run deepseek-r1:8b --num_ctx 8192 --temperature 0.6
To make settings stick, save them in a Modelfile. Our guide to creating a custom Ollama model with a Modelfile covers the format:
FROM deepseek-r1:8b
PARAMETER temperature 0.6
PARAMETER num_ctx 8192
SYSTEM You are a careful reasoning assistant. Show your working, then give the final answer.
ollama create r1-reasoner -f Modelfile
ollama run r1-reasoner
Step 4: Use R1 from scripts and apps
Ollama exposes an OpenAI-compatible API, so any tool that talks to a local endpoint can use R1. A plain curl call looks like this:
curl http://localhost:11434/api/chat -d '{
"model": "deepseek-r1:8b",
"messages": [{"role": "user", "content": "Write a Python function that finds prime numbers up to n."}],
"stream": false
}'
The response JSON carries the thinking trace in the thinking field and the final answer in message.content. Point coding tools at the same endpoint, base URL http://localhost:11434/v1, and R1 becomes a free local reasoning backend for your editor. If you want a chat UI instead of a terminal, our Open WebUI tutorial walks through the setup.
Troubleshooting
It answers, but very slowly. On CPU-only machines the 8B model manages a few tokens per second, and the thinking trace makes every answer long. Drop to the 1.5B model, or move the work to a machine with a GPU. Check whether the model actually loaded onto the GPU with ollama ps.
It forgets the question halfway through. The thinking trace filled the context window. Restart with a larger --num_ctx, or break the problem into smaller steps.
The model unloads between prompts. Ollama unloads idle models after five minutes by default. Add "keep_alive": "30m" to your API call, or start the model with ollama run deepseek-r1:8b --keepalive 30m.
Answers ramble or contradict themselves. That is usually temperature, not the model. Bring it back to 0.6, and keep prompts to one problem at a time. R1 reasons best when the question is specific.
When local R1 is the right call, and when it is not
Local R1 fits three situations: you want reasoning without sending data to a cloud API, you run the same kinds of problems often enough that per-token pricing adds up, or you build agents and tools that need a reasoning model on tap. The 8B and 14B distills cover most of that on hardware people already own. It is the wrong call when you need the full 671B model's quality, answers in under a second, or only ask a handful of questions a week; in that last case the hosted DeepSeek API is cheaper than a GPU you barely use. If you outgrow one machine, the next step is a real inference server: our guide to serving an open model with vLLM covers that path.
Start with ollama run deepseek-r1:8b, give it a problem you would normally paste into a chatbot, and read the thinking trace. That trace is the fastest way to judge whether a local reasoning model earns a place in your workflow.


Comments
Post a Comment