Posted on

How to Run DeepSeek-R1 Locally: Step-by-Step Guide

DeepSeek, a revolutionary open-source AI initiative from China, has garnered significant attention with its first-generation reasoning models, DeepSeek-R1. Offering performance comparable to OpenAI’s Model o1, DeepSeek-R1 provides developers with a cost-efficient alternative for AI-driven applications in reasoning, coding, and mathematics. For enthusiasts looking to deploy these models on their local machines, this guide outlines the installation process for Windows, macOS, and Linux systems.


What is DeepSeek-R1?

DeepSeek-R1 is the flagship model of DeepSeek, a Chinese AI startup founded in 2023 by Liang Wenfeng. The company’s commitment to open-source development has empowered developers worldwide to inspect, modify, and improve the technology. With six dense models distilled from DeepSeek-R1 based on Qwen and Llama architectures, the platform achieves high performance at a fraction of the computational and energy requirements traditionally associated with AI systems.

DeepSeek-R1 supports various configurations, including models scaled from 1.5B to 671B parameters, enabling versatility across multiple applications. Its architecture makes it compatible with a broad range of devices, provided sufficient memory and computational resources are available.


Installing Ollama: A Prerequisite for DeepSeek-R1

To run DeepSeek-R1 locally, you will first need to install Ollama, a framework that facilitates deploying AI models on personal machines. Below are step-by-step instructions for each operating system:


Windows Installation

Ollama is available as a native Windows application with support for NVIDIA and AMD Radeon GPUs. Follow these steps to set up Ollama:

  • Ensure your system meets the following requirements:
    • Windows 10 (22H2 or newer, Home or Pro).
    • Updated NVIDIA (452.39 or newer) or AMD Radeon drivers.
    • At least 4GB of disk space for the installation binary, plus additional storage for models (up to hundreds of GB).
  • Download the OllamaSetup.exe installer from https://ollama.com/download/windows .
  • Run the installer and follow on-screen instructions. No administrator privileges are required.
  • Launch Ollama, which runs as a background service, and access the command-line interface via Command Prompt, PowerShell, or your preferred terminal.

macOS Installation

Setting up Ollama on macOS is straightforward:

  • Visit https://ollama.com/download/mac and download the macOS installer.
  • Unzip the downloaded file and drag the Ollama.app folder to your Applications directory.
  • Launch the app to complete the installation process.

Linux Installation

For Linux users, the Ollama installation process involves running a simple command in the terminal:

  • Open your terminal and run the following command:
    curl -fsSL https://ollama.com/install.sh | sh
  • Follow any additional prompts to complete the installation.

Running DeepSeek-R1 on Your Local Machine

Once Ollama is installed, you can proceed to download and run DeepSeek-R1 models. Below are the steps to set up the models based on your computational requirements:


System Requirements for DeepSeek-R1

The DeepSeek-R1 models vary in size, with the larger models requiring more system resources:

  • 1.5B model: 8 GB RAM (minimum).
  • 7B model: 8 GB RAM (minimum).
  • 13B model: 16 GB RAM.
  • 33B model: 32 GB RAM.
  • 671B model: Higher-end systems with significant memory and GPU capacity.

Pulling and Running DeepSeek-R1 Models

To run a specific DeepSeek-R1 model, use the following commands:

  • For the 1.5B model:
    ollama run deepseek-r1:1.5b
  • For the 7B model:
    ollama run deepseek-r1:7b
  • For the 14B model:
    ollama run deepseek-r1:14b
  • For the 32B model:
    ollama run deepseek-r1:32b
  • For the 70B model:
    ollama run deepseek-r1:70b
  • For the 671B model:
    ollama run deepseek-r1:671b

Understanding DeepSeek-R1’s Distilled Models

DeepSeek-R1’s innovation lies not only in its full-scale models but also in its distilled variants. By fine-tuning reasoning patterns from larger models, DeepSeek has created smaller, dense models that deliver exceptional performance on benchmarks:

  • Qwen 1.5B: Optimized for lightweight applications.
  • Qwen 7B: Balances performance and resource efficiency.
  • Llama 8B: Ideal for mid-tier systems.
  • Qwen 14B and 32B: Designed for higher-end use cases.
  • Llama 70B: Competes with top-tier proprietary models.

Licensing and Usage

DeepSeek-R1 models are licensed under the MIT License, allowing for commercial use, modification, and derivative works. Distilled models, such as Qwen and Llama variants, are derived from respective open-source frameworks and finetuned using DeepSeek’s proprietary datasets. This licensing ensures flexibility for developers aiming to integrate these models into diverse applications.


Conclusion

DeepSeek-R1 offers an exciting opportunity for developers to explore cutting-edge AI technology at reduced costs. By following the steps outlined above, you can harness the power of DeepSeek-R1 on your local machine, whether you are a Windows, macOS, or Linux user. With its open-source ethos and scalability, DeepSeek is poised to redefine the future of AI development and deployment.