Blog

How to run DeepSeek R1 locally

DeepSeek R1 is an open-source LLM for conversational AI, coding, and problem-solving. Here's how to run it locally.


People who want full control over data, security, and performance run LLMs locally.

DeepSeek R1 is an open-source LLM for conversational AI, coding, and problem-solving that recently outperformed OpenAI’s flagship reasoning model, o1, on several benchmarks.

You’re in the right place if you’d like to get this model running locally.

How to run DeepSeek R1 using Ollama

What is Ollama?

Ollama runs AI models on your local machine. It simplifies the complexities of AI model deployment by offering:

  • Pre-packaged model support: It supports many popular AI models, including DeepSeek R1.
  • Cross-platform compatibility: Works on macOS, Windows, and Linux.
  • Simplicity and performance: Minimal fuss, straightforward commands, and efficient resource use.

Why Ollama?

  1. Easy Installation – Quick setup on multiple platforms.
  2. Local Execution – Everything runs on your machine, ensuring full data privacy.
  3. Effortless Model Switching – Pull different AI models as needed.

Download and Install Ollama

Visit Ollama’s website for detailed installation instructions, or install directly via Homebrew on macOS:

brew install ollama

For Windows and Linux, follow the platform-specific steps provided on the Ollama website.

Fetch DeepSeek R1

Next, pull the DeepSeek R1 model onto your machine:

ollama pull deepseek-r1

By default, this downloads the main DeepSeek R1 model (which is large). If you’re interested in a specific distilled variant (e.g., 1.5B, 7B, 14B), just specify its tag, like:

ollama pull deepseek-r1:1.5b

Run Ollama serve

Do this in a separate terminal tab or a new terminal window:

ollama serve

Start using DeepSeek R1

Once installed, you can interact with the model right from your terminal:

ollama run deepseek-r1

Or, to run the 1.5B distilled model:

ollama run deepseek-r1:1.5b

Or, to prompt the model:

ollama run deepseek-r1:1.5b  "What is the latest news on Rust programming language trends?"

Here are a few example prompts to get you started:

Chat

What’s the latest news on Rust programming language trends?

Coding

How do I write a regular expression for email validation?

Math

Simplify this equation: 3x^2 + 5x - 2.

What is DeepSeek R1?

DeepSeek R1 is a state-of-the-art AI model built for developers. It excels at:

  • Conversational AI – Natural, human-like dialogue.
  • Code Assistance – Generating and refining code snippets.
  • Problem-Solving – Tackling math, algorithmic challenges, and beyond.

Why it matters

Running DeepSeek R1 locally keeps your data private, as no information is sent to external servers.

At the same time, you’ll enjoy faster responses and the freedom to integrate this AI model into any workflow without worrying about external dependencies.

For a more in-depth look at the model, its origins and why it’s remarkable, check out our explainer post on DeepSeek R1.

A note on distilled models

DeepSeek’s team has demonstrated that reasoning patterns learned by large models can be distilled into smaller models.

This process fine-tunes a smaller “student” model using outputs (or “reasoning traces”) from the larger “teacher” model, often resulting in better performance than training a small model from scratch.

The DeepSeek-R1-Distill variants are smaller (1.5B, 7B, 8B, etc.) and optimized for developers who:

  • Want lighter compute requirements, so they can run models on less-powerful machines.
  • Prefer faster responses, especially for real-time coding help.
  • Don’t want to sacrifice too much performance or reasoning capability.

Practical usage tips

Command-line automation

Wrap your Ollama commands in shell scripts to automate repetitive tasks. For instance, you could create a script like:

#!/usr/bin/env bash
PROMPT="$*"
ollama run deepseek-r1:7b "$PROMPT"

Now you can fire off requests quickly:

./ask-deepseek.sh "Explain how to write a regex for email validation"

IDE integration and command line tools

Many IDEs allow you to configure external tools or run tasks.

You can set up an action that prompts DeepSeek R1 for code generation or refactoring, and inserts the returned snippet directly into your editor window.

Open source tools like mods provide excellent interfaces to local and cloud-based LLMs.

FAQ

Q: Which version of DeepSeek R1 should I choose?

A: If you have a powerful GPU or CPU and need top-tier performance, use the main DeepSeek R1 model. If you’re on limited hardware or prefer faster generation, pick a distilled variant (e.g., 1.5B, 14B).

Q: Can I run DeepSeek R1 in a Docker container or on a remote server?

A: Yes. As long as Ollama can be installed, you can run DeepSeek R1 in Docker, on cloud VMs, or on-prem servers.

Q: Is it possible to fine-tune DeepSeek R1 further?

A: Yes. Both the main and distilled models are licensed to allow modifications or derivative works. Be sure to check the license specifics for Qwen- and Llama-based variants.

Q: Do these models support commercial use?

A: Yes. DeepSeek R1 series models are MIT-licensed, and the Qwen-distilled variants are under Apache 2.0 from their original base. For Llama-based variants, check the Llama license details. All are relatively permissive, but read the exact wording to confirm your planned use.

In this article

This site uses cookies to improve your experience. Please accept the use of cookies on this site. You can review our cookie policy here and our privacy policy here. If you choose to refuse, functionality of this site will be limited.