DeepSeek-R1 is an open-source language model developed on DeepSeek-V3-Base that's been making waves in the AI neighborhood. Not just does it match-or even surpass-OpenAI's o1 design in lots of standards, but it also comes with totally MIT-licensed weights. This marks it as the first non-OpenAI/Google design to provide strong reasoning abilities in an open and available way.
What makes DeepSeek-R1 particularly exciting is its transparency. Unlike the less-open approaches from some industry leaders, DeepSeek has released a detailed training approach in their paper.
The design is also extremely affordable, 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 models required more data and calculate. While that's still valid, models like o1 and R1 demonstrate an option: inference-time scaling through reasoning.
The Essentials
The DeepSeek-R1 paper presented numerous models, however main among them were R1 and R1-Zero. Following these are a series of distilled designs that, while fascinating, I won't talk about here.
DeepSeek-R1 utilizes two significant concepts:
1. A multi-stage pipeline where a small set of cold-start information kickstarts the design, followed by large-scale RL.
2. Group Relative Policy Optimization (GRPO), a reinforcement knowing technique that relies on comparing numerous model outputs per prompt to avoid the need for a different critic.
R1 and R1-Zero are both thinking models. This basically means they do Chain-of-Thought before responding to. For the R1 series of models, this takes kind as thinking within a tag, before responding to 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 design's policy to make the most of benefit.
R1-Zero attains excellent accuracy but in some cases produces complicated outputs, such as mixing several languages in a single action. R1 repairs that by including minimal monitored fine-tuning and multiple RL passes, which enhances both correctness and readability.
It is intriguing how some languages may reveal certain ideas much better, which leads the model to select the most expressive language for the job.
Training Pipeline
The training pipeline that DeepSeek published in the R1 paper is exceptionally interesting. It showcases how they produced such strong thinking models, and what you can get out of each phase. This includes the issues that the resulting designs from each stage have, and how they solved it in the next phase.
It's interesting that their training pipeline varies from the typical:
The usual training technique: Pretraining on large 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 several SFT and RL stages
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 good beginning point. This gives a great model to start RL.
First RL Stage: Apply GRPO with rule-based benefits to improve reasoning correctness and format (such as requiring chain-of-thought into thinking tags). When they were near merging in the RL procedure, they moved to the next action. The outcome of this action is a strong thinking design but with weak general capabilities, e.g., poor formatting and language blending.
Rejection Sampling + general data: Create new SFT information through rejection tasting on the RL checkpoint (from action 2), integrated with supervised data from the DeepSeek-V3-Base design. They gathered around 600k premium thinking samples.
Second Fine-Tuning: Fine-tune DeepSeek-V3-Base again on 800k total samples (600k thinking + 200k general tasks) for broader capabilities. This step led to a strong reasoning design with general abilities.
Second RL Stage: Add more reward signals (helpfulness, harmlessness) to fine-tune the final model, in addition to the thinking benefits. The result is DeepSeek-R1.
They likewise did model distillation for numerous Qwen and Llama designs on the thinking traces to get distilled-R1 models.
Model distillation is a method where you utilize a teacher model to enhance a trainee model by generating training information for the trainee model.
The teacher is usually a bigger design than the trainee.
Group Relative Policy Optimization (GRPO)
The fundamental idea behind utilizing support 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 however also for proper format and language consistency, so the design slowly finds out to favor reactions that fulfill these quality criteria.
In this paper, they motivate the R1 design to produce chain-of-thought reasoning through RL training with GRPO.
Rather than adding a different 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 reliance on straightforward, rule-based reward functions.
Instead of depending on costly external models or human-graded examples as in traditional RLHF, the RL used for R1 uses simple requirements: it may provide a greater reward if the answer is proper, if it follows the anticipated/ formatting, and if the language of the answer matches that of the prompt.
Not counting on a reward model likewise implies you do not need to hang out and effort training it, and it does not take memory and compute away from your main design.
GRPO was introduced in the DeepSeekMath paper. Here's how GRPO works:
1. For each input prompt, the design generates different responses.
2. Each response gets a scalar benefit based on factors like precision, formatting, and language consistency.
3. Rewards are adjusted relative to the group's efficiency, basically measuring just how much better each action is compared to the others.
4. The design updates its strategy somewhat to favor responses with greater relative benefits. It just makes small adjustments-using strategies like clipping and a KL penalty-to make sure the policy does not wander off too far from its initial habits.
A cool aspect of GRPO is its versatility. You can utilize basic rule-based reward functions-for instance, awarding a benefit when the model correctly utilizes the syntax-to guide the training.
While DeepSeek utilized GRPO, you might use alternative techniques instead (PPO or PRIME).
For those aiming to dive deeper, Will Brown has actually written rather a good implementation of training an LLM with RL utilizing GRPO. GRPO has also currently been added to the Transformer Reinforcement Learning (TRL) library, which is another excellent 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 final note on explaining DeepSeek-R1 and bphomesteading.com the approaches they have actually presented 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 improves the model's total efficiency by rendering the output distribution more robust, visualchemy.gallery to put it simply, it appears that the improvement is credited to the proper response from TopK instead of the enhancement of fundamental abilities.
In other words, RL fine-tuning tends to shape the output circulation so that the highest-probability outputs are more likely to be correct, even though the general capability (as measured by the variety 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 actions instead of enhancing the design with totally brand-new capabilities.
Consequently, while RL techniques such as PPO and GRPO can produce considerable performance 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 big milestone. I'm excited to see how it unfolds!
Running DeepSeek-R1
I've utilized DeepSeek-R1 via the main chat user interface for various issues, which it seems to fix all right. The extra search functionality makes it even better to use.
Interestingly, o3-mini(-high) was launched as I was writing this post. From my initial testing, R1 seems more powerful at mathematics than o3-mini.
I likewise leased a single H100 through 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 design would carry out when released on a single H100 GPU-not to thoroughly evaluate the design's capabilities.
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 via llama.cpp:
29 layers appeared to be the sweet area given 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 regional gaming setup.
Digital Spaceport wrote a full guide on how to run Deepseek R1 671b completely 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 rather manageable for any severe work, however it's enjoyable to run these big models on available hardware.
What matters most to me is a combination of usefulness and time-to-usefulness in these models. Since thinking designs need to think before answering, their time-to-usefulness is generally greater than other models, however their effectiveness is likewise usually higher.
We need to both maximize usefulness and decrease time-to-usefulness.
70B through Ollama
70.6 b params, 4-bit KM quantized DeepSeek-R1 running through Ollama:
GPU usage soars 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 completely regional "deep scientist" 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 a novel autoregressive framework that unifies multimodal understanding and generation. It can both understand and generate 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 rivals the efficiency of OpenAI's o1. It provides a detailed method for training such designs using large-scale support learning methods.
DeepSeek-V3 Technical Report (December 2024) This report talks about the implementation of an FP8 blended accuracy training structure validated on a very large-scale design, attaining both sped up training and reduced GPU memory usage.
DeepSeek LLM: Scaling Open-Source Language Models with Longtermism (January 2024) This paper explores scaling laws and provides findings that facilitate the scaling of massive designs in open-source configurations. It introduces the DeepSeek LLM job, devoted 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 introduces the DeepSeek-Coder series, a range of open-source code models trained from scratch on 2 trillion tokens. The designs 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 model defined by affordable training and effective 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 similar to GPT-4 Turbo in code-specific tasks.
Interesting occasions
- Hong Kong University reproduces R1 results (Jan 25, '25).
- Huggingface announces huggingface/open-r 1: Fully open reproduction of DeepSeek-R1 to replicate R1, fully open source (Jan 25, '25).
- OpenAI researcher verifies the DeepSeek group separately discovered and used some core concepts the OpenAI team utilized on the way to o1
Liked this post? Join the newsletter.