Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
I infotopia
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 55
    • Issues 55
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
  • Analytics
    • Analytics
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Create a new issue
  • Jobs
  • Issue Boards
Collapse sidebar
  • Aliza Flinn
  • infotopia
  • Issues
  • #15

Closed
Open
Created Feb 10, 2025 by Aliza Flinn@alizaflinn3888Maintainer

Understanding DeepSeek R1


DeepSeek-R1 is an open-source language model built on DeepSeek-V3-Base that's been making waves in the AI community. Not only does it match-or even surpass-OpenAI's o1 design in lots of criteria, but it likewise comes with fully MIT-licensed weights. This marks it as the first non-OpenAI/Google design to deliver strong thinking abilities in an open and available way.

What makes DeepSeek-R1 particularly amazing is its openness. Unlike the less-open methods from some market leaders, DeepSeek has actually released a detailed training approach in their paper. The model is also extremely affordable, with input tokens costing just $0.14-0.55 per million (vs o1's $15) and output tokens at $2.19 per million (vs o1's $60).

Until ~ GPT-4, the typical knowledge was that better models needed more data and compute. While that's still valid, securityholes.science models like o1 and R1 show an option: inference-time scaling through reasoning.

The Essentials

The DeepSeek-R1 paper presented numerous models, however main amongst them were R1 and R1-Zero. Following these are a series of distilled designs that, while interesting, I will not go over here.

DeepSeek-R1 utilizes two major ideas:

1. A multi-stage pipeline where a little set of cold-start information kickstarts the model, followed by large-scale RL. 2. Group Relative Policy Optimization (GRPO), a support learning approach that counts on comparing numerous model outputs per timely to prevent the requirement for a separate critic.

R1 and R1-Zero are both reasoning designs. This essentially implies they do Chain-of-Thought before addressing. For the R1 series of designs, users.atw.hu this takes kind as thinking within a tag, before answering with a last summary.

R1-Zero vs R1

R1-Zero applies Reinforcement Learning (RL) straight to DeepSeek-V3-Base with no supervised fine-tuning (SFT). RL is utilized to enhance the model's policy to maximize benefit. R1-Zero attains outstanding precision but in some cases produces confusing outputs, such as blending numerous languages in a single action. R1 repairs that by incorporating restricted monitored fine-tuning and multiple RL passes, which enhances both accuracy and readability.

It is intriguing how some languages may express certain concepts better, bytes-the-dust.com which leads the design to choose the most expressive language for the task.

Training Pipeline

The training pipeline that DeepSeek released in the R1 paper is tremendously intriguing. It showcases how they developed such strong reasoning designs, and what you can get out of each phase. This includes the problems that the resulting models from each stage have, and how they solved it in the next stage.

It's interesting that their training pipeline differs from the usual:

The usual training technique: Pretraining on large dataset (train to forecast next word) to get the base model → supervised fine-tuning → choice tuning through RLHF R1-Zero: Pretrained → RL R1: Pretrained → Multistage training pipeline with numerous SFT and RL phases

Cold-Start Fine-Tuning: Fine-tune DeepSeek-V3-Base on a couple of thousand Chain-of-Thought (CoT) samples to guarantee the RL process has a decent beginning point. This gives a great model to start RL. First RL Stage: Apply GRPO with rule-based rewards to enhance thinking accuracy and format (such as requiring chain-of-thought into believing tags). When they were near merging in the RL procedure, they relocated to the next action. The result of this step is a strong thinking design but with weak basic capabilities, e.g., poor formatting and language blending. Rejection Sampling + basic information: Create brand-new SFT information through rejection sampling on the RL checkpoint (from action 2), integrated with monitored information from the DeepSeek-V3-Base model. They gathered around 600k top quality thinking samples. Second Fine-Tuning: Fine-tune DeepSeek-V3-Base again on 800k overall samples (600k thinking + 200k basic jobs) for broader capabilities. This step resulted in a strong thinking design with general abilities. Second RL Stage: Add more reward signals (helpfulness, harmlessness) to refine the last model, in addition to the reasoning rewards. The result is DeepSeek-R1. They also did design distillation for several Qwen and Llama models on the reasoning traces to get distilled-R1 designs.

Model distillation is a strategy where you utilize an instructor design to enhance a trainee design by creating training information for the trainee design. The teacher is usually a larger model than the trainee.

Group Relative Policy Optimization (GRPO)

The standard idea behind using support learning for LLMs is to fine-tune the design's policy so that it naturally produces more accurate and useful answers. They used a reward system that checks not just for accuracy however likewise for appropriate format and language consistency, so the design gradually learns to prefer actions that meet these quality criteria.

In this paper, they motivate the R1 model to create chain-of-thought thinking through RL training with GRPO. Instead of including a separate module at reasoning time, the training procedure itself nudges the model to produce detailed, detailed outputs-making the chain-of-thought an emergent habits of the optimized policy.

What makes their method especially fascinating is its dependence on straightforward, rule-based reward functions. Instead of depending on pricey external designs or human-graded examples as in standard RLHF, the RL used for R1 utilizes simple criteria: it may give a higher reward if the answer is correct, if it follows the anticipated/ format, and if the language of the response matches that of the timely. Not counting on a reward model also suggests you don't need to hang around and effort training it, and it does not take memory and calculate away from your main design.

GRPO was presented in the DeepSeekMath paper. Here's how GRPO works:

1. For each input prompt, the model creates different actions. 2. Each response gets a scalar reward based on aspects like precision, format, and language consistency. 3. Rewards are adjusted relative to the group's efficiency, basically measuring how much better each reaction is compared to the others. 4. The model updates its strategy slightly to prefer reactions with higher relative benefits. It only makes minor adjustments-using strategies like clipping and a KL penalty-to make sure the policy does not stray too far from its initial behavior.

A cool element of GRPO is its flexibility. You can use easy rule-based benefit functions-for instance, granting a bonus when the model correctly uses the syntax-to guide the training.

While DeepSeek utilized GRPO, you might utilize alternative methods instead (PPO or PRIME).

For those aiming to dive much deeper, Will Brown has composed rather a great application of training an LLM with RL utilizing GRPO. GRPO has actually also already been added to the Transformer Reinforcement Learning (TRL) library, which is another great resource. Finally, Yannic Kilcher has an excellent video explaining GRPO by going through the DeepSeekMath paper.

Is RL on LLMs the path to AGI?

As a last note on explaining DeepSeek-R1 and the methodologies they have actually provided in their paper, I wish to highlight a passage from the DeepSeekMath paper, based on a point Yannic Kilcher made in his video.

These findings indicate that RL boosts the model's overall efficiency by rendering the output distribution more robust, to put it simply, it seems that the enhancement is associated to boosting the proper reaction from TopK instead of the enhancement of fundamental capabilities.

Simply put, RL fine-tuning tends to form the output circulation so that the highest-probability outputs are more most likely to be appropriate, although the general ability (as measured by the diversity of correct answers) is mainly present in the pretrained design.

This suggests that support learning on LLMs is more about refining and "shaping" the existing circulation of actions instead of endowing the design with totally brand-new abilities. Consequently, while RL methods such as PPO and GRPO can produce substantial performance gains, there appears to be a fundamental ceiling identified by the underlying design's pretrained understanding.

It is uncertain to me how far RL will take us. Perhaps it will be the stepping stone to the next huge milestone. I'm delighted to see how it unfolds!

Running DeepSeek-R1

I have actually utilized DeepSeek-R1 by means of the main chat interface for numerous issues, which it seems to fix all right. The extra search performance makes it even nicer to utilize.

Interestingly, o3-mini(-high) was launched as I was composing this post. From my initial testing, R1 seems more powerful at math than o3-mini.

I also leased a single H100 by means of Lambda Labs for $2/h (26 CPU cores, 214.7 GB RAM, 1.1 TB SSD) to run some experiments. The main objective was to see how the model would carry out when deployed on a single H100 GPU-not to extensively evaluate the model's abilities.

671B via Llama.cpp

DeepSeek-R1 1.58-bit (UD-IQ1_S) quantized design by Unsloth, with a 4-bit quantized KV-cache and partial GPU offloading (29 layers operating on the GPU), running through llama.cpp:

29 layers seemed to be the sweet area offered this configuration.

Performance:

A r/localllama user explained that they had the ability to get over 2 tok/sec with DeepSeek R1 671B, without using their GPU on their local video gaming setup. Digital Spaceport wrote a full guide on how to run Deepseek R1 671b completely locally on a $2000 EPYC server, on which you can get ~ 4.25 to 3.5 tokens per second.

As you can see, the tokens/s isn't quite bearable for any serious work, but it's fun to run these big models on available hardware.

What matters most to me is a mix of usefulness and time-to-usefulness in these designs. Since reasoning designs require to think before addressing, their time-to-usefulness is typically greater than other models, but their usefulness is likewise usually higher. We need to both make the most of usefulness and minimize time-to-usefulness.

70B by means of Ollama

70.6 b params, 4-bit KM quantized DeepSeek-R1 running via Ollama:

GPU usage shoots up here, as expected when compared to the mainly CPU-powered run of 671B that I showcased above.

Resources

DeepSeek-R1: Incentivizing Reasoning Capability in LLMs by means of Reinforcement Learning [2402.03300] DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models DeepSeek R1 - Notion (Building a completely regional "deep scientist" with DeepSeek-R1 - YouTube). DeepSeek R1's recipe to duplicate o1 and the future of reasoning LMs. The Illustrated DeepSeek-R1 - by Jay Alammar. Explainer: What's R1 & Everything Else? - Tim Kellogg. DeepSeek R1 Explained to your granny - YouTube

DeepSeek

- Try R1 at chat.deepseek.com. GitHub - deepseek-ai/DeepSeek-R 1. deepseek-ai/Janus-Pro -7 B · Hugging Face (January 2025): Janus-Pro is a novel autoregressive framework that merges multimodal understanding and generation. It can both understand and create images. DeepSeek-R1: Incentivizing Reasoning Capability in Large Language Models through Reinforcement Learning (January 2025) This paper presents DeepSeek-R1, an open-source thinking model that equals the efficiency of OpenAI's o1. It provides a detailed approach for training such designs using massive support knowing methods. DeepSeek-V3 Technical Report (December 2024) This report discusses the application of an FP8 blended precision training framework confirmed on a very large-scale model, attaining both sped up training and lowered GPU memory use. DeepSeek LLM: Scaling Open-Source Language Models with Longtermism (January 2024) This paper explores scaling laws and presents findings that facilitate the of large-scale designs in open-source configurations. It presents the DeepSeek LLM project, devoted to advancing open-source language models with a long-lasting viewpoint. DeepSeek-Coder: When the Large Language Model Meets Programming-The Rise of Code Intelligence (January 2024) This research presents the DeepSeek-Coder series, a variety of open-source code designs trained from scratch on 2 trillion tokens. The models are pre-trained on a premium project-level code corpus and utilize a fill-in-the-blank job to boost code generation and infilling. DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model (May 2024) This paper presents DeepSeek-V2, a Mixture-of-Experts (MoE) language design identified by cost-effective training and effective reasoning. DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligence (June 2024) This research presents DeepSeek-Coder-V2, an open-source Mixture-of-Experts (MoE) code language design that attains efficiency comparable to GPT-4 Turbo in code-specific jobs.

Interesting events

- Hong Kong University replicates R1 outcomes (Jan 25, raovatonline.org '25).

  • Huggingface announces huggingface/open-r 1: Fully open reproduction of DeepSeek-R1 to replicate R1, totally open source (Jan 25, '25).
  • OpenAI researcher verifies the DeepSeek team separately discovered and used some core ideas the OpenAI group used en route to o1

    Liked this post? Join the newsletter.
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking