Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
  • Sign in / Register
J
joblink
  • 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
  • Brent Fremont
  • joblink
  • Issues
  • #1

Closed
Open
Opened Feb 10, 2025 by Brent Fremont@brentq7377841
  • Report abuse
  • New issue
Report abuse New issue

Understanding DeepSeek R1


DeepSeek-R1 is an open-source language model developed on DeepSeek-V3-Base that's been making waves in the AI neighborhood. Not just does it match-or even surpass-OpenAI's o1 design in lots of criteria, however it also includes totally MIT-licensed weights. This marks it as the first non-OpenAI/Google model to provide strong thinking capabilities in an open and available way.

What makes DeepSeek-R1 especially exciting is its transparency. Unlike the less-open approaches from some market leaders, DeepSeek has actually published a detailed training methodology in their paper. The design is also remarkably cost-efficient, demo.qkseo.in with 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 much better designs needed more data and calculate. While that's still valid, models like o1 and R1 demonstrate an alternative: inference-time scaling through thinking.

The Essentials

The DeepSeek-R1 paper presented multiple models, however 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 two major concepts:

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 multiple design outputs per timely to avoid the requirement for a separate critic.

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

R1-Zero vs R1

R1-Zero applies Reinforcement Learning (RL) straight to DeepSeek-V3-Base without any supervised fine-tuning (SFT). RL is used to optimize the model's policy to maximize benefit. R1-Zero attains excellent accuracy however sometimes produces complicated outputs, such as mixing multiple languages in a single response. R1 repairs that by integrating minimal monitored fine-tuning and numerous RL passes, which improves both accuracy and readability.

It is fascinating how some languages might express certain concepts better, which leads the model to choose the most meaningful language for the job.

Training Pipeline

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

It's fascinating that their training pipeline differs from the usual:

The typical training technique: wiki.vst.hs-furtwangen.de Pretraining on big dataset (train to forecast next word) to get the base model → monitored fine-tuning → choice tuning via 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 guarantee the RL process has a good beginning point. This offers a good model to begin RL. First RL Stage: Apply GRPO with rule-based benefits to improve reasoning accuracy and format (such as requiring chain-of-thought into believing tags). When they were near convergence in the RL procedure, they moved to the next step. The outcome of this step is a strong thinking design but with weak general capabilities, e.g., bad format and language blending. Rejection Sampling + general information: Create brand-new SFT data through rejection sampling on the RL checkpoint (from action 2), combined with supervised data from the DeepSeek-V3-Base design. They gathered around 600k high-quality reasoning samples. Second Fine-Tuning: Fine-tune DeepSeek-V3-Base again on 800k total samples (600k reasoning + 200k basic jobs) 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 fine-tune the last model, in addition to the thinking rewards. The result is DeepSeek-R1. They also did design distillation for several Qwen and Llama models on the reasoning traces to get distilled-R1 models.

Model distillation is a method where you use an instructor design to enhance a trainee model by creating training information for the trainee model. The instructor is usually a larger design than the trainee.

Group Relative Policy Optimization (GRPO)

The standard idea behind utilizing support learning for LLMs is to fine-tune the model's policy so that it naturally produces more precise and helpful responses. They utilized a benefit system that inspects not just for accuracy however likewise for correct formatting and language consistency, so the design slowly finds out to prefer reactions that satisfy these quality criteria.

In this paper, they motivate the R1 design to produce chain-of-thought reasoning through RL training with GRPO. Instead of adding a different module at inference time, the training process itself pushes the design to produce detailed, detailed outputs-making the chain-of-thought an emerging habits of the optimized policy.

What makes their method particularly interesting is its dependence on straightforward, rule-based reward functions. Instead of depending on costly external designs or human-graded examples as in conventional RLHF, the RL used for R1 uses easy criteria: it may offer a greater reward if the response is correct, if it follows the anticipated/ format, and if the language of the answer matches that of the prompt. Not counting on a reward design also indicates you do not have to hang out and effort training it, and it does not take memory and compute away from your main model.

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

1. For each input prompt, the model produces various responses. 2. Each action gets a scalar reward based on elements like accuracy, format, and language consistency. 3. Rewards are changed relative to the group's efficiency, basically determining just how much better each action is compared to the others. 4. The model updates its technique a little to prefer responses with higher relative advantages. It just makes small adjustments-using methods like clipping and a KL penalty-to ensure the policy doesn't stray too far from its original habits.

A cool element of GRPO is its versatility. You can utilize basic rule-based reward functions-for circumstances, granting a bonus offer when the model 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 actually composed rather a nice application of training an LLM with RL using GRPO. GRPO has actually also already been added to the Transformer Reinforcement Learning (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 final note on explaining DeepSeek-R1 and the approaches they've presented 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 suggest that RL boosts the design's overall performance by rendering the output circulation more robust, in other words, it appears that the improvement is associated to improving the proper reaction from TopK instead of the enhancement of basic capabilities.

Simply put, RL fine-tuning tends to form the output circulation so that the highest-probability outputs are most likely to be right, even though the general ability (as measured by the variety of proper responses) is mainly present in the pretrained design.

This recommends that reinforcement learning on LLMs is more about refining and "shaping" the existing distribution of actions instead of enhancing the model with totally brand-new abilities. Consequently, while RL strategies such as PPO and GRPO can produce considerable performance gains, there appears to be an inherent ceiling determined 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 huge turning point. I'm thrilled to see how it unfolds!

Running DeepSeek-R1

I've utilized DeepSeek-R1 by means of the main chat user interface for numerous problems, which it appears to resolve well enough. The additional search functionality makes it even nicer to use.

Interestingly, o3-mini(-high) was launched as I was composing this post. From my initial screening, R1 seems 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 model would perform when deployed on a single H100 GPU-not to thoroughly check the model's abilities.

671B through 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 running on the GPU), running by means of llama.cpp:

29 layers appeared to be the sweet spot provided 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 local video 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 quite manageable for any severe work, but it's enjoyable to run these big models on available hardware.

What matters most to me is a combination of effectiveness and time-to-usefulness in these models. Since thinking models require to believe before answering, their time-to-usefulness is normally higher than other models, but their usefulness is also normally greater. We need to both optimize usefulness and decrease time-to-usefulness.

70B via Ollama

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

GPU utilization 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 fully local "deep scientist" with DeepSeek-R1 - YouTube). DeepSeek R1's dish 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 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 structure that merges multimodal understanding and generation. It can both understand and generate images. DeepSeek-R1: Incentivizing Reasoning Capability in Large Language Models by means of Reinforcement Learning (January 2025) This paper introduces DeepSeek-R1, an open-source reasoning design that equals the performance of OpenAI's o1. It presents a detailed method for training such models utilizing large-scale reinforcement knowing strategies. DeepSeek-V3 Technical Report (December 2024) This report goes over the application of an FP8 combined accuracy training framework verified on an exceptionally massive model, attaining both accelerated training and decreased GPU memory use. DeepSeek LLM: Scaling Open-Source Language Models with Longtermism (January 2024) This paper looks into scaling laws and presents findings that assist in the scaling of massive designs in open-source configurations. It presents the DeepSeek LLM project, committed to advancing open-source language models with a long-term viewpoint. DeepSeek-Coder: When the Large Language Model Meets Programming-The Rise of Code Intelligence (January 2024) This research introduces the DeepSeek-Coder series, a range of open-source code designs trained from scratch on 2 trillion tokens. The designs are pre-trained on a top quality 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 presents DeepSeek-V2, a Mixture-of-Experts (MoE) language model defined by economical training and efficient inference. DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligence (June 2024) This research study introduces DeepSeek-Coder-V2, an open-source Mixture-of-Experts (MoE) code language model that attains efficiency similar to GPT-4 Turbo in code-specific tasks.

Interesting events

- Hong Kong University duplicates R1 outcomes (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 verifies the DeepSeek group individually found and utilized some core concepts the OpenAI group used en route to o1

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