Beginner

DeepSeek: Introduction

This course covered DeepSeek's Mixture-of-Experts architecture, its benchmarked performance against leading closed-source models, and practical local deployment.

This course explores DeepSeek, an open-source large language model family that achieves cost-effective, state-of-the-art performance through a Mixture-of-Experts (MoE) architecture. The material is organized into three parts: understanding the MoE architecture and how experts are selected and routed, examining DeepSeek’s benchmark results and reasoning strengths in math, coding, and logic, and finally covering practical local deployment, cost analysis, and optimization.

Table of Contents


Module 1: Understanding DeepSeek’s MoE Architecture

How Traditional Dense LLMs Work

To understand why the Mixture-of-Experts (MoE) architecture is powerful, it helps to first understand how traditional dense large language models work. In a dense model, every single part of the network is active for every piece of information (every token) it processes. This design gives consistent results, but because it uses all of its billions of parameters for every single token, the computational cost is very high, making it an expensive architecture to run.

Conceptually, the flow of a dense model looks like this: input flows into the model, which may have N total parameters, and all N parameters are active for every token. Every single part of the model has to work to process the data and produce an output. While this is powerful, having every component active for every task results in a high computational cost — this is the core tradeoff of dense architectures.

flowchart LR
    A[Input Token] --> B["Dense Model (N total parameters)"]
    B --> C["All N parameters active"]
    C --> D[Output]

    style C fill:#f96,stroke:#333,stroke-width:1px

The Mixture-of-Experts Innovation

Instead of one giant, fully active network, MoE models use multiple specialized expert networks — think of this like a team of specialized consultants. When an input comes in, a router (or gate) acts like a manager, quickly deciding which two to four experts are the best fit for that specific piece of information or token. Only those selected experts are activated.

This means the model achieves the same high quality of output as a massive dense model, but uses only a small fraction of the computing power, because the vast majority of the model sits idle for any given token. This makes MoE models much faster and cheaper to run.

Key definitions:

  • Expert: A specialized neural network trained to handle a specific type of data pattern or knowledge domain. The overall model contains many experts, and each one becomes proficient at processing certain kinds of information, such as scientific terminology, legal syntax, or conversational phrasing. For any given input token, only a small subset of experts is activated, which reduces computational cost.
  • Router: A small, trainable network that acts as a traffic control system, analyzing each input token and deciding which experts are best suited to process it. For every token, the router assigns a probability score to each expert, then selects the top-k experts (typically two to four) with the highest scores to be active for that token — effectively routing the information to the most relevant specialized networks.

This gating mechanism is what allows the model to maintain high performance while using only a fraction of its total computational resources.

flowchart LR
    A[Input Token] --> R{Router / Gate}
    R -->|score + select top-k| E1[Expert 1]
    R -->|score + select top-k| E2[Expert 2]
    R -.->|not selected| E3[Expert 3 idle]
    R -.->|not selected| E4[Expert 4 idle]
    R -.->|not selected| E5["... Expert N idle"]
    E1 --> C[Combine weighted outputs]
    E2 --> C
    C --> O[Output]

How Expert Selection Works

When an input token arrives — for example, the word “algorithm” — the router network analyzes the context and the token itself. It scores all available experts and selects the top-k experts (typically two to four). These selected experts process the token in parallel, and their outputs are then combined using learned weights.

For example, if the token is “algorithm,” the router might activate both a computer science expert and a mathematics expert, combining their knowledge to generate the best response. The combined output then moves to the next layer of the model.

Two major reasons explain why the MoE design is so fast:

  1. Router speed: The router that decides which experts to use is extremely fast — it operates with a delay of less than 1 ms per token. This tiny delay has very little impact on the overall speed of the model.
  2. Parallel expert execution: When the router selects the top experts, they process the token at the exact same time, working side by side. This means there is essentially no extra time or overhead added to the process.

This combination of a very fast router and simultaneous expert processing is what makes MoE models like DeepSeek both powerful and incredibly efficient compared to traditional dense models.

Patterns of Expert Specialization

How does the MoE model decide which two to four experts to activate for a given token? These experts naturally specialize into different patterns during training, and this specialization is what lets the router efficiently pick the right expert for the job. This specialization falls into three common patterns:

  1. Domain experts — Specialize in specific areas of knowledge, much like university departments: programming and computer science, natural sciences, social sciences, and so on. This lets the model deeply understand and recall information within a certain field.
  2. Function experts — Specialize in what the model is asked to do, not what it is about. Some experts are great at reasoning and logic, others at mathematical calculation, and others are dedicated to creative writing or text summarization, translation, or question answering. This division makes the model highly efficient at performing complex tasks, mastering the way information is handled regardless of topic.
  3. Structural experts — Focus on how the response is put together: response initialization (making sure the beginning of the answer is strong), the middle reasoning and elaboration, and the conclusion generation. Other experts in this group focus purely on punctuation and grammar, or code formatting and syntax.

This small division of labor is why MoE models can be so fast and capable — only activating the precise experts needed for the topic, the task, and the structure of the reply.

Important nuances about how this specialization emerges:

  • Experts are not explicitly programmed — they are not given a specific topic to study. Their specialization happens naturally as the model learns during training.
  • Routing is learned, not hard-coded. The router is not given a fixed set of rules; it learns the best way to send tokens to experts over time.
  • Specialization improves over time. As the model trains, experts get better and better at their unique jobs.
  • The experts activated to understand a question may be different from the experts activated to formulate and write the answer.

Worked Example: Solving a Quadratic Equation

To see expert routing in action, consider a real example: a multi-step math problem solving the quadratic equation x² + 5x − 6 = 0.

As the model processes the input, it breaks the sentence into tokens, and for each token the router activates the best set of experts:

  • The word “solve” at the beginning signals that this is a task, so the router activates the reasoning and math experts for the problem setup.
  • The tokens “quadratic” and “equation” enable other experts that recognize the type of problem being asked.
  • The actual mathematical terms, like and the rest of the equation, call the algebra, arithmetic, and notation experts to correctly handle the variables and constants.
  • Finally, the = 0 token triggers the math and solver experts to carry out the actual solution steps.
flowchart TD
    T1["Token: solve"] --> R1{Router}
    R1 --> ER["Reasoning & Math Experts"]

    T2["Tokens: quadratic, equation"] --> R2{Router}
    R2 --> EP["Problem-Type Recognition Experts"]

    T3["Token: x², coefficients"] --> R3{Router}
    R3 --> EA["Algebra, Arithmetic & Notation Experts"]

    T4["Token: = 0"] --> R4{Router}
    R4 --> ES["Math & Solver Experts"]

    ER --> Out[Final Solved Answer]
    EP --> Out
    EA --> Out
    ES --> Out

Accessing DeepSeek Models

Once the power of the MoE architecture is understood, the next step is accessing DeepSeek models in practice. There are several ways to start using this technology:

  • Official DeepSeek API — The recommended way, giving direct, reliable access to the most powerful, up-to-date models.
  • Local deployment options — Tools such as Ollama or LMStudio, which are great for running smaller versions of the models on your own machine.
  • Third-party integrations — Platforms like Hugging Face Transformers, a popular library for using AI models.

The simplest way to use the API is a POST request. The critical parts are specifying the model you want to use (for example, the deepseek-chat model) and including the messages array, which contains your prompt or question:

{
  "model": "deepseek-chat",
  "messages": [
    {
      "role": "user",
      "content": "Explain the Mixture-of-Experts (MoE) architecture simply in one paragraph."
    }
  ],
  "max_tokens": 500,
  "temperature": 0.5
}

To get your own API key:

  1. Log in, then navigate to API keys.
  2. Select Create new API key.
  3. To use the API, top up your account with a minimal value under Top up (a small balance is required to make calls).

Demo: Calling the DeepSeek API from C#

This demo integrates the DeepSeek API directly into an application, asking the DeepSeek model to explain the Mixture-of-Experts architecture itself. The C# code below defines a simple program that calls the deepseek-chat API. It uses the HttpClient class to send an HTTP POST request to the DeepSeek server, passing the API key in the Authorization header for authentication. The request body is a JSON string that asks the deepseek-chat model to explain the Mixture-of-Experts architecture simply, in one paragraph. Finally, the code receives and prints the full JSON response from the model to the console.

using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

public class DeepSeekApiExample
{
    private const string ApiKey = "YOUR_API_KEY_HERE";
    private const string ApiUrl = "https://api.deepseek.com/v1/chat/completions";
    private const string ModelName = "deepseek-chat";

    public static async Task Main(string[] args)
    {
        Console.WriteLine("Asking DeepSeek to explain the MoE architecture...");
        await ExplainMoE();
    }

    public static async Task ExplainMoE()
    {
        using var client = new HttpClient();
        // Set the Authorization header with the API key
        client.DefaultRequestHeaders.Add("Authorization", $"Bearer {ApiKey}");

        // 1. Define the message/prompt
        string prompt = "Explain the Mixture-of-Experts (MoE) architecture simply in one paragraph.";

        // 2. Construct the JSON request body
        string jsonBody = $$"""
        {
          "model": "{{ModelName}}",
          "messages": [
            {
              "role": "user",
              "content": "{{prompt}}"
            }
          ],
          "max_tokens": 500,
          "temperature": 0.5
        }
        """;

        // 3. Send the request
        var content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
        try
        {
            var response = await client.PostAsync(ApiUrl, content);
            response.EnsureSuccessStatusCode(); // Throws an exception on bad status codes (4xx or 5xx)

            // 4. Read and display the response
            string responseBody = await response.Content.ReadAsStringAsync();
            // Note: In a real app, you would parse the JSON response
            // to extract just the generated text from the 'choices' array.
            Console.WriteLine("\n--- DeepSeek Response (Full JSON) ---");
            Console.WriteLine(responseBody);
        }
        catch (HttpRequestException e)
        {
            Console.WriteLine($"\nRequest Error: {e.Message}");
            Console.WriteLine("Make sure your API Key is correct.");
        }
    }
}

To run the app:

dotnet run

Running the program sends the request and prints the full JSON response to the console. The generated explanation of the MoE architecture appears inside the content property of the response’s choices array.

sequenceDiagram
    participant App as C# Console App
    participant API as DeepSeek API
    App->>App: Build JSON request body (model, messages, max_tokens, temperature)
    App->>API: POST /v1/chat/completions (Authorization: Bearer API_KEY)
    API-->>App: 200 OK + JSON response body
    App->>App: Print full JSON response to console

Module 2: DeepSeek-R1 Performance and Benchmarking

This module moves from architecture to results, examining how effective the Mixture-of-Experts design is in real-world scenarios — specifically DeepSeek’s competitive reasoning capabilities. Three key areas are covered:

  1. The DeepSeek-R1 distillation process — a training technique where a larger, more powerful model teaches a smaller, more efficient model how to behave.
  2. Benchmark comparisons — how DeepSeek’s open-source MoE architecture stands up against top closed-source models in the industry.
  3. Real-world reasoning demonstrations — proving DeepSeek is strong not just in tests, but also in practical, complex tasks like advanced math and coding challenges.

The DeepSeek-R1 Distillation Process

Distillation is key to creating a small, fast, and accessible version of the powerful DeepSeek model. The process transfers knowledge from a large model to a smaller one, much like a teacher teaching a student.

  • The base model is DeepSeek-R1, which has 671 billion parameters and excellent reasoning capabilities.
  • Through knowledge distillation, this reasoning ability is transferred to much smaller models, such as R1-Qwen3-8B, with only 8 billion parameters.
  • The student model learns to mimic the reasoning patterns of the larger teacher model.

The result is impressive: the 8-billion-parameter model retains about 95% of the reasoning capability of the teacher while being 80 times faster. This makes it practical for deployment in resource-constrained environments.

flowchart LR
    subgraph Teacher["Teacher Model"]
        T["DeepSeek-R1<br/>671B parameters<br/>Excellent reasoning"]
    end
    subgraph Student["Student Model"]
        S["R1-Qwen3-8B<br/>8B parameters<br/>~95% of reasoning quality<br/>~80x faster inference"]
    end
    T -- "Knowledge Distillation<br/>(mimic reasoning patterns)" --> S

Comparing the teacher and student models directly:

AspectDeepSeek-R1 (Teacher)R1-Qwen3-8B (Student)
Parameters671 billion8 billion
Compute to runHighExtremely low
Inference speedBaseline~80x faster
Reasoning quality retained100% (reference)~95% of teacher’s quality
State-of-the-art in its classYes, achieved SOTA results for its size class

Distillation provides several important benefits:

  • The student model mimics the larger model’s reasoning, meaning you get high quality without the huge size.
  • It runs about 80 times faster, making it ideal for devices or systems with limited resources.
  • It leads to greater accessibility, allowing more people to run powerful AI locally.
  • The R1-Qwen3-8B model achieved state-of-the-art results in its model class, proving that distillation works.

Benchmark Performance Analysis

This section tackles a central question in the AI industry: can an open-source model actually beat the major commercial offerings? For years, the assumption was that state-of-the-art reasoning — solving PhD-level physics problems or debugging complex enterprise code — required a closed model such as OpenAI’s o1. Open-source models were considered good enough for basic tasks, but not leaders. The following benchmark data (from late 2025) compares DeepSeek-R1 directly against OpenAI o1.

General knowledge — MMLU (Massive Multitask Language Understanding), which covers 57 subjects including history, law, and elementary math:

BenchmarkDeepSeek-R1OpenAI o1
MMLU (general knowledge, 57 subjects)90.8%91.8%

The knowledge gap is essentially closed — the open model knows nearly as many facts about the world as the more expensive closed model.

Reasoning benchmarks — facts are easy, but reasoning is hard, and this is where the results become notable:

BenchmarkWhat it measuresDeepSeek-R1OpenAI o1
MATH-500Difficult word problems requiring multi-step logic97.3%96.4%
AIME (American Invitational Mathematics Examination)Math problems designed to challenge top high-school studentsSlight lead for R1

DeepSeek-R1 actually outperforms OpenAI o1 on MATH-500. This suggests that the Mixture-of-Experts architecture isn’t just efficient — it is better at maintaining a focused train of thought. When the model triggers its math expert parameters, it focuses purely on the logic without getting distracted.

Coding — Codeforces Elo rating, a competitive platform where humans race to solve algorithmic problems:

BenchmarkDeepSeek-R1OpenAI o1 / o3
Codeforces Elo~2029 (expert tier, better than ~96% of human programmers)~2061 (slight edge in raw score)

An Elo rating of ~2029 places DeepSeek-R1 in the expert tier — performing better than 96% of human programmers on the platform. It is effectively a senior software engineer that can be run on your own infrastructure. While OpenAI’s o1 and the newer o3 still hold a slight edge in raw score, the functional difference in day-to-day work — debugging a legacy codebase or generating boilerplate — is negligible.

flowchart TB
    subgraph Benchmarks["Benchmark Comparison: DeepSeek-R1 vs OpenAI o1"]
        direction LR
        M1["MMLU<br/>R1: 90.8% | o1: 91.8%"]
        M2["MATH-500<br/>R1: 97.3% | o1: 96.4%"]
        M3["AIME<br/>R1: slight lead"]
        M4["Codeforces Elo<br/>R1: ~2029 | o1/o3: ~2061"]
    end

Pricing and Economics

Benchmarks are only half of the story — the other half is economics, and this is where the comparison becomes decisive rather than merely competitive.

Token typeOpenAI o1DeepSeek-R1Price difference
Input tokens (per 1M)$15.00$0.55~27x cheaper
Input tokens with context caching (per 1M)$15.00$0.15~50x+ cheaper
Output tokens (per 1M)$60.00$2.19~27x cheaper
Output tokens with context caching (per 1M)$60.00$0.14~50x+ cheaper

That is not a 20% discount — it is a 27x difference in price for standard usage, and over 50x cheaper when DeepSeek’s context caching is used (reusing prompts or documents).

If an AI agent needs to reason for a long time, using OpenAI o1 could make a project cost-prohibitive. Using DeepSeek-R1 makes it economically viable to let the model reason longer, iterate more, and double-check its work.

Verdict: DeepSeek-R1 has proven that open-source intelligence is no longer lagging behind — in reasoning and mathematics, it has caught up to the very best. Combining state-of-the-art performance with a 27x cost reduction and the freedom to self-host for total privacy makes DeepSeek-R1 the default choice for high-volume, complex reasoning tasks.

Demo: Multi-Step Reasoning Problem

This demo runs a live logic demonstration: a classic logical puzzle, a ranking problem about a race. This is the kind of task that standard large language models struggle with, because they try to predict the answer word by word — but this problem requires planning, since you cannot know who finishes third without first mapping out the entire race.

Steps:

  1. Log in.
  2. Paste the following problem:

Five people are participating in a race. Alice finishes before John. John finishes before Carol. David finishes after Carol, but before Eve. Who finishes in third place?

In real time, the model breaks down the problem, performs mathematical/logical reasoning, and verifies several possibilities before submitting a final answer — concluding that only Carol can finish third given the conditions.

Repeating the same problem in “DeepThink” mode produces denser, more visible reasoning steps. The model:

  1. Parses the constraints.
  2. Builds a logical ordering.
  3. Generates all valid sequences.
  4. Identifies which people could possibly finish third.

This chain-of-thought visibility is valuable for debugging and understanding the model’s decision-making process.

flowchart TD
    A["Parse constraints:<br/>Alice < John < Carol<br/>Carol < David < Eve"] --> B["Build logical ordering"]
    B --> C["Generate all valid sequences"]
    C --> D["Identify candidates for 3rd place"]
    D --> E["Conclude: Alice, John, Carol, David, Eve"]
    E --> F["Answer: Carol finishes third"]

The final answer explanation: the conditions given form a complete chain — Alice finishes before John, John finishes before Carol, Carol finishes before David, and David finishes before Eve. This produces the exact order Alice, John, Carol, David, Eve, leaving Carol in third place. The response was generated quickly, in around 41 seconds, and can be compared against responses from other closed-source models for the same question.


Module 3: Practical Implementation and Cost Analysis

This module gets hands-on: building a dedicated research assistant on a local machine using DeepSeek, understanding the true cost of ownership for different deployment options, and applying optimization tips for running large models on consumer hardware.

Building a Local Research Assistant with Ollama

To run DeepSeek locally across Windows, Mac, and Linux, this course uses Ollama. The model used is DeepSeek-R1 Distilled 7B — the reasoning version of the model, distilled down to a size that runs fast on most laptops while still possessing excellent logic.

Rather than building just a generic chatbot, the goal is to create a researcher persona by defining a custom Modelfile. A standard model is generic by default; to make the AI more useful, it needs a specific identity. The Modelfile is essentially a blueprint that defines the AI’s personality and lets you configure exactly how it should behave — for example, via a system prompt such as “You are a senior researcher.” This command tells the AI to adopt that persona and answer all questions from that specific viewpoint, making its responses more targeted and helpful.

The Modelfile used in this course:

FROM deepseek-r1:7b

# Set temperature to 0.6 for focused but fluent reasoning
PARAMETER temperature 0.6

# Set the context window size (standard 8k for local)
PARAMETER num_ctx 8192

# System Prompt
SYSTEM """
You are a Senior Research Scientist. Your goal is to analyze
academic text with high scrutiny.
When provided with an abstract or paper segment, you must:
1. Summarize the core methodology.
2. Identify potential logical fallacies or sample size biases.
3. Suggest three follow-up questions for peer review.
Do not act as a conversational chatbot; act as a rigorous analyst.
"""

This customizes the DeepSeek-R1 7B model to act as a specialized senior research scientist. It permanently sets the AI’s behavior to analyze academic text, requiring it to summarize methodologies, identify biases, and suggest peer review questions, while setting technical limits like a temperature of 0.6 for focused responses.

Demo: Setting Up DeepSeek for Research Applications

Steps to set up DeepSeek locally with the custom Modelfile:

  1. Go to ollama.com and download Ollama.
  2. Install the downloaded application.
  3. Open a terminal and pull the distilled reasoning model:
ollama pull deepseek-r1:7b
  1. Create an empty folder, switch to it, and open it in Visual Studio Code.
  2. Create a new file with no extension (named Modelfile by convention) and paste in the Modelfile contents shown above. (The same file is available in the course’s Exercise Files section.)
  3. Save the file, then run the following command to build the custom model — this tells Ollama to build a new model named deepseek-research using the Modelfile located in the current folder:
ollama create deepseek-research -f Modelfile

Running this writes the model manifest.

  1. Run the new custom model:
ollama run deepseek-research
  1. At the prompt, ask a question, for example:
What is MoE in DeepSeek?

While the model reasons, its real-time chain-of-thought is visible. Because the model was configured as a senior research scientist, it first analyzes the query itself and tries to resolve the meaning of “MoE” — initially considering ambiguous options such as “model of error” — but because the prompt also includes the keyword “DeepSeek,” it correctly infers that MoE refers to Mixture of Experts. It then follows its configured process:

  1. Summarize the core methodology.
  2. Identify logical fallacies or sample-size biases.
  3. Suggest follow-up questions for peer review.

The follow-up questions for peer review are grouped into three categories:

  • Were the experiments conducted on diverse datasets to ensure robustness?
  • How were the results validated across different domains or use cases (generalizability)?
  • Was there an evaluation of potential biases in the training data?

The model concludes that, if provided with the exact study or section being analyzed, it can offer a more precise and rigorous critique.

sequenceDiagram
    participant User
    participant Ollama as Ollama (deepseek-research)
    User->>Ollama: ollama create deepseek-research -f Modelfile
    Ollama-->>User: Writes model manifest
    User->>Ollama: ollama run deepseek-research
    User->>Ollama: "What is MoE in DeepSeek?"
    Ollama->>Ollama: Reason about query (resolve MoE ambiguity)
    Ollama->>Ollama: Step 1 - Summarize methodology
    Ollama->>Ollama: Step 2 - Identify biases/fallacies
    Ollama->>Ollama: Step 3 - Suggest peer-review questions
    Ollama-->>User: Structured research-scientist response

Total Cost of Ownership Calculation

Once the model is running locally, the next question is whether it is more practical to access DeepSeek’s capabilities through the API or to operate it on your own hardware.

Provider / ModelInput price (per 1M tokens)Output price (per 1M tokens)
Typical high-end closed models$2.50 – $5.00$2.50 – $5.00
DeepSeek V3 API$0.27$1.10
DeepSeek-R1 (reasoner) API$0.55$2.19

Hosting the model locally eliminates per-token fees, with expenses limited to hardware and electricity. The DeepSeek API already provides significant cost savings compared to premium closed-source services, but if you have a suitable GPU, local hosting can be even more economical, since your main ongoing cost becomes power usage. The trade-off is that managing your own system requires taking on responsibility for maintenance and uptime.

For a scenario processing around 1 million tokens per month:

Deployment optionEstimated monthly cost
DeepSeek API$20.00 – $50.00 / month
Cloud GPU (e.g., RunPod, Lambda)~$0.30 / hour

Guidance:

  • APIs are the better choice for lighter, occasional usage (for example, a chatbot triggered once an hour) — you avoid paying for an idle GPU server.
  • Local or cloud hosting becomes more cost-effective for applications that run continuously throughout the day / around the clock.
  • For most individual developers and small teams, the DeepSeek API still provides the ideal balance of low cost and zero server management overhead.

Best Practices and Optimization Tips

The main limitation when running AI locally is VRAM. Running the full DeepSeek model at FP16 precision requires heavy-duty hardware, so consumer systems rely on quantization to make the model manageable.

  • Quantization compresses model weights. The recommended format, Q4_K_M, shrinks the model by nearly 70% while preserving nearly all of its reasoning ability. In Ollama, this format is often the default, though you can explicitly select tags such as Q4_K_M when additional space savings are needed.
  • Context window management: DeepSeek supports a 128K context window, but performance slows as that window fills. A practical approach is to summarize the conversation history every 10 turns and maintain a rolling window that includes only the most recent messages rather than the full dialogue.
  • Prompt caching: If you are asking similar questions across multiple documents, using prompt/context caching can improve efficiency and speed.
  • Hardware monitoring is essential when running local AI:
PlatformRecommended monitoring tool
Linux / WSLnvtop for a visual overview of GPU activity
WindowsTask Manager → Performance tab → GPU section (check Cuda graph / dedicated GPU memory)
macOS (Apple Silicon)Activity Monitor, or the asitop terminal tool for unified memory usage

If memory usage reaches 100%, the model will either crash or slow down significantly. The solution is to switch to a smaller, more aggressively quantized model.


Summary

This course covered DeepSeek’s Mixture-of-Experts architecture, its benchmarked performance against leading closed-source models, and practical local deployment.

Key principles:

  • Dense models activate all parameters for every token, which is powerful but computationally expensive. MoE models activate only a small subset of specialized experts (typically 2–4) per token, selected by a fast, learned router — delivering comparable quality at a fraction of the compute cost.
  • Experts specialize naturally during training into domain, function, and structural patterns; routing is learned, not hard-coded, and specialization improves over time.
  • Knowledge distillation transfers reasoning ability from a huge teacher model (DeepSeek-R1, 671B parameters) to a much smaller student model (R1-Qwen3-8B, 8B parameters), retaining ~95% of reasoning quality at ~80x the inference speed.
  • On benchmarks (late 2025 data), DeepSeek-R1 is essentially at parity with or ahead of OpenAI o1 on MMLU, MATH-500, AIME, and Codeforces Elo, while costing roughly 27x less per token (and 50x+ less with context caching).
  • DeepSeek models can be accessed via the official API, run locally with Ollama or LMStudio, or used via Hugging Face Transformers.
  • Local deployment via a custom Modelfile lets you define a persistent persona (e.g., a senior research scientist) with tuned parameters like temperature and context window size.
  • Choosing between API and self-hosting is primarily a cost/usage-pattern decision: APIs suit light or occasional workloads; self-hosting or cloud GPUs suit continuous, high-volume workloads.
  • Quantization (e.g., Q4_K_M) and context window management are essential for running large models on consumer hardware within VRAM limits.

Quick-Reference: Benchmark Scores

BenchmarkDeepSeek-R1OpenAI o1 (or o3 where noted)
MMLU90.8%91.8%
MATH-50097.3%96.4%
AIMESlight lead
Codeforces Elo~2029~2061
Input price / 1M tokens$0.55$15.00
Output price / 1M tokens$2.19$60.00

Deployment Checklist

  • Choose an access method: official API, Ollama/LMStudio (local), or Hugging Face Transformers.
  • For API use: create an account at deepseek.com, generate an API key, and top up the account balance.
  • For local use: install Ollama, pull the desired distilled model (e.g., deepseek-r1:7b).
  • Define a Modelfile with a system prompt, temperature, and context window (num_ctx) suited to your use case.
  • Build the custom model with ollama create <name> -f Modelfile and run it with ollama run <name>.
  • Estimate monthly token volume to decide between API billing and self-hosted/cloud GPU hosting.
  • Apply quantization (Q4_K_M) if VRAM is limited, and monitor GPU/unified memory usage during inference.
  • Manage long conversations via periodic summarization and rolling context windows to stay within the 128K context limit efficiently.

Search Terms

deepseek · llm · application · development · artificial · intelligence · generative · ai · analysis · benchmark · cost · deepseek-r1 · performance · research

Interested in this course?

Contact us to book it or get a custom training plan for your team.