Understanding DeepSeek R1
zandraheaton14 урећивао ову страницу пре 3 месеци


DeepSeek-R1 is an open-source language design built on DeepSeek-V3-Base that's been making waves in the AI community. Not just does it match-or even surpass-OpenAI's o1 model in many benchmarks, however it also includes completely MIT-licensed weights. This marks it as the very first non-OpenAI/Google design to deliver strong reasoning abilities in an open and available way.

What makes DeepSeek-R1 especially exciting is its openness. Unlike the less-open techniques from some industry leaders, DeepSeek has published a detailed training method in their paper. The model is also remarkably cost-effective, 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).

Until ~ GPT-4, the common wisdom was that better models required more information and compute. While that's still valid, wiki.dulovic.tech designs like o1 and R1 an option: inference-time scaling through reasoning.

The Essentials

The DeepSeek-R1 paper provided numerous designs, but main among them were R1 and R1-Zero. Following these are a series of distilled designs that, while interesting, I will not talk about here.

DeepSeek-R1 uses 2 major ideas:

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

  1. Group Relative Policy Optimization (GRPO), a support knowing approach that counts on comparing several model outputs per timely to prevent the requirement for a different critic.

    R1 and R1-Zero are both reasoning designs. This essentially means they do Chain-of-Thought before answering. For the R1 series of models, this takes form as thinking within a tag, before answering with a last summary.

    R1-Zero vs R1

    R1-Zero applies Reinforcement Learning (RL) straight to DeepSeek-V3-Base without any monitored fine-tuning (SFT). RL is used to optimize the design's policy to maximize benefit. R1-Zero attains excellent accuracy but often produces complicated outputs, such as blending several languages in a single reaction. R1 repairs that by incorporating limited monitored fine-tuning and multiple RL passes, which improves both correctness and readability.

    It is fascinating how some languages might express certain concepts better, which leads the model to choose the most expressive language for the job.

    Training Pipeline

    The training pipeline that DeepSeek released in the R1 paper is tremendously interesting. It showcases how they produced such strong thinking models, and what you can anticipate from each phase. This includes the problems that the resulting models from each phase have, and how they solved it in the next phase.

    It's interesting that their training pipeline differs from the usual:

    The usual training strategy: Pretraining on large dataset (train to predict next word) to get the base design → monitored fine-tuning → choice tuning via RLHF R1-Zero: Pretrained → RL R1: Pretrained → Multistage training pipeline with several SFT and RL phases

    Cold-Start Fine-Tuning: Fine-tune DeepSeek-V3-Base on a few thousand Chain-of-Thought (CoT) samples to ensure the RL process has a decent starting point. This gives an excellent model to begin RL. First RL Stage: Apply GRPO with rule-based benefits to enhance reasoning accuracy and formatting (such as requiring chain-of-thought into thinking tags). When they were near convergence in the RL process, they moved to the next action. The outcome of this step is a strong reasoning model but with weak general abilities, e.g., poor formatting and language blending. Rejection Sampling + basic data: Create new SFT information through rejection sampling on the RL checkpoint (from step 2), combined with supervised data from the DeepSeek-V3-Base model. They gathered around 600k high-quality thinking samples. Second Fine-Tuning: Fine-tune DeepSeek-V3-Base again on 800k total samples (600k reasoning + 200k basic jobs) for wider capabilities. This action led to a strong thinking model with basic abilities. Second RL Stage: Add more reward signals (helpfulness, harmlessness) to refine the last model, in addition to the reasoning benefits. The outcome is DeepSeek-R1. They likewise did model distillation for numerous Qwen and Llama models on the thinking traces to get distilled-R1 designs.

    Model distillation is a strategy where you utilize an instructor model to enhance a trainee model by producing training information for the trainee design. The teacher is usually a larger design than the trainee.

    Group Relative Policy Optimization (GRPO)

    The fundamental idea behind utilizing support knowing for LLMs is to fine-tune the model's policy so that it naturally produces more accurate and beneficial answers. They utilized a reward system that inspects not only for correctness but likewise for correct formatting and language consistency, so the model slowly finds out to favor responses that meet these quality requirements.

    In this paper, they encourage the R1 design to create chain-of-thought thinking through RL training with GRPO. Instead of including a different module at reasoning time, links.gtanet.com.br the training procedure itself pushes the model to produce detailed, detailed outputs-making the chain-of-thought an emerging behavior of the enhanced policy.

    What makes their technique particularly intriguing is its reliance on straightforward, rule-based reward functions. Instead of depending upon pricey external designs or human-graded examples as in standard RLHF, the RL used for R1 utilizes basic criteria: it may provide a higher reward if the response is proper, if it follows the expected/ format, and if the language of the response matches that of the timely. Not depending on a reward model also suggests you do not have to hang around and effort training it, and it doesn't take memory and calculate away from your main model.

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

    1. For each input timely, the model creates different responses.
  2. Each reaction gets a scalar reward based on factors like precision, formatting, and language consistency.
  3. Rewards are adjusted relative to the group's performance, basically determining just how much better each action is compared to the others.
  4. The model updates its technique a little to favor actions with greater relative benefits. It just makes small adjustments-using techniques like clipping and a KL penalty-to ensure the policy does not stray too far from its initial habits.

    A cool aspect of GRPO is its flexibility. You can utilize easy rule-based reward functions-for circumstances, granting a reward when the model properly uses the syntax-to guide the training.

    While DeepSeek used GRPO, you could use alternative methods instead (PPO or PRIME).

    For those aiming to dive deeper, Will Brown has written quite a nice execution of training an LLM with RL utilizing GRPO. GRPO has also already been contributed to the Transformer Reinforcement Learning (TRL) library, which is another good resource. Finally, engel-und-waisen.de Yannic Kilcher has a great 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 methodologies they have actually provided in their paper, I wish to highlight a passage from the DeepSeekMath paper, based on a point Yannic Kilcher made in his video.

    These findings indicate that RL enhances the design's overall performance by rendering the output distribution more robust, to put it simply, it seems that the improvement is credited to improving the appropriate action from TopK rather than the enhancement of fundamental abilities.

    In other words, RL fine-tuning tends to form the output distribution so that the highest-probability outputs are most likely to be right, even though the overall ability (as determined by the variety of proper answers) is mainly present in the pretrained model.

    This suggests that support learning on LLMs is more about refining and "shaping" the existing circulation of reactions instead of endowing the model with totally brand-new abilities. Consequently, while RL methods such as PPO and GRPO can produce considerable efficiency gains, there seems a fundamental ceiling determined 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 huge milestone. I'm excited to see how it unfolds!

    Running DeepSeek-R1

    I've used DeepSeek-R1 by means of the main chat user interface for numerous problems, which it appears to fix well enough. The additional search functionality makes it even nicer to use.

    Interestingly, o3-mini(-high) was launched as I was composing this post. From my initial screening, R1 seems more powerful at mathematics than o3-mini.

    I likewise leased a single H100 through 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 model would carry out when deployed on a single H100 GPU-not to thoroughly evaluate the design's abilities.

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

    29 layers seemed to be the sweet spot provided this configuration.

    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 gaming setup. Digital Spaceport composed a full guide on how to run Deepseek R1 671b completely locally 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 rather bearable for any major work, however it's fun to run these large designs on available hardware.

    What matters most to me is a combination of usefulness and time-to-usefulness in these models. Since thinking models require to think before responding to, their time-to-usefulness is generally greater than other models, but their effectiveness is likewise usually greater. We require to both make the most of effectiveness and lessen time-to-usefulness.

    70B through Ollama

    70.6 b params, 4-bit KM quantized DeepSeek-R1 running by means of 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 via Reinforcement Learning [2402.03300] DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models DeepSeek R1 - Notion (Building a totally regional "deep scientist" with DeepSeek-R1 - YouTube). DeepSeek R1's dish to duplicate 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 an unique autoregressive structure that merges multimodal understanding and generation. It can both comprehend and generate 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 model that measures up to the efficiency of OpenAI's o1. It presents a detailed approach for training such models using large-scale support knowing techniques. DeepSeek-V3 Technical Report (December 2024) This report talks about the implementation of an FP8 mixed precision training structure verified on a very massive model, attaining both accelerated training and lowered GPU memory use. DeepSeek LLM: Scaling Open-Source Language Models with Longtermism (January 2024) This paper explores scaling laws and provides findings that assist in the scaling of massive models in open-source configurations. It presents the DeepSeek LLM task, dedicated to advancing open-source language designs 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 introduces the DeepSeek-Coder series, a variety of open-source code designs 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 job to enhance 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 economical training and effective 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 tasks.

    Interesting occasions

    - Hong Kong University reproduces R1 outcomes (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 scientist validates the DeepSeek team separately found and used some core ideas the OpenAI group utilized en route to o1

    Liked this post? Join the newsletter.