Odstranění Wiki stránky „Understanding DeepSeek R1“ nemůže být vráceno zpět. Pokračovat?
DeepSeek-R1 is an open-source language model constructed on DeepSeek-V3-Base that’s been making waves in the AI community. Not only does it match-or even surpass-OpenAI’s o1 model in many criteria, but it likewise includes totally MIT-licensed weights. This marks it as the very first non-OpenAI/Google model to deliver strong reasoning abilities in an open and available way.
What makes DeepSeek-R1 particularly interesting is its transparency. Unlike the less-open approaches from some industry leaders, addsub.wiki DeepSeek has actually published a detailed training method in their paper.
The model is likewise remarkably cost-efficient, 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 knowledge was that better models needed more information and compute. While that’s still valid, designs like o1 and R1 show an option: inference-time scaling through reasoning.
The Essentials
The DeepSeek-R1 paper provided numerous designs, but main amongst them were R1 and R1-Zero. Following these are a series of distilled models that, while interesting, I will not go over here.
DeepSeek-R1 utilizes two significant concepts:
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 reinforcement learning technique that counts on comparing several model outputs per prompt to avoid the requirement for a separate critic.
R1 and R1-Zero are both thinking designs. This essentially implies they do Chain-of-Thought before answering. For the R1 series of models, this takes type as believing 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 supervised fine-tuning (SFT). RL is used to optimize the design’s policy to optimize benefit.
R1-Zero attains excellent precision however often produces complicated outputs, such as mixing multiple languages in a single response. R1 repairs that by incorporating restricted monitored fine-tuning and several RL passes, which enhances both accuracy and readability.
It is fascinating how some languages might reveal certain concepts much better, which leads the model to select the most expressive language for the task.
Training Pipeline
The training pipeline that DeepSeek released in the R1 paper is profoundly interesting. It showcases how they created such strong reasoning models, and what you can expect from each stage. This includes the issues that the resulting models from each stage have, and how they resolved it in the next stage.
It’s fascinating that their training pipeline differs from the usual:
The normal training strategy: Pretraining on large dataset (train to predict next word) to get the base design → supervised fine-tuning → choice tuning by means of RLHF
R1-Zero: Pretrained → RL
R1: Pretrained → Multistage training pipeline with multiple 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 procedure has a good beginning point. This gives a great model to begin RL.
First RL Stage: Apply GRPO with rule-based rewards to enhance reasoning accuracy and format (such as requiring chain-of-thought into believing tags). When they were near convergence in the RL procedure, they relocated to the next action. The result of this step is a strong reasoning design but with weak general capabilities, e.g., bad format and language blending.
Rejection Sampling + general information: Create new SFT information through rejection sampling on the RL checkpoint (from action 2), combined with supervised data from the DeepSeek-V3-Base design. They gathered around 600k top quality thinking samples.
Second Fine-Tuning: Fine-tune DeepSeek-V3-Base again on 800k total samples (600k reasoning + 200k basic tasks) for wider capabilities. This action led to a strong thinking design with general capabilities.
Second RL Stage: Add more benefit signals (helpfulness, harmlessness) to refine the last model, in addition to the thinking benefits. The result is DeepSeek-R1.
They likewise did design distillation for several Qwen and Llama designs on the reasoning traces to get distilled-R1 models.
Model distillation is a method where you use an instructor model to improve a trainee design by generating training information for the trainee model.
The teacher is usually a larger design than the trainee.
Group Relative Policy Optimization (GRPO)
The fundamental concept behind utilizing reinforcement learning for LLMs is to fine-tune the design’s policy so that it naturally produces more accurate and beneficial answers.
They used a reward system that examines not just for accuracy but likewise for proper formatting and language consistency, so the design slowly finds out to prefer reactions that fulfill these quality criteria.
In this paper, they motivate the R1 design to produce chain-of-thought thinking through RL training with GRPO.
Instead of adding a separate module at reasoning time, the training process itself nudges the model to produce detailed, detailed outputs-making the chain-of-thought an emergent behavior of the enhanced policy.
What makes their approach particularly interesting is its reliance on straightforward, rule-based reward functions.
Instead of depending upon costly external designs or human-graded examples as in standard RLHF, the RL utilized for R1 utilizes basic requirements: it might give a greater benefit if the answer is right, if it follows the expected/ formatting, and if the language of the answer matches that of the prompt.
Not depending on a reward design likewise indicates you do not need to hang around and effort training it, and it does not take memory and compute away from your main model.
GRPO was introduced in the DeepSeekMath paper. Here’s how GRPO works:
1. For each input timely, the design creates different responses.
2. Each action receives a scalar benefit based on factors like accuracy, formatting, and language consistency.
3. Rewards are changed relative to the group’s efficiency, basically measuring how much better each action is compared to the others.
4. The model updates its strategy slightly to prefer responses with higher relative benefits. It only makes small adjustments-using strategies like clipping and a KL penalty-to guarantee the policy does not stray too far from its initial habits.
A cool aspect of GRPO is its flexibility. You can use easy rule-based reward functions-for circumstances, granting a bonus when the design properly utilizes the syntax-to guide the training.
While DeepSeek utilized GRPO, you could utilize alternative techniques instead (PPO or PRIME).
For those aiming to dive much deeper, Will Brown has actually composed quite a good implementation of training an LLM with RL using GRPO. GRPO has likewise currently been contributed to the Transformer Reinforcement Learning (TRL) library, which is another excellent 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 approaches they have actually presented in their paper, I want 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 performance by rendering the output circulation more robust, to put it simply, it appears that the enhancement is associated to improving the appropriate reaction from TopK rather than the enhancement of essential capabilities.
To put it simply, RL fine-tuning tends to form the output distribution so that the highest-probability outputs are most likely to be proper, utahsyardsale.com although the total ability (as determined 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 distribution of actions instead of endowing the model with completely brand-new capabilities.
Consequently, while RL techniques such as PPO and GRPO can produce substantial performance gains, there appears to be an inherent ceiling identified by the underlying model’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 delighted to see how it unfolds!
Running DeepSeek-R1
I’ve used DeepSeek-R1 through the main chat interface for various problems, which it seems to solve well enough. The extra search functionality makes it even better to use.
Interestingly, o3-mini(-high) was released as I was composing this post. From my preliminary screening, R1 appears more at math than o3-mini.
I likewise rented 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 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 running on the GPU), running via llama.cpp:
29 layers seemed to be the sweet area given this setup.
Performance:
A r/localllama user explained that they had the ability to overcome 2 tok/sec with DeepSeek R1 671B, without using their GPU on their regional video gaming setup.
Digital Spaceport composed 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 manageable for any major work, but it’s enjoyable to run these large designs on available hardware.
What matters most to me is a combination of usefulness and time-to-usefulness in these designs. Since reasoning models need to believe before answering, their time-to-usefulness is generally higher than other models, but their effectiveness is likewise typically greater.
We need to both maximize usefulness and reduce time-to-usefulness.
70B through Ollama
70.6 b params, 4-bit KM quantized DeepSeek-R1 running through Ollama:
GPU usage soars 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 through Reinforcement Learning
[2402.03300] DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models
DeepSeek R1 - Notion (Building a fully regional “deep scientist” 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 grandmother - 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 produce 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 design that equals the efficiency of OpenAI’s o1. It presents a detailed method for training such designs utilizing large-scale support learning strategies.
DeepSeek-V3 Technical Report (December 2024) This report discusses the application of an FP8 mixed accuracy training framework verified on an extremely large-scale model, attaining both sped up training and lowered GPU memory use.
DeepSeek LLM: Scaling Open-Source Language Models with Longtermism (January 2024) This paper looks into scaling laws and provides findings that facilitate the scaling of large-scale 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 presents the DeepSeek-Coder series, a variety of open-source code designs trained from scratch on 2 trillion tokens. The designs are pre-trained on a high-quality project-level code corpus and utilize a fill-in-the-blank task to enhance 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 design defined by cost-effective training and effective inference.
DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligence (June 2024) This research presents DeepSeek-Coder-V2, wiki.eqoarevival.com an open-source Mixture-of-Experts (MoE) code language model that attains performance equivalent to GPT-4 Turbo in code-specific tasks.
Interesting events
- Hong Kong University duplicates R1 outcomes (Jan 25, ‘25).
Odstranění Wiki stránky „Understanding DeepSeek R1“ nemůže být vráceno zpět. Pokračovat?