ekurtic commited on
Commit
db4ec7c
·
verified ·
1 Parent(s): b78ad1c

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +109 -0
README.md ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ library_name: vllm
4
+ base_model:
5
+ - deepseek-ai/DeepSeek-R1
6
+ pipeline_tag: text-generation
7
+ tags:
8
+ - deepseek
9
+ - neuralmagic
10
+ - redhat
11
+ - llmcompressor
12
+ - quantized
13
+ - INT4
14
+ - GPTQ
15
+ ---
16
+
17
+ # DeepSeek-R1-quantized.w4a16
18
+
19
+ ## Model Overview
20
+ - **Model Architecture:** DeepseekV3ForCausalLM
21
+ - **Input:** Text
22
+ - **Output:** Text
23
+ - **Model Optimizations:**
24
+ - **Activation quantization:** None
25
+ - **Weight quantization:** INT4
26
+ - **Release Date:** 04/15/2025
27
+ - **Version:** 1.0
28
+ - **Model Developers:** RedHat (Neural Magic)
29
+
30
+
31
+ ### Model Optimizations
32
+
33
+ This model was obtained by quantizing weights of [DeepSeek-R1](https://huggingface.co/deepseek-ai/DeepSeek-R1) to INT4 data type.
34
+ This optimization reduces the number of bits used to represent weights from 8 to 4, reducing GPU memory requirements (by approximately 50%).
35
+ Weight quantization also reduces disk size requirements by approximately 50%.
36
+
37
+
38
+ ## Deployment
39
+
40
+ This model can be deployed efficiently using the [vLLM](https://docs.vllm.ai/en/latest/) backend, as shown in the example below.
41
+
42
+ ```python
43
+ from vllm import LLM, SamplingParams
44
+ from transformers import AutoTokenizer
45
+
46
+ model_id = "RedHatAI/DeepSeek-R1-quantized.w4a16"
47
+ number_gpus = 8
48
+
49
+ sampling_params = SamplingParams(temperature=0.7, top_p=0.8, max_tokens=256)
50
+
51
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
52
+
53
+ prompt = "Give me a short introduction to large language model."
54
+
55
+ llm = LLM(model=model_id, tensor_parallel_size=number_gpus)
56
+
57
+ outputs = llm.generate(prompt, sampling_params)
58
+
59
+ generated_text = outputs[0].outputs[0].text
60
+ print(generated_text)
61
+ ```
62
+
63
+ vLLM aslo supports OpenAI-compatible serving. See the [documentation](https://docs.vllm.ai/en/latest/) for more details.
64
+
65
+
66
+ ## Evaluation
67
+
68
+ The model was evaluated on the OpenLLM leaderboard task (v1) via [lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness), and on popular reasoning tasks (AIME 2024, MATH-500, GPQA-Diamond) via [LightEval](https://github.com/huggingface/open-r1).
69
+ For reasoning evaluations, we estimate pass@1 based on 10 runs with different seeds.
70
+
71
+ <details>
72
+ <summary>Evaluation details</summary>
73
+
74
+ **OpenLLM v1**
75
+ ```
76
+ lm_eval \
77
+ --model vllm \
78
+ --model_args pretrained="RedHatAI/DeepSeek-R1-quantized.w4a16",dtype=auto,add_bos_token=True,max_model_len=4096,tensor_parallel_size=8,gpu_memory_utilization=0.8,enable_chunked_prefill=True,trust_remote_code=True \
79
+ --tasks openllm \
80
+ --batch_size auto
81
+ ```
82
+
83
+ **Reasoning Benchmarks**
84
+ ```
85
+ export MODEL_ARGS="pretrained=RedHatAI/DeepSeek-R1-quantized.w4a16,dtype=bfloat16,max_model_length=38768,gpu_memory_utilization=0.8,tensor_parallel_size=8,add_special_tokens=false,generation_parameters={\"max_new_tokens\":32768,\"temperature\":0.6,\"top_p\":0.95,\"seed\":42}"
86
+ export VLLM_WORKER_MULTIPROC_METHOD=spawn
87
+ lighteval vllm $MODEL_ARGS "custom|aime24|0|0,custom|math_500|0|0,custom|gpqa:diamond|0|0" \
88
+ --custom-tasks src/open_r1/evaluate.py \
89
+ --use-chat-template \
90
+ --output-dir $OUTPUT_DIR
91
+ ```
92
+
93
+ </details>
94
+
95
+ ### Accuracy
96
+
97
+ | | Recovery (%) | deepseek/DeepSeek-R1 | RedHatAI/DeepSeek-R1-quantized.w4a16<br>(this model) |
98
+ | --------------------------- | :----------: | :------------------: | :--------------------------------------------------: |
99
+ | ARC-Challenge<br>25-shot | 100.00 | 72.53 | 72.53 |
100
+ | GSM8k<br>5-shot | 99.76 | 95.91 | 95.68 |
101
+ | HellaSwag<br>10-shot | 100.07 | 89.30 | 89.36 |
102
+ | MMLU<br>5-shot | 99.74 | 87.22 | 86.99 |
103
+ | TruthfulQA<br>0-shot | 100.83 | 59.28 | 59.77 |
104
+ | WinoGrande<br>5-shot | 101.65 | 82.00 | 83.35 |
105
+ | **OpenLLM v1<br>Average Score** | **100.30** | **81.04** | **81.28** |
106
+ | AIME 2024<br>pass@1 | 98.30 | 78.33 | 77.00 |
107
+ | MATH-500<br>pass@1 | 99.84 | 97.24 | 97.08 |
108
+ | GPQA Diamond<br>pass@1 | 98.01 | 73.38 | 71.92 |
109
+ | **Reasoning<br>Average Score** | **98.81** | **82.99** | **82.00** |