Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
  • Sign in / Register
F
freesoftwareservers
  • 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
  • Garnet Medlock
  • freesoftwareservers
  • Issues
  • #1

You need to sign in or sign up before continuing.
Closed
Open
Opened Feb 11, 2025 by Garnet Medlock@garnetmedlock7
  • Report abuse
  • New issue
Report abuse New issue

Understanding DeepSeek R1


DeepSeek-R1 is an open-source language model 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 benchmarks, however it likewise includes 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 interesting is its openness. Unlike the less-open techniques from some industry leaders, DeepSeek has published a detailed training approach 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 typical wisdom was that better designs needed more data and compute. While that's still valid, designs like o1 and R1 demonstrate an option: inference-time scaling through reasoning.

The Essentials

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

1. A multi-stage pipeline where a small set of cold-start information kickstarts the model, bbarlock.com followed by massive RL. 2. Group Relative Policy Optimization (GRPO), oke.zone a reinforcement learning technique that depends on comparing numerous design outputs per prompt to avoid the requirement for a separate critic.

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

R1-Zero vs R1

R1-Zero applies Reinforcement Learning (RL) straight to DeepSeek-V3-Base with no monitored fine-tuning (SFT). RL is used to optimize the model's policy to maximize reward. R1-Zero attains outstanding precision however sometimes produces confusing outputs, such as mixing numerous languages in a single action. R1 repairs that by including restricted monitored fine-tuning and several RL passes, which improves both correctness and readability.

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

Training Pipeline

The training pipeline that DeepSeek released in the R1 paper is tremendously fascinating. It showcases how they developed such strong reasoning designs, and what you can get out of each stage. This consists of the problems that the resulting designs from each stage have, and how they fixed it in the next phase.

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

The typical training method: Pretraining on large dataset (train to predict next word) to get the base design → monitored fine-tuning → choice 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 guarantee the RL process has a decent beginning point. This gives an excellent design to begin RL. First RL Stage: Apply GRPO with rule-based rewards to enhance thinking accuracy and format (such as forcing chain-of-thought into thinking tags). When they were near convergence in the RL process, they relocated to the next action. The outcome of this action is a strong reasoning design but with weak general abilities, e.g., bad formatting and language blending. Rejection Sampling + general data: Create brand-new SFT data through rejection sampling on the RL checkpoint (from action 2), integrated with supervised data from the DeepSeek-V3-Base model. They collected around 600k high-quality reasoning samples. Second Fine-Tuning: Fine-tune DeepSeek-V3-Base again on 800k overall samples (600k reasoning + 200k basic tasks) for more comprehensive abilities. This step resulted in a strong thinking model with basic capabilities. Second RL Stage: Add more benefit signals (helpfulness, addsub.wiki harmlessness) to refine the last model, in addition to the reasoning benefits. The result is DeepSeek-R1. They likewise did design distillation for a number of Qwen and Llama models on the thinking traces to get distilled-R1 models.

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

Group Relative Policy Optimization (GRPO)

The fundamental idea behind utilizing support knowing for LLMs is to tweak the design's policy so that it naturally produces more precise and helpful answers. They used a benefit system that examines not just for accuracy but also for appropriate formatting and language consistency, so the design gradually finds out to favor reactions that meet these quality requirements.

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

What makes their approach particularly interesting is its reliance on straightforward, rule-based reward functions. Instead of depending upon expensive external models or human-graded examples as in standard RLHF, the RL utilized for R1 utilizes simple criteria: it may provide a higher 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 benefit design also suggests you don't have to invest time and effort training it, and it doesn't 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 produces different actions. 2. Each reaction gets a scalar reward based upon aspects like accuracy, formatting, and language consistency. 3. Rewards are adjusted relative to the group's efficiency, essentially measuring just how much better each response is compared to the others. 4. The model updates its strategy slightly to favor actions with higher relative benefits. It just makes slight 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 flexibility. You can use basic rule-based reward functions-for circumstances, awarding a benefit when the design correctly uses the syntax-to guide the training.

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

For those aiming to dive deeper, Will Brown has composed rather a good execution of training an LLM with RL using GRPO. GRPO has actually also currently been contributed to the Transformer Reinforcement Learning (TRL) library, which is another excellent resource. Finally, Yannic Kilcher has a fantastic 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 methods 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 enhances the design's overall efficiency by rendering the output circulation more robust, simply put, it seems that the enhancement is attributed to improving the proper reaction from TopK rather than the enhancement of fundamental abilities.

In other words, RL fine-tuning tends to form the output distribution so that the highest-probability outputs are more likely to be proper, bybio.co even though the overall ability (as measured by the variety of proper responses) is mainly present in the pretrained model.

This suggests that support knowing on LLMs is more about refining and "forming" the existing circulation of actions rather than endowing the model with entirely new abilities. Consequently, while RL techniques such as PPO and GRPO can produce substantial efficiency gains, wiki.asexuality.org there appears to be an intrinsic ceiling determined by the underlying design's pretrained understanding.

It is uncertain to me how far RL will take us. Perhaps it will be the stepping stone to the next big turning point. I'm delighted to see how it unfolds!

Running DeepSeek-R1

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

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

I also leased a single H100 through 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 perform when released on a single H100 GPU-not to extensively test the design's abilities.

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

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

Performance:

A r/localllama user explained that they were able to get over 2 tok/sec with DeepSeek R1 671B, without utilizing their GPU on their local video gaming setup. Digital Spaceport composed a complete 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 rather manageable for any severe work, but it's enjoyable to run these large designs on available hardware.

What matters most to me is a combination of effectiveness and time-to-usefulness in these models. Since reasoning designs require to believe before addressing, their time-to-usefulness is usually higher than other designs, however their usefulness is also usually greater. We require to both optimize effectiveness and lessen 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 expected when compared to the mainly CPU-powered run of 671B that I showcased above.

Resources

DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning [2402.03300] DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models DeepSeek R1 - Notion (Building a fully regional "deep researcher" with DeepSeek-R1 - YouTube). DeepSeek R1's recipe to duplicate 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 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 an unique autoregressive structure that combines 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 provides a detailed method for training such designs using massive support learning methods. DeepSeek-V3 Technical Report (December 2024) This report goes over the execution of an FP8 blended accuracy training framework verified on an incredibly large-scale design, attaining both accelerated training and lowered GPU memory use. DeepSeek LLM: Scaling Open-Source Language Models with Longtermism (January 2024) This paper dives into scaling laws and provides findings that assist in the scaling of large-scale designs in open-source setups. It presents the DeepSeek LLM project, committed to advancing open-source language models 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 study presents the DeepSeek-Coder series, a series of open-source code models trained from scratch on 2 trillion tokens. The models are pre-trained on a top quality project-level code corpus and use 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, setiathome.berkeley.edu a Mixture-of-Experts (MoE) language model defined by economical training and effective 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 model that attains performance similar to GPT-4 Turbo in code-specific jobs.

Interesting occasions

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

  • Huggingface reveals huggingface/open-r 1: Fully open reproduction of DeepSeek-R1 to R1, fully open source (Jan 25, '25).
  • OpenAI researcher confirms the DeepSeek team individually found and used some core ideas the OpenAI group utilized 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: garnetmedlock7/freesoftwareservers#1