Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Submit feedback
    • Contribute to GitLab
  • Sign in
S
sheiksandwiches
  • Project
    • Project
    • Details
    • Activity
    • Cycle Analytics
  • Issues 153
    • Issues 153
    • 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
  • Adela Baine
  • sheiksandwiches
  • Issues
  • #71

Closed
Open
Opened Feb 11, 2025 by Adela Baine@adelabaine0415
  • Report abuse
  • New issue
Report abuse New issue

Understanding DeepSeek R1


DeepSeek-R1 is an open-source language design developed on DeepSeek-V3-Base that's been making waves in the AI community. Not only does it match-or even surpass-OpenAI's o1 design in many benchmarks, however it also features fully MIT-licensed weights. This marks it as the first non-OpenAI/Google design to provide strong reasoning abilities in an open and lespoetesbizarres.free.fr available way.

What makes DeepSeek-R1 especially amazing is its transparency. Unlike the less-open techniques from some industry leaders, DeepSeek has actually released a detailed training approach in their paper. The model is also remarkably 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).

Until ~ GPT-4, the typical knowledge was that much better models needed more data and compute. While that's still valid, designs like o1 and R1 demonstrate an alternative: inference-time scaling through thinking.

The Essentials

The DeepSeek-R1 paper provided several models, however main amongst them were R1 and R1-Zero. Following these are a series of distilled models that, while interesting, I will not talk about here.

DeepSeek-R1 uses 2 major ideas:

1. A multi-stage pipeline where a small set of cold-start data kickstarts the model, followed by large-scale RL. 2. Group Relative Policy Optimization (GRPO), a reinforcement learning technique that relies on comparing multiple design outputs per prompt to avoid the requirement for a different critic.

R1 and R1-Zero are both thinking models. This essentially implies they do Chain-of-Thought before addressing. For the R1 series of models, this takes type as believing within a tag, asteroidsathome.net before addressing with a last summary.

R1-Zero vs R1

R1-Zero applies Reinforcement Learning (RL) straight to DeepSeek-V3-Base with no monitored fine-tuning (SFT). RL is used to optimize the design's policy to take full advantage of benefit. R1-Zero attains exceptional precision but in some cases produces confusing outputs, such as mixing numerous languages in a single response. R1 repairs that by integrating limited supervised fine-tuning and numerous RL passes, which improves both correctness and readability.

It is interesting how some languages may express certain ideas better, which leads the design to choose the most expressive language for the job.

Training Pipeline

The training pipeline that DeepSeek published in the R1 paper is tremendously interesting. It showcases how they produced such strong reasoning models, and what you can anticipate from each phase. This consists of the problems that the resulting designs from each stage have, and how they resolved it in the next stage.

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

The usual training technique: Pretraining on big dataset (train to forecast next word) to get the base design → monitored fine-tuning → preference tuning by means of RLHF R1-Zero: Pretrained → RL R1: Pretrained → Multistage training pipeline with multiple SFT and RL stages

Cold-Start Fine-Tuning: Fine-tune DeepSeek-V3-Base on a couple of thousand Chain-of-Thought (CoT) samples to guarantee the RL procedure has a good starting point. This offers an excellent design to begin RL. First RL Stage: Apply GRPO with rule-based benefits to enhance reasoning 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 action. The outcome of this step is a strong reasoning design but with weak general capabilities, e.g., poor format and language mixing. Rejection Sampling + basic data: Create new SFT information through rejection tasting on the RL checkpoint (from action 2), combined with supervised data from the DeepSeek-V3-Base model. They collected around 600k high-quality thinking samples. Second Fine-Tuning: Fine-tune DeepSeek-V3-Base again on 800k overall samples (600k reasoning + 200k basic tasks) for wider capabilities. This action led to a strong reasoning model with basic abilities. Second RL Stage: Add more reward signals (helpfulness, harmlessness) to improve the final model, in addition to the reasoning rewards. The outcome is DeepSeek-R1. They likewise did design distillation for a number of Qwen and Llama designs on the reasoning traces to get distilled-R1 models.

Model distillation is a technique where you use a teacher design to improve a trainee model by generating training data for the trainee model. The instructor is generally a larger model than the trainee.

Group Relative Policy Optimization (GRPO)

The basic concept behind utilizing reinforcement learning for LLMs is to tweak the model's policy so that it naturally produces more precise and helpful answers. They utilized a reward system that inspects not only for correctness but likewise for proper format and language consistency, so the design gradually learns to favor responses that meet these quality requirements.

In this paper, they encourage the R1 model to produce chain-of-thought reasoning through RL training with GRPO. Instead of 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 behavior of the enhanced policy.

What makes their approach particularly interesting is its dependence on straightforward, rule-based benefit functions. Instead of depending on expensive external designs or prazskypantheon.cz human-graded examples as in traditional RLHF, the RL utilized for R1 utilizes easy criteria: it may give a greater reward if the response is appropriate, if it follows the anticipated/ format, and if the language of the response matches that of the timely. Not depending on a benefit model likewise implies you do not need to hang out and effort training it, and it does not 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 prompt, the model generates various responses. 2. Each action gets a scalar reward based upon aspects like precision, format, and language consistency. 3. Rewards are adjusted relative to the group's performance, basically measuring how much better each action is compared to the others. 4. The design updates its method slightly to prefer responses with greater relative benefits. It only makes minor adjustments-using techniques like clipping and a KL penalty-to guarantee the policy does not stray too far from its original habits.

A cool element of GRPO is its versatility. You can use basic rule-based benefit functions-for instance, awarding a perk when the model properly utilizes the syntax-to guide the training.

While DeepSeek utilized GRPO, you could use alternative techniques instead (PPO or PRIME).

For those aiming to dive much deeper, Will Brown has written quite a great execution of training an LLM with RL using GRPO. GRPO has likewise currently been contributed to the Transformer Reinforcement Learning (TRL) library, which is another excellent 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 provided in their paper, I want to highlight a passage from the DeepSeekMath paper, based upon 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, simply put, it appears that the enhancement is associated to boosting the correct response from TopK rather than the improvement of essential abilities.

In other words, RL fine-tuning tends to form the output distribution so that the highest-probability outputs are more likely to be appropriate, although the general ability (as determined by the variety of appropriate answers) is mainly present in the pretrained design.

This suggests that reinforcement knowing on LLMs is more about refining and "shaping" the existing circulation of responses instead of endowing the design with entirely new abilities. Consequently, while RL methods such as PPO and GRPO can produce substantial efficiency gains, there seems a fundamental 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 huge turning point. I'm excited to see how it unfolds!

Running DeepSeek-R1

I've utilized DeepSeek-R1 through the main chat user interface for various problems, which it seems to fix well enough. The extra search performance makes it even nicer to utilize.

Interestingly, o3-mini(-high) was launched as I was composing this post. From my preliminary screening, R1 appears stronger at mathematics than o3-mini.

I likewise leased a single H100 by means of 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 test the design's capabilities.

671B through Llama.cpp

DeepSeek-R1 1.58-bit (UD-IQ1_S) quantized design 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 offered 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 local gaming setup. Digital Spaceport wrote a complete 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 designs on available hardware.

What matters most to me is a mix of effectiveness and time-to-usefulness in these designs. Since thinking models require to think before responding to, wiki.rolandradio.net their time-to-usefulness is typically greater than other designs, however their usefulness is likewise usually higher. We need to both make the most of effectiveness and minimize time-to-usefulness.

70B through 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 through Reinforcement Learning [2402.03300] DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models DeepSeek R1 - Notion (Building a totally local "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 granny - 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 create 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 matches the performance of OpenAI's o1. It presents a detailed method for training such models using large-scale support knowing techniques. DeepSeek-V3 Technical Report (December 2024) This report goes over the execution of an FP8 mixed precision training structure validated on an incredibly large-scale model, attaining both sped up training and decreased GPU memory use. DeepSeek LLM: Scaling Open-Source Language Models with Longtermism (January 2024) This paper explores scaling laws and provides findings that facilitate the scaling of massive models in open-source configurations. It presents the DeepSeek LLM task, devoted to advancing open-source language designs with a long-term 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 designs are pre-trained on a high-quality 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 provides DeepSeek-V2, a Mixture-of-Experts (MoE) language design identified by economical training and efficient inference. DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligence (June 2024) This research study presents DeepSeek-Coder-V2, surgiteams.com an open-source Mixture-of-Experts (MoE) code language model that attains efficiency comparable to GPT-4 Turbo in code-specific jobs.

Interesting events

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

  • Huggingface reveals huggingface/open-r 1: Fully open recreation of DeepSeek-R1 to R1, fully open source (Jan 25, '25). - OpenAI scientist confirms the DeepSeek team independently found and used some core ideas the OpenAI team utilized on the way 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: adelabaine0415/sheiksandwiches#71