Instructions to use deepseek-ai/DeepSeek-R1-Distill-Llama-70B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use deepseek-ai/DeepSeek-R1-Distill-Llama-70B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="deepseek-ai/DeepSeek-R1-Distill-Llama-70B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("deepseek-ai/DeepSeek-R1-Distill-Llama-70B") model = AutoModelForCausalLM.from_pretrained("deepseek-ai/DeepSeek-R1-Distill-Llama-70B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use deepseek-ai/DeepSeek-R1-Distill-Llama-70B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "deepseek-ai/DeepSeek-R1-Distill-Llama-70B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "deepseek-ai/DeepSeek-R1-Distill-Llama-70B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/deepseek-ai/DeepSeek-R1-Distill-Llama-70B
- SGLang
How to use deepseek-ai/DeepSeek-R1-Distill-Llama-70B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "deepseek-ai/DeepSeek-R1-Distill-Llama-70B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "deepseek-ai/DeepSeek-R1-Distill-Llama-70B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "deepseek-ai/DeepSeek-R1-Distill-Llama-70B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "deepseek-ai/DeepSeek-R1-Distill-Llama-70B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use deepseek-ai/DeepSeek-R1-Distill-Llama-70B with Docker Model Runner:
docker model run hf.co/deepseek-ai/DeepSeek-R1-Distill-Llama-70B
Upload model files and documentation
#26
by Jiaao - opened
- LICENSE +2 -2
- README.md +51 -216
- config.json +7 -19
- figures/benchmark.jpg +0 -0
LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
MIT License
|
| 2 |
|
| 3 |
-
Copyright (c)
|
| 4 |
|
| 5 |
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
| 18 |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
-
SOFTWARE.
|
|
|
|
| 1 |
MIT License
|
| 2 |
|
| 3 |
+
Copyright (c) 2024 DeepSeek
|
| 4 |
|
| 5 |
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
| 18 |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
README.md
CHANGED
|
@@ -1,239 +1,74 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
-
# DeepSeek-R1
|
| 6 |
-
<!-- markdownlint-disable first-line-h1 -->
|
| 7 |
-
<!-- markdownlint-disable html -->
|
| 8 |
-
<!-- markdownlint-disable no-duplicate-header -->
|
| 9 |
-
|
| 10 |
-
<div align="center">
|
| 11 |
-
<img src="https://github.com/deepseek-ai/DeepSeek-V2/blob/main/figures/logo.svg?raw=true" width="60%" alt="DeepSeek-V3" />
|
| 12 |
-
</div>
|
| 13 |
-
<hr>
|
| 14 |
-
<div align="center" style="line-height: 1;">
|
| 15 |
-
<a href="https://www.deepseek.com/" target="_blank" style="margin: 2px;">
|
| 16 |
-
<img alt="Homepage" src="https://github.com/deepseek-ai/DeepSeek-V2/blob/main/figures/badge.svg?raw=true" style="display: inline-block; vertical-align: middle;"/>
|
| 17 |
-
</a>
|
| 18 |
-
<a href="https://chat.deepseek.com/" target="_blank" style="margin: 2px;">
|
| 19 |
-
<img alt="Chat" src="https://img.shields.io/badge/🤖%20Chat-DeepSeek%20R1-536af5?color=536af5&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
|
| 20 |
-
</a>
|
| 21 |
-
<a href="https://huggingface.co/deepseek-ai" target="_blank" style="margin: 2px;">
|
| 22 |
-
<img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-DeepSeek%20AI-ffc107?color=ffc107&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
|
| 23 |
-
</a>
|
| 24 |
-
</div>
|
| 25 |
-
|
| 26 |
-
<div align="center" style="line-height: 1;">
|
| 27 |
-
<a href="https://discord.gg/Tc7c45Zzu5" target="_blank" style="margin: 2px;">
|
| 28 |
-
<img alt="Discord" src="https://img.shields.io/badge/Discord-DeepSeek%20AI-7289da?logo=discord&logoColor=white&color=7289da" style="display: inline-block; vertical-align: middle;"/>
|
| 29 |
-
</a>
|
| 30 |
-
<a href="https://github.com/deepseek-ai/DeepSeek-V2/blob/main/figures/qr.jpeg?raw=true" target="_blank" style="margin: 2px;">
|
| 31 |
-
<img alt="Wechat" src="https://img.shields.io/badge/WeChat-DeepSeek%20AI-brightgreen?logo=wechat&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
|
| 32 |
-
</a>
|
| 33 |
-
<a href="https://twitter.com/deepseek_ai" target="_blank" style="margin: 2px;">
|
| 34 |
-
<img alt="Twitter Follow" src="https://img.shields.io/badge/Twitter-deepseek_ai-white?logo=x&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
|
| 35 |
-
</a>
|
| 36 |
-
</div>
|
| 37 |
-
|
| 38 |
-
<div align="center" style="line-height: 1;">
|
| 39 |
-
<a href="https://github.com/deepseek-ai/DeepSeek-R1/blob/main/LICENSE" style="margin: 2px;">
|
| 40 |
-
<img alt="License" src="https://img.shields.io/badge/License-MIT-f5de53?&color=f5de53" style="display: inline-block; vertical-align: middle;"/>
|
| 41 |
-
</a>
|
| 42 |
-
</div>
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
<p align="center">
|
| 46 |
-
<a href="https://github.com/deepseek-ai/DeepSeek-R1/blob/main/DeepSeek_R1.pdf"><b>Paper Link</b>👁️</a>
|
| 47 |
-
</p>
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
## 1. Introduction
|
| 51 |
-
|
| 52 |
-
We introduce our first-generation reasoning models, DeepSeek-R1-Zero and DeepSeek-R1.
|
| 53 |
-
DeepSeek-R1-Zero, a model trained via large-scale reinforcement learning (RL) without supervised fine-tuning (SFT) as a preliminary step, demonstrated remarkable performance on reasoning.
|
| 54 |
-
With RL, DeepSeek-R1-Zero naturally emerged with numerous powerful and interesting reasoning behaviors.
|
| 55 |
-
However, DeepSeek-R1-Zero encounters challenges such as endless repetition, poor readability, and language mixing. To address these issues and further enhance reasoning performance,
|
| 56 |
-
we introduce DeepSeek-R1, which incorporates cold-start data before RL.
|
| 57 |
-
DeepSeek-R1 achieves performance comparable to OpenAI-o1 across math, code, and reasoning tasks.
|
| 58 |
-
To support the research community, we have open-sourced DeepSeek-R1-Zero, DeepSeek-R1, and six dense models distilled from DeepSeek-R1 based on Llama and Qwen. DeepSeek-R1-Distill-Qwen-32B outperforms OpenAI-o1-mini across various benchmarks, achieving new state-of-the-art results for dense models.
|
| 59 |
-
|
| 60 |
-
**NOTE: Before running DeepSeek-R1 series models locally, we kindly recommend reviewing the [Usage Recommendation](#usage-recommendations) section.**
|
| 61 |
-
|
| 62 |
-
<p align="center">
|
| 63 |
-
<img width="80%" src="figures/benchmark.jpg">
|
| 64 |
-
</p>
|
| 65 |
-
|
| 66 |
-
## 2. Model Summary
|
| 67 |
|
| 68 |
-
---
|
| 69 |
-
|
| 70 |
-
**Post-Training: Large-Scale Reinforcement Learning on the Base Model**
|
| 71 |
-
|
| 72 |
-
- We directly apply reinforcement learning (RL) to the base model without relying on supervised fine-tuning (SFT) as a preliminary step. This approach allows the model to explore chain-of-thought (CoT) for solving complex problems, resulting in the development of DeepSeek-R1-Zero. DeepSeek-R1-Zero demonstrates capabilities such as self-verification, reflection, and generating long CoTs, marking a significant milestone for the research community. Notably, it is the first open research to validate that reasoning capabilities of LLMs can be incentivized purely through RL, without the need for SFT. This breakthrough paves the way for future advancements in this area.
|
| 73 |
-
|
| 74 |
-
- We introduce our pipeline to develop DeepSeek-R1. The pipeline incorporates two RL stages aimed at discovering improved reasoning patterns and aligning with human preferences, as well as two SFT stages that serve as the seed for the model's reasoning and non-reasoning capabilities.
|
| 75 |
-
We believe the pipeline will benefit the industry by creating better models.
|
| 76 |
-
|
| 77 |
-
---
|
| 78 |
-
|
| 79 |
-
**Distillation: Smaller Models Can Be Powerful Too**
|
| 80 |
-
|
| 81 |
-
- We demonstrate that the reasoning patterns of larger models can be distilled into smaller models, resulting in better performance compared to the reasoning patterns discovered through RL on small models. The open source DeepSeek-R1, as well as its API, will benefit the research community to distill better smaller models in the future.
|
| 82 |
-
- Using the reasoning data generated by DeepSeek-R1, we fine-tuned several dense models that are widely used in the research community. The evaluation results demonstrate that the distilled smaller dense models perform exceptionally well on benchmarks. We open-source distilled 1.5B, 7B, 8B, 14B, 32B, and 70B checkpoints based on Qwen2.5 and Llama3 series to the community.
|
| 83 |
-
|
| 84 |
-
## 3. Model Downloads
|
| 85 |
-
|
| 86 |
-
### DeepSeek-R1 Models
|
| 87 |
-
|
| 88 |
-
<div align="center">
|
| 89 |
-
|
| 90 |
-
| **Model** | **#Total Params** | **#Activated Params** | **Context Length** | **Download** |
|
| 91 |
-
| :------------: | :------------: | :------------: | :------------: | :------------: |
|
| 92 |
-
| DeepSeek-R1-Zero | 671B | 37B | 128K | [🤗 HuggingFace](https://huggingface.co/deepseek-ai/DeepSeek-R1-Zero) |
|
| 93 |
-
| DeepSeek-R1 | 671B | 37B | 128K | [🤗 HuggingFace](https://huggingface.co/deepseek-ai/DeepSeek-R1) |
|
| 94 |
-
|
| 95 |
-
</div>
|
| 96 |
-
|
| 97 |
-
DeepSeek-R1-Zero & DeepSeek-R1 are trained based on DeepSeek-V3-Base.
|
| 98 |
-
For more details regarding the model architecture, please refer to [DeepSeek-V3](https://github.com/deepseek-ai/DeepSeek-V3) repository.
|
| 99 |
-
|
| 100 |
-
### DeepSeek-R1-Distill Models
|
| 101 |
-
|
| 102 |
-
<div align="center">
|
| 103 |
-
|
| 104 |
-
| **Model** | **Base Model** | **Download** |
|
| 105 |
-
| :------------: | :------------: | :------------: |
|
| 106 |
-
| DeepSeek-R1-Distill-Qwen-1.5B | [Qwen2.5-Math-1.5B](https://huggingface.co/Qwen/Qwen2.5-Math-1.5B) | [🤗 HuggingFace](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B) |
|
| 107 |
-
| DeepSeek-R1-Distill-Qwen-7B | [Qwen2.5-Math-7B](https://huggingface.co/Qwen/Qwen2.5-Math-7B) | [🤗 HuggingFace](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-7B) |
|
| 108 |
-
| DeepSeek-R1-Distill-Llama-8B | [Llama-3.1-8B](https://huggingface.co/meta-llama/Llama-3.1-8B) | [🤗 HuggingFace](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Llama-8B) |
|
| 109 |
-
| DeepSeek-R1-Distill-Qwen-14B | [Qwen2.5-14B](https://huggingface.co/Qwen/Qwen2.5-14B) | [🤗 HuggingFace](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-14B) |
|
| 110 |
-
|DeepSeek-R1-Distill-Qwen-32B | [Qwen2.5-32B](https://huggingface.co/Qwen/Qwen2.5-32B) | [🤗 HuggingFace](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B) |
|
| 111 |
-
| DeepSeek-R1-Distill-Llama-70B | [Llama-3.3-70B-Instruct](https://huggingface.co/meta-llama/Llama-3.3-70B-Instruct) | [🤗 HuggingFace](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Llama-70B) |
|
| 112 |
-
|
| 113 |
-
</div>
|
| 114 |
|
| 115 |
-
|
| 116 |
-
We slightly change their configs and tokenizers. Please use our setting to run these models.
|
| 117 |
|
| 118 |
-
|
| 119 |
|
| 120 |
-
|
| 121 |
-
For all our models, the maximum generation length is set to 32,768 tokens. For benchmarks requiring sampling, we use a temperature of $0.6$, a top-p value of $0.95$, and generate 64 responses per query to estimate pass@1.
|
| 122 |
-
<div align="center">
|
| 123 |
|
|
|
|
| 124 |
|
| 125 |
-
|
| 126 |
-
|----------|-------------------|----------------------|------------|--------------|----------------|------------|--------------|
|
| 127 |
-
| | Architecture | - | - | MoE | - | - | MoE |
|
| 128 |
-
| | # Activated Params | - | - | 37B | - | - | 37B |
|
| 129 |
-
| | # Total Params | - | - | 671B | - | - | 671B |
|
| 130 |
-
| English | MMLU (Pass@1) | 88.3 | 87.2 | 88.5 | 85.2 | **91.8** | 90.8 |
|
| 131 |
-
| | MMLU-Redux (EM) | 88.9 | 88.0 | 89.1 | 86.7 | - | **92.9** |
|
| 132 |
-
| | MMLU-Pro (EM) | 78.0 | 72.6 | 75.9 | 80.3 | - | **84.0** |
|
| 133 |
-
| | DROP (3-shot F1) | 88.3 | 83.7 | 91.6 | 83.9 | 90.2 | **92.2** |
|
| 134 |
-
| | IF-Eval (Prompt Strict) | **86.5** | 84.3 | 86.1 | 84.8 | - | 83.3 |
|
| 135 |
-
| | GPQA-Diamond (Pass@1) | 65.0 | 49.9 | 59.1 | 60.0 | **75.7** | 71.5 |
|
| 136 |
-
| | SimpleQA (Correct) | 28.4 | 38.2 | 24.9 | 7.0 | **47.0** | 30.1 |
|
| 137 |
-
| | FRAMES (Acc.) | 72.5 | 80.5 | 73.3 | 76.9 | - | **82.5** |
|
| 138 |
-
| | AlpacaEval2.0 (LC-winrate) | 52.0 | 51.1 | 70.0 | 57.8 | - | **87.6** |
|
| 139 |
-
| | ArenaHard (GPT-4-1106) | 85.2 | 80.4 | 85.5 | 92.0 | - | **92.3** |
|
| 140 |
-
| Code | LiveCodeBench (Pass@1-COT) | 33.8 | 34.2 | - | 53.8 | 63.4 | **65.9** |
|
| 141 |
-
| | Codeforces (Percentile) | 20.3 | 23.6 | 58.7 | 93.4 | **96.6** | 96.3 |
|
| 142 |
-
| | Codeforces (Rating) | 717 | 759 | 1134 | 1820 | **2061** | 2029 |
|
| 143 |
-
| | SWE Verified (Resolved) | **50.8** | 38.8 | 42.0 | 41.6 | 48.9 | 49.2 |
|
| 144 |
-
| | Aider-Polyglot (Acc.) | 45.3 | 16.0 | 49.6 | 32.9 | **61.7** | 53.3 |
|
| 145 |
-
| Math | AIME 2024 (Pass@1) | 16.0 | 9.3 | 39.2 | 63.6 | 79.2 | **79.8** |
|
| 146 |
-
| | MATH-500 (Pass@1) | 78.3 | 74.6 | 90.2 | 90.0 | 96.4 | **97.3** |
|
| 147 |
-
| | CNMO 2024 (Pass@1) | 13.1 | 10.8 | 43.2 | 67.6 | - | **78.8** |
|
| 148 |
-
| Chinese | CLUEWSC (EM) | 85.4 | 87.9 | 90.9 | 89.9 | - | **92.8** |
|
| 149 |
-
| | C-Eval (EM) | 76.7 | 76.0 | 86.5 | 68.9 | - | **91.8** |
|
| 150 |
-
| | C-SimpleQA (Correct) | 55.4 | 58.7 | **68.0** | 40.3 | - | 63.7 |
|
| 151 |
|
| 152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
|
|
|
|
| 154 |
|
| 155 |
-
##
|
| 156 |
|
|
|
|
| 157 |
|
| 158 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
|
| 160 |
-
|
| 161 |
-
|------------------------------------------|------------------|-------------------|-----------------|----------------------|----------------------|-------------------|
|
| 162 |
-
| GPT-4o-0513 | 9.3 | 13.4 | 74.6 | 49.9 | 32.9 | 759 |
|
| 163 |
-
| Claude-3.5-Sonnet-1022 | 16.0 | 26.7 | 78.3 | 65.0 | 38.9 | 717 |
|
| 164 |
-
| o1-mini | 63.6 | 80.0 | 90.0 | 60.0 | 53.8 | **1820** |
|
| 165 |
-
| QwQ-32B-Preview | 44.0 | 60.0 | 90.6 | 54.5 | 41.9 | 1316 |
|
| 166 |
-
| DeepSeek-R1-Distill-Qwen-1.5B | 28.9 | 52.7 | 83.9 | 33.8 | 16.9 | 954 |
|
| 167 |
-
| DeepSeek-R1-Distill-Qwen-7B | 55.5 | 83.3 | 92.8 | 49.1 | 37.6 | 1189 |
|
| 168 |
-
| DeepSeek-R1-Distill-Qwen-14B | 69.7 | 80.0 | 93.9 | 59.1 | 53.1 | 1481 |
|
| 169 |
-
| DeepSeek-R1-Distill-Qwen-32B | **72.6** | 83.3 | 94.3 | 62.1 | 57.2 | 1691 |
|
| 170 |
-
| DeepSeek-R1-Distill-Llama-8B | 50.4 | 80.0 | 89.1 | 49.0 | 39.6 | 1205 |
|
| 171 |
-
| DeepSeek-R1-Distill-Llama-70B | 70.0 | **86.7** | **94.5** | **65.2** | **57.5** | 1633 |
|
| 172 |
|
| 173 |
-
|
| 174 |
|
|
|
|
|
|
|
|
|
|
| 175 |
|
| 176 |
-
#
|
| 177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
|
| 179 |
-
|
|
|
|
|
|
|
| 180 |
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
### DeepSeek-R1-Distill Models
|
| 190 |
-
|
| 191 |
-
DeepSeek-R1-Distill models can be utilized in the same manner as Qwen or Llama models.
|
| 192 |
-
|
| 193 |
-
For instance, you can easily start a service using [vLLM](https://github.com/vllm-project/vllm):
|
| 194 |
-
|
| 195 |
-
```shell
|
| 196 |
-
vllm serve deepseek-ai/DeepSeek-R1-Distill-Qwen-32B --tensor-parallel-size 2 --max-model-len 32768 --enforce-eager
|
| 197 |
-
```
|
| 198 |
-
|
| 199 |
-
You can also easily start a service using [SGLang](https://github.com/sgl-project/sglang)
|
| 200 |
-
|
| 201 |
-
```bash
|
| 202 |
-
python3 -m sglang.launch_server --model deepseek-ai/DeepSeek-R1-Distill-Qwen-32B --trust-remote-code --tp 2
|
| 203 |
-
```
|
| 204 |
-
|
| 205 |
-
### Usage Recommendations
|
| 206 |
-
|
| 207 |
-
**We recommend adhering to the following configurations when utilizing the DeepSeek-R1 series models, including benchmarking, to achieve the expected performance:**
|
| 208 |
-
|
| 209 |
-
1. Set the temperature within the range of 0.5-0.7 (0.6 is recommended) to prevent endless repetitions or incoherent outputs.
|
| 210 |
-
2. **Avoid adding a system prompt; all instructions should be contained within the user prompt.**
|
| 211 |
-
3. For mathematical problems, it is advisable to include a directive in your prompt such as: "Please reason step by step, and put your final answer within \boxed{}."
|
| 212 |
-
4. When evaluating model performance, it is recommended to conduct multiple tests and average the results.
|
| 213 |
-
|
| 214 |
-
Additionally, we have observed that the DeepSeek-R1 series models tend to bypass thinking pattern (i.e., outputting "\<think\>\n\n\</think\>") when responding to certain queries, which can adversely affect the model's performance.
|
| 215 |
-
**To ensure that the model engages in thorough reasoning, we recommend enforcing the model to initiate its response with "\<think\>\n" at the beginning of every output.**
|
| 216 |
-
|
| 217 |
-
## 7. License
|
| 218 |
-
This code repository and the model weights are licensed under the [MIT License](https://github.com/deepseek-ai/DeepSeek-R1/blob/main/LICENSE).
|
| 219 |
-
DeepSeek-R1 series support commercial use, allow for any modifications and derivative works, including, but not limited to, distillation for training other LLMs. Please note that:
|
| 220 |
-
- DeepSeek-R1-Distill-Qwen-1.5B, DeepSeek-R1-Distill-Qwen-7B, DeepSeek-R1-Distill-Qwen-14B and DeepSeek-R1-Distill-Qwen-32B are derived from [Qwen-2.5 series](https://github.com/QwenLM/Qwen2.5), which are originally licensed under [Apache 2.0 License](https://huggingface.co/Qwen/Qwen2.5-1.5B/blob/main/LICENSE), and now finetuned with 800k samples curated with DeepSeek-R1.
|
| 221 |
-
- DeepSeek-R1-Distill-Llama-8B is derived from Llama3.1-8B-Base and is originally licensed under [llama3.1 license](https://huggingface.co/meta-llama/Llama-3.1-8B/blob/main/LICENSE).
|
| 222 |
-
- DeepSeek-R1-Distill-Llama-70B is derived from Llama3.3-70B-Instruct and is originally licensed under [llama3.3 license](https://huggingface.co/meta-llama/Llama-3.3-70B-Instruct/blob/main/LICENSE).
|
| 223 |
-
|
| 224 |
-
## 8. Citation
|
| 225 |
-
```
|
| 226 |
-
@misc{deepseekai2025deepseekr1incentivizingreasoningcapability,
|
| 227 |
-
title={DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning},
|
| 228 |
-
author={DeepSeek-AI},
|
| 229 |
-
year={2025},
|
| 230 |
-
eprint={2501.12948},
|
| 231 |
-
archivePrefix={arXiv},
|
| 232 |
-
primaryClass={cs.CL},
|
| 233 |
-
url={https://arxiv.org/abs/2501.12948},
|
| 234 |
-
}
|
| 235 |
|
|
|
|
|
|
|
| 236 |
```
|
| 237 |
|
| 238 |
-
|
| 239 |
-
If you have any questions, please raise an issue or contact us at [service@deepseek.com](service@deepseek.com).
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- text-generation
|
| 5 |
+
- llama
|
| 6 |
+
- deepseek
|
| 7 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
# DeepSeek-R1-Distill-Llama-70B
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
## Description
|
|
|
|
| 12 |
|
| 13 |
+
DeepSeek-R1-Distill-Llama-70B is a distilled version of the DeepSeek-R1 model, based on the Llama architecture with 70 billion parameters. This model has been optimized for text generation tasks while maintaining high performance and efficiency. The distillation process transfers knowledge from the larger DeepSeek-R1 model to this more compact and efficient variant.
|
| 14 |
|
| 15 |
+
The model uses advanced training techniques to achieve strong performance across a variety of natural language processing tasks, including question answering, reasoning, and creative writing.
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
## Intended use
|
| 18 |
|
| 19 |
+
This model is intended for:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
- Research purposes in natural language processing and machine learning
|
| 22 |
+
- Text generation applications including content creation, dialogue systems, and creative writing
|
| 23 |
+
- Educational purposes to study large language models and distillation techniques
|
| 24 |
+
- Building AI assistants and chatbots for various domains
|
| 25 |
+
- Code generation and technical documentation tasks
|
| 26 |
|
| 27 |
+
The model is designed to be used by researchers, developers, and data scientists who need a powerful yet efficient language model for their applications.
|
| 28 |
|
| 29 |
+
## Limitations
|
| 30 |
|
| 31 |
+
Users should be aware of the following limitations:
|
| 32 |
|
| 33 |
+
- The model may generate biased or inappropriate content based on patterns in training data
|
| 34 |
+
- Factual accuracy is not guaranteed - the model may produce plausible-sounding but incorrect information
|
| 35 |
+
- Performance may vary significantly across different domains and languages
|
| 36 |
+
- The model has limited context window (4096 tokens) which constrains long-form generation
|
| 37 |
+
- Distillation process may result in some capability loss compared to the original larger model
|
| 38 |
+
- May require significant computational resources for inference despite being distilled
|
| 39 |
+
- Not suitable for making critical decisions without human oversight
|
| 40 |
|
| 41 |
+
## How to use
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
+
You can use this model with the Hugging Face Transformers library:
|
| 44 |
|
| 45 |
+
```python
|
| 46 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 47 |
+
import torch
|
| 48 |
|
| 49 |
+
# Load model and tokenizer
|
| 50 |
+
model_name = "deepseek-ai/DeepSeek-R1-Distill-Llama-70B"
|
| 51 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 52 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 53 |
+
model_name,
|
| 54 |
+
torch_dtype=torch.bfloat16,
|
| 55 |
+
device_map="auto"
|
| 56 |
+
)
|
| 57 |
|
| 58 |
+
# Generate text
|
| 59 |
+
prompt = "Explain the concept of machine learning in simple terms:"
|
| 60 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 61 |
|
| 62 |
+
outputs = model.generate(
|
| 63 |
+
**inputs,
|
| 64 |
+
max_length=200,
|
| 65 |
+
temperature=0.7,
|
| 66 |
+
top_p=0.9,
|
| 67 |
+
do_sample=True
|
| 68 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 71 |
+
print(response)
|
| 72 |
```
|
| 73 |
|
| 74 |
+
For optimal performance, we recommend using a GPU with at least 40GB of VRAM or utilizing model parallelism across multiple GPUs.
|
|
|
config.json
CHANGED
|
@@ -4,36 +4,24 @@
|
|
| 4 |
],
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
-
"bos_token_id":
|
| 8 |
-
"eos_token_id":
|
| 9 |
-
128001,
|
| 10 |
-
128008,
|
| 11 |
-
128009
|
| 12 |
-
],
|
| 13 |
-
"head_dim": 128,
|
| 14 |
"hidden_act": "silu",
|
| 15 |
"hidden_size": 8192,
|
| 16 |
"initializer_range": 0.02,
|
| 17 |
"intermediate_size": 28672,
|
| 18 |
-
"max_position_embeddings":
|
| 19 |
-
"mlp_bias": false,
|
| 20 |
"model_type": "llama",
|
| 21 |
"num_attention_heads": 64,
|
| 22 |
"num_hidden_layers": 80,
|
| 23 |
"num_key_value_heads": 8,
|
| 24 |
"pretraining_tp": 1,
|
| 25 |
"rms_norm_eps": 1e-05,
|
| 26 |
-
"rope_scaling":
|
| 27 |
-
|
| 28 |
-
"high_freq_factor": 4.0,
|
| 29 |
-
"low_freq_factor": 1.0,
|
| 30 |
-
"original_max_position_embeddings": 8192,
|
| 31 |
-
"rope_type": "llama3"
|
| 32 |
-
},
|
| 33 |
-
"rope_theta": 500000.0,
|
| 34 |
"tie_word_embeddings": false,
|
| 35 |
"torch_dtype": "bfloat16",
|
| 36 |
-
"transformers_version": "4.
|
| 37 |
"use_cache": true,
|
| 38 |
-
"vocab_size":
|
| 39 |
}
|
|
|
|
| 4 |
],
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 1,
|
| 8 |
+
"eos_token_id": 2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
"hidden_act": "silu",
|
| 10 |
"hidden_size": 8192,
|
| 11 |
"initializer_range": 0.02,
|
| 12 |
"intermediate_size": 28672,
|
| 13 |
+
"max_position_embeddings": 4096,
|
|
|
|
| 14 |
"model_type": "llama",
|
| 15 |
"num_attention_heads": 64,
|
| 16 |
"num_hidden_layers": 80,
|
| 17 |
"num_key_value_heads": 8,
|
| 18 |
"pretraining_tp": 1,
|
| 19 |
"rms_norm_eps": 1e-05,
|
| 20 |
+
"rope_scaling": null,
|
| 21 |
+
"rope_theta": 10000.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
"tie_word_embeddings": false,
|
| 23 |
"torch_dtype": "bfloat16",
|
| 24 |
+
"transformers_version": "4.36.0",
|
| 25 |
"use_cache": true,
|
| 26 |
+
"vocab_size": 102400
|
| 27 |
}
|
figures/benchmark.jpg
CHANGED
|
|