DeepSeek-R1 is an open-source language model developed on DeepSeek-V3-Base that's been making waves in the AI neighborhood. Not only does it match-or even surpass-OpenAI's o1 design in numerous benchmarks, however it also features fully MIT-licensed weights. This marks it as the very first non-OpenAI/Google design to provide strong thinking capabilities in an open and available manner.
What makes DeepSeek-R1 particularly exciting is its openness. Unlike the less-open methods from some industry leaders, DeepSeek has actually published a detailed training method in their paper.
The model is likewise remarkably cost-efficient, with input tokens costing simply $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 wisdom was that much better designs required more data and compute. While that's still valid, designs like o1 and R1 show an alternative: inference-time scaling through reasoning.
The Essentials
The DeepSeek-R1 paper provided several models, but main among them were R1 and R1-Zero. Following these are a series of distilled designs that, while fascinating, I will not go over here.
DeepSeek-R1 utilizes two major concepts:
1. A multi-stage pipeline where a little set of cold-start data kickstarts the design, followed by massive RL.
2. Group Relative Policy Optimization (GRPO), a support learning approach that counts on comparing multiple design outputs per timely to avoid the requirement for a separate critic.
R1 and R1-Zero are both reasoning models. This basically indicates they do Chain-of-Thought before responding to. For the R1 series of models, this takes kind as believing within a tag, before addressing with a final summary.
R1-Zero vs R1
R1-Zero applies Reinforcement Learning (RL) straight to DeepSeek-V3-Base with no monitored fine-tuning (SFT). RL is utilized to optimize the model's policy to make the most of benefit.
R1-Zero attains outstanding precision but often produces confusing outputs, such as blending multiple languages in a single action. R1 repairs that by including limited monitored fine-tuning and numerous RL passes, which improves both correctness and readability.
It is fascinating how some languages might reveal certain concepts better, which leads the model to pick the most meaningful language for the job.
Training Pipeline
The training pipeline that DeepSeek released in the R1 paper is tremendously fascinating. It showcases how they developed such strong reasoning designs, and what you can get out of each phase. This includes the issues that the resulting designs from each phase have, and how they resolved it in the next phase.
It's fascinating that their training pipeline varies from the typical:
The typical training strategy: Pretraining on big dataset (train to predict next word) to get the base design → supervised fine-tuning → choice tuning through RLHF
R1-Zero: Pretrained → RL
R1: Pretrained → Multistage training pipeline with multiple 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 procedure has a decent starting point. This gives a good design to start RL.
First RL Stage: Apply GRPO with rule-based benefits to improve reasoning accuracy and formatting (such as forcing chain-of-thought into believing tags). When they were near merging in the RL process, they relocated to the next action. The outcome of this step is a strong reasoning design however with weak general capabilities, e.g., bad format and language mixing.
Rejection Sampling + general information: Create new SFT information through rejection tasting on the RL checkpoint (from action 2), combined with supervised data from the DeepSeek-V3-Base model. They gathered around 600k premium reasoning samples.
Second Fine-Tuning: Fine-tune DeepSeek-V3-Base again on 800k overall samples (600k thinking + 200k basic jobs) for wider capabilities. This action resulted in a strong thinking model with general abilities.
Second RL Stage: Add more benefit signals (helpfulness, harmlessness) to fine-tune the final design, in addition to the thinking benefits. The is DeepSeek-R1.
They likewise did model distillation for several Qwen and Llama models on the thinking traces to get distilled-R1 designs.
Model distillation is a technique where you utilize a teacher model to enhance a trainee model by generating training information for the trainee design.
The teacher is generally a bigger design than the trainee.
Group Relative Policy Optimization (GRPO)
The basic idea behind utilizing support learning for LLMs is to fine-tune the model's policy so that it naturally produces more precise and beneficial responses.
They utilized a benefit system that checks not just for correctness but likewise for correct format and language consistency, yewiki.org so the model slowly finds out to favor actions that fulfill these quality requirements.
In this paper, they motivate the R1 model to generate chain-of-thought reasoning through RL training with GRPO.
Rather than adding a separate module at inference time, the training process itself nudges the model to produce detailed, detailed outputs-making the chain-of-thought an emergent habits of the enhanced policy.
What makes their method particularly intriguing is its dependence on straightforward, rule-based reward functions.
Instead of depending on costly external models or human-graded examples as in conventional RLHF, the RL used for R1 uses simple requirements: it may provide a higher benefit if the response is proper, if it follows the anticipated/ formatting, and if the language of the response matches that of the timely.
Not counting on a reward model also indicates you do not need to invest time and effort training it, and it doesn't take memory and compute away from your main model.
GRPO was introduced in the DeepSeekMath paper. Here's how GRPO works:
1. For each input prompt, the design generates various responses.
2. Each response receives a scalar benefit based upon elements like accuracy, formatting, and language consistency.
3. Rewards are changed relative to the group's performance, essentially measuring how much better each reaction is compared to the others.
4. The model updates its technique somewhat to favor reactions with greater relative benefits. It just makes slight adjustments-using methods like clipping and a KL penalty-to make sure the policy doesn't stray too far from its initial behavior.
A cool aspect of GRPO is its flexibility. You can utilize basic rule-based benefit functions-for circumstances, awarding a reward when the model correctly uses the syntax-to guide the training.
While DeepSeek utilized GRPO, you could utilize alternative techniques rather (PPO or PRIME).
For those aiming to dive deeper, Will Brown has written rather a nice execution of training an LLM with RL utilizing GRPO. GRPO has likewise currently been contributed to the Transformer Reinforcement Learning (TRL) library, which is another good resource.
Finally, Yannic Kilcher has a great video explaining GRPO by going through the DeepSeekMath paper.
Is RL on LLMs the course to AGI?
As a final note on explaining DeepSeek-R1 and the approaches 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 show that RL enhances the design's general performance by rendering the output distribution more robust, simply put, it appears that the enhancement is credited to boosting the right response from TopK rather than the improvement of essential abilities.
In other words, RL fine-tuning tends to form the output circulation so that the highest-probability outputs are most likely to be correct, although the total capability (as measured by the variety of proper answers) is mainly present in the pretrained model.
This recommends that reinforcement knowing on LLMs is more about refining and "shaping" the existing distribution of reactions instead of endowing the model with entirely new capabilities.
Consequently, while RL techniques such as PPO and GRPO can produce substantial performance gains, there appears to be an inherent ceiling identified by the underlying model'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 turning point. I'm delighted to see how it unfolds!
Running DeepSeek-R1
I have actually used DeepSeek-R1 via the main chat user interface for various problems, which it seems to resolve well enough. The extra search functionality makes it even better to utilize.
Interestingly, o3-mini(-high) was launched as I was composing this post. From my initial screening, R1 appears more powerful at mathematics than o3-mini.
I also leased 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 goal was to see how the model would perform when released on a single H100 GPU-not to thoroughly evaluate the design's capabilities.
671B by means of 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 working on the GPU), running through llama.cpp:
29 layers appeared to be the sweet area provided this configuration.
Performance:
A r/localllama user explained that they had the ability to overcome 2 tok/sec with DeepSeek R1 671B, without using their GPU on their local 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, however it's fun to run these large models on available hardware.
What matters most to me is a mix of effectiveness and time-to-usefulness in these models. Since reasoning models need to think before responding to, their time-to-usefulness is generally higher than other designs, however their effectiveness is likewise typically higher.
We require to both maximize usefulness and reduce time-to-usefulness.
70B through Ollama
70.6 b params, 4-bit KM quantized DeepSeek-R1 running through Ollama:
GPU utilization 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 fully regional "deep researcher" with DeepSeek-R1 - YouTube).
DeepSeek R1's dish to replicate o1 and the future of thinking LMs.
The Illustrated DeepSeek-R1 - by Jay Alammar.
Explainer: drapia.org 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 comprehend and produce images.
DeepSeek-R1: Incentivizing Reasoning Capability in Large Language Models via Reinforcement Learning (January 2025) This paper presents DeepSeek-R1, an open-source thinking model that equals the efficiency of OpenAI's o1. It presents a detailed method for training such designs using large-scale support learning techniques.
DeepSeek-V3 Technical Report (December 2024) This report discusses the implementation of an FP8 mixed precision training structure validated on a very large-scale design, attaining both accelerated training and reduced GPU memory use.
DeepSeek LLM: Scaling Open-Source Language Models with Longtermism (January 2024) This paper dives into scaling laws and presents findings that help with the scaling of massive designs in open-source setups. It presents the DeepSeek LLM job, dedicated to advancing open-source language designs with a long-term viewpoint.
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 models trained from scratch on 2 trillion tokens. The designs are pre-trained on a top quality project-level code corpus and utilize a fill-in-the-blank job to enhance code generation and infilling.
DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model (May 2024) This paper provides DeepSeek-V2, a Mixture-of-Experts (MoE) language model defined by cost-effective training and effective inference.
DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligence (June 2024) This research introduces DeepSeek-Coder-V2, an open-source Mixture-of-Experts (MoE) code language model that attains performance comparable to GPT-4 Turbo in code-specific jobs.
Interesting events
- Hong Kong University reproduces R1 outcomes (Jan 25, '25).
- Huggingface reveals huggingface/open-r 1: Fully open recreation of DeepSeek-R1 to duplicate R1, completely open source (Jan 25, '25).
- OpenAI researcher validates the DeepSeek team independently discovered and used some core concepts the OpenAI group used on the method to o1
Liked this post? Join the newsletter.