How to Run DeepSeek-R1-Zero Locally: A Complete Setup Guide

TLDR: To run DeepSeek-R1-Zero locally, download the 671B-parameter weights from Hugging Face, install the DeepSeek-V3 inference runtime, and serve the model using vLLM or SGLang with tensor-parallel configuration across multiple GPUs.

DeepSeek-R1-Zero is the first-generation reasoning model released by DeepSeek-AI, demonstrating emergent chain-of-thought capabilities through pure reinforcement learning. While the deepseek-ai/DeepSeek-R1 repository contains model cards and usage documentation, the actual inference implementation resides in the companion DeepSeek-V3 project. This guide provides the exact steps to run DeepSeek-R1-Zero locally using the officially supported inference stack.

Prerequisites for Local Deployment

Hardware Requirements

Running the full DeepSeek-R1-Zero checkpoint requires substantial GPU memory. The model contains 671 billion parameters, necessitating multiple high-memory GPUs configured with tensor parallelism. You will need at least two NVIDIA GPUs with 80GB VRAM each (such as A100 or H100) to run inference efficiently using the configurations shown in this guide.

Software Dependencies

Install the DeepSeek-V3 inference runtime and your preferred serving framework. The DeepSeek-V3 repository provides the necessary PyTorch-based model configuration and loading logic. You will also need either vLLM (version 0.5.0 or later) or SGLang installed in your Python environment to handle the model serving.

Downloading the Model Weights

DeepSeek-AI hosts the official DeepSeek-R1-Zero weights on Hugging Face at deepseek-ai/DeepSeek-R1-Zero. Download the checkpoint using the Hugging Face CLI or allow the inference server to fetch the model automatically on first launch. According to the source documentation, these download links are specified in the repository README at lines 73-74【README.md†L73-L74】.

Setting Up the Inference Runtime

While the DeepSeek-R1 repository contains model documentation, the executable inference code resides in the DeepSeek-V3 repository. Clone the DeepSeek-V3 project and install its requirements to access the model architecture implementation required to load and serve the checkpoint. The README explicitly directs users to the "Running DeepSeek-R1 locally" section of the DeepSeek-V3 documentation for runtime setup instructions【README.md†L74-L78】.

Deploying DeepSeek-R1-Zero with vLLM

vLLM provides optimized serving for large language models with tensor parallelism support. Use the following command to start a DeepSeek-R1-Zero server across two GPUs with a 32,000-token context window:

vllm serve deepseek-ai/DeepSeek-R1-Zero \
  --tensor-parallel-size 2 \
  --max-model-len 32768 \
  --enforce-eager

The --tensor-parallel-size 2 flag distributes the 671B parameters across two GPUs, while --enforce-eager disables CUDA graph optimizations to reduce memory overhead during initial setup. This command structure is documented in the repository's inference examples【README.md†L74-L78】.

Deploying DeepSeek-R1-Zero with SGLang

SGLang offers an alternative high-performance serving option with native support for the DeepSeek model architecture. Launch the server using the following command:

python3 -m sglang.launch_server \
  --model deepseek-ai/DeepSeek-R1-Zero \
  --trust-remote-code \
  --tp 2

The --tp 2 parameter specifies tensor parallelism across two GPUs, matching the vLLM configuration. The --trust-remote-code flag allows SGLang to execute the custom model architecture code from the DeepSeek-V3 repository. This approach is referenced in the README's SGLang examples【README.md†L80-L84】.

Optimizing Inference Parameters

DeepSeek-R1-Zero performs best with specific generation settings recommended for the entire R1 model family. Configure your inference client with these parameters:

  • Temperature: Set to approximately 0.6 (acceptable range 0.5–0.7). Higher temperatures introduce unnecessary randomness that can disrupt the model's chain-of-thought reasoning process【README.md†L90-L91】.
  • System Prompts: Avoid using system prompts entirely. Place all instructions within the user prompt to prevent interference with the model's reasoning capabilities【README.md†L91-L92】.
  • Mathematical Reasoning: When solving math problems, prepend the following instruction to your prompt: "Please reason step-by-step, and put your final answer within (\boxed{...})." This formatting triggers the model's trained behavior for structured mathematical output【README.md†L92-L93】.

Summary

Running DeepSeek-R1-Zero locally requires careful coordination between hardware resources, the DeepSeek-V3 inference runtime, and specialized serving frameworks. The key steps involve:

  • Downloading the 671B-parameter checkpoint from Hugging Face at deepseek-ai/DeepSeek-R1-Zero
  • Installing the DeepSeek-V3 inference runtime to handle model architecture and loading
  • Deploying via vLLM or SGLang with tensor-parallel size 2 (or higher) across multiple high-memory GPUs
  • Configuring generation parameters with temperature 0.6, avoiding system prompts, and using specific formatting for mathematical tasks

Frequently Asked Questions

What hardware is required to run DeepSeek-R1-Zero locally?

DeepSeek-R1-Zero contains 671 billion parameters and requires at least two NVIDIA GPUs with 80GB VRAM each, such as A100 or H100 accelerators. The model uses tensor parallelism to distribute weights across multiple GPUs, making multi-GPU setup mandatory for loading the full checkpoint into memory.

Where is the inference code for DeepSeek-R1-Zero located?

The executable inference code resides in the DeepSeek-V3 repository, not the DeepSeek-R1 repository. The R1 repository contains model cards, documentation, and usage guidelines, while the V3 project provides the PyTorch-based runtime, model architecture implementation, and configuration files necessary to load and serve the checkpoint.

Can I run DeepSeek-R1-Zero on consumer-grade GPUs?

No, the full DeepSeek-R1-Zero checkpoint cannot run on consumer-grade GPUs due to the massive 671B parameter count and associated memory requirements. However, DeepSeek provides distilled versions (such as DeepSeek-R1-Distill-Qwen and DeepSeek-R1-Distill-Llama) ranging from 1.5B to 70B parameters that can run efficiently on standard consumer hardware.

What temperature setting should I use for DeepSeek-R1-Zero?

Set the temperature to approximately 0.6 (with an acceptable range of 0.5–0.7) for optimal reasoning performance. Higher temperatures introduce unnecessary randomness that can disrupt the model's chain-of-thought reasoning process, while lower temperatures may reduce the model's ability to explore alternative solution paths during complex problem solving.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →