eaddario commited on
Commit
398ddf7
·
verified ·
1 Parent(s): afa61ba

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +103 -39
README.md CHANGED
@@ -11,69 +11,133 @@ pipeline_tag: text-generation
11
  tags:
12
  - gguf
13
  - quant
 
14
  ---
15
 
16
- # GGUF and "i-matrix" quantized versions of deepseek-ai/DeepSeek-R1-Distill-Llama-8B
17
 
18
- Using [LLaMA C++](https://github.com/ggerganov/llama.cpp) release [b4608](https://github.com/ggerganov/llama.cpp/releases/tag/b4608) for quantization.
19
 
20
  Original model: [deepseek-ai/DeepSeek-R1-Distill-Llama-8B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Llama-8B)
21
 
22
  From the original model creators:
23
-
24
  > 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. With RL, DeepSeek-R1-Zero naturally emerged with numerous powerful and interesting reasoning behaviors. However, DeepSeek-R1-Zero encounters challenges such as endless repetition, poor readability, and language mixing. To address these issues and further enhance reasoning performance, we introduce DeepSeek-R1, which incorporates cold-start data before RL. DeepSeek-R1 achieves performance comparable to OpenAI-o1 across math, code, and reasoning tasks. 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.
25
-
26
  > NOTE: Before running DeepSeek-R1 series models locally, we kindly recommend reviewing the [Usage Recommendation](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Llama-8B#usage-recommendations) section.
27
 
28
- All quantized versions were generated using an appropriate imatrix created from datasets available at [eaddario/imatrix-calibration](https://huggingface.co/datasets/eaddario/imatrix-calibration).
29
 
30
- 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.
31
 
32
- The process to produce the quantized [GGUF](https://huggingface.co/docs/hub/en/gguf) models is roughly as follows:
33
 
34
- 1. Convert the the original model's safetensors into GGUF F16*
35
- 2. Estimate the Perplexity score for the F16 model (base) using [wikitext-2-raw-v1](https://huggingface.co/datasets/Salesforce/wikitext/tree/main/wikitext-2-raw-v1), and record the [logits](https://huggingface.co/eaddario/DeepSeek-R1-Distill-Llama-8B-GGUF/tree/main/logits)
36
- 3. Generate the [imatrix](https://huggingface.co/eaddario/DeepSeek-R1-Distill-Llama-8B-GGUF/tree/main/imatrix) for each calibration dataset
37
- 4. Create quantized versions of the base model using each imatrix per quant type
38
- 5. Calculate the Perplexity and KL Divergence scores for each quantized model [(scores)](https://huggingface.co/eaddario/DeepSeek-R1-Distill-Llama-8B-GGUF/tree/main/scores)
39
- 6. For each quant type, keep the version with the best (usually the lowest) scores
40
 
41
- *[BF16](https://en.wikipedia.org/wiki/Bfloat16_floating-point_format) would be preferred, but Apple's GPUs don't support it yet, and therefore any operations are executed in the CPU, making it unacceptably slow. This is expected to change in the near term but until then, if you are using Apple kit avoid using any models tagged BF16
42
 
43
- # Motivation
44
 
45
- An area of ongoing personal research is to optimize the inference performance of LLMs when deployed in resource-constrained environments like, for example, commodity hardware, personal desktops/laptops, edge devices, etc.
46
 
47
- 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!).
48
 
49
- By producing imatrix optimized quantized models, we can maintain inference efficiency whilst reducing memory size and CPU/GPU processing requirements. This optimization is crucial for deploying LLMs on devices with limited hardware capabilities, such as mobile phones or edge devices, without sacrificing significant accuracy.
 
 
 
 
 
 
 
 
50
 
51
  # Models
52
 
53
- | Filename | Quant type | Size | Perplexity (μ) | ln(PPL(Q)/PPL(base)) | KL Divergence (μ) | Description |
54
- |-----------------------------------------------------------------------------------|------------|------|---------------------|----------------------|--------------------|----------------------------------------------------------------------------------|
55
- | [DeepSeek-R1-Distill-Llama-8B-F16](./DeepSeek-R1-Distill-Llama-8B-F16.gguf) | F16 | 15G | 14.009216 ±0.118474 | N/A | N/A | 16-bit standard IEEE 754 half-precision floating-point number |
56
- | [DeepSeek-R1-Distill-Llama-8B-Q8_0](./DeepSeek-R1-Distill-Llama-8B-Q8_0.gguf) | Q8_0 | 8.0G | 14.034924 ±0.119030 | 99.93% | 0.001945 ±0.000033 | Extremely high quality, generally unneeded but max available quant |
57
- | [DeepSeek-R1-Distill-Llama-8B-Q6_K](./DeepSeek-R1-Distill-Llama-8B-Q6_K.gguf) | Q6_K | 6.1G | 13.846273 ±0.117603 | 99.39% | 0.044284 ±0.000722 | Very high quality, near perfect, *recommended* |
58
- | [DeepSeek-R1-Distill-Llama-8B-Q5_K_M](./DeepSeek-R1-Distill-Llama-8B-Q5_K_M.gguf) | Q5_K_M | 5.3G | 14.094598 ±0.119327 | 99.25% | 0.045327 ±0.000475 | High quality |
59
- | [DeepSeek-R1-Distill-Llama-8B-Q5_K_S](./DeepSeek-R1-Distill-Llama-8B-Q5_K_S.gguf) | Q5_K_S | 5.2G | 14.060444 ±0.119091 | 99.49% | 0.030597 ±0.000278 | High quality, *recommended* |
60
- | [DeepSeek-R1-Distill-Llama-8B-IQ4_NL](./DeepSeek-R1-Distill-Llama-8B-IQ4_NL.gguf) | IQ4_NL | 4.4G | 14.150903 ±0.119732 | 98.72% | 0.081957 ±0.000567 | Good quality, new method (super-blocks with 256 weights), Q4_K_S performs better |
61
- | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M](./DeepSeek-R1-Distill-Llama-8B-Q4_K_M.gguf) | Q4_K_M | 4.6G | 14.049490 ±0.119296 | 98.90% | 0.071652 ±0.000563 | Good quality, default size for must use cases, *recommended* |
62
- | [DeepSeek-R1-Distill-Llama-8B-Q4_K_S](./DeepSeek-R1-Distill-Llama-8B-Q4_K_S.gguf) | Q4_K_S | 4.4G | 14.156039 ±0.120378 | 98.86% | 0.073625 ±0.000505 | Good quality, best choice in the Q4 series if RAM is scarce, *recommended* |
63
- | [DeepSeek-R1-Distill-Llama-8B-IQ3_M](./DeepSeek-R1-Distill-Llama-8B-IQ3_M.gguf) | IQ3_M | 3.5G | 15.074649 ±0.125392 | 96.24% | 0.231125 ±0.001065 | Medium-low quality, new method with decent performance comparable to Q3_K_M |
64
- | [DeepSeek-R1-Distill-Llama-8B-IQ3_S](./DeepSeek-R1-Distill-Llama-8B-IQ3_S.gguf) | IQ3_S | 3.4G | 15.334981 ±0.127912 | 95.98% | 0.248986 ±0.001138 | Lower quality, new method with decent performance, sligthly better than Q3_K_S |
65
- | [DeepSeek-R1-Distill-Llama-8B-Q3_K_L](./DeepSeek-R1-Distill-Llama-8B-Q3_K_L.gguf) | Q3_K_L | 4.0G | 14.871865 ±0.126955 | 97.50% | 0.154127 ±0.000850 | Lower quality but usable, good for low RAM availability |
66
- | [DeepSeek-R1-Distill-Llama-8B-Q3_K_M](./DeepSeek-R1-Distill-Llama-8B-Q3_K_M.gguf) | Q3_K_M | 3.7G | 15.028835 ±0.128791 | 97.12% | 0.176316 ±0.000924 | Medium-low quality |
67
- | [DeepSeek-R1-Distill-Llama-8B-Q3_K_S](./DeepSeek-R1-Distill-Llama-8B-Q3_K_S.gguf) | Q3_K_S | 3.4G | 15.513099 ±0.129202 | 94.85% | 0.320092 ±0.001344 | Lower quality but may be usable in certain cases |
68
-
69
- 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.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  # Metrics used
 
72
 
73
- **[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.
74
 
75
- **[Kullback–Leibler (KL) Divergence](https://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_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.
76
 
77
- ## Credits
78
 
79
- 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.
 
 
 
 
 
 
 
 
11
  tags:
12
  - gguf
13
  - quant
14
+ - experimental
15
  ---
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
 
23
  From the original model creators:
 
24
  > 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. With RL, DeepSeek-R1-Zero naturally emerged with numerous powerful and interesting reasoning behaviors. However, DeepSeek-R1-Zero encounters challenges such as endless repetition, poor readability, and language mixing. To address these issues and further enhance reasoning performance, we introduce DeepSeek-R1, which incorporates cold-start data before RL. DeepSeek-R1 achieves performance comparable to OpenAI-o1 across math, code, and reasoning tasks. 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.
25
+ >
26
  > NOTE: Before running DeepSeek-R1 series models locally, we kindly recommend reviewing the [Usage Recommendation](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Llama-8B#usage-recommendations) section.
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
 
42
+ The process to generate these models is roughly as follows:
43
 
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
+
52
+ *[BF16](<https://en.wikipedia.org/wiki/Bfloat16_floating-point_format>) would be preferred, but Apple's GPUs don't support it yet, and therefore any operations are executed in the CPU, making it unacceptably slow. This is expected to change in the near term but until then, if you are using Apple kit avoid using any models tagged BF16
53
 
54
  # Models
55
 
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
90
+ Scores generated using [llama-perplexity](<https://github.com/ggml-org/llama.cpp/tree/master/examples/perplexity>) with 750 tasks per test, and a context size of 768 tokens. Naive (`llama-quantize` with no optimization) Q4_K_M quantization included for comparison.
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 |
123
+ | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M-unsloth](https://huggingface.co/unsloth/DeepSeek-R1-Distill-Llama-8B-GGUF) | 4.58 GiB | 8.03 B | Metal,BLAS | 6 | pp512 | 328.93 ± 0.15 |
124
+ | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M-unsloth](https://huggingface.co/unsloth/DeepSeek-R1-Distill-Llama-8B-GGUF) | 4.58 GiB | 8.03 B | Metal,BLAS | 6 | tg128 | 26.43 ± 0.01 |
125
+ | [DeepSeek-R1-Distill-Llama-8B-Q4_K_M-unsloth](https://huggingface.co/unsloth/DeepSeek-R1-Distill-Llama-8B-GGUF) | 4.58 GiB | 8.03 B | Metal,BLAS | 6 | pp1024+tg1024 | 42.38 ± 0.97 |
126
 
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
 
134
+ **[HellaSwag](<https://rowanzellers.com/hellaswag/>):** the Harder Endings, Longer contexts, and Low-shot Activities for Situations With Adversarial Generations (bit of a mouthful!) is a benchmark designed to test commonsense natural language inference. It requires the model to predict the most likely ending of a sentence.
135
 
136
+ **[MMLU](<https://github.com/hendrycks/test>):** the Massive Multitask Language Understanding evaluates LLMs’ general knowledge and problem-solving abilities across 57 subjects, including elementary mathematics, US history, computer science, and law.
137
+
138
+ **[Truthful QA](<https://github.com/sylinrl/TruthfulQA>):** evaluates how well LLMs generate truthful responses to questions. It identifies whether AI models can avoid generating false or misleading information, particularly in areas where human knowledge is prone to misconceptions.
139
+
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.