eaddario commited on
Commit
7158ed1
·
verified ·
1 Parent(s): 4a6a053

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +54 -54
README.md CHANGED
@@ -16,7 +16,7 @@ tags:
16
 
17
  # Experimental GGUF quantized versions of deepseek-ai/DeepSeek-R1-Distill-Llama-8B
18
 
19
- Using [LLaMA C++](<https://github.com/ggerganov/llama.cpp>) release [b4872](<https://github.com/ggerganov/llama.cpp/releases/tag/b4872>) for quantization.
20
 
21
  Original model: [deepseek-ai/DeepSeek-R1-Distill-Llama-8B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Llama-8B)
22
 
@@ -27,15 +27,15 @@ From the original model creators:
27
 
28
  # PLEASE READ THIS BEFORE USING THESE EXPERIMENTAL VERSIONS!
29
 
30
- An area of personal interest is finding ways to optimize the inference performance of LLMs when deployed in resource-constrained environments like commodity hardware, desktops, laptops, edge devices, etc. There are many approaches to accomplish this, including architecture simplification and knowledge distillation, but for now I'm focusing primarily on quantization and pruning.
31
 
32
- The process of [quantization](<https://huggingface.co/docs/optimum/en/concept_guides/quantization>) reduces the precision of the model's weights, leading to significant reductions in model size, memory needs and computational requirements (a good thing), but this however comes at the expense of a loss in the model's capabilities and accuracy (a bad thing!).
33
 
34
- Another approach is to [prune](<https://en.wikipedia.org/wiki/Pruning_(artificial_neural_network>) the model, that is, to selectively zero-out groups of parameters. Although significant reductions can be achieved this way, the risk of severely degrading the model's performance is markedly higher than when quantizing, as the process requires a deep understanding of the model's architecture in order to identify which tensors can be safely zero'ed. For all means and purposes, pruning is the equivalent of lobotomizing the LLM!
35
 
36
- A successful outcome is when the overall size is reduced with no, or negligible, loss of capabilities (i.e. language understanding, math and logic problem-solving, conversation, coding, domain-specific knowledge, etc.) compared to the original version. On that regard, the method I'm using seems to yield some modest but encouraging results, and the versions available in this repo are on average **7.5% smaller** than other, high-quality, sources with negligible loss of capability. As I continue to improve the process and develop tools to automate it, I aim to achieve further reductions in the **10-15%** range, maybe more.
37
 
38
- For testing and comparison I used models produced by [Unsloth](<https://huggingface.co/unsloth>) ([Daniel and Michael Han](<https://unsloth.ai/>) do some really advanced level stuff!) and [Bartowski](<https://huggingface.co/bartowski>) (see credits below).
39
 
40
  All experimental versions were generated using an appropriate imatrix created from calibration datasets available at [eaddario/imatrix-calibration](<https://huggingface.co/datasets/eaddario/imatrix-calibration>). At its core, an Importance Matrix (imatrix) is a table or, more broadly, a structured representation that scores the relative importance of different features or parameters in a machine learning model. It essentially quantifies the "impact" each feature has on a specific outcome, prediction, or relationship being modeled, and it helps to counterbalance the negative effects of quantization and pruning.
41
 
@@ -44,8 +44,8 @@ The process to generate these models is roughly as follows:
44
  1. Convert the the original model's tensors to [GGUF](<https://huggingface.co/docs/hub/en/gguf>) F16*
45
  2. Estimate the Perplexity score for the F16 model (baseline) using the [wikitext-2-raw-v1](<https://huggingface.co/datasets/Salesforce/wikitext/tree/main/wikitext-2-raw-v1>) dataset, and save the [logits](<https://huggingface.co/eaddario/DeepSeek-R1-Distill-Llama-8B-GGUF/tree/main/logits>)
46
  3. Generate an [imatrix](<https://huggingface.co/eaddario/DeepSeek-R1-Distill-Llama-8B-GGUF/tree/main/imatrix>) from selected calibration datasets
47
- 4. Quantize & prune versions of the base model
48
- 5. Calculate Perplexity, KL Divergence, ARC (Easy+Challenge), HellaSwag, MMLU, Truthful QA and WinoGrande [scores](<https://huggingface.co/eaddario/DeepSeek-R1-Distill-Llama-8B-GGUF/tree/main/scores>) for each quantized model
49
  6. Keep versions with the best scores
50
  7. Repeat until all desired quants are created. I find that quantizations below Q3/IQ3 are not fit for my purposes and therefore do not usually generate them, but happy to provide other quants on request.
51
 
@@ -56,34 +56,34 @@ The process to generate these models is roughly as follows:
56
  ### Sizes (in GB)
57
  | Model | Bartowski | Unsloth | Repo | Shrinkage |
58
  |-----------------------------------------------------------------------------------|----------:|---------|------:|----------:|
59
- | [DeepSeek-R1-Distill-Llama-8B-IQ3_M](./DeepSeek-R1-Distill-Llama-8B-IQ3_M.gguf) | 3.78 | N/A | 3.47 | 8.2% |
60
- | [DeepSeek-R1-Distill-Llama-8B-IQ3_S](./DeepSeek-R1-Distill-Llama-8B-IQ3_S.gguf) | N/A | N/A | 3.37 | N/A |
61
- | [DeepSeek-R1-Distill-Llama-8B-IQ4_NL](./DeepSeek-R1-Distill-Llama-8B-IQ4_NL.gguf) | 4.68 | N/A | 4.35 | 7.1% |
62
- | [DeepSeek-R1-Distill-Llama-8B-Q3_K_L](./DeepSeek-R1-Distill-Llama-8B-Q3_K_L.gguf) | 4.32 | N/A | 4.01 | 7.2% |
63
- | [DeepSeek-R1-Distill-Llama-8B-Q3_K_M](./DeepSeek-R1-Distill-Llama-8B-Q3_K_M.gguf) | 4.02 | 4.02 | 3.70 | 8.0% |
64
- | [DeepSeek-R1-Distill-Llama-8B-Q3_K_S](./DeepSeek-R1-Distill-Llama-8B-Q3_K_S.gguf) | 3.66 | N/A | 3.35 | 8.5% |
65
- | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M](./DeepSeek-R1-Distill-Llama-8B-Q4_K_M.gguf) | 4.92 | 4.92 | 4.59 | 6.7% |
66
- | [DeepSeek-R1-Distill-Llama-8B-Q4_K_S](./DeepSeek-R1-Distill-Llama-8B-Q4_K_S.gguf) | 4.69 | N/A | 4.36 | 7.0% |
67
- | [DeepSeek-R1-Distill-Llama-8B-Q5_K_M](./DeepSeek-R1-Distill-Llama-8B-Q5_K_M.gguf) | 5.73 | 5.73 | 5.34 | 6.8% |
68
- | [DeepSeek-R1-Distill-Llama-8B-Q5_K_S](./DeepSeek-R1-Distill-Llama-8B-Q5_K_S.gguf) | 5.60 | N/A | 5.21 | 7.0% |
69
- | [DeepSeek-R1-Distill-Llama-8B-Q6_K](./DeepSeek-R1-Distill-Llama-8B-Q6_K.gguf) | 6.60 | 6.60 | 6.13 | 7.1% |
70
- | [DeepSeek-R1-Distill-Llama-8B-Q8_0](./DeepSeek-R1-Distill-Llama-8B-Q8_0.gguf) | 8.54 | 8.54 | 7.82 | 8.4% |
71
 
72
  ### Perplexity and KL Divergence scores
73
  | Model | μPPL | 𝜌PPL | μKLD | RMS Δp |
74
  |-----------------------------------------------------------------------------------|--------------------:|-------:|-------------------:|--------------:|
75
- | [DeepSeek-R1-Distill-Llama-8B-IQ3_M](./DeepSeek-R1-Distill-Llama-8B-IQ3_M.gguf) | 17.240743 ±0.144856 | 93.48% | 0.435823 ±0.001620 | 17.425 ±0.066 |
76
- | [DeepSeek-R1-Distill-Llama-8B-IQ3_S](./DeepSeek-R1-Distill-Llama-8B-IQ3_S.gguf) | 17.465106 ±0.147682 | 93.39% | 0.441957 ±0.001645 | 17.470 ±0.066 |
77
- | [DeepSeek-R1-Distill-Llama-8B-IQ4_NL](./DeepSeek-R1-Distill-Llama-8B-IQ4_NL.gguf) | 15.346180 ±0.129934 | 96.24% | 0.241193 ±0.001277 | 12.484 ±0.063 |
78
- | [DeepSeek-R1-Distill-Llama-8B-Q3_K_L](./DeepSeek-R1-Distill-Llama-8B-Q3_K_L.gguf) | 16.876273 ±0.145643 | 94.72% | 0.352343 ±0.001451 | 15.201 ±0.063 |
79
- | [DeepSeek-R1-Distill-Llama-8B-Q3_K_M](./DeepSeek-R1-Distill-Llama-8B-Q3_K_M.gguf) | 16.919080 ±0.146005 | 94.48% | 0.367114 ±0.001473 | 15.568 ±0.064 |
80
- | [DeepSeek-R1-Distill-Llama-8B-Q3_K_S](./DeepSeek-R1-Distill-Llama-8B-Q3_K_S.gguf) | 17.644226 ±0.148490 | 92.27% | 0.506686 ±0.001786 | 18.534 ±0.068 |
81
- | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M](./DeepSeek-R1-Distill-Llama-8B-Q4_K_M.gguf) | 15.147873 ±0.128370 | 96.59% | 0.220231 ±0.001199 | 11.951 ±0.062 |
82
- | [DeepSeek-R1-Distill-Llama-8B-Q4_K_S](./DeepSeek-R1-Distill-Llama-8B-Q4_K_S.gguf) | 15.349770 ±0.130408 | 96.40% | 0.232634 ±0.001239 | 12.329 ±0.063 |
83
- | [DeepSeek-R1-Distill-Llama-8B-Q5_K_M](./DeepSeek-R1-Distill-Llama-8B-Q5_K_M.gguf) | 15.039770 ±0.127564 | 96.94% | 0.197358 ±0.001179 | 11.230 ±0.063 |
84
- | [DeepSeek-R1-Distill-Llama-8B-Q5_K_S](./DeepSeek-R1-Distill-Llama-8B-Q5_K_S.gguf) | 15.206373 ±0.129316 | 96.84% | 0.203119 ±0.001209 | 11.416 ±0.063 |
85
- | [DeepSeek-R1-Distill-Llama-8B-Q6_K](./DeepSeek-R1-Distill-Llama-8B-Q6_K.gguf) | 14.974922 ±0.127271 | 97.07% | 0.188803 ±0.001173 | 10.958 ±0.063 |
86
- | [DeepSeek-R1-Distill-Llama-8B-Q8_0](./DeepSeek-R1-Distill-Llama-8B-Q8_0.gguf) | 15.069153 ±0.128019 | 97.05% | 0.190406 ±0.001195 | 11.046 ±0.064 |
87
  | [DeepSeek-R1-Distill-Llama-8B-F16](./DeepSeek-R1-Distill-Llama-8B-F16.gguf) | 14.009216 ±0.118474 | 100% | N/A | N/A |
88
 
89
  ### ARC, HellaSwag, MMLU, Truthful QA and WinoGrande scores
@@ -91,32 +91,32 @@ Scores generated using [llama-perplexity](<https://github.com/ggml-org/llama.cpp
91
 
92
  For the test data used in the generation of these scores, follow the appropiate links: [HellaSwag](<https://github.com/klosax/hellaswag_text_data>), [ARC, MMLU, Truthful QA](<https://huggingface.co/datasets/ikawrakow/validation-datasets-for-llama.cpp/tree/main>) and [WinoGrande](<https://huggingface.co/datasets/ikawrakow/winogrande-eval-for-llama.cpp/tree/main>)
93
 
94
- | Model | ARC | HellaSwag | MMLU | Truthful QA | WinoGrande |
95
- |---------------------------------------------------------------------------------------------------------------------|----------------:|----------:|----------------:|----------------:|----------------:|
96
- | [DeepSeek-R1-Distill-Llama-8B-IQ3_M](./DeepSeek-R1-Distill-Llama-8B-IQ3_M.gguf) | 49.2000 ±1.8267 | 71.07 | 36.9333 ±1.7635 | 32.9333 ±1.7172 | 66.1333 ±1.7292 |
97
- | [DeepSeek-R1-Distill-Llama-8B-IQ3_S](./DeepSeek-R1-Distill-Llama-8B-IQ3_S.gguf) | 46.2667 ±1.8219 | 71.87 | 37.2000 ±1.7661 | 33.3333 ±1.7225 | 66.0000 ±1.7309 |
98
- | [DeepSeek-R1-Distill-Llama-8B-IQ4_NL](./DeepSeek-R1-Distill-Llama-8B-IQ4_NL.gguf) | 50.0000 ±1.8270 | 74.13 | 36.5333 ±1.7594 | 32.8000 ±1.7155 | 67.8667 ±1.7063 |
99
- | [DeepSeek-R1-Distill-Llama-8B-Q3_K_L](./DeepSeek-R1-Distill-Llama-8B-Q3_K_L.gguf) | 50.0000 ±1.8270 | 71.20 | 35.0667 ±1.7436 | 31.3333 ±1.6949 | 66.9333 ±1.7190 |
100
- | [DeepSeek-R1-Distill-Llama-8B-Q3_K_M](./DeepSeek-R1-Distill-Llama-8B-Q3_K_M.gguf) | 49.2000 ±1.8267 | 70.00 | 35.7333 ±1.7510 | 32.0000 ±1.7045 | 67.6000 ±1.7100 |
101
- | [DeepSeek-R1-Distill-Llama-8B-Q3_K_S](./DeepSeek-R1-Distill-Llama-8B-Q3_K_S.gguf) | 51.0667 ±1.8265 | 70.40 | 33.2000 ±1.7207 | 30.5333 ±1.6828 | 68.9333 ±1.6909 |
102
- | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M](./DeepSeek-R1-Distill-Llama-8B-Q4_K_M.gguf) | 49.2000 ±1.8267 | 74.27 | 35.7333 ±1.7510 | 34.0000 ±1.7309 | 66.8000 ±1.7207 |
103
- | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M-bartowski](https://huggingface.co/bartowski/DeepSeek-R1-Distill-Llama-8B-GGUF) | 52.0000 ±1.8255 | 73.73 | 37.0667 ±1.7648 | 32.2667 ±1.7082 | 68.4000 ±1.6988 |
104
- | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M-unsloth](https://huggingface.co/unsloth/DeepSeek-R1-Distill-Llama-8B-GGUF) | 50.9333 ±1.8266 | 73.47 | 36.4000 ±1.7581 | 32.6667 ±1.7137 | 67.8667 ±1.7063 |
105
- | [DeepSeek-R1-Distill-Llama-8B-Q4_K_S](./DeepSeek-R1-Distill-Llama-8B-Q4_K_S.gguf) | 49.6000 ±1.8269 | 74.13 | 36.2667 ±1.7567 | 33.2000 ±1.7207 | 67.3333 ±1.7137 |
106
- | [DeepSeek-R1-Distill-Llama-8B-Q5_K_M](./DeepSeek-R1-Distill-Llama-8B-Q5_K_M.gguf) | 48.1333 ±1.8257 | 74.13 | 35.0667 ±1.7436 | 32.5333 ±1.7119 | 66.8000 ±1.7207 |
107
- | [DeepSeek-R1-Distill-Llama-8B-Q5_K_S](./DeepSeek-R1-Distill-Llama-8B-Q5_K_S.gguf) | 48.9333 ±1.8265 | 74.13 | 34.8000 ±1.7405 | 31.3333 ±1.6949 | 66.2667 ±1.7276 |
108
- | [DeepSeek-R1-Distill-Llama-8B-Q6_K](./DeepSeek-R1-Distill-Llama-8B-Q6_K.gguf) | 48.1333 ±1.8257 | 74.80 | 35.6000 ±1.7496 | 32.0000 ±1.7045 | 66.6667 ±1.7225 |
109
- | [DeepSeek-R1-Distill-Llama-8B-Q8_0](./DeepSeek-R1-Distill-Llama-8B-Q8_0.gguf) | 48.2667 ±1.8259 | 74.80 | 35.4667 ±1.7481 | 32.2667 ±1.7082 | 66.8000 ±1.7207 |
110
- | [DeepSeek-R1-Distill-Llama-8B-F16](./DeepSeek-R1-Distill-Llama-8B-F16.gguf) | 50.1333 ±1.8270 | 74.40 | 36.6667 ±1.7608 | 32.0000 ±1.7045 | 67.7333 ±1.7082 |
111
 
112
  ### Tokens per Second - Benchmarks
113
  Scores generated using [llama-bench](https://github.com/ggml-org/llama.cpp/tree/master/examples/llama-bench). Q4_K_M quantizations from [Bartowski](https://huggingface.co/bartowski/DeepSeek-R1-Distill-Qwen-7B-GGUF/tree/main) and [Unsloth](https://huggingface.co/unsloth/DeepSeek-R1-Distill-Qwen-7B-GGUF/tree/main) included for comparison.
114
 
115
  | model | size | params | backend | threads | test | t/s |
116
  |---------------------------------------------------------------------------------------------------------------------|---------:|-------:|------------|--------:|--------------:|--------------:|
117
- | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M](./DeepSeek-R1-Distill-Llama-8B-Q4_K_M.gguf) | 4.27 GiB | 8.03 B | Metal,BLAS | 6 | pp512 | 329.64 ± 0.06 |
118
- | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M](./DeepSeek-R1-Distill-Llama-8B-Q4_K_M.gguf) | 4.27 GiB | 8.03 B | Metal,BLAS | 6 | tg128 | 26.93 ± 0.04 |
119
- | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M](./DeepSeek-R1-Distill-Llama-8B-Q4_K_M.gguf) | 4.27 GiB | 8.03 B | Metal,BLAS | 6 | pp1024+tg1024 | 43.70 ± 0.09 |
120
  | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M-bartowski](https://huggingface.co/bartowski/DeepSeek-R1-Distill-Llama-8B-GGUF) | 4.58 GiB | 8.03 B | Metal,BLAS | 6 | pp512 | 329.03 ± 0.11 |
121
  | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M-bartowski](https://huggingface.co/bartowski/DeepSeek-R1-Distill-Llama-8B-GGUF) | 4.58 GiB | 8.03 B | Metal,BLAS | 6 | tg128 | 25.79 ± 0.92 |
122
  | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M-bartowski](https://huggingface.co/bartowski/DeepSeek-R1-Distill-Llama-8B-GGUF) | 4.58 GiB | 8.03 B | Metal,BLAS | 6 | pp1024+tg1024 | 42.35 ± 0.93 |
@@ -127,7 +127,7 @@ Scores generated using [llama-bench](https://github.com/ggml-org/llama.cpp/tree/
127
  # Metrics used
128
  **[Perplexity](<https://huggingface.co/docs/transformers/en/perplexity>):** one of the key metrics used in NLP evaluation. It measures the quality of a language model by evaluating how well it predicts the next token given a particular sequence of words. A PPL of **1** indicates an exact match between predicted and actual, whereas values greater than one indicate a degree of "surprise" the generated token differs from the expected.
129
 
130
- **[Kullback–Leibler (KL) Divergence](<https://en.wikipedia.org/wiki/Kullback–Leibler_divergence>):** a statistical measure of how much a probability distribution differs from another. When quantizing models (or altering the original tensors in any way for that matter), the closest we can preserve the weights' probability distribution to the orignal model the better, thus the closest to **0** the better.
131
 
132
  **[AI2 Reasoning Challenge (ARC)](<https://leaderboard.allenai.org/arc/submissions/get-started>):** a benchmark to evaluate the ability of AI models to answer complex science questions that require logical reasoning beyond pattern matching.
133
 
@@ -140,4 +140,4 @@ Scores generated using [llama-bench](https://github.com/ggml-org/llama.cpp/tree/
140
  **[Winogrande](<https://winogrande.allenai.org/>):** based on the [Winograd Schema Challenge](<https://cdn.aaai.org/ocs/4492/4492-21843-1-PB.pdf>), is a natural language understanding task requiring models to resolve ambiguities in sentences involving pronoun references.
141
 
142
  ## Credits
143
- A big **Thank You!** to [Colin Kealty](<https://huggingface.co/bartowski>) for the many contributions and for being one of the best sources of high quality quantized models available in Hugginface, and a really big ***Thank You!*** to [Georgi Gerganov](<https://github.com/ggerganov>) for his amazing work with **llama.cpp** and the **gguf** file format.
 
16
 
17
  # Experimental GGUF quantized versions of deepseek-ai/DeepSeek-R1-Distill-Llama-8B
18
 
19
+ Using [LLaMA C++](<https://github.com/ggerganov/llama.cpp>) release [b4930](<https://github.com/ggerganov/llama.cpp/releases/tag/b4930>) for quantization.
20
 
21
  Original model: [deepseek-ai/DeepSeek-R1-Distill-Llama-8B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Llama-8B)
22
 
 
27
 
28
  # PLEASE READ THIS BEFORE USING THESE EXPERIMENTAL VERSIONS!
29
 
30
+ An area of personal interest is finding ways to optimize the inference performance of LLMs when deployed in resource-constrained environments like commodity hardware, desktops, laptops, mobiles, edge devices, etc. There are many approaches to accomplish this, including architecture simplification and knowledge distillation, but my focus has been primarily on quantization and pruning.
31
 
32
+ The method that I'm using to produce these experimental versions is explained in [Squeezing Tensor Bits: the quest for smaller LLMs](https://medium.com/@eaddario/squeezing-tensor-bits-the-quest-for-smaller-llms-86b23bd052ca), but at a high level it involves using a custom version of the `llama-quantize` tool to selectively quantize different tensors at different levels.
33
 
34
+ There’re two pull requests ([#12511](https://github.com/ggml-org/llama.cpp/pull/12511) & [#12512](https://github.com/ggml-org/llama.cpp/pull/12512)) to merge these changes back into the core llama.cpp project. This may or may not ever happen but until then, the modified version will be available on my [GitHub](https://github.com/EAddario/llama.cpp).
35
 
36
+ In addition to [llama-quantize](https://github.com/EAddario/llama.cpp/tree/quantize), there’s a version of [llama-perplexity](https://github.com/EAddario/llama.cpp/tree/perplexity) that allows you to continue generating test scores even if there’s a context window overflow (original behaviour is to stop).
37
 
38
+ For testing and comparison I use models produced by [Unsloth](<https://huggingface.co/unsloth>) ([Daniel and Michael Han](<https://unsloth.ai/>) do some really advanced level stuff!) and [Bartowski](<https://huggingface.co/bartowski>) (see credits below).
39
 
40
  All experimental versions were generated using an appropriate imatrix created from calibration datasets available at [eaddario/imatrix-calibration](<https://huggingface.co/datasets/eaddario/imatrix-calibration>). At its core, an Importance Matrix (imatrix) is a table or, more broadly, a structured representation that scores the relative importance of different features or parameters in a machine learning model. It essentially quantifies the "impact" each feature has on a specific outcome, prediction, or relationship being modeled, and it helps to counterbalance the negative effects of quantization and pruning.
41
 
 
44
  1. Convert the the original model's tensors to [GGUF](<https://huggingface.co/docs/hub/en/gguf>) F16*
45
  2. Estimate the Perplexity score for the F16 model (baseline) using the [wikitext-2-raw-v1](<https://huggingface.co/datasets/Salesforce/wikitext/tree/main/wikitext-2-raw-v1>) dataset, and save the [logits](<https://huggingface.co/eaddario/DeepSeek-R1-Distill-Llama-8B-GGUF/tree/main/logits>)
46
  3. Generate an [imatrix](<https://huggingface.co/eaddario/DeepSeek-R1-Distill-Llama-8B-GGUF/tree/main/imatrix>) from selected calibration datasets
47
+ 4. Select an appropiate quant level for each tensor using a modified version of `llama-quantize`
48
+ 5. Calculate Perplexity, KL Divergence, ARC (Easy+Challenge), HellaSwag, MMLU, Truthful QA and WinoGrande scores for each quantized model
49
  6. Keep versions with the best scores
50
  7. Repeat until all desired quants are created. I find that quantizations below Q3/IQ3 are not fit for my purposes and therefore do not usually generate them, but happy to provide other quants on request.
51
 
 
56
  ### Sizes (in GB)
57
  | Model | Bartowski | Unsloth | Repo | Shrinkage |
58
  |-----------------------------------------------------------------------------------|----------:|---------|------:|----------:|
59
+ | [DeepSeek-R1-Distill-Llama-8B-IQ3_M](./DeepSeek-R1-Distill-Llama-8B-IQ3_M.gguf) | 3.78 | N/A | 3.48 | 7.9% |
60
+ | [DeepSeek-R1-Distill-Llama-8B-IQ3_S](./DeepSeek-R1-Distill-Llama-8B-IQ3_S.gguf) | N/A | N/A | 3.24 | N/A |
61
+ | [DeepSeek-R1-Distill-Llama-8B-IQ4_NL](./DeepSeek-R1-Distill-Llama-8B-IQ4_NL.gguf) | 4.68 | N/A | 4.30 | 8.1% |
62
+ | [DeepSeek-R1-Distill-Llama-8B-Q3_K_L](./DeepSeek-R1-Distill-Llama-8B-Q3_K_L.gguf) | 4.32 | N/A | 3.45 | 20.1% |
63
+ | [DeepSeek-R1-Distill-Llama-8B-Q3_K_M](./DeepSeek-R1-Distill-Llama-8B-Q3_K_M.gguf) | 4.02 | 4.02 | 3.37 | 16.2% |
64
+ | [DeepSeek-R1-Distill-Llama-8B-Q3_K_S](./DeepSeek-R1-Distill-Llama-8B-Q3_K_S.gguf) | 3.66 | N/A | 3.28 | 10.4% |
65
+ | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M](./DeepSeek-R1-Distill-Llama-8B-Q4_K_M.gguf) | 4.92 | 4.92 | 4.44 | 9.8% |
66
+ | [DeepSeek-R1-Distill-Llama-8B-Q4_K_S](./DeepSeek-R1-Distill-Llama-8B-Q4_K_S.gguf) | 4.69 | N/A | 4.31 | 8.1% |
67
+ | [DeepSeek-R1-Distill-Llama-8B-Q5_K_M](./DeepSeek-R1-Distill-Llama-8B-Q5_K_M.gguf) | 5.73 | 5.73 | 5.35 | 6.6% |
68
+ | [DeepSeek-R1-Distill-Llama-8B-Q5_K_S](./DeepSeek-R1-Distill-Llama-8B-Q5_K_S.gguf) | 5.60 | N/A | 5.19 | 7.3% |
69
+ | [DeepSeek-R1-Distill-Llama-8B-Q6_K](./DeepSeek-R1-Distill-Llama-8B-Q6_K.gguf) | 6.60 | 6.60 | 6.17 | 6.5% |
70
+ | [DeepSeek-R1-Distill-Llama-8B-Q8_0](./DeepSeek-R1-Distill-Llama-8B-Q8_0.gguf) | 8.54 | 8.54 | 7.84 | 8.2% |
71
 
72
  ### Perplexity and KL Divergence scores
73
  | Model | μPPL | 𝜌PPL | μKLD | RMS Δp |
74
  |-----------------------------------------------------------------------------------|--------------------:|-------:|-------------------:|--------------:|
75
+ | [DeepSeek-R1-Distill-Llama-8B-IQ3_M](./DeepSeek-R1-Distill-Llama-8B-IQ3_M.gguf) | 18.513609 ±0.156607 | 91.75% | 0.532214 ±0.001850 | 19.740 ±0.070 |
76
+ | [DeepSeek-R1-Distill-Llama-8B-IQ3_S](./DeepSeek-R1-Distill-Llama-8B-IQ3_S.gguf) | 19.112490 ±0.165621 | 91.50% | 0.547460 ±0.001918 | 19.434 ±0.071 |
77
+ | [DeepSeek-R1-Distill-Llama-8B-IQ4_NL](./DeepSeek-R1-Distill-Llama-8B-IQ4_NL.gguf) | 16.368324 ±0.146856 | 96.44% | 0.243864 ±0.001293 | 12.434 ±0.063 |
78
+ | [DeepSeek-R1-Distill-Llama-8B-Q3_K_L](./DeepSeek-R1-Distill-Llama-8B-Q3_K_L.gguf) | 17.319338 ±0.145208 | 92.60% | 0.477681 ±0.001783 | 18.029 ±0.069 |
79
+ | [DeepSeek-R1-Distill-Llama-8B-Q3_K_M](./DeepSeek-R1-Distill-Llama-8B-Q3_K_M.gguf) | 17.594278 ±0.144215 | 91.45% | 0.553217 ±0.001919 | 19.812 ±0.070 |
80
+ | [DeepSeek-R1-Distill-Llama-8B-Q3_K_S](./DeepSeek-R1-Distill-Llama-8B-Q3_K_S.gguf) | 18.458827 ±0.153192 | 90.73% | 0.602604 ±0.002075 | 20.369 ±0.072 |
81
+ | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M](./DeepSeek-R1-Distill-Llama-8B-Q4_K_M.gguf) | 14.675582 ±0.124114 | 98.02% | 0.126483 ±0.000727 | 9.254 ±0.052 |
82
+ | [DeepSeek-R1-Distill-Llama-8B-Q4_K_S](./DeepSeek-R1-Distill-Llama-8B-Q4_K_S.gguf) | 14.635869 ±0.123593 | 97.97% | 0.130017 ±0.000732 | 9.361 ±0.053 |
83
+ | [DeepSeek-R1-Distill-Llama-8B-Q5_K_M](./DeepSeek-R1-Distill-Llama-8B-Q5_K_M.gguf) | 14.310641 ±0.120564 | 98.83% | 0.076779 ±0.000579 | 7.195 ±0.050 |
84
+ | [DeepSeek-R1-Distill-Llama-8B-Q5_K_S](./DeepSeek-R1-Distill-Llama-8B-Q5_K_S.gguf) | 14.305297 ±0.120363 | 98.82% | 0.077645 ±0.000576 | 7.256 ±0.049 |
85
+ | [DeepSeek-R1-Distill-Llama-8B-Q6_K](./DeepSeek-R1-Distill-Llama-8B-Q6_K.gguf) | 14.223713 ±0.119989 | 98.91% | 0.071936 ±0.000599 | 6.892 ±0.051 |
86
+ | [DeepSeek-R1-Distill-Llama-8B-Q8_0](./DeepSeek-R1-Distill-Llama-8B-Q8_0.gguf) | 14.249305 ±0.120101 | 98.99% | 0.066705 ±0.000592 | 6.662 ±0.052 |
87
  | [DeepSeek-R1-Distill-Llama-8B-F16](./DeepSeek-R1-Distill-Llama-8B-F16.gguf) | 14.009216 ±0.118474 | 100% | N/A | N/A |
88
 
89
  ### ARC, HellaSwag, MMLU, Truthful QA and WinoGrande scores
 
91
 
92
  For the test data used in the generation of these scores, follow the appropiate links: [HellaSwag](<https://github.com/klosax/hellaswag_text_data>), [ARC, MMLU, Truthful QA](<https://huggingface.co/datasets/ikawrakow/validation-datasets-for-llama.cpp/tree/main>) and [WinoGrande](<https://huggingface.co/datasets/ikawrakow/winogrande-eval-for-llama.cpp/tree/main>)
93
 
94
+ | Model | ARC | HellaSwag | MMLU | Truthful QA | WinoGrande | Avg Score |
95
+ |---------------------------------------------------------------------------------------------------------------------|----------------:|----------:|----------------:|----------------:|----------------:|----------:|
96
+ | [DeepSeek-R1-Distill-Llama-8B-IQ3_M](./DeepSeek-R1-Distill-Llama-8B-IQ3_M.gguf) | 51.3369 ±1.8288 | 69.33 | 32.9333 ±1.7172 | 32.2981 ±2.6100 | 64.2667 ±1.7510 | 50.03 |
97
+ | [DeepSeek-R1-Distill-Llama-8B-IQ3_S](./DeepSeek-R1-Distill-Llama-8B-IQ3_S.gguf) | 48.1928 ±1.8294 | 66.67 | 34.5333 ±1.7374 | 31.1321 ±2.6007 | 65.2000 ±1.7405 | 49.15 |
98
+ | [DeepSeek-R1-Distill-Llama-8B-IQ4_NL](./DeepSeek-R1-Distill-Llama-8B-IQ4_NL.gguf) | 51.8072 ±1.8294 | 72.00 | 36.6667 ±1.7608 | 32.1212 ±2.5743 | 65.3333 ±1.7389 | 51.59 |
99
+ | [DeepSeek-R1-Distill-Llama-8B-Q3_K_L](./DeepSeek-R1-Distill-Llama-8B-Q3_K_L.gguf) | 51.4056 ±1.8299 | 65.20 | 34.5333 ±1.7374 | 33.8509 ±2.6412 | 68.0000 ±1.7045 | 50.60 |
100
+ | [DeepSeek-R1-Distill-Llama-8B-Q3_K_M](./DeepSeek-R1-Distill-Llama-8B-Q3_K_M.gguf) | 51.5395 ±1.8298 | 70.13 | 34.4000 ±1.7358 | 31.3665 ±2.5897 | 66.1333 ±1.7292 | 50.71 |
101
+ | [DeepSeek-R1-Distill-Llama-8B-Q3_K_S](./DeepSeek-R1-Distill-Llama-8B-Q3_K_S.gguf) | 50.8021 ±1.8292 | 71.20 | 31.3333 ±1.6949 | 34.5679 ±2.6462 | 67.4667 ±1.7119 | 51.07 |
102
+ | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M](./DeepSeek-R1-Distill-Llama-8B-Q4_K_M.gguf) | 52.8782 ±1.8276 | 74.40 | 35.7333 ±1.7510 | 34.0625 ±2.6534 | 67.4667 ±1.7119 | 52.91 |
103
+ | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M-bartowski](https://huggingface.co/bartowski/DeepSeek-R1-Distill-Llama-8B-GGUF) | 50.3347 ��1.8306 | 74.40 | 34.8000 ±1.7405 | 37.1069 ±2.7133 | 69.4667 ±1.6828 | 53.22 |
104
+ | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M-unsloth](https://huggingface.co/unsloth/DeepSeek-R1-Distill-Llama-8B-GGUF) | 52.4766 ±1.8284 | 73.20 | 33.2000 ±1.7207 | 36.0000 ±2.6667 | 68.4000 ±1.6988 | 52.66 |
105
+ | [DeepSeek-R1-Distill-Llama-8B-Q4_K_S](./DeepSeek-R1-Distill-Llama-8B-Q4_K_S.gguf) | 50.2008 ±1.8306 | 74.93 | 34.1333 ±1.7325 | 34.6875 ±2.6650 | 66.9333 ±1.7190 | 52.18 |
106
+ | [DeepSeek-R1-Distill-Llama-8B-Q5_K_M](./DeepSeek-R1-Distill-Llama-8B-Q5_K_M.gguf) | 53.6096 ±1.8246 | 72.66 | 34.6667 ±1.7389 | 35.7798 ±2.6549 | 66.0000 ±1.7309 | 52.54 |
107
+ | [DeepSeek-R1-Distill-Llama-8B-Q5_K_S](./DeepSeek-R1-Distill-Llama-8B-Q5_K_S.gguf) | 53.2798 ±1.8267 | 75.33 | 35.2000 ±1.7451 | 36.3354 ±2.6845 | 68.8000 ±1.6929 | 53.79 |
108
+ | [DeepSeek-R1-Distill-Llama-8B-Q6_K](./DeepSeek-R1-Distill-Llama-8B-Q6_K.gguf) | 51.8717 ±1.8281 | 76.00 | 33.3333 ±1.7225 | 35.1852 ±2.6571 | 68.6667 ±1.6949 | 53.01 |
109
+ | [DeepSeek-R1-Distill-Llama-8B-Q8_0](./DeepSeek-R1-Distill-Llama-8B-Q8_0.gguf) | 51.9359 ±1.8268 | 72.00 | 33.4667 ±1.7242 | 35.0000 ±2.6705 | 68.6667 ±1.6949 | 52.21 |
110
+ | [DeepSeek-R1-Distill-Llama-8B-F16](./DeepSeek-R1-Distill-Llama-8B-F16.gguf) | 51.4706 ±1.8286 | 72.93 | 36.1333 ±1.7553 | 36.1111 ±2.6726 | 68.8000 ±1.6929 | 53.09 |
111
 
112
  ### Tokens per Second - Benchmarks
113
  Scores generated using [llama-bench](https://github.com/ggml-org/llama.cpp/tree/master/examples/llama-bench). Q4_K_M quantizations from [Bartowski](https://huggingface.co/bartowski/DeepSeek-R1-Distill-Qwen-7B-GGUF/tree/main) and [Unsloth](https://huggingface.co/unsloth/DeepSeek-R1-Distill-Qwen-7B-GGUF/tree/main) included for comparison.
114
 
115
  | model | size | params | backend | threads | test | t/s |
116
  |---------------------------------------------------------------------------------------------------------------------|---------:|-------:|------------|--------:|--------------:|--------------:|
117
+ | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M](./DeepSeek-R1-Distill-Llama-8B-Q4_K_M.gguf) | 4.13 GiB | 8.03 B | Metal,BLAS | 6 | pp512 | 330.94 ± 1.42 |
118
+ | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M](./DeepSeek-R1-Distill-Llama-8B-Q4_K_M.gguf) | 4.13 GiB | 8.03 B | Metal,BLAS | 6 | tg128 | 26.28 ± 0.11 |
119
+ | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M](./DeepSeek-R1-Distill-Llama-8B-Q4_K_M.gguf) | 4.13 GiB | 8.03 B | Metal,BLAS | 6 | pp1024+tg1024 | 42.90 ± 0.05 |
120
  | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M-bartowski](https://huggingface.co/bartowski/DeepSeek-R1-Distill-Llama-8B-GGUF) | 4.58 GiB | 8.03 B | Metal,BLAS | 6 | pp512 | 329.03 ± 0.11 |
121
  | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M-bartowski](https://huggingface.co/bartowski/DeepSeek-R1-Distill-Llama-8B-GGUF) | 4.58 GiB | 8.03 B | Metal,BLAS | 6 | tg128 | 25.79 ± 0.92 |
122
  | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M-bartowski](https://huggingface.co/bartowski/DeepSeek-R1-Distill-Llama-8B-GGUF) | 4.58 GiB | 8.03 B | Metal,BLAS | 6 | pp1024+tg1024 | 42.35 ± 0.93 |
 
127
  # Metrics used
128
  **[Perplexity](<https://huggingface.co/docs/transformers/en/perplexity>):** one of the key metrics used in NLP evaluation. It measures the quality of a language model by evaluating how well it predicts the next token given a particular sequence of words. A PPL of **1** indicates an exact match between predicted and actual, whereas values greater than one indicate a degree of "surprise" the generated token differs from the expected.
129
 
130
+ **[Kullback–Leibler (KL) Divergence](<https://en.wikipedia.org/wiki/Kullback–Leibler_divergence>):** a statistical measure of how much a probability distribution differs from another. When quantizing models (or altering the original tensors in any way for that matter), the closest we can preserve the weights' probability distribution to the original model the better, thus the closest to **0** the better.
131
 
132
  **[AI2 Reasoning Challenge (ARC)](<https://leaderboard.allenai.org/arc/submissions/get-started>):** a benchmark to evaluate the ability of AI models to answer complex science questions that require logical reasoning beyond pattern matching.
133
 
 
140
  **[Winogrande](<https://winogrande.allenai.org/>):** based on the [Winograd Schema Challenge](<https://cdn.aaai.org/ocs/4492/4492-21843-1-PB.pdf>), is a natural language understanding task requiring models to resolve ambiguities in sentences involving pronoun references.
141
 
142
  ## Credits
143
+ A big **Thank You!** to [Colin Kealty](<https://huggingface.co/bartowski>) for the many contributions and for being one of the best sources of high quality quantized models available in Hugginface, and a really big ***Thank You!*** to [Georgi Gerganov](<https://github.com/ggerganov>) for his amazing work with **llama.cpp** and the **ggml/gguf** libraries.