DeepSeek-R1 is an open-source language design constructed on DeepSeek-V3-Base that's been making waves in the AI community. Not just does it match-or even surpass-OpenAI's o1 model in lots of benchmarks, however it also includes totally MIT-licensed weights. This marks it as the very first non-OpenAI/Google design to provide strong reasoning abilities in an open and available manner.
What makes DeepSeek-R1 especially amazing is its openness. Unlike the less-open methods from some industry leaders, DeepSeek has actually published a detailed training methodology in their paper.
The model is also incredibly cost-effective, 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 better models needed more data and calculate. While that's still valid, designs like o1 and R1 show an option: inference-time scaling through reasoning.
The Essentials
The DeepSeek-R1 paper presented numerous models, but main amongst 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 utilizes 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 reinforcement knowing method that depends on comparing multiple model outputs per prompt to prevent the requirement for a separate critic.
R1 and R1-Zero are both reasoning models. This essentially means they do Chain-of-Thought before responding to. For the R1 series of models, this takes type as believing within a tag, before answering with a last summary.
R1-Zero vs R1
R1-Zero uses Reinforcement Learning (RL) straight to DeepSeek-V3-Base with no monitored fine-tuning (SFT). RL is used to enhance the design's policy to make the most of benefit.
R1-Zero attains excellent precision however in some cases produces confusing outputs, such as blending multiple languages in a single response. R1 repairs that by incorporating restricted supervised fine-tuning and several RL passes, which improves both accuracy and readability.
It is fascinating how some languages may reveal certain ideas much better, which leads the design to select the most expressive language for the job.
Training Pipeline
The training pipeline that DeepSeek released in the R1 paper is tremendously interesting. It showcases how they created such strong thinking models, and what you can get out of each stage. This includes the issues that the resulting models from each phase have, and how they fixed it in the next phase.
It's interesting that their training pipeline differs from the typical:
The normal training method: tandme.co.uk Pretraining on large dataset (train to anticipate next word) to get the base design → supervised fine-tuning → preference tuning via 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 few thousand Chain-of-Thought (CoT) samples to guarantee the RL procedure has a good beginning point. This offers a good design 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 believing tags). When they were near merging in the RL procedure, they moved to the next step. The result of this step is a strong reasoning model however with weak basic capabilities, e.g., bad formatting and language mixing.
Rejection Sampling + basic information: Create new SFT information through rejection sampling on the RL checkpoint (from step 2), combined with supervised information from the DeepSeek-V3-Base model. They gathered around 600k premium thinking samples.
Second Fine-Tuning: Fine-tune DeepSeek-V3-Base again on 800k overall samples (600k reasoning + 200k basic tasks) for wider abilities. This action resulted in a strong thinking design with basic abilities.
Second RL Stage: Add more benefit signals (helpfulness, harmlessness) to refine the final design, in addition to the reasoning benefits. The outcome is DeepSeek-R1.
They also did design distillation for numerous Qwen and Llama designs on the thinking traces to get distilled-R1 models.
Model distillation is a technique where you use an instructor model to improve a trainee design by generating training data for the trainee design.
The teacher is usually a larger design than the trainee.
Group Relative Policy Optimization (GRPO)
The standard idea behind using support knowing 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 examines not just for accuracy however likewise for proper formatting and language consistency, so the design gradually learns to favor responses that fulfill these quality criteria.
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 reasoning time, the training process itself pushes the model to produce detailed, detailed outputs-making the chain-of-thought an emergent behavior of the optimized policy.
What makes their approach especially interesting is its reliance on straightforward, rule-based reward functions.
Instead of depending upon pricey external models or human-graded examples as in standard RLHF, the RL utilized for R1 utilizes easy criteria: it might give a greater reward if the answer is proper, if it follows the anticipated/ format, and if the language of the answer matches that of the prompt.
Not counting on a reward design also implies you don't need to invest time and effort training it, and it doesn't take memory and compute far from your main design.
GRPO was introduced in the DeepSeekMath paper. Here's how GRPO works:
1. For fishtanklive.wiki each input timely, the design creates different responses.
2. Each action gets a scalar benefit based upon aspects like accuracy, formatting, and language consistency.
3. Rewards are adjusted relative to the group's efficiency, basically determining just how much better each reaction is compared to the others.
4. The design updates its technique a little to favor responses with higher relative benefits. It just makes minor adjustments-using strategies like clipping and a KL penalty-to guarantee the policy doesn't stray too far from its original behavior.
A cool aspect of GRPO is its flexibility. You can use basic rule-based reward functions-for instance, granting a perk when the design correctly utilizes the syntax-to guide the training.
While DeepSeek used GRPO, you could use alternative techniques rather (PPO or PRIME).
For those aiming to dive much deeper, Will Brown has written rather a good implementation of training an LLM with RL using GRPO. GRPO has actually also currently 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 course to AGI?
As a final note on explaining DeepSeek-R1 and the methodologies 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 performance by rendering the output circulation more robust, simply put, it appears that the improvement is credited to improving the correct response from TopK instead of the enhancement of essential capabilities.
Simply put, RL fine-tuning tends to form the output circulation so that the highest-probability outputs are more likely to be proper, despite the fact that the overall capability (as measured by the variety of appropriate responses) is mainly present in the pretrained model.
This suggests that reinforcement knowing on LLMs is more about refining and "shaping" the existing circulation of responses rather than enhancing the model with entirely brand-new capabilities.
Consequently, while RL methods such as PPO and GRPO can produce considerable efficiency gains, there seems an intrinsic ceiling determined by the underlying design'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 thrilled to see how it unfolds!
Running DeepSeek-R1
I have actually utilized DeepSeek-R1 through the main chat user interface for numerous problems, championsleage.review which it seems to resolve well enough. The extra search functionality makes it even better to utilize.
Interestingly, o3-mini(-high) was released as I was writing this post. From my initial testing, R1 seems more powerful at math than o3-mini.
I also rented 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 abilities.
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 operating on the GPU), running through llama.cpp:
29 layers seemed to be the sweet area 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 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 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 designs. Since thinking designs need to think before responding to, their time-to-usefulness is generally greater than other designs, however their effectiveness is likewise typically higher.
We require to both maximize usefulness and minimize 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 by means of Reinforcement Learning
[2402.03300] DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models
DeepSeek R1 - Notion (Building a totally local "deep scientist" with DeepSeek-R1 - YouTube).
DeepSeek R1's recipe 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 grandma - 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 structure that combines multimodal understanding and generation. It can both comprehend and generate images.
DeepSeek-R1: Incentivizing Reasoning Capability in Large Language Models by means of Reinforcement Learning (January 2025) This paper introduces DeepSeek-R1, an open-source reasoning model that matches the performance of OpenAI's o1. It provides a detailed method for training such models utilizing massive support knowing methods.
DeepSeek-V3 Technical Report (December 2024) This report discusses the implementation of an FP8 mixed precision training structure confirmed on an incredibly massive model, attaining both sped up training and decreased GPU memory usage.
DeepSeek LLM: Scaling Open-Source Language Models with Longtermism (January 2024) This paper explores scaling laws and presents findings that assist in the scaling of massive designs in open-source setups. It presents the DeepSeek LLM project, committed to advancing open-source language models with a long-term point of view.
DeepSeek-Coder: When the Large Language Model Meets Programming-The Rise of Code Intelligence (January 2024) This research introduces the DeepSeek-Coder series, a variety of open-source code models trained from on 2 trillion tokens. The designs are pre-trained on a premium project-level code corpus and use a fill-in-the-blank task to improve 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 identified by affordable training and efficient reasoning.
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 efficiency equivalent to GPT-4 Turbo in code-specific jobs.
Interesting occasions
- Hong Kong University replicates R1 outcomes (Jan 25, '25).
- Huggingface announces huggingface/open-r 1: Fully open recreation of DeepSeek-R1 to duplicate R1, fully open source (Jan 25, '25).
- OpenAI scientist confirms the DeepSeek team separately discovered and utilized some core concepts the OpenAI team utilized en route to o1
Liked this post? Join the newsletter.