Understanding DeepSeek R1

Comments · 112 Views

DeepSeek-R1 is an open-source language design constructed on DeepSeek-V3-Base that's been making waves in the AI neighborhood.

DeepSeek-R1 is an open-source language model constructed on DeepSeek-V3-Base that's been making waves in the AI community. Not only does it match-or even surpass-OpenAI's o1 model in many benchmarks, however it also features completely MIT-licensed weights. This marks it as the very first non-OpenAI/Google design to deliver strong thinking abilities in an open and available manner.


What makes DeepSeek-R1 especially exciting is its openness. Unlike the less-open approaches from some industry leaders, DeepSeek has published a detailed training method in their paper.
The model is also incredibly economical, 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 common knowledge was that much better models required more data and calculate. While that's still legitimate, designs like o1 and R1 demonstrate an option: inference-time scaling through reasoning.


The Essentials


The DeepSeek-R1 paper provided several designs, but main among them were R1 and R1-Zero. Following these are a series of distilled designs that, greyhawkonline.com while interesting, I won't talk about here.


DeepSeek-R1 uses two significant ideas:


1. A multi-stage pipeline where a little set of cold-start information kickstarts the design, followed by massive RL.
2. Group Relative Policy Optimization (GRPO), a support learning method that relies on comparing several model outputs per prompt to avoid the need for a different critic.


R1 and R1-Zero are both thinking models. This basically implies they do Chain-of-Thought before addressing. For the R1 series of models, this takes type as thinking within a tag, before responding to with a last summary.


R1-Zero vs R1


R1-Zero applies Reinforcement Learning (RL) straight to DeepSeek-V3-Base without any monitored fine-tuning (SFT). RL is utilized to optimize the model's policy to make the most of reward.
R1-Zero attains outstanding accuracy but in some cases produces confusing outputs, such as blending multiple languages in a single response. R1 repairs that by incorporating limited monitored fine-tuning and numerous RL passes, which enhances both correctness and readability.


It is interesting how some languages may reveal certain ideas better, which leads the design to pick the most meaningful language for the job.


Training Pipeline


The training pipeline that DeepSeek released in the R1 paper is profoundly interesting. It showcases how they developed such strong thinking models, and what you can expect from each stage. This consists of the problems that the resulting models from each stage have, and how they resolved it in the next phase.


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


The usual training strategy: wiki.snooze-hotelsoftware.de Pretraining on big dataset (train to predict next word) to get the base modelmonitored fine-tuning → choice tuning through RLHF
R1-Zero: Pretrained → RL
R1: PretrainedMultistage training pipeline with several SFT and RL stages


Cold-Start Fine-Tuning: Fine-tune DeepSeek-V3-Base on a few thousand Chain-of-Thought (CoT) samples to guarantee the RL procedure has a good starting point. This offers an excellent model to begin RL.
First RL Stage: Apply GRPO with rule-based rewards to enhance reasoning accuracy and format (such as requiring chain-of-thought into thinking tags). When they were near merging in the RL process, they relocated to the next action. The outcome of this action is a strong reasoning model however with weak basic capabilities, e.g., poor formatting and language blending.
Rejection Sampling + basic information: Create brand-new SFT data through rejection sampling on the RL checkpoint (from action 2), combined with supervised data from the DeepSeek-V3-Base model. They collected around 600k top quality reasoning samples.
Second Fine-Tuning: Fine-tune DeepSeek-V3-Base again on 800k total samples (600k thinking + 200k general tasks) for broader capabilities. This action resulted in a strong thinking design with general abilities.
Second RL Stage: Add more reward signals (helpfulness, harmlessness) to refine the last design, annunciogratis.net in addition to the reasoning rewards. The result is DeepSeek-R1.
They also did design distillation for a number of Qwen and Llama designs on the thinking traces to get distilled-R1 designs.


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


Group Relative Policy Optimization (GRPO)


The basic idea behind utilizing reinforcement learning for LLMs is to fine-tune the design's policy so that it naturally produces more precise and useful responses.
They used a reward system that inspects not just for accuracy but likewise for correct formatting and language consistency, so the model slowly learns to prefer responses that meet these quality criteria.


In this paper, they encourage the R1 model to generate chain-of-thought thinking through RL training with GRPO.
Rather than adding a separate module at reasoning time, the training procedure itself pushes the design to produce detailed, detailed outputs-making the chain-of-thought an emerging behavior of the enhanced policy.


What makes their technique especially interesting is its reliance on straightforward, rule-based benefit functions.
Instead of depending on pricey external designs or human-graded examples as in conventional RLHF, the RL utilized for R1 utilizes easy requirements: it may give a greater reward if the answer is appropriate, if it follows the expected/ format, and if the language of the answer matches that of the timely.
Not relying on a benefit model likewise suggests you do not need to spend time and effort training it, and it doesn't take memory and compute away from your main design.


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


1. For each input timely, the model produces different actions.
2. Each action receives a scalar benefit based upon factors like precision, formatting, championsleage.review and language consistency.
3. Rewards are changed relative to the group's efficiency, essentially measuring how much better each response is compared to the others.
4. The model updates its method a little to favor users.atw.hu responses with greater relative advantages. It just makes small adjustments-using methods like clipping and a KL penalty-to ensure the policy does not wander off too far from its initial habits.


A cool element of GRPO is its versatility. You can use easy rule-based reward functions-for instance, granting a bonus offer when the design properly uses the syntax-to guide the training.


While DeepSeek used GRPO, you could utilize alternative methods rather (PPO or PRIME).


For those aiming to dive much deeper, Will Brown has written quite a good implementation of training an LLM with RL using GRPO. GRPO has actually likewise already been contributed to the Transformer Reinforcement Learning (TRL) library, which is another great resource.
Finally, Yannic Kilcher has a fantastic video explaining GRPO by going through the DeepSeekMath paper.


Is RL on LLMs the path to AGI?


As a final note on explaining DeepSeek-R1 and the methods they have actually presented in their paper, I want to highlight a passage from the DeepSeekMath paper, based upon a point Yannic Kilcher made in his video.


These findings show that RL boosts the design's total performance by rendering the output circulation more robust, simply put, it seems that the enhancement is attributed to enhancing the appropriate reaction from TopK rather than the enhancement of essential capabilities.


Simply put, RL fine-tuning tends to shape the output circulation so that the highest-probability outputs are more likely to be right, although the overall capability (as determined by the diversity of correct answers) is mainly present in the pretrained design.


This recommends that reinforcement learning on LLMs is more about refining and "shaping" the existing distribution of actions rather than enhancing the model with completely new capabilities.
Consequently, while RL strategies such as PPO and GRPO can produce considerable performance gains, there seems a fundamental ceiling figured out by the underlying model's pretrained knowledge.


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


Running DeepSeek-R1


I've utilized DeepSeek-R1 via the main chat interface for different issues, which it seems to solve well enough. The extra search performance makes it even better to use.


Interestingly, o3-mini(-high) was released as I was writing this post. From my preliminary screening, R1 appears more powerful at math than o3-mini.


I also rented a single H100 via 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 perform when deployed on a single H100 GPU-not to extensively test the model's capabilities.


671B by means of Llama.cpp


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


29 layers seemed to be the sweet spot given this configuration.


Performance:


A r/localllama user explained that they were able to get over 2 tok/sec with DeepSeek R1 671B, without using their GPU on their local video gaming setup.
Digital Spaceport composed a full guide on how to run Deepseek R1 671b totally 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, however it's fun to run these large models on available hardware.


What matters most to me is a mix of usefulness and time-to-usefulness in these models. Since thinking designs require to believe before answering, their time-to-usefulness is normally greater than other designs, however their effectiveness is also typically greater.
We need to both maximize usefulness and decrease time-to-usefulness.


70B via Ollama


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


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


Resources


DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning
[2402.03300] DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models
DeepSeek R1 - Notion (Building a totally regional "deep researcher" with DeepSeek-R1 - YouTube).
DeepSeek R1's dish to duplicate o1 and the future of thinking 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 an unique autoregressive framework that merges multimodal understanding and generation. It can both understand and produce images.
DeepSeek-R1: Incentivizing Reasoning Capability in Large Language Models via Reinforcement Learning (January 2025) This paper introduces DeepSeek-R1, an open-source reasoning model that rivals the efficiency of OpenAI's o1. It provides a detailed approach for training such models using large-scale reinforcement knowing methods.
DeepSeek-V3 Technical Report (December 2024) This report talks about the execution of an FP8 blended precision training structure confirmed on an incredibly large-scale model, attaining both accelerated training and minimized GPU memory use.
DeepSeek LLM: Scaling Open-Source Language Models with Longtermism (January 2024) This paper looks into scaling laws and presents findings that facilitate the scaling of large-scale models in open-source setups. It presents the DeepSeek LLM project, committed to advancing open-source language models with a long-term perspective.
DeepSeek-Coder: When the Large Language Model Meets Programming-The Rise of Code Intelligence (January 2024) This research study presents the DeepSeek-Coder series, a variety of open-source code designs trained from scratch on 2 trillion tokens. The designs are pre-trained on a top quality project-level code corpus and use a fill-in-the-blank task to enhance 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 defined by economical training and effective reasoning.
DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligence (June 2024) This research study introduces DeepSeek-Coder-V2, an open-source Mixture-of-Experts (MoE) code language design that attains efficiency equivalent to GPT-4 Turbo in code-specific tasks.


Interesting events


- Hong Kong University reproduces R1 outcomes (Jan 25, '25).
- Huggingface reveals huggingface/open-r 1: Fully open reproduction of DeepSeek-R1 to replicate R1, completely open source (Jan 25, '25).
- OpenAI researcher validates the DeepSeek team separately found and used some core concepts the OpenAI team utilized en route to o1


Liked this post? Join the newsletter.

Comments