Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
H
howtomakeamanloveyou
  • Project
    • Project
    • Details
    • Activity
    • Cycle Analytics
  • Issues 1
    • Issues 1
    • List
    • Boards
    • 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
  • Leandro Jay
  • howtomakeamanloveyou
  • Issues
  • #1

Closed
Open
Opened Feb 09, 2025 by Leandro Jay@leandrojay6935
  • 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 just does it match-or even surpass-OpenAI's o1 model in numerous benchmarks, however it also includes totally MIT-licensed weights. This marks it as the first non-OpenAI/Google design to deliver strong reasoning abilities in an open and available manner.

What makes DeepSeek-R1 especially interesting is its openness. Unlike the less-open approaches from some market leaders, DeepSeek has actually released a detailed training methodology in their paper. The design 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 typical knowledge was that much better models needed more information and compute. While that's still legitimate, models like o1 and R1 demonstrate an alternative: inference-time scaling through thinking.

The Essentials

The DeepSeek-R1 paper provided several models, 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 design, followed by massive RL. 2. Group Relative Policy Optimization (GRPO), a support learning method that depends on comparing several design outputs per timely to prevent the requirement for a separate critic.

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

R1-Zero vs R1

R1-Zero applies Reinforcement Learning (RL) straight to DeepSeek-V3-Base with no supervised fine-tuning (SFT). RL is utilized to optimize the model's policy to optimize reward. 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 minimal monitored fine-tuning and several RL passes, which improves both accuracy and readability.

It is interesting how some languages may express certain ideas better, which leads the model to choose the most expressive language for bytes-the-dust.com the task.

Training Pipeline

The training pipeline that DeepSeek published in the R1 paper is exceptionally intriguing. It showcases how they created such strong reasoning designs, and what you can anticipate from each stage. This includes the issues that the resulting designs from each phase have, and how they resolved it in the next stage.

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

The normal training method: Pretraining on large dataset (train to predict next word) to get the base model → supervised fine-tuning → choice tuning by means of RLHF R1-Zero: Pretrained → RL R1: Pretrained → Multistage training pipeline with several 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 decent starting point. This offers a good design to start RL. First RL Stage: Apply GRPO with rule-based benefits to enhance thinking correctness and format (such as forcing chain-of-thought into thinking tags). When they were near convergence in the RL process, they moved to the next action. The result of this step is a strong reasoning design but with weak basic abilities, e.g., poor formatting and language mixing. Rejection Sampling + general information: Create new SFT information through rejection sampling on the RL checkpoint (from step 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 total samples (600k reasoning + 200k basic tasks) for more comprehensive abilities. This action led to a strong reasoning model with basic capabilities. 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 several Qwen and Llama designs on the reasoning traces to get distilled-R1 designs.

Model distillation is a technique where you use an instructor surgiteams.com design to improve a trainee model by data for the trainee design. The instructor kenpoguy.com is generally a bigger design than the trainee.

Group Relative Policy Optimization (GRPO)

The standard idea behind using support learning for LLMs is to tweak the design's policy so that it naturally produces more accurate and beneficial answers. They used a reward system that examines not only for accuracy but also for correct formatting and language consistency, so the model gradually finds out to prefer responses that meet these quality criteria.

In this paper, they motivate the R1 design to generate chain-of-thought thinking through RL training with GRPO. Rather than including a different module at inference time, the training process itself nudges the model to produce detailed, detailed outputs-making the chain-of-thought an emergent behavior of the optimized policy.

What makes their method especially intriguing is its dependence on straightforward, rule-based benefit functions. Instead of depending on pricey external models or human-graded examples as in conventional RLHF, the RL used for R1 utilizes basic criteria: it might give a higher reward if the answer is appropriate, if it follows the expected/ formatting, and if the language of the answer matches that of the prompt. Not relying on a reward design also indicates you do not need to hang around and effort training it, and it doesn't take memory and calculate far from your main model.

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

1. For galgbtqhistoryproject.org each input prompt, the design produces various responses. 2. Each response receives a scalar benefit based upon elements like accuracy, format, and language consistency. 3. Rewards are adjusted relative to the group's efficiency, essentially determining just how much better each response is compared to the others. 4. The design updates its strategy somewhat to prefer actions with higher relative benefits. It only makes minor adjustments-using techniques like clipping and a KL penalty-to make sure the policy doesn't wander off too far from its original habits.

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

While DeepSeek utilized GRPO, you might utilize alternative approaches instead (PPO or PRIME).

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

Is RL on LLMs the path to AGI?

As a final 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 improves the design's overall efficiency by rendering the output distribution more robust, in other words, it appears that the enhancement is credited to increasing the proper action from TopK rather than the improvement of basic abilities.

In other words, RL fine-tuning tends to form the output circulation so that the highest-probability outputs are more likely to be correct, despite the fact that the total capability (as measured by the diversity of correct answers) is mainly present in the pretrained design.

This recommends that reinforcement learning on LLMs is more about refining and "forming" the existing circulation of actions rather than enhancing the model with completely new abilities. Consequently, while RL methods such as PPO and GRPO can produce considerable performance 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 big milestone. I'm delighted to see how it unfolds!

Running DeepSeek-R1

I've used DeepSeek-R1 by means of the main chat interface for different issues, which it appears to fix all right. The additional search functionality makes it even better to use.

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

I likewise 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 objective was to see how the design would carry out when released on a single H100 GPU-not to extensively check the model's abilities.

671B via Llama.cpp

DeepSeek-R1 1.58-bit (UD-IQ1_S) quantized model by Unsloth, it-viking.ch with a 4-bit quantized KV-cache and partial GPU offloading (29 layers running on the GPU), running by means of llama.cpp:

29 layers appeared to be the sweet spot 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 gaming setup. Digital Spaceport composed a complete guide on how to run Deepseek R1 671b fully 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 quite manageable for any major work, however it's enjoyable to run these big designs 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 answering, their time-to-usefulness is normally greater than other models, however their effectiveness is also normally greater. We need to both optimize effectiveness and decrease time-to-usefulness.

70B by means of Ollama

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

GPU utilization 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 by means of 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 reproduce o1 and islider.ru the future of thinking 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 combines multimodal understanding and generation. It can both understand and generate images. DeepSeek-R1: Incentivizing Reasoning Capability in Large Language Models through Reinforcement Learning (January 2025) This paper presents DeepSeek-R1, an open-source thinking model that measures up to the performance of OpenAI's o1. It presents a detailed approach for training such models using massive reinforcement knowing strategies. DeepSeek-V3 Technical Report (December 2024) This report discusses the execution of an FP8 combined precision training structure confirmed on an extremely massive model, attaining both sped up training and minimized 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 presents the DeepSeek LLM task, devoted 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 designs are pre-trained on a high-quality project-level code corpus and employ a fill-in-the-blank job 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 model defined by affordable training and tandme.co.uk effective reasoning. DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligence (June 2024) This research presents DeepSeek-Coder-V2, an open-source Mixture-of-Experts (MoE) code language model that attains efficiency equivalent to GPT-4 Turbo in code-specific jobs.

Interesting events

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

  • Huggingface announces huggingface/open-r 1: Fully open recreation of DeepSeek-R1 to duplicate R1, fully open source (Jan 25, '25).
  • OpenAI researcher confirms the DeepSeek group individually discovered and utilized some core concepts the OpenAI group used on the way to o1

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