Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A aquahubkenya
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1
    • Issues 1
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Joy Galvin
  • aquahubkenya
  • Issues
  • #1

Closed
Open
Created Feb 10, 2025 by Joy Galvin@joygalvin59428Maintainer

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 just does it match-or even surpass-OpenAI's o1 design in many criteria, but it likewise features totally MIT-licensed weights. This marks it as the first non-OpenAI/Google design to provide strong thinking abilities in an open and available manner.

What makes DeepSeek-R1 especially exciting is its openness. Unlike the less-open methods from some market leaders, DeepSeek has released a detailed training methodology in their paper. The model is also remarkably economical, 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 designs required more data and calculate. While that's still legitimate, oke.zone models like o1 and R1 show an alternative: inference-time scaling through thinking.

The Essentials

The DeepSeek-R1 paper provided numerous designs, but main among them were R1 and R1-Zero. Following these are a series of distilled designs that, while intriguing, I will not go over here.

DeepSeek-R1 utilizes two 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 knowing technique that relies on comparing numerous model outputs per timely to avoid the need for a different critic.

R1 and R1-Zero are both thinking designs. This essentially suggests they do Chain-of-Thought before responding to. For the R1 series of designs, this takes form 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 monitored fine-tuning (SFT). RL is utilized to enhance the model's policy to optimize benefit. R1-Zero attains exceptional accuracy but often produces confusing outputs, such as blending numerous languages in a single action. R1 repairs that by integrating minimal monitored fine-tuning and numerous RL passes, which improves both correctness and readability.

It is fascinating how some languages might reveal certain ideas better, which leads the model to select the most meaningful language for the task.

Training Pipeline

The training pipeline that DeepSeek released in the R1 paper is immensely interesting. It showcases how they developed such strong thinking models, and what you can get out of each stage. This consists of the issues that the resulting designs from each stage have, and how they solved it in the next phase.

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

The typical training strategy: Pretraining on large dataset (train to predict next word) to get the base model → monitored fine-tuning → preference tuning by means of 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 design to start RL. First RL Stage: Apply GRPO with rule-based rewards to enhance thinking correctness and formatting (such as requiring chain-of-thought into believing tags). When they were near convergence in the RL process, they relocated to the next action. The outcome of this step is a strong thinking model but with weak basic abilities, e.g., poor format and language mixing. Rejection Sampling + general data: Create brand-new SFT data through rejection tasting on the RL checkpoint (from step 2), combined with monitored information from the DeepSeek-V3-Base design. They collected around 600k top quality reasoning samples. Second Fine-Tuning: archmageriseswiki.com Fine-tune DeepSeek-V3-Base again on 800k overall samples (600k thinking + 200k basic jobs) for wider abilities. This action led to a strong reasoning model with basic abilities. Second RL Stage: Add more reward signals (helpfulness, harmlessness) to improve the last model, in addition to the reasoning rewards. The result 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 utilize an instructor model to improve a trainee design by producing training information for the trainee design. The instructor is normally a bigger model than the trainee.

Group Relative Policy Optimization (GRPO)

The standard concept behind utilizing reinforcement learning for LLMs is to tweak the design's policy so that it naturally produces more accurate and useful responses. They used a benefit system that inspects not only for accuracy however also for correct format and language consistency, so the model slowly discovers to favor actions that fulfill these quality criteria.

In this paper, they motivate the R1 design to create chain-of-thought thinking 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 emerging habits of the enhanced policy.

What makes their technique particularly interesting is its dependence on straightforward, rule-based reward functions. Instead of depending upon pricey external designs or human-graded examples as in standard RLHF, the RL used for R1 utilizes basic criteria: it may give a greater benefit if the response is appropriate, if it follows the expected/ formatting, and if the language of the answer matches that of the prompt. Not counting on a reward model likewise means you don't have to hang around and effort training it, and coastalplainplants.org 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 timely, the model creates different responses. 2. Each response gets a scalar reward based upon elements like accuracy, formatting, and language consistency. 3. Rewards are changed relative to the group's efficiency, essentially determining how much better each action is compared to the others. 4. The design updates its method slightly to favor reactions with greater relative benefits. It just makes minor adjustments-using techniques like clipping and a KL penalty-to guarantee the policy doesn't wander off too far from its original behavior.

A cool aspect of GRPO is its flexibility. You can utilize basic rule-based reward functions-for annunciogratis.net instance, awarding a benefit when the model correctly utilizes the syntax-to guide the training.

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

For those aiming to dive much deeper, Will Brown has composed quite a great execution of training an LLM with RL using GRPO. GRPO has also currently been included to the Transformer Reinforcement Learning (TRL) library, which is another great resource. Finally, Yannic Kilcher has a great 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 approaches they've provided in their paper, I desire to highlight a passage from the DeepSeekMath paper, based upon a point Yannic Kilcher made in his video.

These findings indicate that RL enhances the design's total efficiency by rendering the output distribution more robust, in other words, it appears that the enhancement is attributed to increasing the proper response from TopK instead of the improvement of essential capabilities.

In other words, coastalplainplants.org RL fine-tuning tends to form the output circulation so that the highest-probability outputs are more likely to be right, although the general ability (as measured by the variety of proper responses) is mainly present in the pretrained model.

This recommends that support learning on LLMs is more about refining and "forming" the existing distribution of reactions rather than enhancing the model with totally new capabilities. Consequently, while RL techniques such as PPO and GRPO can produce substantial performance gains, there seems a fundamental ceiling figured out 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 excited to see how it unfolds!

Running DeepSeek-R1

I've utilized DeepSeek-R1 via the main chat user interface for different problems, which it appears to fix well enough. The extra search functionality makes it even better to use.

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

I also 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 goal was to see how the design would carry out when deployed on a single H100 GPU-not to thoroughly test the design's capabilities.

671B by means of 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 through llama.cpp:

29 layers seemed to be the sweet area offered this setup.

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 full guide on how to run Deepseek R1 671b totally 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 bearable for any serious work, but it's enjoyable to run these big designs on available hardware.

What matters most to me is a mix of usefulness and users.atw.hu time-to-usefulness in these designs. Since thinking designs need to believe before addressing, their time-to-usefulness is typically greater than other models, but their effectiveness is also normally higher. We need to both optimize effectiveness and lessen 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 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 regional "deep scientist" with DeepSeek-R1 - YouTube). DeepSeek R1's dish to replicate 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 an unique autoregressive framework 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 presents DeepSeek-R1, an open-source reasoning model that equals the efficiency of OpenAI's o1. It presents a detailed method for training such models using massive support learning techniques. DeepSeek-V3 Technical Report (December 2024) This report discusses the execution of an FP8 blended accuracy training structure validated on an incredibly large-scale model, attaining both accelerated training and lowered GPU memory use. DeepSeek LLM: Scaling Open-Source Language Models with Longtermism (January 2024) This paper explores scaling laws and presents findings that help with the scaling of large-scale designs in open-source setups. It introduces the DeepSeek LLM project, devoted to advancing open-source language designs with a long-term perspective. DeepSeek-Coder: When the Large Language Model Meets Programming-The Rise of Code Intelligence (January 2024) This research introduces 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 top 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 characterized 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 equivalent to GPT-4 Turbo in code-specific jobs.

Interesting occasions

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

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

    Liked this post? Join the newsletter.
Assignee
Assign to
Time tracking