DeepSeek-R1 is an open-source language design constructed on DeepSeek-V3-Base that's been making waves in the AI neighborhood. Not only does it match-or even surpass-OpenAI's o1 design in lots of benchmarks, but it also features totally 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 methods from some industry leaders, DeepSeek has actually released a detailed training method in their paper.
The design 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 typical wisdom was that better designs required more information and compute. While that's still valid, models like o1 and R1 show an option: inference-time scaling through thinking.
The Essentials
The DeepSeek-R1 paper provided multiple models, however main amongst them were R1 and R1-Zero. Following these are a series of distilled models that, while fascinating, I will not discuss here.
DeepSeek-R1 uses 2 significant concepts:
1. A multi-stage pipeline where a small set of cold-start information kickstarts the model, followed by large-scale RL.
2. Group Relative Policy Optimization (GRPO), a reinforcement learning technique that relies on comparing multiple design outputs per timely to avoid the need for a separate critic.
R1 and R1-Zero are both reasoning designs. This essentially suggests they do Chain-of-Thought before answering. For the R1 series of designs, this takes type as thinking within a tag, before responding to with a final summary.
R1-Zero vs R1
R1-Zero applies Reinforcement Learning (RL) straight to DeepSeek-V3-Base without any supervised fine-tuning (SFT). RL is used to optimize the design's policy to make the most of benefit.
R1-Zero attains excellent accuracy however often produces complicated outputs, such as mixing multiple languages in a single reaction. R1 repairs that by including limited supervised fine-tuning and several RL passes, which improves both accuracy and readability.
It is interesting how some languages might express certain ideas better, which leads the design to choose the most meaningful language for the job.
Training Pipeline
The training pipeline that DeepSeek published in the R1 paper is exceptionally intriguing. It showcases how they developed such strong reasoning models, higgledy-piggledy.xyz and what you can anticipate from each phase. This includes the issues that the resulting designs from each phase have, and how they solved it in the next phase.
It's interesting that their training pipeline varies from the usual:
The usual training strategy: Pretraining on big dataset (train to anticipate next word) to get the base design → monitored fine-tuning → choice tuning through RLHF
R1-Zero: Pretrained → RL
R1: Pretrained → Multistage training pipeline with numerous SFT and RL phases
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 provides a good design to start RL.
First RL Stage: Apply GRPO with rule-based rewards to improve reasoning correctness and formatting (such as forcing chain-of-thought into thinking tags). When they were near merging in the RL procedure, they transferred to the next action. The outcome of this step is a strong thinking design but with weak basic abilities, e.g., bad formatting and language mixing.
Rejection Sampling + basic data: Create new SFT data through rejection sampling on the RL checkpoint (from action 2), combined with supervised information 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 jobs) for broader capabilities. This action resulted in a strong reasoning model with basic capabilities.
Second RL Stage: Add more reward signals (helpfulness, harmlessness) to fine-tune the last model, in addition to the reasoning rewards. The outcome is DeepSeek-R1.
They likewise did design distillation for numerous Qwen and drapia.org Llama models on the reasoning traces to get distilled-R1 designs.
Model distillation is a technique where you use an instructor model to improve a trainee model by producing training data for the trainee model.
The instructor is generally a bigger model than the trainee.
Group Relative Policy Optimization (GRPO)
The standard concept behind utilizing support knowing for LLMs is to fine-tune the design's policy so that it naturally produces more accurate and beneficial answers.
They utilized a benefit system that inspects not just for correctness however also for wiki.vst.hs-furtwangen.de proper format and language consistency, so the model gradually learns to prefer actions that fulfill these quality criteria.
In this paper, they encourage the R1 design to create chain-of-thought thinking through RL training with GRPO.
Rather than adding a different module at reasoning time, the training procedure itself pushes the design to produce detailed, detailed outputs-making the chain-of-thought an emergent behavior of the optimized policy.
What makes their technique particularly interesting is its dependence on straightforward, rule-based reward functions.
Instead of depending upon pricey external designs or human-graded examples as in traditional RLHF, the RL used for R1 utilizes basic criteria: it may offer a higher reward if the response is proper, vmeste-so-vsemi.ru if it follows the expected/ format, and if the language of the response matches that of the timely.
Not relying on a reward design also suggests you do not have to hang out and effort training it, 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 timely, the design generates various responses.
2. Each action gets a scalar reward based upon aspects like precision, formatting, and language consistency.
3. Rewards are changed relative to the group's performance, essentially measuring just how much better each reaction is compared to the others.
4. The model updates its method slightly to prefer responses with greater relative benefits. It just makes slight adjustments-using strategies like clipping and a KL penalty-to make sure the policy doesn't stray too far from its original habits.
A cool aspect of GRPO is its flexibility. You can utilize simple rule-based reward functions-for instance, awarding a reward when the model correctly utilizes the syntax-to guide the training.
While DeepSeek used GRPO, you could utilize alternative methods rather (PPO or PRIME).
For those aiming to dive much deeper, Will Brown has actually composed rather a good application of training an LLM with RL using GRPO. GRPO has actually also currently been included 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 methodologies 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 total efficiency by rendering the output distribution more robust, to put it simply, it seems that the improvement is credited to increasing the right response from TopK instead of the improvement of basic abilities.
In other words, RL fine-tuning tends to form the output distribution so that the highest-probability outputs are most likely to be proper, although the general ability (as measured by the diversity of correct responses) is mainly present in the pretrained model.
This recommends that support knowing on LLMs is more about refining and "shaping" the existing circulation of reactions instead of endowing the model with totally brand-new abilities.
Consequently, while RL methods such as PPO and GRPO can produce significant efficiency gains, there appears to be a fundamental ceiling identified by the underlying design'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 delighted to see how it unfolds!
Running DeepSeek-R1
I've used DeepSeek-R1 by means of the main chat interface for different problems, pipewiki.org which it seems to solve all right. The additional search functionality makes it even better to use.
Interestingly, o3-mini(-high) was launched as I was composing 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 model would perform when released on a single H100 GPU-not to extensively evaluate the model's abilities.
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 operating on the GPU), running by means of llama.cpp:
29 layers seemed to be the sweet spot given this setup.
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 local gaming setup.
Digital Spaceport composed 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, however it's enjoyable to run these big models on available hardware.
What matters most to me is a combination of effectiveness and time-to-usefulness in these models. Since reasoning designs need to think before addressing, their time-to-usefulness is generally higher than other designs, however their usefulness is likewise normally higher.
We need to both optimize effectiveness and lessen 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 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 completely local "deep researcher" with DeepSeek-R1 - YouTube).
DeepSeek R1's dish to reproduce 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 an unique autoregressive structure that unifies multimodal understanding and generation. It can both comprehend 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 design that rivals the efficiency of OpenAI's o1. It provides a detailed method for training such models using massive reinforcement learning techniques.
DeepSeek-V3 Technical Report (December 2024) This report goes over the application of an FP8 blended precision training framework verified on an incredibly massive design, attaining both sped up training and decreased GPU memory usage.
DeepSeek LLM: Scaling Open-Source Language Models with Longtermism (January 2024) This paper looks into scaling laws and provides findings that assist in the scaling of large-scale designs in open-source configurations. It introduces the DeepSeek LLM project, devoted to advancing open-source language designs with a long-lasting viewpoint.
DeepSeek-Coder: When the Large Language Model Meets Programming-The Rise of Code Intelligence (January 2024) This research presents 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 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 presents DeepSeek-V2, a Mixture-of-Experts (MoE) language model defined by cost-effective training and effective reasoning.
DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code (June 2024) This research study introduces DeepSeek-Coder-V2, an open-source Mixture-of-Experts (MoE) code language model that attains performance comparable to GPT-4 Turbo in code-specific jobs.
Interesting events
- Hong Kong University reproduces R1 outcomes (Jan 25, '25).
- Huggingface announces huggingface/open-r 1: Fully open reproduction of DeepSeek-R1 to duplicate R1, completely open source (Jan 25, '25).
- OpenAI researcher confirms the DeepSeek team separately discovered and used some core concepts the OpenAI team used on the method to o1
Liked this post? Join the newsletter.
1
Understanding DeepSeek R1
Perry Hanes edited this page 2025-02-10 00:01:57 +08:00