Understanding DeepSeek R1
josefinabojorq이(가) 5 달 전에 이 페이지를 수정함


DeepSeek-R1 is an open-source language model built 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 many benchmarks, however it also features completely MIT-licensed weights. This marks it as the very first non-OpenAI/Google design to deliver strong reasoning capabilities in an open and available way.

What makes DeepSeek-R1 especially interesting is its transparency. Unlike the less-open approaches from some market leaders, DeepSeek has actually released a detailed training approach in their paper. The model is also extremely affordable, 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 common knowledge was that better required more data and compute. While that's still valid, designs like o1 and R1 demonstrate an alternative: inference-time scaling through reasoning.

The Essentials

The DeepSeek-R1 paper provided multiple designs, hikvisiondb.webcam however main among them were R1 and R1-Zero. Following these are a series of distilled designs that, while fascinating, I won't go over here.

DeepSeek-R1 utilizes 2 significant ideas:

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

  1. Group Relative Policy Optimization (GRPO), a support learning method that depends on comparing multiple model outputs per prompt to avoid the requirement for a different critic.

    R1 and R1-Zero are both reasoning models. This basically suggests they do Chain-of-Thought before answering. For the R1 series of designs, this takes type as believing within a tag, before answering with a last summary.

    R1-Zero vs R1

    R1-Zero uses Reinforcement Learning (RL) straight to DeepSeek-V3-Base without any monitored fine-tuning (SFT). RL is utilized to optimize the design's policy to make the most of benefit. R1-Zero attains outstanding precision however in some cases produces complicated outputs, such as blending several languages in a single reaction. R1 repairs that by including limited monitored fine-tuning and several RL passes, which improves both correctness and readability.

    It is fascinating how some languages may express certain concepts much better, which leads the design to pick the most meaningful language for the job.

    Training Pipeline

    The training pipeline that DeepSeek released in the R1 paper is exceptionally fascinating. It showcases how they produced such strong thinking models, and links.gtanet.com.br what you can get out of each stage. This includes the issues that the resulting models from each stage have, niaskywalk.com and how they resolved it in the next phase.

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

    The typical training technique: Pretraining on large dataset (train to forecast next word) to get the base design → supervised fine-tuning → choice tuning through RLHF R1-Zero: Pretrained → RL R1: Pretrained → Multistage training pipeline with numerous SFT and RL phases

    Cold-Start Fine-Tuning: Fine-tune DeepSeek-V3-Base on a couple of thousand Chain-of-Thought (CoT) samples to make sure the RL procedure has a decent beginning point. This provides an excellent model to begin RL. First RL Stage: Apply GRPO with rule-based benefits to improve thinking accuracy and format (such as requiring chain-of-thought into believing tags). When they were near merging in the RL process, they moved to the next step. The result of this step is a strong reasoning design however with weak basic capabilities, e.g., poor formatting and language mixing. Rejection Sampling + basic information: Create new SFT information through rejection sampling on the RL checkpoint (from action 2), integrated with monitored data from the DeepSeek-V3-Base model. They gathered around 600k top quality reasoning samples. Second Fine-Tuning: Fine-tune DeepSeek-V3-Base again on 800k overall samples (600k reasoning + 200k general tasks) for wider capabilities. This step resulted in a strong thinking design with basic capabilities. Second RL Stage: Add more reward signals (helpfulness, harmlessness) to improve the last model, in addition to the thinking benefits. The result is DeepSeek-R1. They also did model distillation for numerous Qwen and Llama designs on the reasoning traces to get distilled-R1 models.

    Model distillation is a method where you use a teacher model to enhance a trainee design by producing training data for the trainee design. The instructor wolvesbaneuo.com is normally a larger model than the trainee.

    Group Relative Policy Optimization (GRPO)

    The fundamental concept behind using support learning for LLMs is to tweak the design's policy so that it naturally produces more accurate and useful responses. They utilized a reward system that examines not just for correctness however also for appropriate formatting and language consistency, so the design gradually finds out to prefer responses that meet these quality requirements.

    In this paper, they motivate the R1 design to generate chain-of-thought reasoning through RL training with GRPO. Rather than adding a separate module at reasoning time, the training process itself nudges the model to produce detailed, detailed outputs-making the chain-of-thought an emergent habits of the enhanced policy.

    What makes their approach particularly interesting is its reliance on straightforward, rule-based reward functions. Instead of depending upon expensive external models or human-graded examples as in conventional RLHF, the RL utilized for R1 uses easy requirements: it may provide a greater benefit if the response is right, if it follows the expected/ format, and if the language of the response matches that of the prompt. Not relying on a benefit design also indicates you don't have to invest time and effort training it, and it doesn't take memory and compute away from your main design.

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

    1. For bbarlock.com each input prompt, the design creates different reactions.
  2. Each action gets a scalar benefit based on factors like precision, format, and language consistency.
  3. Rewards are adjusted relative to the group's efficiency, essentially determining how much better each response is compared to the others.
  4. The design updates its strategy slightly to favor actions with higher relative benefits. It only makes slight adjustments-using techniques like clipping and a KL penalty-to guarantee the policy doesn't stray too far from its original behavior.

    A cool element of GRPO is its versatility. You can utilize simple rule-based benefit functions-for instance, awarding a bonus offer when the design properly utilizes the syntax-to guide the training.

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

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

    Is RL on LLMs the course to AGI?

    As a final note on explaining DeepSeek-R1 and prawattasao.awardspace.info the methodologies they have actually presented 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 show that RL enhances the model's overall efficiency by rendering the output circulation more robust, in other words, it seems that the enhancement is attributed to increasing the correct action from TopK rather than the improvement of fundamental abilities.

    In other words, RL fine-tuning tends to shape the output distribution so that the highest-probability outputs are more likely to be appropriate, even though the general capability (as measured by the diversity of appropriate answers) is mainly present in the pretrained model.

    This recommends that support knowing on LLMs is more about refining and "shaping" the existing distribution of reactions instead of enhancing the model with entirely brand-new abilities. Consequently, while RL methods such as PPO and GRPO can produce considerable performance gains, there appears to be a fundamental ceiling determined by the underlying design's pretrained knowledge.

    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 delighted to see how it unfolds!

    Running DeepSeek-R1

    I've utilized DeepSeek-R1 by means of the main chat user interface for various problems, which it appears to resolve all right. The extra search functionality makes it even nicer to use.

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

    I also rented 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 design would carry out when deployed on a single H100 GPU-not to thoroughly test the design's capabilities.

    671B by means of 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 offered this setup.

    Performance:

    A r/localllama user explained that they were able to overcome 2 tok/sec with DeepSeek R1 671B, without utilizing their GPU on their regional video 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.

    As you can see, the tokens/s isn't rather bearable for any serious work, however it's enjoyable to run these big models on available hardware.

    What matters most to me is a combination of effectiveness and time-to-usefulness in these designs. Since thinking models require to think before answering, their time-to-usefulness is usually greater than other designs, but their usefulness is also usually higher. We require to both take full advantage of usefulness and lessen time-to-usefulness.

    70B via Ollama

    70.6 b params, 4-bit KM quantized DeepSeek-R1 running via Ollama:

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

    Resources

    DeepSeek-R1: Incentivizing Reasoning Capability in LLMs by means of Reinforcement Learning [2402.03300] DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models DeepSeek R1 - Notion (Building a totally local "deep scientist" 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 grandmother - 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 framework that combines multimodal understanding and generation. It can both understand and create 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 design that equals the efficiency of OpenAI's o1. It presents a detailed approach for training such designs utilizing large-scale support learning strategies. DeepSeek-V3 Technical Report (December 2024) This report discusses the execution of an FP8 combined accuracy training structure validated on an incredibly massive design, attaining both sped up training and minimized GPU memory use. DeepSeek LLM: Scaling Open-Source Language Models with Longtermism (January 2024) This paper digs into scaling laws and provides findings that facilitate the scaling of large-scale designs in open-source setups. 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 series of open-source code designs trained from scratch on 2 trillion tokens. The designs are pre-trained on a high-quality project-level code corpus and use a fill-in-the-blank task 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 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 model that attains performance similar 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 reproduce R1, fully open source (Jan 25, '25). - OpenAI scientist confirms the DeepSeek group individually found and used some core concepts the OpenAI team utilized on the way to o1

    Liked this post? Join the newsletter.