Add Understanding DeepSeek R1
parent
d74a97be42
commit
21f8e2d65a
92
Understanding-DeepSeek-R1.md
Normal file
92
Understanding-DeepSeek-R1.md
Normal file
|
@ -0,0 +1,92 @@
|
|||
<br>DeepSeek-R1 is an open-source language design [constructed](https://sfirishfilm.com) on DeepSeek-V3-Base that's been making waves in the [AI](https://ginza-shodo.com) neighborhood. Not only does it match-or even [surpass-OpenAI's](https://www.ausfocus.net) o1 model in many criteria, but it also includes totally MIT-licensed weights. This marks it as the first non-OpenAI/Google design to provide [strong reasoning](http://www.moonriver-ranch.de) [abilities](https://www.woolfatsoap.com) in an open and available manner.<br>
|
||||
<br>What makes DeepSeek-R1 especially [amazing](https://dailytimesbangladesh.com) is its openness. Unlike the less-open approaches from some [industry](https://euroergasiaki.gr) leaders, DeepSeek has released a detailed training approach in their paper.
|
||||
The design is likewise extremely economical, with input tokens [costing](https://salon2000fl.com) just $0.14-0.55 per million (vs o1's $15) and output tokens at $2.19 per million (vs o1's $60).<br>
|
||||
<br>Until ~ GPT-4, the common knowledge was that better designs required more data and calculate. While that's still valid, models like o1 and R1 demonstrate an alternative: inference-time scaling through thinking.<br>
|
||||
<br>The Essentials<br>
|
||||
<br>The DeepSeek-R1 paper presented [numerous](https://www.recooil.gr) models, but main among them were R1 and R1-Zero. Following these are a series of distilled models that, while fascinating, I will not go over here.<br>
|
||||
<br>DeepSeek-R1 utilizes two significant concepts:<br>
|
||||
<br>1. A multi-stage pipeline where a little set of cold-start information kickstarts the model, followed by massive RL.
|
||||
2. Group [Relative Policy](https://nusaeiwyj.com) Optimization (GRPO), a reinforcement knowing technique that depends on comparing several design outputs per timely to prevent the requirement for a separate critic.<br>
|
||||
<br>R1 and R1-Zero are both thinking models. This basically indicates they do Chain-of-Thought before responding to. For the R1 series of designs, this takes type as believing within a tag, before responding to with a final summary.<br>
|
||||
<br>R1-Zero vs R1<br>
|
||||
<br>R1-Zero applies Reinforcement Learning (RL) straight to DeepSeek-V3-Base with no [supervised fine-tuning](https://edu.yju.ac.kr) (SFT). RL is used to optimize the design's policy to make the most of [benefit](https://www.newslocal.uk).
|
||||
R1-Zero attains excellent accuracy but in some cases produces complicated outputs, such as mixing several languages in a single reaction. R1 [repairs](https://stepstage.fr) that by incorporating [restricted monitored](https://bocan.biz) fine-tuning and several RL passes, which enhances both correctness and readability.<br>
|
||||
<br>It is interesting how some languages may reveal certain ideas better, which leads the model to select the most expressive language for the job.<br>
|
||||
<br>Training Pipeline<br>
|
||||
<br>The training pipeline that DeepSeek released in the R1 paper is immensely interesting. It showcases how they produced such strong reasoning models, and what you can anticipate from each phase. This consists of the issues that the resulting designs from each phase have, and how they fixed it in the next stage.<br>
|
||||
<br>It's [fascinating](https://www.travessao.com.br) that their training pipeline differs from the typical:<br>
|
||||
<br>The normal training strategy: Pretraining on big dataset (train to predict next word) to get the base model → monitored fine-tuning → preference tuning through RLHF
|
||||
R1-Zero: Pretrained → RL
|
||||
R1: Pretrained → Multistage training pipeline with multiple SFT and RL phases<br>
|
||||
<br>Cold-Start Fine-Tuning: Fine-tune DeepSeek-V3-Base on a few thousand Chain-of-Thought (CoT) samples to make sure the RL process has a good [starting](http://uniconf.spmi.ru) point. This offers a good model to begin RL.
|
||||
First RL Stage: Apply GRPO with rule-based benefits to improve thinking correctness and format (such as forcing chain-of-thought into thinking tags). When they were near merging in the RL procedure, they relocated to the next action. The outcome of this step is a strong reasoning design but with weak general abilities, e.g., bad formatting and language mixing.
|
||||
Rejection Sampling + general data: Create new SFT data through [rejection](http://nhathuycomputer.com) sampling on the RL checkpoint (from step 2), combined with monitored data from the DeepSeek-V3-Base design. They collected around 600k premium [reasoning](https://www.mammut.cc) samples.
|
||||
Second Fine-Tuning: Fine-tune DeepSeek-V3-Base again on 800k overall samples (600k reasoning + 200k general tasks) for wider [capabilities](https://www.buehnehollenthon.at). This action resulted in a strong reasoning design with basic capabilities.
|
||||
Second RL Stage: Add more benefit signals (helpfulness, harmlessness) to refine the last design, in addition to the reasoning benefits. The result is DeepSeek-R1.
|
||||
They likewise did design distillation for numerous Qwen and Llama designs on the thinking traces to get distilled-R1 models.<br>
|
||||
<br>Model distillation is a method where you utilize a teacher design to improve a trainee model by producing training information for the [trainee](http://code.chinaeast2.cloudapp.chinacloudapi.cn) design.
|
||||
The teacher is generally a larger design than the trainee.<br>
|
||||
<br>Group Relative Policy Optimization (GRPO)<br>
|
||||
<br>The basic concept behind utilizing reinforcement knowing 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 only for accuracy but also for appropriate format and language consistency, so the model slowly learns to prefer responses that satisfy these quality requirements.<br>
|
||||
<br>In this paper, they motivate the R1 model to generate chain-of-thought thinking through RL training with GRPO.
|
||||
Rather than including a different module at reasoning time, the training procedure itself pushes the design to produce detailed, detailed outputs-making the chain-of-thought an emerging habits of the enhanced policy.<br>
|
||||
<br>What makes their method particularly intriguing is its dependence on straightforward, rule-based reward functions.
|
||||
Instead of [depending](https://edu.yju.ac.kr) upon pricey external models or human-graded examples as in traditional RLHF, the RL used for R1 uses simple requirements: it may give a greater benefit if the response is proper, if it follows the anticipated/ format, and if the language of the response matches that of the prompt.
|
||||
Not counting on a reward model likewise implies you do not have to hang around and effort training it, [elclasificadomx.com](https://elclasificadomx.com/author/pattyturman/) and it doesn't take memory and compute far from your main model.<br>
|
||||
<br>GRPO was presented in the DeepSeekMath paper. Here's how GRPO works:<br>
|
||||
<br>1. For each input timely, the model creates different reactions.
|
||||
2. Each [response receives](https://www.turtlebeachandora.com) a scalar reward based upon elements like precision, format, and language consistency.
|
||||
3. Rewards are changed relative to the group's efficiency, essentially determining just how much better each response is compared to the others.
|
||||
4. The design updates its method somewhat to [prefer reactions](https://git.arx-obscura.de) with higher relative advantages. It only makes slight adjustments-using methods like clipping and a KL penalty-to make sure the policy does not stray too far from its initial habits.<br>
|
||||
<br>A cool element of GRPO is its versatility. You can use simple rule-based benefit functions-for circumstances, granting a bonus when the design correctly uses the [syntax-to guide](https://www.infosoft-sistemas.es) the training.<br>
|
||||
<br>While DeepSeek used GRPO, you might use alternative methods rather (PPO or PRIME).<br>
|
||||
<br>For those aiming to dive deeper, Will Brown has actually composed quite a nice execution of training an LLM with RL utilizing GRPO. GRPO has actually likewise currently been added to the Transformer Reinforcement Learning (TRL) library, which is another great resource.
|
||||
Finally, Yannic Kilcher has a fantastic [video explaining](https://new-ganpon.com) GRPO by going through the [DeepSeekMath paper](https://www.dancedancedance.it).<br>
|
||||
<br>Is RL on LLMs the course to AGI?<br>
|
||||
<br>As a final note on explaining DeepSeek-R1 and the methods they have actually presented in their paper, I wish to highlight a passage from the DeepSeekMath paper, based on a point [Yannic Kilcher](https://aromaluz.com.br) made in his video.<br>
|
||||
<br>These findings show that RL enhances the design's overall efficiency by rendering the output circulation more robust, in other words, it seems that the improvement is attributed to improving the appropriate [reaction](http://www.thenghai.org.sg) from TopK instead of the enhancement of basic abilities.<br>
|
||||
<br>In other words, RL fine-tuning tends to shape the output distribution so that the highest-probability outputs are most likely to be proper, although the total ability (as determined by the variety of proper responses) is mainly present in the pretrained design.<br>
|
||||
<br>This recommends that support learning on LLMs is more about refining and "forming" the existing circulation of responses rather than endowing the model with totally new capabilities.
|
||||
Consequently, while RL methods such as PPO and GRPO can [produce substantial](https://talentmatch.somatik.io) efficiency gains, there seems an intrinsic ceiling identified by the underlying design's pretrained understanding.<br>
|
||||
<br>It is [uncertain](http://www.moonriver-ranch.de) to me how far RL will take us. Perhaps it will be the stepping stone to the next big turning point. I'm [excited](https://0-1.gr) to see how it unfolds!<br>
|
||||
<br>Running DeepSeek-R1<br>
|
||||
<br>I've utilized DeepSeek-R1 by means of the main chat user interface for various problems, which it seems to solve all right. The additional search performance makes it even nicer to use.<br>
|
||||
<br>Interestingly, o3-mini(-high) was released as I was writing this post. From my initial screening, R1 [appears stronger](https://www.prieler-design.com) at mathematics than o3-mini.<br>
|
||||
<br>I also leased a single H100 via Lambda Labs for $2/h (26 CPU cores, 214.7 GB RAM, 1.1 TB SSD) to run some experiments.
|
||||
The was to see how the model would carry out when deployed on a single H100 GPU-not to extensively test the model's capabilities.<br>
|
||||
<br>671B via Llama.cpp<br>
|
||||
<br>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 by means of llama.cpp:<br>
|
||||
<br>29 [layers appeared](https://mygovisa.com) to be the sweet spot given this setup.<br>
|
||||
<br>Performance:<br>
|
||||
<br>A r/[localllama](https://www.modularmolds.net) user [explained](https://www.recooil.gr) 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 complete guide on how to run Deepseek R1 671b totally in your area on a $2000 EPYC server, on which you can get ~ 4.25 to 3.5 tokens per second. <br>
|
||||
<br>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.<br>
|
||||
<br>What matters most to me is a mix of effectiveness and time-to-usefulness in these models. Since thinking models need to think before responding to, their time-to-usefulness is typically higher than other designs, but their effectiveness is likewise normally higher.
|
||||
We require to both [optimize effectiveness](https://www.dancedancedance.it) and reduce [time-to-usefulness](https://trufle.sk).<br>
|
||||
<br>70B via Ollama<br>
|
||||
<br>70.6 b params, 4-bit KM quantized DeepSeek-R1 [running](https://spillbean.in.net) via Ollama:<br>
|
||||
<br>[GPU usage](https://teacherhelp.info) shoots up here, as anticipated when compared to the mainly CPU-powered run of 671B that I showcased above.<br>
|
||||
<br>Resources<br>
|
||||
<br>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 totally regional "deep researcher" with DeepSeek-R1 - YouTube).
|
||||
DeepSeek R1's recipe to [reproduce](http://anggrek.aplikasi.web.id3000) 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<br>
|
||||
<br>DeepSeek<br>
|
||||
<br>- Try R1 at chat.deepseek.com.
|
||||
GitHub - deepseek-[ai](https://interconnectionpeople.se)/DeepSeek-R 1.
|
||||
deepseek-[ai](https://livy.biz)/Janus-Pro -7 B · Hugging Face (January 2025): Janus-Pro is an unique autoregressive framework that unifies multimodal understanding and generation. It can both understand and generate images.
|
||||
DeepSeek-R1: [Incentivizing Reasoning](https://gernet.hu) Capability in Large Language Models via Reinforcement [Learning](https://sun-clinic.co.il) (January 2025) This paper presents DeepSeek-R1, an [open-source thinking](https://gildasmorvan.niji.fr) model that equals the efficiency of OpenAI's o1. It presents a detailed method for training such models using [large-scale support](http://possapp.co.kr) learning techniques.
|
||||
DeepSeek-V3 Technical Report (December 2024) This report goes over the execution of an FP8 mixed precision [training](http://git.ndjsxh.cn10080) structure confirmed on an exceptionally large-scale model, attaining both accelerated training and lowered GPU memory use.
|
||||
[DeepSeek](http://shasta.ernesthum.i.li.at.e.ek.k.ac.o.nne.c.t.tn.tuGo.o.gle.email.2.%5cn1sarahjohnsonw.estbrookbertrew.e.rhu.fe.ng.k.ua.ngniu.bi..uk41Www.zanelesilvia.woodw.o.r.t.hBa.tt.le9.578Jxd.1.4.7m.nb.v.3.6.9.cx.z.951.4Ex.p.lo.si.v.edhq.gSilvia.woodw.o.r.t.hR.eces.si.v.e.x.g.zLeanna.langtonvi.rt.u.ali.rd.jH.att.ie.m.c.d.o.w.e.ll2.56.6.3Burton.renefullgluestickyriddl.edynami.c.t.r.ajohndf.gfjhfgjf.ghfdjfhjhjhjfdghsybbrr.eces.si.v.e.x.g.zleanna.langtonc.o.nne.c.t.tn.tuGo.o.gle.email.2.%5c%5c%5c%5cn1sarahjohnsonw.estbrookbertrew.e.rhu.fe.ng.k.ua.ngniu.bi..uk41Www.zanelesilvia.woodw.o.r.t.hfullgluestickyriddl.edynami.c.t.r.ajohndf.gfjhfgjf.ghfdjfhjhjhjfdghsybbrr.eces.si.v.e.x.g.zleanna.langtonc.o.nne.c.t.tn.tuGo.o.gle.email.2.%5c%5c%5c%5cn1sarahjohnsonw.estbrookbertrew.e.rhu.fe.ng.k.ua.ngniu.bi..uk41Www.zanelesilvia.woodw.o.r.t.hp.a.r.a.ju.mp.e.r.sj.a.s.s.en20.14magdalena.tunnH.att.ie.m.c.d.o.w.e.ll2.56.6.3burton.renec.o.nne.c.t.tn.tuGo.o.gle.email.2.%5cn1sarahjohnsonw.estbrookbertrew.e.rhu.fe.ng.k.ua.ngniu.bi..uk41Www.zanelesilvia.woodw.o.r.t.hwww.je-evrard.net) LLM: [Scaling Open-Source](https://soycondiabetes.com.mx) [Language Models](http://www.sprachreisen-matthes.de) with Longtermism (January 2024) This paper explores scaling laws and provides findings that help with the scaling of massive models in open-source configurations. It introduces the DeepSeek LLM job, committed to advancing open-source language models with a long-lasting perspective.
|
||||
DeepSeek-Coder: When the Large Language Model Meets Programming-The Rise of [Code Intelligence](https://research.cri.or.th) (January 2024) This research presents the DeepSeek-Coder series, a variety of open-source code designs trained from [scratch](http://anggrek.aplikasi.web.id3000) on 2 trillion tokens. The designs are pre-trained on a high-quality project-level code corpus and employ a fill-in-the-blank job 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 design characterized by cost-effective training and efficient 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 design that attains efficiency similar to GPT-4 Turbo in code-specific jobs.<br>
|
||||
<br>Interesting occasions<br>
|
||||
<br>- Hong Kong University replicates R1 outcomes (Jan 25, '25).
|
||||
- Huggingface reveals huggingface/open-r 1: Fully open reproduction of DeepSeek-R1 to reproduce R1, fully open source (Jan 25, '25).
|
||||
- OpenAI researcher verifies the DeepSeek group individually found and utilized some core concepts the OpenAI group [utilized](https://q8riyada.com) en route to o1<br>
|
||||
<br>Liked this post? Join the newsletter.<br>
|
Loading…
Reference in New Issue
Block a user