Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Submit feedback
    • Contribute to GitLab
  • Sign in
L
laraza
  • Project
    • Project
    • Details
    • Activity
    • Cycle Analytics
  • Issues 1
    • Issues 1
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Create a new issue
  • Jobs
  • Issue Boards
  • Christin Brooker
  • laraza
  • Issues
  • #1

Closed
Open
Opened Feb 12, 2025 by Christin Brooker@christinbrooke
  • Report abuse
  • New issue
Report abuse New issue

Understanding DeepSeek R1


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 criteria, but it also features totally MIT-licensed weights. This marks it as the first non-OpenAI/Google design to deliver strong reasoning capabilities in an open and available way.

What makes DeepSeek-R1 particularly interesting is its openness. Unlike the less-open methods from some industry leaders, DeepSeek has actually released a detailed training methodology in their paper. The model is likewise remarkably affordable, 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 typical wisdom was that better models needed more information and compute. While that's still legitimate, visualchemy.gallery designs like o1 and R1 demonstrate an option: inference-time scaling through reasoning.

The Essentials

The DeepSeek-R1 paper presented numerous models, but main among them were R1 and R1-Zero. Following these are a series of distilled designs that, while fascinating, I won't talk about here.

DeepSeek-R1 utilizes 2 significant concepts:

1. A multi-stage pipeline where a small set of cold-start data kickstarts the design, followed by large-scale RL. 2. Group Relative Policy Optimization (GRPO), classifieds.ocala-news.com a support learning technique that depends on comparing numerous design outputs per timely to avoid the requirement for a different critic.

R1 and R1-Zero are both reasoning models. This basically implies they do Chain-of-Thought before answering. For the R1 series of models, this takes type as believing within a tag, before responding to 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 used to optimize the model's policy to maximize reward. R1-Zero attains outstanding accuracy but sometimes produces complicated outputs, such as mixing several languages in a single reaction. R1 repairs that by incorporating minimal monitored fine-tuning and several RL passes, which improves both accuracy and readability.

It is fascinating how some languages may reveal certain concepts much better, which leads the design to choose the most meaningful language for the task.

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 stage have, and how they solved it in the next stage.

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

The typical training method: Pretraining on large dataset (train to predict next word) to get the base design → monitored fine-tuning → preference tuning via RLHF R1-Zero: Pretrained → RL R1: Pretrained → Multistage training pipeline with numerous SFT and visualchemy.gallery RL phases

Cold-Start Fine-Tuning: Fine-tune DeepSeek-V3-Base on a couple of thousand Chain-of-Thought (CoT) samples to ensure the RL procedure has a decent starting point. This gives an excellent model to start RL. First RL Stage: Apply GRPO with rule-based benefits to improve reasoning correctness and formatting (such as forcing chain-of-thought into believing tags). When they were near merging in the RL process, they relocated to the next action. The outcome of this step is a strong thinking model but with weak basic abilities, e.g., bad format and language blending. Rejection Sampling + general information: Create new SFT information through rejection tasting on the RL checkpoint (from action 2), combined with monitored data from the DeepSeek-V3-Base design. They collected around 600k top quality reasoning samples. Second Fine-Tuning: Fine-tune DeepSeek-V3-Base again on 800k overall samples (600k thinking + 200k basic tasks) for opensourcebridge.science more comprehensive abilities. This action resulted in a strong reasoning design with basic abilities. Second RL Stage: Add more reward signals (helpfulness, harmlessness) to improve the last model, in addition to the reasoning benefits. The outcome is DeepSeek-R1. They likewise did design distillation for several Qwen and Llama designs on the thinking traces to get distilled-R1 designs.

Model distillation is a method where you utilize a teacher design to enhance a trainee model by training information for the trainee design. The instructor is generally a bigger model than the trainee.

Group Relative Policy Optimization (GRPO)

The basic idea behind using support learning for LLMs is to tweak the design's policy so that it naturally produces more precise and oke.zone helpful responses. They used a reward system that checks not just for accuracy however also for correct format and language consistency, so the design slowly discovers to favor reactions that satisfy these quality requirements.

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

What makes their method especially interesting is its dependence on straightforward, rule-based benefit functions. Instead of depending upon costly external designs or human-graded examples as in standard RLHF, the RL used for R1 uses easy requirements: it might give a greater benefit if the response is appropriate, if it follows the anticipated/ format, and if the language of the answer matches that of the timely. Not relying on a reward design likewise means you do not have to spend time and effort training it, and classificados.diariodovale.com.br it doesn't take memory and compute far from your main model.

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

1. For each input prompt, the design generates different actions. 2. Each action receives a scalar reward based upon elements like accuracy, format, and language consistency. 3. Rewards are changed relative to the group's performance, basically determining just how much better each reaction is compared to the others. 4. The design updates its strategy slightly to prefer responses with greater relative advantages. It only 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 aspect of GRPO is its flexibility. You can utilize simple rule-based benefit functions-for instance, granting a bonus when the model properly uses the syntax-to guide the training.

While DeepSeek used GRPO, you might utilize alternative methods instead (PPO or users.atw.hu PRIME).

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

Is RL on LLMs the path to AGI?

As a last note on explaining DeepSeek-R1 and the approaches they have actually provided in their paper, I wish to highlight a passage from the DeepSeekMath paper, based upon a point Yannic Kilcher made in his video.

These findings show that RL improves the model's overall efficiency by rendering the output circulation more robust, in other words, it seems that the enhancement is attributed to boosting the correct action from TopK instead of the enhancement of essential capabilities.

To put it simply, RL fine-tuning tends to form the output distribution so that the highest-probability outputs are more most likely to be correct, even though the total ability (as measured by the variety of correct responses) is mainly present in the pretrained design.

This recommends that reinforcement knowing on LLMs is more about refining and "shaping" the existing circulation of responses instead of endowing the model with completely brand-new abilities. Consequently, while RL methods such as PPO and GRPO can produce considerable efficiency gains, there appears to be an intrinsic ceiling identified by the underlying model'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 excited to see how it unfolds!

Running DeepSeek-R1

I have actually utilized DeepSeek-R1 by means of the main chat interface for different problems, which it appears to solve well enough. The extra search performance makes it even better to use.

Interestingly, o3-mini(-high) was launched as I was writing this post. From my initial screening, R1 seems stronger at math than o3-mini.

I also 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 design would perform when released on a single H100 GPU-not to thoroughly evaluate 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 operating on the GPU), running by means of llama.cpp:

29 layers seemed to be the sweet area given this configuration.

Performance:

A r/localllama user explained that they were able to get over 2 tok/sec with DeepSeek R1 671B, without using their GPU on their local gaming setup. Digital Spaceport composed a full guide on how to run Deepseek R1 671b totally 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 manageable for any major work, but it's enjoyable to run these large models on available hardware.

What matters most to me is a mix of usefulness and time-to-usefulness in these models. Since reasoning models require to think before addressing, their time-to-usefulness is generally higher than other models, but their usefulness is likewise typically greater. We need to both make the most of usefulness and reduce time-to-usefulness.

70B by means of 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 through Reinforcement Learning [2402.03300] DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models DeepSeek R1 - Notion (Building a completely local "deep scientist" with DeepSeek-R1 - YouTube). DeepSeek R1's recipe to replicate 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 an unique autoregressive framework that merges multimodal understanding and generation. It can both understand and produce images. DeepSeek-R1: Incentivizing Reasoning Capability in Large Language Models through Reinforcement Learning (January 2025) This paper presents DeepSeek-R1, an open-source reasoning design that matches the performance of OpenAI's o1. It presents a detailed methodology for training such models utilizing large-scale reinforcement learning strategies. DeepSeek-V3 Technical Report (December 2024) This report talks about the application of an FP8 combined precision training structure verified on a very large-scale model, attaining both sped up training and lowered GPU memory usage. DeepSeek LLM: Scaling Open-Source Language Models with Longtermism (January 2024) This paper looks into scaling laws and provides findings that facilitate the scaling of massive designs in open-source configurations. It introduces the DeepSeek LLM task, committed to advancing open-source language designs with a long-lasting viewpoint. DeepSeek-Coder: When the Large Language Model Meets Programming-The Rise of Code Intelligence (January 2024) This research presents 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 utilize 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 provides DeepSeek-V2, a Mixture-of-Experts (MoE) language model identified by affordable training and efficient reasoning. DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligence (June 2024) This research study presents 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 events

- Hong Kong University duplicates R1 results (Jan 25, '25).

  • Huggingface reveals huggingface/open-r 1: Fully open reproduction of DeepSeek-R1 to duplicate R1, totally open source (Jan 25, '25).
  • OpenAI researcher verifies the DeepSeek team independently discovered and used some core concepts the OpenAI team used en route to o1

    Liked this post? Join the newsletter.
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
No due date
0
Labels
None
Assign labels
  • View project labels
Reference: christinbrooke/laraza#1