1
0
Understanding DeepSeek R1
felipaslocum43 upravil túto stránku 4 mesiacov pred


DeepSeek-R1 is an open-source language model 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 numerous benchmarks, but it likewise includes totally MIT-licensed weights. This marks it as the first non-OpenAI/Google model to provide strong reasoning abilities in an open and available way.

What makes DeepSeek-R1 particularly interesting is its openness. Unlike the less-open methods from some market leaders, DeepSeek has released a detailed training methodology in their paper. The design 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 much better designs required more information and calculate. While that's still valid, models like o1 and R1 show an option: inference-time scaling through reasoning.

The Essentials

The DeepSeek-R1 paper presented several designs, but main among them were R1 and R1-Zero. Following these are a series of distilled models that, while intriguing, I won't go over here.

DeepSeek-R1 uses two significant ideas:

1. A multi-stage pipeline where a small set of cold-start data kickstarts the design, followed by large-scale RL.

  1. Group Relative Policy Optimization (GRPO), a support learning technique that counts on comparing multiple model outputs per timely to prevent the requirement for a separate critic.

    R1 and R1-Zero are both thinking designs. This basically implies they do Chain-of-Thought before responding to. For the R1 series of models, this takes kind as believing within a tag, before addressing with a final summary.

    R1-Zero vs R1

    R1-Zero applies Reinforcement Learning (RL) straight to DeepSeek-V3-Base with no monitored fine-tuning (SFT). RL is utilized to enhance the design's policy to optimize benefit. R1-Zero attains exceptional accuracy however often produces complicated outputs, wiki.myamens.com such as mixing numerous languages in a single action. R1 repairs that by including minimal monitored fine-tuning and multiple RL passes, which enhances both accuracy and readability.

    It is interesting how some languages might reveal certain concepts much better, which leads the design to select the most meaningful language for the task.

    Training Pipeline

    The training pipeline that DeepSeek released in the R1 paper is tremendously fascinating. It showcases how they developed such strong reasoning models, and what you can get out of each stage. This includes the issues that the resulting models from each phase have, and how they fixed it in the next stage.

    It's intriguing that their training pipeline differs from the normal:

    The usual training method: Pretraining on big dataset (train to anticipate next word) to get the base modelmonitored fine-tuningchoice tuning via 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 few thousand Chain-of-Thought (CoT) samples to guarantee the RL process has a decent beginning point. This offers an excellent design to begin RL. First RL Stage: Apply GRPO with rule-based rewards to enhance thinking accuracy and formatting (such as requiring chain-of-thought into thinking tags). When they were near convergence in the RL procedure, they transferred to the next step. The result of this step is a strong reasoning design however with weak general abilities, e.g., bad formatting and language blending. Rejection Sampling + basic information: Create new SFT information through rejection sampling on the RL checkpoint (from step 2), combined with monitored information from the DeepSeek-V3-Base design. They collected around 600k premium reasoning samples. Second Fine-Tuning: Fine-tune DeepSeek-V3-Base again on 800k overall samples (600k thinking + 200k general jobs) for more comprehensive abilities. This step led to a strong thinking design with general abilities. Second RL Stage: Add more benefit signals (helpfulness, harmlessness) to improve the final design, in addition to the thinking rewards. The result is DeepSeek-R1. They also did design distillation for a number of Qwen and Llama models on the thinking traces to get distilled-R1 designs.

    Model distillation is a method where you use a teacher design to improve a trainee model by producing training data for the trainee model. The instructor is generally a bigger design than the trainee.

    Group Relative Policy Optimization (GRPO)

    The standard concept behind using support knowing for LLMs is to fine-tune the design's policy so that it naturally produces more accurate and videochatforum.ro helpful responses. They utilized a benefit system that examines not only for accuracy but also for correct formatting and language consistency, so the design slowly finds out to prefer responses that meet these quality requirements.

    In this paper, they motivate the R1 design to create chain-of-thought thinking through RL training with GRPO. Rather than including a different module at reasoning time, the training procedure itself pushes the model to produce detailed, detailed outputs-making the chain-of-thought an emergent habits of the optimized policy.

    What makes their method particularly interesting is its reliance on straightforward, rule-based benefit functions. Instead of depending on pricey external models or human-graded examples as in conventional RLHF, the RL utilized for R1 utilizes simple criteria: it might give a higher benefit if the response is appropriate, if it follows the anticipated/ formatting, and if the language of the answer matches that of the prompt. Not counting on a benefit design likewise implies you do not have to hang around and effort training it, and it doesn't take memory and compute far from your main model.

    GRPO was presented in the DeepSeekMath paper. Here's how GRPO works:

    1. For each input prompt, the design produces various reactions.
  2. Each action receives a scalar reward based upon factors like precision, format, and language consistency.
  3. Rewards are adjusted relative to the group's efficiency, basically determining just how much better each reaction is compared to the others.
  4. The design updates its method a little to favor reactions with greater relative benefits. It just makes minor adjustments-using methods like clipping and a KL penalty-to make sure the policy does not stray too far from its original habits.

    A cool element of GRPO is its flexibility. You can use simple rule-based benefit functions-for circumstances, granting a perk when the design properly uses the syntax-to guide the training.

    While DeepSeek used GRPO, you might use alternative methods rather (PPO or PRIME).

    For those aiming to dive deeper, Will Brown has actually composed quite a great application of training an LLM with GRPO. GRPO has also already been contributed to the Transformer Reinforcement Learning (TRL) library, which is another great resource. Finally, Yannic Kilcher has an excellent video explaining GRPO by going through the DeepSeekMath paper.

    Is RL on LLMs the course to AGI?

    As a last note on explaining DeepSeek-R1 and the methods they've presented in their paper, I desire to highlight a passage from the DeepSeekMath paper, based on a point Yannic Kilcher made in his video.

    These findings suggest that RL boosts the design's total efficiency by rendering the output circulation more robust, in other words, angevinepromotions.com it seems that the enhancement is attributed to enhancing the proper reaction from TopK rather than the enhancement of basic capabilities.

    To put it simply, RL fine-tuning tends to shape the output distribution so that the highest-probability outputs are more most likely to be right, although the total capability (as determined by the diversity of proper answers) is mainly present in the pretrained model.

    This recommends that reinforcement learning on LLMs is more about refining and "forming" the existing distribution of actions rather than endowing the design with totally new abilities. Consequently, while RL techniques such as PPO and GRPO can produce significant efficiency gains, there seems an intrinsic ceiling figured out 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 big milestone. I'm delighted to see how it unfolds!

    Running DeepSeek-R1

    I've used DeepSeek-R1 through the main chat interface for different problems, which it seems to fix well enough. The additional search performance makes it even better to use.

    Interestingly, o3-mini(-high) was released as I was writing this post. From my preliminary testing, R1 seems stronger at math than o3-mini.

    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 main goal was to see how the model would carry out when deployed on a single H100 GPU-not to extensively test the model's capabilities.

    671B via Llama.cpp

    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 running on the GPU), running through llama.cpp:

    29 layers appeared 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 utilizing their GPU on their local video gaming setup. Digital Spaceport wrote a complete guide on how to run Deepseek R1 671b completely locally on a $2000 EPYC server, bio.rogstecnologia.com.br on which you can get ~ 4.25 to 3.5 tokens per second.

    As you can see, the tokens/s isn't rather bearable for any major work, but it's enjoyable to run these large designs on available hardware.

    What matters most to me is a mix of effectiveness and time-to-usefulness in these models. Since reasoning designs need to believe before addressing, their time-to-usefulness is typically greater than other models, however their effectiveness is also generally higher. We require to both maximize usefulness and lessen time-to-usefulness.

    70B through Ollama

    70.6 b params, 4-bit KM quantized DeepSeek-R1 running by means of Ollama:

    GPU utilization soars here, as anticipated when compared to the mainly CPU-powered run of 671B that I showcased above.

    Resources

    DeepSeek-R1: engel-und-waisen.de 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 regional "deep researcher" with DeepSeek-R1 - YouTube). DeepSeek R1's dish to reproduce o1 and the future of reasoning LMs. The Illustrated DeepSeek-R1 - by Jay Alammar. Explainer: What's R1 & Everything Else? - Tim Kellogg. DeepSeek R1 Explained to your grandma - 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 unifies multimodal understanding and generation. It can both understand and produce images. DeepSeek-R1: Incentivizing Reasoning Capability in Large Language Models by means of Reinforcement Learning (January 2025) This paper presents DeepSeek-R1, an open-source thinking design that rivals the performance of OpenAI's o1. It provides a detailed approach for training such models using massive reinforcement knowing methods. DeepSeek-V3 Technical Report (December 2024) This report talks about the implementation of an FP8 mixed accuracy training structure verified on a very massive design, attaining both sped up training and lowered GPU memory use. DeepSeek LLM: Scaling Open-Source Language Models with Longtermism (January 2024) This paper explores scaling laws and presents findings that assist in the scaling of massive models in open-source configurations. It introduces the DeepSeek LLM task, dedicated to advancing open-source language models with a long-lasting viewpoint. DeepSeek-Coder: When the Large Language Model Meets Programming-The Rise of Code Intelligence (January 2024) This research study presents the DeepSeek-Coder series, a series of open-source code models 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 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 design defined by affordable training and efficient reasoning. DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligence (June 2024) This research introduces DeepSeek-Coder-V2, an open-source Mixture-of-Experts (MoE) code language design that attains performance comparable to GPT-4 Turbo in code-specific jobs.

    Interesting occasions

    - Hong Kong University duplicates R1 results (Jan 25, '25).
  5. Huggingface reveals huggingface/open-r 1: Fully open reproduction of DeepSeek-R1 to duplicate R1, totally open source (Jan 25, '25).
  6. OpenAI researcher validates the DeepSeek group individually found and utilized some core ideas the OpenAI group utilized en route to o1

    Liked this post? Join the newsletter.