Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
  • Sign in / Register
T
trojanhorse
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 1
    • Issues 1
    • List
    • Boards
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Analytics
    • Analytics
    • CI / CD
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Create a new issue
  • Jobs
  • Issue Boards
  • Nelson Stepp
  • trojanhorse
  • Issues
  • #1

Closed
Open
Opened 5 months ago by Nelson Stepp@nelsonstepp28
  • Report abuse
  • New issue
Report abuse New issue

Understanding DeepSeek R1


DeepSeek-R1 is an open-source language design constructed on DeepSeek-V3-Base that's been making waves in the AI community. Not just does it match-or even surpass-OpenAI's o1 design in numerous benchmarks, however it likewise comes with completely MIT-licensed weights. This marks it as the very first non-OpenAI/Google design to provide strong thinking capabilities in an open and available way.

What makes DeepSeek-R1 especially interesting is its transparency. Unlike the less-open methods from some market leaders, setiathome.berkeley.edu DeepSeek has released a detailed training method in their paper. The design is also incredibly 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 much better models needed more information and calculate. While that's still valid, models like o1 and R1 show an option: coastalplainplants.org inference-time scaling through reasoning.

The Essentials

The DeepSeek-R1 paper presented numerous models, however main amongst them were R1 and R1-Zero. Following these are a series of distilled models that, while intriguing, I won't go over here.

DeepSeek-R1 utilizes 2 significant ideas:

1. A multi-stage pipeline where a little set of cold-start data kickstarts the design, followed by large-scale RL. 2. Group Relative Policy Optimization (GRPO), a support knowing technique that counts on comparing several design outputs per prompt to avoid the need for a separate critic.

R1 and R1-Zero are both reasoning models. This basically means they do Chain-of-Thought before responding to. For the R1 series of models, this takes kind 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 supervised fine-tuning (SFT). RL is used to enhance the design's policy to make the most of reward. R1-Zero attains exceptional accuracy however sometimes produces confusing outputs, such as mixing several languages in a single reaction. R1 repairs that by incorporating limited supervised fine-tuning and multiple 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 published in the R1 paper is profoundly intriguing. It showcases how they produced such strong reasoning designs, and what you can anticipate from each phase. This consists of 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 typical:

The typical training method: Pretraining on big dataset (train to anticipate next word) to get the base model → monitored fine-tuning → preference tuning through RLHF R1-Zero: Pretrained → RL R1: Pretrained → Multistage training pipeline with numerous SFT and RL stages

Cold-Start Fine-Tuning: Fine-tune DeepSeek-V3-Base on a couple of thousand Chain-of-Thought (CoT) samples to ensure the RL process has a good starting point. This gives a good model to begin RL. First RL Stage: Apply GRPO with rule-based rewards to enhance thinking correctness and formatting (such as forcing chain-of-thought into thinking tags). When they were near merging in the RL procedure, they relocated to the next action. The result of this step is a strong thinking design but with weak general abilities, e.g., bad format and language blending. Rejection Sampling + basic information: Create brand-new SFT data through rejection sampling on the RL checkpoint (from step 2), integrated with monitored information from the DeepSeek-V3-Base design. They gathered around 600k premium reasoning samples. Second Fine-Tuning: Fine-tune DeepSeek-V3-Base again on 800k overall samples (600k reasoning + 200k general tasks) for broader capabilities. This action resulted in a strong reasoning model with general abilities. Second RL Stage: Add more benefit signals (helpfulness, harmlessness) to improve the final model, in addition to the thinking rewards. The result is DeepSeek-R1. They likewise did model distillation for several Qwen and Llama designs on the thinking traces to get distilled-R1 models.

Model distillation is a method where you utilize a teacher model to improve a trainee model by creating training information for the trainee design. The teacher is typically a bigger model 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 precise and useful responses. They utilized a reward system that inspects not only for accuracy but also for proper formatting and language consistency, so the design gradually finds out to favor 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. Instead of adding a separate module at reasoning time, the training process itself pushes the design to produce detailed, detailed outputs-making the chain-of-thought an emergent habits of the enhanced policy.

What makes their method particularly interesting is its dependence on straightforward, rule-based reward functions. Instead of depending on pricey external models or human-graded examples as in conventional RLHF, the RL utilized for R1 utilizes simple requirements: it may provide a greater benefit if the response is correct, if it follows the expected/ format, and if the language of the answer matches that of the prompt. Not relying on a benefit design also means you do not have to spend time and effort training it, and it does not take memory and compute away from your main design.

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

1. For each input timely, the design generates various actions. 2. Each action gets a scalar reward based on aspects like accuracy, format, and language consistency. 3. Rewards are changed relative to the group's performance, basically measuring just how much better each response is compared to the others. 4. The model updates its technique slightly to favor responses with greater relative advantages. It only makes minor adjustments-using methods like clipping and a KL penalty-to ensure the policy does not wander off too far from its original habits.

A cool element of GRPO is its flexibility. You can utilize simple rule-based reward functions-for instance, awarding a reward when the design correctly utilizes the syntax-to guide the training.

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

For those aiming to dive deeper, Will Brown has actually composed rather a good implementation of training an LLM with RL using GRPO. GRPO has also already been contributed to the Transformer Reinforcement (TRL) library, which is another great resource. Finally, Yannic Kilcher has a terrific 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 have actually 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 enhances the design's general performance by rendering the output circulation more robust, in other words, it appears that the enhancement is associated to increasing the appropriate reaction from TopK rather than the enhancement of essential abilities.

Simply put, RL fine-tuning tends to form the output circulation so that the highest-probability outputs are most likely to be appropriate, despite the fact that the total capability (as measured by the diversity of appropriate answers) is mainly present in the pretrained model.

This suggests that reinforcement learning on LLMs is more about refining and "forming" the existing circulation of reactions rather than endowing the model with entirely brand-new abilities. Consequently, while RL strategies such as PPO and GRPO can produce substantial efficiency gains, there appears to be an inherent ceiling determined by the underlying model'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 thrilled to see how it unfolds!

Running DeepSeek-R1

I have actually used DeepSeek-R1 via the main chat user interface for various problems, which it appears to solve all right. The extra search functionality makes it even nicer to utilize.

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

I likewise rented a single H100 by means of Lambda Labs for $2/h (26 CPU cores, 214.7 GB RAM, experienciacortazar.com.ar 1.1 TB SSD) to run some experiments. The main objective was to see how the design would perform when deployed on a single H100 GPU-not to thoroughly evaluate the model's abilities.

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 through llama.cpp:

29 layers appeared to be the sweet area offered this configuration.

Performance:

A r/localllama user explained that they had the ability to get over 2 tok/sec with DeepSeek R1 671B, without utilizing their GPU on their local video gaming setup. Digital Spaceport wrote a complete guide on how to run Deepseek R1 671b fully 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 quite bearable for any major work, but it's enjoyable to run these big designs on available hardware.

What matters most to me is a mix of effectiveness and time-to-usefulness in these models. Since reasoning designs require to believe before responding to, their time-to-usefulness is generally greater than other designs, but their usefulness is also generally higher. We require 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 by means of Ollama:

GPU utilization soars 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 recipe 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 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 framework that merges multimodal understanding and generation. It can both understand and generate images. DeepSeek-R1: Incentivizing Reasoning Capability in Large Language Models via Reinforcement Learning (January 2025) This paper introduces DeepSeek-R1, an open-source reasoning model that rivals the performance of OpenAI's o1. It provides a detailed approach for training such designs using massive reinforcement knowing strategies. DeepSeek-V3 Technical Report (December 2024) This report goes over the implementation of an FP8 combined accuracy training structure validated on an exceptionally massive model, attaining both accelerated training and minimized GPU memory usage. DeepSeek LLM: Scaling Open-Source Language Models with Longtermism (January 2024) This paper looks into scaling laws and provides findings that assist in the scaling of massive designs in open-source setups. It introduces the DeepSeek LLM job, dedicated 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 study introduces the DeepSeek-Coder series, a series of open-source code models trained from scratch on 2 trillion tokens. The designs are pre-trained on a premium project-level code corpus and employ a fill-in-the-blank task 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 model identified by affordable training and efficient inference. 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 efficiency similar to GPT-4 Turbo in code-specific jobs.

Interesting occasions

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

  • Huggingface announces huggingface/open-r 1: Fully open recreation of DeepSeek-R1 to reproduce R1, completely open source (Jan 25, '25).
  • OpenAI researcher validates the DeepSeek team independently discovered and used some core concepts the OpenAI group utilized en route to o1

    Liked this post? Join the newsletter.

Please solve the reCAPTCHA

We want to be sure it is you, please confirm you are not a robot.

  • Discussion 0
  • Designs
  • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
Please register or sign in to reply
0 Assignees
Assign to
None
Milestone
None
Assign milestone
None
Time tracking
No estimate or time spent
None
Due date
None
0
Labels
None
Assign labels
  • View project labels
Confidentiality
Not confidential
Lock issue
Unlocked
participants
Reference: nelsonstepp28/trojanhorse#1