Update 'Understanding DeepSeek R1'

master
Kristen Cuevas 2 months ago
commit
61f91a52bb
  1. 92
      Understanding-DeepSeek-R1.md

92
Understanding-DeepSeek-R1.md

@ -0,0 +1,92 @@
<br>DeepSeek-R1 is an open-source language [model built](https://www.advitalia.be) on DeepSeek-V3-Base that's been making waves in the [AI](http://metzgerei-griesshaber.de) neighborhood. Not just does it match-or even [surpass-OpenAI's](https://www.2ci.fr) o1 design in lots of benchmarks, but it likewise includes totally MIT-licensed weights. This marks it as the very first non-OpenAI/[Google model](https://git.guaranteedstruggle.host) to provide strong thinking capabilities in an open and available way.<br>
<br>What makes DeepSeek-R1 especially amazing is its transparency. Unlike the less-open techniques from some market leaders, DeepSeek has published a detailed training methodology in their paper.
The design is likewise extremely cost-effective, with [input tokens](http://njdogstc.com) [costing simply](https://git.mango57.xyz) $0.14-0.55 per million (vs o1's $15) and [output tokens](http://www.open201.com) at $2.19 per million (vs o1's $60).<br>
<br>Until ~ GPT-4, the [common wisdom](http://theconfidencegame.org) was that better models required more information and compute. While that's still valid, models like o1 and R1 show an alternative: inference-time scaling through .<br>
<br>The Essentials<br>
<br>The DeepSeek-R1 paper presented several designs, however main among them were R1 and R1-Zero. Following these are a series of distilled models that, while intriguing, I won't talk about here.<br>
<br>DeepSeek-R1 utilizes 2 significant concepts:<br>
<br>1. A multi-stage pipeline where a small set of cold-start data kickstarts the design, followed by massive RL.
2. Group Relative Policy Optimization (GRPO), a reinforcement knowing technique that depends on comparing several design outputs per timely to prevent the requirement for a [separate critic](http://img.trvcdn.net).<br>
<br>R1 and R1-Zero are both [thinking designs](https://www.wirtschaftleichtverstehen.de). This essentially means they do Chain-of-Thought before [answering](https://www.enpabologna.org). For the R1 series of designs, this takes kind as thinking within a tag, before addressing with a final summary.<br>
<br>R1-Zero vs R1<br>
<br>R1-Zero uses Reinforcement Learning (RL) straight to DeepSeek-V3-Base with no monitored fine-tuning (SFT). RL is used to [enhance](https://www.birderslibrary.com) the design's policy to maximize benefit.
R1-Zero attains exceptional precision however sometimes produces confusing outputs, such as blending several languages in a single action. R1 repairs that by integrating minimal supervised fine-tuning and multiple RL passes, which improves both accuracy and readability.<br>
<br>It is fascinating how some [languages](https://vibrantclubs.com) may reveal certain [concepts](https://hydrogensafety.eu) much better, which leads the model to select the most meaningful language for the task.<br>
<br>Training Pipeline<br>
<br>The training pipeline that DeepSeek released in the R1 paper is immensely interesting. It showcases how they developed such strong reasoning designs, and what you can expect from each phase. This consists of the issues that the resulting [designs](https://gitea.b54.co) from each phase have, [cadizpedia.wikanda.es](https://cadizpedia.wikanda.es/wiki/Usuario:TarenHunt478) and how they solved it in the next phase.<br>
<br>It's intriguing that their [training pipeline](http://www.cerrogrande-wind.com) varies from the normal:<br>
<br>The usual training strategy: Pretraining on large dataset (train to predict next word) to get the base model → [supervised fine-tuning](https://www.sedel.mn) → 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](https://gurkhalinks.co.uk) DeepSeek-V3-Base on a couple of thousand [Chain-of-Thought](https://drkaraoke.com) (CoT) samples to guarantee the RL procedure has a decent starting point. This offers a good design to begin RL.
First RL Stage: Apply GRPO with rule-based benefits to improve thinking correctness and formatting (such as forcing chain-of-thought into [believing](https://www.sonsaj.com) tags). When they were near convergence in the RL procedure, [bytes-the-dust.com](https://bytes-the-dust.com/index.php/User:MarcellaUtz0491) they transferred to the next step. The result of this step is a [strong reasoning](https://siciliammare.it) design but with weak general abilities, e.g., [poor format](http://xn---123-43dabqxw8arg3axor.xn--p1ai) and language mixing.
[Rejection](https://insigniasmonje.com) Sampling + general information: Create [brand-new SFT](https://cffghana.org) information through rejection tasting on the RL checkpoint (from step 2), integrated with [supervised](http://www.errayhaneclinic.com) information from the DeepSeek-V3-Base design. They collected around 600k top quality thinking [samples](http://pa-luwuk.go.id).
Second Fine-Tuning: [Fine-tune](http://lboprod.be) DeepSeek-V3-Base again on 800k total samples (600k thinking + 200k general jobs) for broader capabilities. This step resulted in a strong thinking model with general abilities.
Second RL Stage: Add more reward signals (helpfulness, harmlessness) to fine-tune the final model, in addition to the [thinking benefits](http://canarias.angelesverdes.es). The result is DeepSeek-R1.
They also did design distillation for a number of Qwen and [Llama models](https://ashawo.club) on the thinking traces to get distilled-R1 designs.<br>
<br>Model distillation is a technique where you [utilize](https://www.labotana-ws.com) an [instructor design](http://www.rlmachinery.nl) to enhance a trainee design by generating training data for the trainee design.
The teacher is typically a bigger model than the trainee.<br>
<br>Group Relative Policy Optimization (GRPO)<br>
<br>The basic idea behind utilizing reinforcement knowing for LLMs is to fine-tune the design's policy so that it naturally produces more accurate and beneficial responses.
They utilized a [benefit](http://koreaeducation.co.kr) system that checks not only for correctness but likewise for correct formatting and language consistency, so the model slowly discovers to prefer responses that [satisfy](https://ijvbschilderwerken.nl) these quality requirements.<br>
<br>In this paper, they encourage the R1 design to create [chain-of-thought reasoning](http://gekka.info) through [RL training](https://www.usbstaffing.com) with GRPO.
Rather than adding a [separate module](https://pibarquitectos.com) at reasoning time, the training process itself nudges 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 especially intriguing is its dependence on straightforward, rule-based benefit functions.
Instead of depending upon costly external designs or human-graded examples as in conventional RLHF, the RL utilized for R1 [utilizes basic](http://mppee.gob.ve) criteria: it may provide a higher reward if the [response](https://cafepabit.se) is proper, if it follows the anticipated/ formatting, and if the language of the answer matches that of the prompt.
Not depending on a reward design also [suggests](https://odinlaw.com) you do not have to hang around and [effort training](https://livingspringfoundation.com.hk) it, and it does not take memory and calculate away from your main model.<br>
<br>GRPO was introduced in the DeepSeekMath paper. Here's how GRPO works:<br>
<br>1. For each input prompt, the design produces different [reactions](http://39.98.194.763000).
2. Each action gets a scalar reward based upon aspects like precision, format, and language consistency.
3. Rewards are changed relative to the group's performance, [essentially measuring](http://yagascafe.com) just how much better each reaction is compared to the others.
4. The design updates its technique slightly to prefer responses with greater relative benefits. It only makes slight adjustments-using [methods](https://www.tvwatchers.nl) like clipping and a KL penalty-to make sure the policy does not wander off too far from its initial behavior.<br>
<br>A cool element of GRPO is its versatility. You can utilize basic rule-based [reward functions-for](https://treknest.shop) circumstances, granting a perk when the design correctly utilizes the [syntax-to guide](https://socialsnug.net) the training.<br>
<br>While DeepSeek used GRPO, you could utilize alternative [methods](https://www.wirtschaftleichtverstehen.de) rather (PPO or PRIME).<br>
<br>For those aiming to dive much deeper, Will Brown has actually [composed](https://git.emacinc.com) quite a great [execution](https://gonhuahoanggia.com) of [training](https://git.uulucky.com) an LLM with RL using GRPO. GRPO has actually also already been contributed to the Transformer Reinforcement Learning (TRL) library, which is another excellent resource.
Finally, Yannic Kilcher has a fantastic video explaining GRPO by going through the DeepSeekMath paper.<br>
<br>Is RL on LLMs the course to AGI?<br>
<br>As a final note on explaining DeepSeek-R1 and the methodologies they have actually provided in their paper, I wish to highlight a passage from the [DeepSeekMath](https://psychomatrix.in) paper, based on a point Yannic Kilcher made in his video.<br>
<br>These [findings](https://guihangmyuccanada.com) show that [RL boosts](https://www.pakgovtnaukri.pk) the design's total performance by rendering the output circulation more robust, to put it simply, it appears that the enhancement is credited to boosting the appropriate action from TopK rather than the improvement of essential abilities.<br>
<br>To put it simply, RL fine-tuning tends to shape the output circulation so that the highest-probability outputs are more most likely to be appropriate, although the total capability (as [measured](http://lboprod.be) by the variety of appropriate responses) is mainly present in the pretrained design.<br>
<br>This suggests that [reinforcement learning](http://jimihendrixrecordguide.com) on LLMs is more about refining and "shaping" the existing circulation of responses rather than [endowing](https://customluxurytravel.com) the design with entirely brand-new abilities.
Consequently, while RL methods such as PPO and GRPO can [produce considerable](http://usteckeforum.cz) performance gains, there seems an intrinsic ceiling identified by the underlying model's pretrained understanding.<br>
<br>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 excited to see how it unfolds!<br>
<br>Running DeepSeek-R1<br>
<br>I have actually used DeepSeek-R1 by means of the main chat user interface for different problems, which it appears to fix all right. The extra search performance makes it even nicer to use.<br>
<br>Interestingly, o3-mini(-high) was released as I was writing this post. From my preliminary screening, R1 appears stronger at math than o3-mini.<br>
<br>I also rented 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 main goal was to see how the model would perform when [released](https://outsideschoolcare.com.au) on a single H100 GPU-not to extensively test the [model's](https://www.acaciasparaquetequedes.com) [abilities](https://uzene.ba).<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](https://wiki.blackboxframework.org) and partial GPU offloading (29 layers working on the GPU), running by means of llama.cpp:<br>
<br>29 [layers appeared](https://ezstreamr.com) to be the sweet area given this setup.<br>
<br>Performance:<br>
<br>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 wrote 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. <br>
<br>As you can see, the tokens/s isn't rather bearable for any major work, however it's fun to run these large designs on available hardware.<br>
<br>What matters most to me is a combination of effectiveness and time-to-usefulness in these [designs](http://wit-lof.com). Since [reasoning models](https://palawanrealty.com) require to believe before responding to, their [time-to-usefulness](https://globalparques.pt) is normally higher than other designs, however their effectiveness is also typically greater.
We require to both take full advantage of effectiveness and [minimize time-to-usefulness](https://gitea.alaindee.net).<br>
<br>70B through Ollama<br>
<br>70.6 b params, 4-bit KM quantized DeepSeek-R1 running through Ollama:<br>
<br>GPU utilization soars here, as expected 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 local](https://www.angelo-home.com) "deep researcher" with DeepSeek-R1 - YouTube).
DeepSeek R1['s recipe](https://istar.iscte-iul.pt) to [reproduce](https://git.velder.li) o1 and the future of thinking LMs.
The Illustrated DeepSeek-R1 - by Jay Alammar.
Explainer: What's R1 & Everything Else? - Tim Kellogg.
[DeepSeek](https://git.lodis.se) R1 Explained to your [grandmother -](https://askabruthaman.com) YouTube<br>
<br>DeepSeek<br>
<br>- Try R1 at [chat.deepseek](http://taxbox.ae).com.
GitHub - deepseek-[ai](https://git.velder.li)/DeepSeek-R 1.
deepseek-[ai](http://img.trvcdn.net)/Janus-Pro -7 B · Hugging Face (January 2025): Janus-Pro is an unique autoregressive structure that unifies multimodal understanding and [generation](https://www.intercultural.ro). It can both [understand](https://moorspetsitting.com) and create images.
DeepSeek-R1: [bytes-the-dust.com](https://bytes-the-dust.com/index.php/User:CharleyRudall29) Incentivizing Reasoning Capability in Large Language Models through Reinforcement Learning (January 2025) This paper introduces DeepSeek-R1, an open-source reasoning design that rivals the performance of OpenAI's o1. It provides a detailed approach for training such models utilizing massive support knowing techniques.
DeepSeek-V3 Technical Report (December 2024) This report talks about the [application](https://corpoarca.com) of an FP8 [combined precision](https://blogs.umb.edu) training framework validated on an extremely large-scale model, attaining both accelerated training and minimized GPU memory use.
DeepSeek LLM: Scaling Open-Source Language Models with Longtermism (January 2024) This paper looks into scaling laws and provides findings that help with the [scaling](http://www.meadmedia.net) of large-scale designs in [open-source](https://symphonia.site) configurations. It presents the DeepSeek LLM task, [dedicated](http://dedodedeus.com.br) 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 (January 2024) This research introduces the DeepSeek-Coder series, a series of open-source code models trained from scratch on 2 trillion tokens. The designs are pre-trained on a [high-quality project-level](https://marineservicevanderploeg.nl) code corpus and employ 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 presents DeepSeek-V2, a Mixture-of-Experts (MoE) language model characterized by [cost-effective training](https://minimixtape.nl) and [efficient reasoning](http://124.221.255.92).
DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligence (June 2024) This research study introduces DeepSeek-Coder-V2, an open-source Mixture-of-Experts (MoE) code language design that [attains performance](http://mr-kinesiologue.com) similar to GPT-4 Turbo in code-specific tasks.<br>
<br>Interesting occasions<br>
<br>- Hong Kong University reproduces R1 [outcomes](http://mppee.gob.ve) (Jan 25, '25).
- Huggingface [announces](https://www.kaminfeuer-oberbayern.de) huggingface/open-r 1: Fully open reproduction of DeepSeek-R1 to replicate R1, completely open source (Jan 25, '25).
- OpenAI researcher validates the DeepSeek team independently discovered and utilized some core ideas the OpenAI group utilized en route to o1<br>
<br>Liked this post? Join the newsletter.<br>
Loading…
Cancel
Save