Add Understanding DeepSeek R1

Lola Hassell 2025-02-09 17:43:23 +00:00
commit 1cd3eb9a44
1 changed files with 92 additions and 0 deletions

@ -0,0 +1,92 @@
<br>DeepSeek-R1 is an open-source language design built on DeepSeek-V3-Base that's been making waves in the [AI](http://openhope.eu) community. Not only does it match-or even surpass-OpenAI's o1 model in many criteria, however it likewise comes with fully MIT-licensed weights. This marks it as the first non-OpenAI/[Google design](https://happybarkdays.com) to deliver strong thinking [capabilities](https://motormarket.ir) in an open and available way.<br>
<br>What makes DeepSeek-R1 especially interesting is its transparency. Unlike the less-open methods from some market leaders, DeepSeek has released a detailed training method in their paper.
The model is likewise extremely cost-efficient, 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).<br>
<br>Until ~ GPT-4, the typical knowledge was that much better designs required more information and calculate. While that's still valid, designs like o1 and R1 show an option: inference-time scaling through [reasoning](https://befamous.cyou).<br>
<br>The Essentials<br>
<br>The DeepSeek-R1 paper provided multiple designs, but main among them were R1 and R1-Zero. Following these are a series of distilled designs that, while intriguing, I will not discuss here.<br>
<br>DeepSeek-R1 utilizes two major concepts:<br>
<br>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 support knowing method that relies on comparing several [model outputs](http://peliagudo.com) per prompt to avoid the requirement for a different critic.<br>
<br>R1 and R1-Zero are both thinking designs. This basically indicates they do Chain-of-Thought before addressing. For the R1 series of models, this takes form as believing within a tag, before answering with a last summary.<br>
<br>R1-Zero vs R1<br>
<br>R1-Zero applies Reinforcement Learning (RL) straight to DeepSeek-V3-Base without any supervised fine-tuning (SFT). RL is [utilized](http://www.thenghai.org.sg) to optimize the model's policy to maximize reward.
R1-Zero attains exceptional accuracy but in some cases produces confusing outputs, such as blending several languages in a [single response](https://ethicsolympiad.org). R1 repairs that by including minimal supervised fine-tuning and several RL passes, which enhances both correctness and readability.<br>
<br>It is interesting how some languages might express certain concepts better, which leads the design to select the most expressive language for the job.<br>
<br>Training Pipeline<br>
<br>The training pipeline that DeepSeek published in the R1 paper is immensely intriguing. It showcases how they created such [strong thinking](http://120.77.2.937000) models, and what you can get out of each stage. This consists of the issues that the resulting designs from each stage have, and how they fixed it in the next stage.<br>
<br>It's interesting that their training pipeline differs from the typical:<br>
<br>The usual training method: Pretraining on large dataset (train to anticipate next word) to get the base design → supervised fine-tuning → preference tuning through RLHF
R1-Zero: [Pretrained](http://ringturbine.com80) → RL
R1: Pretrained → Multistage training pipeline with numerous SFT and RL stages<br>
<br>Cold-Start Fine-Tuning: Fine-tune DeepSeek-V3-Base on a couple of thousand [Chain-of-Thought](http://chunzee.co.kr) (CoT) samples to make sure the RL process has a good starting point. This offers an excellent model to start RL.
First RL Stage: Apply GRPO with [rule-based rewards](https://qatarpharma.org) to improve thinking correctness and format (such as forcing chain-of-thought into [thinking](https://nbt-pia-neumann.de) tags). When they were near [merging](https://wpapi3.lerudi.com) in the RL process, they moved to the next action. The result of this action is a [strong thinking](https://dev.ncot.uk) model however with weak general abilities, e.g., poor format and language blending.
[Rejection Sampling](https://www.jbinstruments.com) + general data: Create brand-new SFT data through rejection sampling on the RL checkpoint (from action 2), integrated with supervised data from the DeepSeek-V3-Base design. They collected around 600[k high-quality](http://skpstachurski.pl) thinking samples.
Second Fine-Tuning: [Fine-tune](http://git.hcclab.online) DeepSeek-V3-Base again on 800k overall [samples](http://log.tkj.jp) (600[k thinking](http://eivissally.com) + 200k general jobs) for wider abilities. This action led to a strong thinking design with basic abilities.
Second RL Stage: Add more reward signals (helpfulness, harmlessness) to refine the last design, in addition to the [thinking benefits](https://www.alcided.com.br). The result is DeepSeek-R1.
They also did model distillation for [numerous Qwen](http://officeemployer.blog.usf.edu) and Llama models on the [thinking traces](http://maviemonhistoireenlettre.unblog.fr) to get distilled-R1 models.<br>
<br>[Model distillation](http://walknroll.online) is a [technique](https://hikari.picboo.com) where you utilize an instructor model to enhance a trainee model by producing training data for the trainee model.
The [teacher](https://waef.org) is typically a [bigger design](https://lionridgedesign.com) than the trainee.<br>
<br>Group Relative Policy Optimization (GRPO)<br>
<br>The fundamental concept behind utilizing reinforcement knowing for LLMs is to tweak the design's policy so that it naturally produces more precise and useful responses.
They utilized a benefit system that examines not only for correctness however also for correct formatting and language consistency, so the model slowly discovers to prefer responses that fulfill these quality criteria.<br>
<br>In this paper, they [encourage](https://source.addedpixels.com) the R1 design to produce chain-of-thought reasoning through RL training with GRPO.
Instead of including a separate module at inference time, the [training process](http://120.48.141.823000) itself pushes the design to produce detailed, detailed outputs-making the chain-of-thought an emerging behavior of the optimized policy.<br>
<br>What makes their method particularly intriguing is its reliance on straightforward, rule-based benefit functions.
Instead of depending upon costly external designs or human-graded examples as in [standard](https://ax3000.aluplan.com.tr) RLHF, the RL utilized for R1 uses simple criteria: it may offer a higher reward if the answer is correct, if it follows the expected/ formatting, and if the language of the answer matches that of the timely.
Not relying on a benefit model also suggests you do not have to spend time and effort training it, and it does not take memory and compute 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 timely, the design creates various responses.
2. Each action gets a [scalar benefit](https://zerowaste.asia) based upon [elements](https://sagehealthcareadmin.com) like accuracy, format, and [language consistency](http://en.dreslee.com).
3. [Rewards](https://gonggam.zieo.net) are changed relative to the group's efficiency, [wiki.rrtn.org](https://wiki.rrtn.org/wiki/index.php/User:IsaacGou73992) essentially measuring how much better each response is compared to the others.
4. The design updates its [technique](http://engagingleaders.com.au) a little to prefer responses with greater relative advantages. It just makes minor adjustments-using strategies like clipping and a KL penalty-to ensure the policy does not stray too far from its [original habits](http://inplaza.com).<br>
<br>A cool element of GRPO is its versatility. You can utilize easy rule-based reward functions-for circumstances, awarding a [bonus offer](https://gitlab.internetguru.io) when the design correctly uses the syntax-to guide the [training](https://music.audbum.com).<br>
<br>While [DeepSeek](https://www.findnaukri.pk) used GRPO, you could [utilize alternative](https://virtualoffice.com.ng) approaches rather (PPO or PRIME).<br>
<br>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 already been [contributed](https://safechina.ru) 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.<br>
<br>Is RL on LLMs the path to AGI?<br>
<br>As a last note on explaining DeepSeek-R1 and the methodologies they have actually provided in their paper, I wish to highlight a passage from the [DeepSeekMath](http://franklinfinish.com) paper, based upon a point Yannic Kilcher made in his video.<br>
<br>These findings show that RL improves the design's total performance by rendering the [output distribution](http://grainfather.tv) more robust, simply put, it appears that the [improvement](https://ame-plus.net) is associated to [improving](https://sirelvis.com) the [proper action](https://www.eucleiaphoto.com) from TopK rather than the enhancement of basic capabilities.<br>
<br>In other words, RL [fine-tuning](http://monlavageauto.fr) tends to form the [output distribution](https://www.valeriarp.com.tr) so that the highest-probability outputs are more likely to be right, although the total ability (as measured by the diversity of proper answers) is mainly present in the pretrained design.<br>
<br>This suggests that reinforcement learning on LLMs is more about refining and "forming" the existing circulation of actions rather than endowing the design with completely [brand-new abilities](https://fundacoesufpel.com.br).
Consequently, while RL strategies such as PPO and GRPO can produce significant performance gains, there appears to be a fundamental ceiling identified by the underlying model's pretrained knowledge.<br>
<br>It is [uncertain](http://pwmati.pl) to me how far RL will take us. Perhaps it will be the [stepping stone](https://virtualoffice.com.ng) to the next huge milestone. I'm thrilled to see how it unfolds!<br>
<br>Running DeepSeek-R1<br>
<br>I've utilized DeepSeek-R1 through the main chat interface for different issues, which it seems to fix all right. The additional search performance makes it even better to [utilize](http://bhuj.rackons.com).<br>
<br>Interestingly, o3-mini(-high) was launched as I was [composing](https://www.corems.org.br) this post. From my [preliminary](https://tempjobsindia.in) screening, R1 [appears stronger](http://patriciaconnerdesigns.com) at math than o3-mini.<br>
<br>I likewise 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 main objective was to see how the design would carry out when released on a single H100 GPU-not to extensively test the design's abilities.<br>
<br>671B through Llama.cpp<br>
<br>DeepSeek-R1 1.58-bit (UD-IQ1_S) quantized model by Unsloth, with a 4-bit quantized KV-cache and partial GPU offloading (29 layers operating on the GPU), [running](https://al-mo7tawa.com) by means of llama.cpp:<br>
<br>29 layers appeared to be the sweet spot offered this setup.<br>
<br>Performance:<br>
<br>A r/localllama user explained that they were able to overcome 2 tok/sec with [DeepSeek](https://www.marketingdd.com) R1 671B, without utilizing their GPU on their [regional gaming](http://simsideo.net) setup.
Digital Spaceport [composed](http://120.77.2.937000) a complete 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. <br>
<br>As you can see, the tokens/s isn't rather [manageable](http://loreephotography.com) for any serious work, however it's fun to run these big models on available hardware.<br>
<br>What most to me is a combination of usefulness and time-to-usefulness in these designs. Since reasoning designs need to believe before responding to, their time-to-usefulness is usually greater than other designs, however their effectiveness is likewise generally greater.
We require to both take full [advantage](http://git.baobaot.com) of effectiveness and [minimize time-to-usefulness](https://hireforjob.com).<br>
<br>70B through Ollama<br>
<br>70.6 b params, 4-bit KM quantized DeepSeek-R1 running via Ollama:<br>
<br>GPU usage 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 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](http://produtos.paginaoficial.ws) R1's dish to reproduce o1 and the future of [reasoning LMs](https://www.anggrekputih.com).
The [Illustrated](http://www.technitronic.com) DeepSeek-R1 - by [Jay Alammar](https://beta.hoofpick.tv).
Explainer: What's R1 & Everything Else? - Tim Kellogg.
DeepSeek R1 Explained to your grandmother - YouTube<br>
<br>DeepSeek<br>
<br>- Try R1 at chat.deepseek.com.
GitHub - deepseek-[ai](https://lisabom.nl)/DeepSeek-R 1.
deepseek-[ai](http://tobracef.com)/[Janus-Pro](https://www.productospalomacolors.com) -7 B · Hugging Face (January 2025): Janus-Pro is a novel autoregressive structure that unifies multimodal understanding and generation. It can both understand and generate images.
DeepSeek-R1: Incentivizing Reasoning Capability in Large Language Models via Reinforcement Learning (January 2025) This paper introduces DeepSeek-R1, an open-source thinking model that matches the performance of [OpenAI's](https://www.yielddrivingschool.ca) o1. It provides a detailed methodology for training such models utilizing massive support knowing methods.
DeepSeek-V3 [Technical Report](https://sevayoga.net) (December 2024) This report discusses the execution of an FP8 mixed precision training framework validated on an [incredibly](https://petrem.ru) large-scale model, attaining both sped up training and reduced GPU memory use.
DeepSeek LLM: [sitiosecuador.com](https://www.sitiosecuador.com/author/susannahx21/) Scaling Open-Source Language Models with Longtermism (January 2024) This paper explores scaling laws and presents findings that assist in the scaling of large-scale models in [open-source](https://www.trinityglobalschool.com) setups. It presents the DeepSeek LLM task, committed to advancing open-source language designs with a long-lasting point of view.
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 variety of open-source code designs [trained](http://ohclub.ru) from scratch on 2 trillion tokens. The models are [pre-trained](http://en.dreslee.com) on a top [quality project-level](http://countrysmokehouse.flywheelsites.com) code corpus and use a fill-in-the-blank task to boost code generation and infilling.
DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts [Language](http://argonizer.ru) Model (May 2024) This paper presents DeepSeek-V2, a Mixture-of-Experts (MoE) [language model](http://chunzee.co.kr) identified by affordable training and efficient reasoning.
DeepSeek-Coder-V2: Breaking the [Barrier](http://porto.grupolhs.co) of Closed-Source Models in Code Intelligence (June 2024) This research introduces DeepSeek-Coder-V2, [bytes-the-dust.com](https://bytes-the-dust.com/index.php/User:SusanBath2) an open-source Mixture-of-Experts (MoE) code language design that attains performance equivalent to GPT-4 Turbo in code-specific jobs.<br>
<br>Interesting events<br>
<br>- Hong Kong University reproduces R1 [outcomes](https://wheeoo.com) (Jan 25, '25).
- Huggingface reveals huggingface/open-r 1: Fully open recreation of DeepSeek-R1 to duplicate R1, completely open source (Jan 25, '25).
- OpenAI scientist validates the DeepSeek team independently found and utilized some [core concepts](https://vassosrestaurant.com) the OpenAI team used on the way to o1<br>
<br>Liked this post? Join the newsletter.<br>