DeepSeek-R1 is an open-source language design constructed on DeepSeek-V3-Base that's been making waves in the AI neighborhood. Not just does it match-or even surpass-OpenAI's o1 model in lots of criteria, however it likewise includes completely MIT-licensed weights. This marks it as the first non-OpenAI/Google model to deliver strong thinking abilities in an open and available way.
What makes DeepSeek-R1 especially interesting is its transparency. Unlike the less-open methods from some market leaders, DeepSeek has published a detailed training method in their paper.
The design is likewise incredibly economical, 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 typical wisdom was that much better designs required more data and calculate. While that's still valid, designs like o1 and R1 demonstrate an alternative: inference-time scaling through thinking.
The Essentials
The DeepSeek-R1 paper provided several designs, however main among them were R1 and R1-Zero. Following these are a series of distilled designs that, while intriguing, I will not discuss here.
DeepSeek-R1 uses 2 significant ideas:
1. A multi-stage pipeline where a small set of cold-start data kickstarts the model, followed by massive RL.
2. Group Relative Policy Optimization (GRPO), a support knowing approach that relies on comparing several model outputs per timely 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 responding to. For the R1 series of designs, this takes form as thinking within a tag, before responding to with a final 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 optimize the model's policy to maximize benefit.
R1-Zero attains outstanding accuracy but in some cases produces complicated outputs, such as blending numerous languages in a single reaction. R1 repairs that by incorporating restricted supervised fine-tuning and numerous RL passes, which enhances both correctness and readability.
It is interesting how some languages might express certain ideas much better, which leads the design to select the most expressive language for addsub.wiki the job.
Training Pipeline
The training pipeline that DeepSeek published in the R1 paper is immensely interesting. It showcases how they created such strong thinking designs, and what you can anticipate from each stage. This includes the problems that the resulting models from each stage have, and how they fixed it in the next phase.
It's intriguing that their training pipeline differs from the typical:
The usual training technique: Pretraining on large dataset (train to predict next word) to get the base model → supervised fine-tuning → choice tuning through RLHF
R1-Zero: Pretrained → RL
R1: Pretrained → Multistage training pipeline with several 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 beginning point. This provides a good model to start RL.
First RL Stage: Apply GRPO with rule-based rewards to improve thinking correctness and format (such as requiring chain-of-thought into thinking tags). When they were near merging in the RL procedure, they relocated to the next step. The result of this action is a strong thinking design however with weak general capabilities, e.g., poor formatting and language blending.
Rejection Sampling + basic data: Create new SFT information through rejection sampling on the RL checkpoint (from action 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 overall samples (600k reasoning + 200k basic tasks) for broader capabilities. This action resulted in a strong reasoning model with basic abilities.
Second RL Stage: Add more reward signals (helpfulness, harmlessness) to fine-tune the last model, in addition to the reasoning benefits. The outcome is DeepSeek-R1.
They likewise did design distillation for a number of Qwen and Llama models on the reasoning traces to get distilled-R1 models.
Model distillation is a method where you utilize a teacher model to improve a trainee model by producing training data for the trainee design.
The teacher is usually a bigger design than the trainee.
Group Relative Policy Optimization (GRPO)

The standard idea behind utilizing 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 checks not only for correctness however likewise for correct formatting and language consistency, so the design slowly learns to prefer reactions that satisfy these quality requirements.
In this paper, they motivate the R1 model to generate chain-of-thought reasoning through RL training with GRPO.
Rather than including a different module at reasoning time, the training process itself nudges the model to produce detailed, detailed outputs-making the chain-of-thought an emerging habits of the enhanced policy.
What makes their technique especially fascinating is its reliance on straightforward, rule-based benefit functions.
Instead of depending upon pricey external models or human-graded examples as in standard RLHF, the RL utilized for R1 utilizes simple requirements: it might provide a higher reward if the response is correct, if it follows the expected/ format, and if the language of the answer matches that of the timely.
Not relying on a benefit design also suggests you do not have to hang out and effort training it, prazskypantheon.cz and it does not take memory and calculate far from your main design.
GRPO was introduced in the DeepSeekMath paper. Here's how GRPO works:
1. For each input prompt, the design generates various reactions.
2. Each action receives a scalar benefit based upon elements like accuracy, formatting, smfsimple.com and language consistency.
3. Rewards are adjusted relative to the group's efficiency, basically determining how much better each reaction is compared to the others.
4. The model updates its strategy a little to favor reactions with higher relative benefits. It only makes minor adjustments-using techniques like clipping and a KL penalty-to ensure the policy doesn't wander off too far from its original habits.

A cool element of GRPO is its flexibility. You can utilize simple rule-based benefit functions-for instance, granting a bonus when the model correctly 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, Will Brown has actually written quite a good execution of training an LLM with RL utilizing GRPO. GRPO has actually likewise currently been contributed to the Transformer Reinforcement Learning (TRL) library, which is another good resource.
Finally, Yannic Kilcher has a terrific video explaining GRPO by going through the DeepSeekMath paper.
Is RL on LLMs the path to AGI?
As a last note on explaining DeepSeek-R1 and the approaches they've 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 show that RL improves the design's overall performance by rendering the output distribution more robust, simply put, it seems that the improvement is associated to improving the appropriate reaction from TopK rather than the improvement of fundamental abilities.
In other words, RL fine-tuning tends to shape the output distribution so that the highest-probability outputs are more likely to be appropriate, although the total ability (as determined by the variety of appropriate responses) is mainly present in the pretrained model.
This recommends that reinforcement knowing on LLMs is more about refining and "forming" the existing circulation of responses rather than endowing the design with completely brand-new capabilities.
Consequently, while RL strategies such as PPO and GRPO can produce substantial efficiency gains, there seems a fundamental 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 huge turning point. I'm thrilled to see how it unfolds!
Running DeepSeek-R1
I have actually utilized DeepSeek-R1 via the main chat interface for different issues, which it appears to resolve all right. The additional search performance makes it even better to use.
Interestingly, o3-mini(-high) was released as I was composing this post. From my initial screening, R1 appears stronger at math than o3-mini.
I also leased a single H100 by means of Lambda Labs for $2/h (26 CPU cores, 214.7 GB RAM, 1.1 TB SSD) to run some experiments.
The main objective was to see how the design would perform when released on a single H100 GPU-not to extensively 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 working on the GPU), running by means of llama.cpp:
29 layers appeared 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 utilizing their GPU on their regional video 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 manageable for any major work, but it's fun to run these large designs 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 addressing, their time-to-usefulness is typically greater than other designs, but their effectiveness is likewise generally higher.
We require to both take full advantage of usefulness and decrease time-to-usefulness.
70B through Ollama
70.6 b params, 4-bit KM quantized DeepSeek-R1 running by means of Ollama:
GPU utilization 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 through 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 reproduce 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 an unique autoregressive framework that merges multimodal understanding and generation. It can both comprehend and online-learning-initiative.org create images.
DeepSeek-R1: Incentivizing Reasoning Capability in Large Language Models via Reinforcement Learning (January 2025) This paper introduces DeepSeek-R1, an open-source thinking design that measures up to the efficiency of OpenAI's o1. It provides a detailed method for training such designs using massive support knowing techniques.
DeepSeek-V3 Technical Report (December 2024) This report goes over the execution of an FP8 combined accuracy training structure verified on an extremely massive design, attaining both sped up training and minimized GPU memory use.
DeepSeek LLM: Scaling Open-Source Language Models with Longtermism (January 2024) This paper explores scaling laws and provides findings that assist in the scaling of massive designs in open-source setups. It presents the DeepSeek LLM project, devoted to advancing open-source language models with a long-lasting 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 designs trained from scratch on 2 trillion tokens. The models 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 presents DeepSeek-V2, a Mixture-of-Experts (MoE) language model characterized by cost-effective 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 model that attains efficiency similar to GPT-4 Turbo in code-specific jobs.
Interesting occasions

- Hong Kong University duplicates R1 outcomes (Jan 25, '25).
- Huggingface reveals huggingface/open-r 1: Fully open reproduction of DeepSeek-R1 to replicate R1, completely open source (Jan 25, '25).
- OpenAI researcher confirms the DeepSeek team individually discovered and used some core concepts the OpenAI team utilized en route to o1
Liked this post? Join the newsletter.