DeepSeek-R1 is an open-source language model developed 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 many criteria, however it likewise features fully MIT-licensed weights. This marks it as the first non-OpenAI/Google design to provide strong thinking abilities in an open and available manner.
What makes DeepSeek-R1 particularly interesting is its openness. Unlike the less-open methods from some industry leaders, DeepSeek has published a detailed training approach in their paper.
The model is also remarkably 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 better models required more information and calculate. While that's still legitimate, models like o1 and R1 show an option: inference-time scaling through reasoning.
The Essentials
The DeepSeek-R1 paper presented several designs, but main among them were R1 and R1-Zero. Following these are a series of distilled models that, while intriguing, I will not go over here.
DeepSeek-R1 uses two major ideas:
1. A multi-stage pipeline where a little set of cold-start data kickstarts the model, followed by massive RL.
2. Group Relative Policy Optimization (GRPO), a support knowing technique that relies on comparing multiple design outputs per prompt to avoid the requirement for a separate critic.
R1 and R1-Zero are both reasoning models. This essentially suggests they do Chain-of-Thought before answering. For the R1 series of designs, this takes kind as believing within a tag, before answering with a last summary.
R1-Zero vs R1
R1-Zero applies Reinforcement Learning (RL) straight to DeepSeek-V3-Base with no supervised fine-tuning (SFT). RL is used to optimize the model's policy to optimize reward.
R1-Zero attains excellent accuracy however in some cases produces complicated outputs, such as mixing multiple languages in a single action. R1 repairs that by including limited monitored fine-tuning and numerous RL passes, which enhances both correctness and readability.
It is intriguing how some languages might reveal certain ideas better, which leads the design to select the most expressive language for the task.
Training Pipeline
The training pipeline that DeepSeek released in the R1 paper is exceptionally intriguing. It showcases how they produced such strong thinking models, and what you can expect from each stage. This consists of the problems that the resulting models from each phase have, and how they solved it in the next phase.
It's fascinating that their training pipeline differs from the typical:
The usual training method: Pretraining on big dataset (train to forecast next word) to get the base model → supervised fine-tuning → choice tuning by means of 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 ensure the RL procedure has a decent beginning point. This offers a great model to start RL.
First RL Stage: Apply GRPO with rule-based benefits to improve reasoning correctness and format (such as forcing chain-of-thought into thinking tags). When they were near convergence in the RL procedure, they relocated to the next action. The result of this step is a strong thinking model however with weak general abilities, e.g., bad formatting and language blending.
Rejection Sampling + basic information: Create new SFT data through rejection sampling on the RL checkpoint (from step 2), integrated with supervised information from the DeepSeek-V3-Base model. They collected around 600k high-quality reasoning samples.
Second Fine-Tuning: Fine-tune DeepSeek-V3-Base again on 800k total samples (600k reasoning + 200k general jobs) for more comprehensive abilities. This step resulted in a strong thinking design with basic abilities.
Second RL Stage: Add more benefit signals (helpfulness, harmlessness) to fine-tune the last model, in addition to the thinking rewards. The outcome is DeepSeek-R1.
They also did model distillation for a number of Qwen and Llama designs on the reasoning traces to get distilled-R1 models.
Model distillation is a method where you use an instructor design to enhance a trainee model by creating training data for the trainee model.
The instructor is generally a larger design than the trainee.
Group Relative Policy Optimization (GRPO)
The basic concept behind utilizing support learning for LLMs is to fine-tune the model's policy so that it naturally produces more precise and useful answers.
They used a benefit system that examines not just for correctness but likewise for correct format and language consistency, so the model gradually discovers to prefer reactions that fulfill these quality criteria.
In this paper, they encourage the R1 model to create chain-of-thought reasoning through RL training with GRPO.
Rather than including 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 optimized policy.
What makes their approach especially interesting is its dependence on straightforward, rule-based reward functions.
Instead of depending upon costly external designs or human-graded examples as in standard RLHF, the RL used for R1 utilizes easy requirements: it may give a higher benefit if the response is appropriate, if it follows the anticipated/ formatting, and if the language of the response matches that of the prompt.
Not depending on a benefit design likewise means you don't need to invest time and archmageriseswiki.com effort training it, and it does not take memory and calculate far from your main model.
GRPO was presented in the DeepSeekMath paper. Here's how GRPO works:
1. For each input timely, the model generates different responses.
2. Each action receives a scalar benefit based upon elements like precision, format, and language consistency.
3. Rewards are changed relative to the group's performance, essentially measuring just how much better each response is compared to the others.
4. The design updates its strategy a little to favor actions with greater relative advantages. It only makes slight adjustments-using techniques like clipping and a KL penalty-to ensure the policy does not wander off too far from its original behavior.
A cool element of GRPO is its flexibility. You can use easy rule-based reward functions-for circumstances, granting a perk when the model correctly utilizes the syntax-to guide the training.
While DeepSeek utilized GRPO, you could use alternative methods rather (PPO or PRIME).
For those aiming to dive much deeper, Will Brown has actually written rather a of training an LLM with RL utilizing 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 path 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 upon a point Yannic Kilcher made in his video.
These findings suggest that RL boosts the model's general efficiency by rendering the output circulation more robust, to put it simply, it appears that the improvement is credited to improving the proper response from TopK rather than the improvement of fundamental capabilities.
Simply put, RL fine-tuning tends to shape the output circulation so that the highest-probability outputs are most likely to be proper, despite the fact that the general capability (as measured by the variety of right answers) is mainly present in the pretrained model.
This suggests that support knowing on LLMs is more about refining and "shaping" the existing distribution of responses rather than enhancing the design with totally brand-new capabilities.
Consequently, while RL methods such as PPO and GRPO can produce substantial efficiency gains, there appears to be an intrinsic 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 milestone. I'm thrilled to see how it unfolds!
Running DeepSeek-R1
I have actually used DeepSeek-R1 by means of the main chat interface for different problems, which it appears to solve well enough. The extra search performance makes it even nicer to use.
Interestingly, o3-mini(-high) was released as I was composing this post. From my preliminary screening, R1 seems more powerful at math 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 model would perform when deployed on a single H100 GPU-not to extensively check the model's capabilities.
671B through 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 running on the GPU), running through llama.cpp:
29 layers seemed to be the sweet area provided this setup.
Performance:
A r/localllama user explained that they were able to overcome 2 tok/sec with DeepSeek R1 671B, without using their GPU on their regional gaming setup.
Digital Spaceport composed a full guide on how to run Deepseek R1 671b fully 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, but it's enjoyable to run these large designs on available hardware.
What matters most to me is a combination of effectiveness and time-to-usefulness in these models. Since thinking models need to think before answering, their time-to-usefulness is usually greater than other models, but their usefulness is likewise generally greater.
We need to both make the most of effectiveness and minimize time-to-usefulness.
70B through Ollama
70.6 b params, 4-bit KM quantized DeepSeek-R1 running through Ollama:
GPU usage 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 via Reinforcement Learning
[2402.03300] DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models
DeepSeek R1 - Notion (Building a fully local "deep scientist" 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 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 framework that unifies multimodal understanding and generation. It can both comprehend and generate 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 rivals the performance of OpenAI's o1. It provides a detailed approach for training such models utilizing large-scale reinforcement knowing methods.
DeepSeek-V3 Technical Report (December 2024) This report talks about the implementation of an FP8 mixed precision training structure validated on an exceptionally large-scale design, attaining both accelerated training and lowered GPU memory use.
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 large-scale designs in open-source setups. It presents the DeepSeek LLM task, akropolistravel.com 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 study introduces the DeepSeek-Coder series, a variety of open-source code designs trained from scratch on 2 trillion tokens. The models 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 provides DeepSeek-V2, a Mixture-of-Experts (MoE) language model identified by affordable training and efficient inference.
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 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 recreation of DeepSeek-R1 to duplicate R1, fully open source (Jan 25, '25).
- OpenAI scientist verifies the DeepSeek group individually found and utilized some core ideas the OpenAI team utilized en route to o1
Liked this post? Join the newsletter.