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 numerous standards, however it also comes with fully MIT-licensed weights. This marks it as the first non-OpenAI/Google design to deliver strong reasoning abilities in an open and available way.
What makes DeepSeek-R1 especially amazing is its openness. Unlike the less-open techniques from some industry leaders, DeepSeek has actually released a detailed training approach in their paper.
The model is likewise incredibly cost-effective, 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 better designs required more information and compute. While that's still valid, designs like o1 and R1 demonstrate an alternative: inference-time scaling through reasoning.
The Essentials
The DeepSeek-R1 paper provided multiple models, but main among them were R1 and R1-Zero. Following these are a series of distilled designs that, while fascinating, I will not talk about here.
DeepSeek-R1 uses 2 major ideas:
1. A multi-stage pipeline where a little set of cold-start data kickstarts the design, followed by large-scale RL.
2. Group Relative Policy Optimization (GRPO), a support knowing approach that depends on comparing several model outputs per timely to prevent the requirement for a separate critic.
R1 and R1-Zero are both thinking models. This essentially means they do Chain-of-Thought before responding to. For the R1 series of designs, this takes type as thinking within a tag, before answering with a last summary.
R1-Zero vs R1
R1-Zero uses Reinforcement Learning (RL) straight to DeepSeek-V3-Base without any monitored fine-tuning (SFT). RL is used to optimize the model's policy to take full advantage of benefit.
R1-Zero attains exceptional accuracy however sometimes produces complicated outputs, such as mixing multiple languages in a single response. R1 repairs that by including limited supervised fine-tuning and multiple RL passes, which enhances both correctness and readability.
It is fascinating how some languages might reveal certain concepts better, which leads the design to select the most meaningful language for the task.
Training Pipeline
The training pipeline that DeepSeek released in the R1 paper is immensely intriguing. It showcases how they developed such strong thinking designs, and what you can anticipate from each stage. This includes the issues that the resulting models from each stage have, asteroidsathome.net and how they resolved it in the next phase.
It's fascinating that their training pipeline differs from the usual:
The usual training technique: Pretraining on large dataset (train to anticipate 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 stages
Cold-Start Fine-Tuning: Fine-tune DeepSeek-V3-Base on a couple of thousand Chain-of-Thought (CoT) samples to make sure the RL process has a good starting point. This offers a good model to begin RL.
First RL Stage: Apply GRPO with rule-based benefits to improve reasoning correctness and akropolistravel.com format (such as forcing chain-of-thought into believing tags). When they were near convergence in the RL procedure, they transferred to the next action. The outcome of this step is a strong reasoning design but with weak general abilities, e.g., bad format and language mixing.
Rejection Sampling + basic data: Create new SFT data through rejection sampling on the RL checkpoint (from step 2), integrated 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 overall samples (600k thinking + 200k basic jobs) for broader . This action resulted in a strong reasoning model with basic capabilities.
Second RL Stage: Add more reward signals (helpfulness, harmlessness) to improve the last model, in addition to the reasoning benefits. The outcome is DeepSeek-R1.
They also did model distillation for numerous Qwen and Llama models on the reasoning traces to get distilled-R1 models.
Model distillation is a method where you utilize an instructor design to improve a trainee design by producing training data for the trainee model.
The teacher is generally a bigger model than the trainee.
Group Relative Policy Optimization (GRPO)
The fundamental concept behind using support learning for LLMs is to tweak the design's policy so that it naturally produces more accurate and beneficial answers.
They used a reward system that checks not just for accuracy but likewise for appropriate formatting and language consistency, funsilo.date so the design slowly discovers to favor reactions that satisfy these quality criteria.
In this paper, they encourage the R1 model to generate chain-of-thought thinking through RL training with GRPO.
Instead of including a separate module at inference time, the training procedure itself pushes the model to produce detailed, wiki.vst.hs-furtwangen.de detailed outputs-making the chain-of-thought an emergent habits of the optimized policy.
What makes their technique particularly fascinating is its reliance on straightforward, rule-based benefit functions.
Instead of depending on pricey external designs or human-graded examples as in standard RLHF, the RL used for R1 uses easy criteria: it may offer a greater reward if the answer is correct, if it follows the anticipated/ formatting, and if the language of the response matches that of the timely.
Not counting on a benefit model also means you do not need to hang around and effort training it, and it does not take memory and calculate away from your main model.
GRPO was presented in the DeepSeekMath paper. Here's how GRPO works:
1. For each input prompt, the design creates different actions.
2. Each response gets a scalar benefit based upon elements like precision, format, and language consistency.
3. Rewards are changed relative to the group's performance, basically measuring just how much better each response is compared to the others.
4. The design updates its method a little to prefer actions with greater relative benefits. It only makes small adjustments-using strategies like clipping and a KL penalty-to make sure the policy does not stray too far from its original habits.
A cool element of GRPO is its versatility. You can utilize basic rule-based reward functions-for instance, granting a bonus offer when the design properly uses the syntax-to guide the training.
While DeepSeek utilized GRPO, you could use alternative techniques instead (PPO or PRIME).
For those aiming to dive much deeper, bytes-the-dust.com Will Brown has written quite a nice execution of training an LLM with RL using GRPO. GRPO has also already been contributed to the Transformer Reinforcement Learning (TRL) library, which is another great 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 overall performance by rendering the output circulation more robust, to put it simply, it appears that the improvement is credited to enhancing the correct response from TopK instead of the enhancement of basic abilities.
In other words, RL fine-tuning tends to form the output distribution so that the highest-probability outputs are more likely to be proper, even though the general capability (as determined by the diversity of proper responses) is mainly present in the pretrained model.
This recommends that support learning on LLMs is more about refining and "shaping" the existing circulation of responses rather than endowing the design with completely new abilities.
Consequently, while RL techniques such as PPO and GRPO can produce substantial efficiency gains, there appears to be an intrinsic ceiling figured out 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 utilized DeepSeek-R1 by means of the main chat interface for different problems, which it appears to fix all right. The extra search performance makes it even nicer to utilize.
Interestingly, o3-mini(-high) was launched as I was writing this post. From my initial screening, R1 seems stronger at math than o3-mini.
I likewise 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 goal was to see how the model would carry out when released on a single H100 GPU-not to extensively evaluate the design'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 working on the GPU), running via llama.cpp:
29 layers seemed to be the sweet spot provided this configuration.
Performance:
A r/localllama user explained that they had the ability to get over 2 tok/sec with DeepSeek R1 671B, without utilizing their GPU on their regional gaming setup.
Digital Spaceport wrote a full guide on how to run Deepseek R1 671b fully in your area 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 manageable for any serious work, but it's fun to run these big designs on available hardware.
What matters most to me is a combination of usefulness and time-to-usefulness in these models. Since thinking designs require to believe before answering, their time-to-usefulness is usually greater than other models, but their usefulness is also typically higher.
We need to both make the most of usefulness and minimize time-to-usefulness.
70B through Ollama
70.6 b params, 4-bit KM quantized DeepSeek-R1 running via Ollama:
GPU utilization soars 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 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 replicate 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 grandmother - 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 structure that combines multimodal understanding and generation. It can both understand and produce images.
DeepSeek-R1: Incentivizing Reasoning Capability in Large Language Models through Reinforcement Learning (January 2025) This paper presents DeepSeek-R1, an open-source reasoning model that matches the efficiency of OpenAI's o1. It presents a detailed method for training such models using large-scale support learning strategies.
DeepSeek-V3 Technical Report (December 2024) This report talks about the application of an FP8 combined accuracy training framework verified on an extremely massive model, attaining both sped up training and reduced GPU memory usage.
DeepSeek LLM: Scaling Open-Source Language Models with Longtermism (January 2024) This paper digs into scaling laws and provides findings that assist in the scaling of massive models in open-source setups. It introduces the DeepSeek LLM job, devoted 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 introduces the DeepSeek-Coder series, a series 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 use 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 model identified by affordable training and efficient reasoning.
DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligence (June 2024) This research study presents DeepSeek-Coder-V2, an open-source Mixture-of-Experts (MoE) code language design that attains performance comparable 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 reproduce R1, completely open source (Jan 25, '25).
- OpenAI scientist verifies the DeepSeek group separately discovered and used some core ideas the OpenAI team utilized en route to o1
Liked this post? Join the newsletter.
1
Understanding DeepSeek R1
Adele Chick edited this page 1 year ago