Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Submit feedback
    • Contribute to GitLab
  • Sign in
W
webdesign-finder
  • 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
  • Clint Bronson
  • webdesign-finder
  • Issues
  • #1

Closed
Open
Opened Feb 09, 2025 by Clint Bronson@clint92a877867
  • Report abuse
  • New issue
Report abuse New issue

Understanding DeepSeek R1


DeepSeek-R1 is an open-source language design 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 criteria, however it likewise comes with completely MIT-licensed weights. This marks it as the first non-OpenAI/Google model to provide strong reasoning abilities in an open and available way.

What makes DeepSeek-R1 especially amazing 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 remarkably cost-efficient, 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 wisdom was that much better designs needed more information and calculate. While that's still valid, designs like o1 and R1 demonstrate an option: inference-time scaling through thinking.

The Essentials

The DeepSeek-R1 paper presented numerous models, however main among them were R1 and R1-Zero. Following these are a series of distilled models that, while fascinating, I will not go over here.

DeepSeek-R1 utilizes two major concepts:

1. A multi-stage pipeline where a small set of cold-start data kickstarts the model, followed by massive RL. 2. Group Relative Policy Optimization (GRPO), a reinforcement knowing technique that counts on comparing numerous model outputs per timely to avoid the requirement for a separate critic.

R1 and R1-Zero are both thinking designs. This essentially implies they do Chain-of-Thought before responding to. For the R1 series of models, this takes form as thinking within a tag, before addressing 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 enhance the model's policy to take full advantage of reward. R1-Zero attains excellent precision however sometimes produces complicated outputs, such as blending multiple languages in a single action. R1 repairs that by incorporating restricted monitored fine-tuning and several RL passes, wiki.dulovic.tech which improves both accuracy and readability.

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

Training Pipeline

The training pipeline that DeepSeek released in the R1 paper is tremendously fascinating. It showcases how they produced such strong thinking designs, and what you can anticipate from each phase. This includes the problems that the resulting designs from each phase have, and how they resolved it in the next phase.

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

The usual training method: Pretraining on large dataset (train to predict next word) to get the base model → supervised fine-tuning → preference tuning through 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 few thousand Chain-of-Thought (CoT) samples to make sure the RL process has a good starting point. This gives a good model to start RL. First RL Stage: Apply GRPO with rule-based benefits to enhance thinking accuracy and format (such as requiring chain-of-thought into believing tags). When they were near merging in the RL procedure, they transferred to the next step. The outcome of this step is a strong reasoning design but with weak general abilities, e.g., bad format and language mixing. Rejection Sampling + general data: Create new SFT information through rejection tasting on the RL checkpoint (from action 2), integrated with monitored information from the DeepSeek-V3-Base model. They gathered around 600k premium thinking samples. Second Fine-Tuning: Fine-tune DeepSeek-V3-Base again on 800k total samples (600k reasoning + 200k basic jobs) for wider abilities. This step resulted in a strong reasoning model with general capabilities. Second RL Stage: Add more reward signals (helpfulness, harmlessness) to improve the last design, in addition to the reasoning benefits. The outcome is DeepSeek-R1. They likewise did model distillation for numerous Qwen and Llama designs on the reasoning traces to get distilled-R1 models.

Model distillation is a strategy where you use a teacher design to enhance a trainee design by generating training information for the trainee design. The teacher is typically a larger model than the trainee.

Group Relative Policy Optimization (GRPO)

The standard idea behind utilizing reinforcement learning for LLMs is to fine-tune the model's policy so that it naturally produces more precise and beneficial answers. They used a benefit system that checks not only for accuracy but also for proper format and language consistency, so the design gradually learns to prefer reactions that satisfy these quality requirements.

In this paper, trademarketclassifieds.com they encourage the R1 model to produce chain-of-thought reasoning through RL training with GRPO. Instead of including a different module at inference time, the training process itself nudges the design to produce detailed, detailed outputs-making the chain-of-thought an emergent behavior of the optimized policy.

What makes their technique especially intriguing is its reliance on straightforward, rule-based reward functions. Instead of depending on costly external designs or human-graded examples as in traditional RLHF, the RL used for R1 uses simple requirements: it might give a higher benefit if the response is right, if it follows the anticipated/ format, and if the language of the answer matches that of the prompt. Not counting on a benefit design likewise indicates you do not need to spend time and effort training it, and it doesn't take memory and compute far from your main design.

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

1. For each input prompt, the design produces different reactions. 2. Each action receives a scalar benefit based upon aspects like precision, format, and language consistency. 3. Rewards are changed relative to the group's efficiency, essentially determining how much better each reaction is compared to the others. 4. The design updates its strategy a little to prefer reactions with higher relative benefits. It just makes minor adjustments-using strategies like clipping and a KL penalty-to ensure the policy does not wander off too far from its initial behavior.

A cool aspect of GRPO is its versatility. You can use easy rule-based reward functions-for instance, granting a benefit when the model properly uses the syntax-to guide the training.

While DeepSeek used GRPO, you might use 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 also currently been contributed to the Transformer Reinforcement Learning (TRL) library, which is another great resource. Finally, Yannic Kilcher has an excellent 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 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 boosts the model's total efficiency by rendering the output distribution more robust, in other words, it appears that the enhancement is credited to increasing the correct response from TopK rather than the improvement of fundamental capabilities.

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

This suggests that support learning on LLMs is more about refining and "shaping" the existing distribution of actions rather than enhancing the model with totally new abilities. Consequently, while RL methods such as PPO and GRPO can produce considerable efficiency gains, there seems a fundamental ceiling identified 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 big milestone. I'm delighted to see how it unfolds!

Running DeepSeek-R1

I have actually utilized DeepSeek-R1 via the main chat user interface for numerous problems, which it seems to fix well enough. The extra search functionality makes it even better to utilize.

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

I also 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 goal was to see how the model would carry out 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 operating on the GPU), running via 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 gaming setup. Digital Spaceport composed a full guide on how to run Deepseek R1 671b completely 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 manageable for any major work, however it's fun to run these big designs on available hardware.

What matters most to me is a combination of usefulness and time-to-usefulness in these models. Since thinking designs need to think before answering, their time-to-usefulness is generally greater than other designs, however their effectiveness is likewise normally higher. We need to both maximize usefulness and decrease time-to-usefulness.

70B through Ollama

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

GPU utilization shoots up here, as anticipated when 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 fully local "deep researcher" with DeepSeek-R1 - YouTube). DeepSeek R1's recipe to replicate o1 and 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 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 an unique autoregressive structure that combines multimodal understanding and generation. It can both comprehend and create 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 measures up to the efficiency of OpenAI's o1. It presents a detailed method for training such designs using large-scale support learning methods. DeepSeek-V3 Technical Report (December 2024) This report goes over the application of an FP8 blended accuracy training structure confirmed on a very massive model, attaining both sped up training and minimized GPU memory usage. DeepSeek LLM: iuridictum.pecina.cz Scaling Open-Source Language Models with Longtermism (January 2024) This paper delves into scaling laws and presents findings that help with the scaling of massive designs in open-source configurations. It presents the DeepSeek LLM job, devoted to advancing open-source language designs with a long-lasting 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, engel-und-waisen.de 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 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 characterized by economical 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 model that attains performance comparable to GPT-4 Turbo in code-specific jobs.

Interesting events

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

  • Huggingface announces huggingface/open-r 1: Fully open recreation of DeepSeek-R1 to replicate R1, completely open source (Jan 25, '25).
  • OpenAI researcher validates the DeepSeek group individually found and used some core concepts the OpenAI team utilized 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: clint92a877867/webdesign-finder#1