Text Generation
GGUF
English
quant
experimental

Experimental layer-wise quantization of mistralai/Mistral-Small-3.2-24B-Instruct-2506

Using LLaMA C++ release b5890 for quantization.

Original model: mistralai/Mistral-Small-3.2-24B-Instruct-2506

From the original model creators:

PLEASE READ THIS BEFORE USING THESE EXPERIMENTAL VERSIONS!

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.

The method used to produce these experimental versions is covered in Squeezing Tensor Bits: the quest for smaller LLMs, but at a high level it involves using a custom version of llama-imatrix to identify influential tensors and quantize the most important layers to higher bit precision and the less important to lower bits. This process was partly inspired by Dumitru's et al Layer-Wise Quantization: A Pragmatic and Effective Method for Quantizing LLMs Beyond Integer Bit-Levels.

As of version b5125, llama-quantize can perform tensor-wide quantization (TWQ), whereby user-defined tensors are quantized at a specific level, or perform layer-wise quantization (LWQ) by selecting different quantization types per tensor/layer. For example, --tensor-type attn_v=q6_k will quantize all Attention Value tensors at q6_k (TWQ), and --tensor-type "\.([0-9]|1[01257]|31)\.attn_k=q4_k" will quantize Attention Key tensors on layers 0 to 9, 10, 11, 12, 15, 17 and 31 at q4_k, leaving the remaining layers at their default value (LWQ).

An enhanced version of llama-imatrix generates useful statistics to guide the tensor and layer selection process. --show-statistics will display:

  • ฮฃ(Actยฒ): the sum of all squared activations over the tensor (i.e. the Importance Scores)
  • Min & Max: minimum and maximum squared activation values
  • ฮผ & ฯƒ: activations' mean and standard deviation
  • % Active: proportion of elements whose average squared activation exceeds a very small threshold (1e-5). Helpful to determine how alive/dormant the tensor is during inference
  • N: number of squared activations in the tensor
  • Entropy: entropy of the squared activation distribution, in bits (standard Shannon entropy measurement)
  • E (norm): Normalized entropy.
  • ZD Score: z-score distribution as described in 3.1 Layer Importance Scores in the Layer-Wise Quantization paper
  • CosSim: cosine similarity between same type tensors with respect to the previous layer (i.e. blk.7.attn_k and blk.6.attn_k)

Please note that statistics are calculated for each individual tensor and should be used to compare between tensors of the same type only. For example, assuming that attn_k in layer 10 has a higher influence during inference than attn_k in layer 7 because its ฮฃ(Actยฒ) is larger makes sense, whilst concluding the same between attn_k and ffn_down does not.

Thereโ€™s a pull request to merge these changes back into the core llama.cpp project. This may or may not ever happen so, until then, the modified version will be available on GitHub.

For testing and comparison I use models produced by Unsloth (Daniel and Michael Han do some really advanced level stuff!) and Bartowski (see credits below) but if they don't provide versions of the required model, all tests and comparisons are done against naive quantizations obtained by simply running llama-quantize with no further optimization.

All experimental versions were generated using an appropriate imatrix created from calibration datasets available at 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 modelled, and it helps to counterbalance the negative effects of quantization and pruning.

The process to generate these models is roughly as follows:

  1. Convert the original model's tensors to GGUF F16*
  2. Estimate the Perplexity score for the F16 model (baseline) using the wikitext-2-raw-v1 dataset, and save the logits
  3. Generate an imatrix from selected calibration datasets
  4. Determine tensor and layer Importance Score contribution using the enhanced version of llama-imatrix
  5. Select an appropriate quant level for each tensor and quantize the model using llama-quantize
  6. Calculate Perplexity, KL Divergence, ARC (Easy+Challenge), HellaSwag, MMLU, Truthful QA and WinoGrande scores for each quantized model
  7. Keep versions with the best scores
  8. 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.

*BF16 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

Models

Sizes (in GB)

Bits per Weight, Perplexity and KL Divergence scores

Model BPW ฮผPPL ๐œŒPPL ฮผKLD RMS ฮ”p
Mistral-Small-3.2-24B-Instruct-2506-IQ3_M 3.6679 5.881495 ยฑ0.036600 96.02% 0.161170 ยฑ0.000932 11.914 ยฑ0.064
Mistral-Small-3.2-24B-Instruct-2506-IQ3_S 3.1939 6.627247 ยฑ0.044839 93.59% 0.280955 ยฑ0.001328 14.705 ยฑ0.066
Mistral-Small-3.2-24B-Instruct-2506-IQ4_NL 4.4277 5.469067 ยฑ0.030378 98.05% 0.079684 ยฑ0.000532 9.157 ยฑ0.058
Mistral-Small-3.2-24B-Instruct-2506-Q3_K_L 3.8586 5.888684 ยฑ0.036150 95.56% 0.156209 ยฑ0.001057 12.306 ยฑ0.070
Mistral-Small-3.2-24B-Instruct-2506-Q3_K_M 3.5336 5.984453 ยฑ0.037095 95.00% 0.174551 ยฑ0.001162 12.839 ยฑ0.072
Mistral-Small-3.2-24B-Instruct-2506-Q3_K_S 3.1164 6.705644 ยฑ0.044170 92.07% 0.287128 ยฑ0.001576 15.477 ยฑ0.074
Mistral-Small-3.2-24B-Instruct-2506-Q4_K_M 4.1108 5.288988 ยฑ0.030482 98.74% 0.046663 ยฑ0.000405 6.914 ยฑ0.057
Mistral-Small-3.2-24B-Instruct-2506-Q4_K_M-bartowski 4.8620 5.162781 ยฑ0.029306 99.42% 0.022338 ยฑ0.000204 4.694 ยฑ0.046
Mistral-Small-3.2-24B-Instruct-2506-Q4_K_M-unsloth 4.8620 5.163345 ยฑ0.029336 99.43% 0.022240 ยฑ0.000199 4.648 ยฑ0.045
Mistral-Small-3.2-24B-Instruct-2506-Q4_K_S 3.8089 5.377537 ยฑ0.031286 98.21% 0.064172 ยฑ0.000515 7.916 ยฑ0.060
Mistral-Small-3.2-24B-Instruct-2506-Q5_K_M 5.4420 5.116946 ยฑ0.028918 99.70% 0.012156 ยฑ0.000121 3.583 ยฑ0.039
Mistral-Small-3.2-24B-Instruct-2506-Q5_K_S 5.0570 5.131193 ยฑ0.029040 99.61% 0.015377 ยฑ0.000140 3.962 ยฑ0.039
Mistral-Small-3.2-24B-Instruct-2506-Q6_K 6.4562 5.071010 ยฑ0.028401 99.92% 0.003122 ยฑ0.000034 1.804 ยฑ0.023
Mistral-Small-3.2-24B-Instruct-2506-Q8_0 7.0672 5.063644 ยฑ0.028399 99.96% 0.001676 ยฑ0.000017 1.290 ยฑ0.015
Mistral-Small-3.2-24B-Instruct-2506-F16 16.0003 5.050590 ยฑ0.028422 100% N/A N/A

ARC, HellaSwag, MMLU, Truthful QA and WinoGrande scores

Scores generated using llama-perplexity with 750 tasks per test, and a context size of 768 tokens.

For the test data used in the generation of these scores, follow the appropiate links: HellaSwag, ARC, MMLU, Truthful QA and WinoGrande

Model ARC HellaSwag MMLU Truthful QA WinoGrande Avg Score
Mistral-Small-3.2-24B-Instruct-2506-IQ3_M 69.7333 ยฑ1.6787 83.87 43.4667 ยฑ1.8113 34.9333 ยฑ1.7420 78.0000 ยฑ1.5136 56.40
Mistral-Small-3.2-24B-Instruct-2506-IQ3_S 67.6000 ยฑ1.7100 83.07 44.1333 ยฑ1.8143 35.4667 ยฑ1.7481 77.6000 ยฑ1.5234 56.67
Mistral-Small-3.2-24B-Instruct-2506-IQ4_NL 69.2000 ยฑ1.6869 84.93 43.0667 ยฑ1.8093 37.8667 ยฑ1.7724 78.9333 ยฑ1.4900 57.47
Mistral-Small-3.2-24B-Instruct-2506-Q3_K_L 69.0667 ยฑ1.6889 82.27 43.3333 ยฑ1.8106 35.4667 ยฑ1.7481 78.0000 ยฑ1.5136 57.25
Mistral-Small-3.2-24B-Instruct-2506-Q3_K_M 68.9333 ยฑ1.6909 82.00 43.2000 ยฑ1.8100 36.6667 ยฑ1.7608 78.1333 ยฑ1.5103 57.76
Mistral-Small-3.2-24B-Instruct-2506-Q3_K_S 69.8667 ยฑ1.6766 81.46 42.8000 ยฑ1.8079 34.5333 ยฑ1.7374 76.1333 ยฑ1.5576 55.39
Mistral-Small-3.2-24B-Instruct-2506-Q4_K_M 69.0667 ยฑ1.6889 83.33 45.0667 ยฑ1.8180 37.4667 ยฑ1.7686 79.0667 ยฑ1.4865 56.61
Mistral-Small-3.2-24B-Instruct-2506-Q4_K_M-bartowski 67.0667 ยฑ1.7172 83.60 45.7333 ยฑ1.8203 36.2667 ยฑ1.7567 79.4667 ยฑ1.4760 61.73
Mistral-Small-3.2-24B-Instruct-2506-Q4_K_M-unsloth 66.6667 ยฑ1.7225 84.00 45.8667 ยฑ1.8207 35.7333 ยฑ1.7510 79.3333 ยฑ1.4795 61.92
Mistral-Small-3.2-24B-Instruct-2506-Q4_K_S 69.2000 ยฑ1.6869 82.93 44.5333 ยฑ1.8160 35.8667 ยฑ1.7525 78.8000 ยฑ1.4934 57.31
Mistral-Small-3.2-24B-Instruct-2506-Q5_K_M 68.9333 ยฑ1.6909 84.13 45.7333 ยฑ1.8203 35.7333 ยฑ1.7510 79.7333 ยฑ1.4688 57.36
Mistral-Small-3.2-24B-Instruct-2506-Q5_K_S 69.2000 ยฑ1.6869 84.13 45.2000 ยฑ1.8185 36.0000 ยฑ1.7539 78.9333 ยฑ1.4900 57.17
Mistral-Small-3.2-24B-Instruct-2506-Q6_K 68.0000 ยฑ1.7045 84.26 44.5333 ยฑ1.8160 36.2667 ยฑ1.7567 79.2000 ยฑ1.4830 57.41
Mistral-Small-3.2-24B-Instruct-2506-Q8_0 68.4000 ยฑ1.6988 84.27 44.5333 ยฑ1.8160 36.8000 ยฑ1.7621 79.0667 ยฑ1.4865 57.28
Mistral-Small-3.2-24B-Instruct-2506-F16 68.2667 ยฑ1.7007 84.40 45.2000 ยฑ1.8185 36.8000 ยฑ1.7621 79.4667 ยฑ1.4760 61.95

Tokens per Second - Benchmarks

Scores generated using llama-bench. Naive (llama-quantize with no optimization) Q4_K_M quantization included for comparison.

model size params backend threads test t/s
Mistral-Small-3.2-24B-Instruct-2506-Q4_K_M 12.17 GiB 23.57 B Metal,BLAS 12 pp512 250.92 ยฑ7.69
Mistral-Small-3.2-24B-Instruct-2506-Q4_K_M 12.17 GiB 23.57 B Metal,BLAS 12 tg128 26.63 ยฑ0.43
Mistral-Small-3.2-24B-Instruct-2506-Q4_K_M 12.17 GiB 23.57 B Metal,BLAS 12 pp1024+tg1024 44.73 ยฑ0.14
Mistral-Small-3.2-24B-Instruct-2506-Q4_K_M-bartowski 13.34 GiB 23.57 B Metal,BLAS 12 pp512 247.65 ยฑ20.10
Mistral-Small-3.2-24B-Instruct-2506-Q4_K_M-bartowski 13.34 GiB 23.57 B Metal,BLAS 12 tg128 27.68 ยฑ1.07
Mistral-Small-3.2-24B-Instruct-2506-Q4_K_M-bartowski 13.34 GiB 23.57 B Metal,BLAS 12 pp1024+tg1024 45.66 ยฑ0.10
Mistral-Small-3.2-24B-Instruct-2506-Q4_K_M-unsloth 13.34 GiB 23.57 B Metal,BLAS 12 pp512 253.28 ยฑ16.91
Mistral-Small-3.2-24B-Instruct-2506-Q4_K_M-unsloth 13.34 GiB 23.57 B Metal,BLAS 12 tg128 27.75 ยฑ0.79
Mistral-Small-3.2-24B-Instruct-2506-Q4_K_M-unsloth 13.34 GiB 23.57 B Metal,BLAS 12 pp1024+tg1024 45.62 ยฑ0.14

Metrics used

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.

Kullbackโ€“Leibler (KL) 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.

AI2 Reasoning Challenge (ARC): a benchmark to evaluate the ability of AI models to answer complex science questions that require logical reasoning beyond pattern matching.

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.

MMLU: 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.

Truthful QA: 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.

Winogrande: based on the Winograd Schema Challenge, is a natural language understanding task requiring models to resolve ambiguities in sentences involving pronoun references.

Credits

LLaMa C++ has a large and vibrant community of contributors (~1,200 last time I checked) that actively maintain and extend its functionality, adding new models and architectures almost as fast as they appear (considering the breakneck speed at which the AI/ML field is advancing, this alone is a remarkable feat!), and whilst I'm grateful to each and everyone of them, I want to recognise three people in particular: Thank You! Colin Kealty for the many contributions and for being one of the best sources of high quality quantized models available on Hugging Face, and a really big Thank You! to Georgi Gerganov for his amazing work with llama.cpp and the ggml/gguf libraries, and Iwan Kawrakow for being one of the key authors behind the many quantisation algorithms and the imatrix functionality.

Downloads last month
-
GGUF
Model size
23.6B params
Architecture
llama
Hardware compatibility
Log In to view the estimation

3-bit

4-bit

5-bit

6-bit

8-bit

16-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for eaddario/Mistral-Small-3.2-24B-Instruct-2506-GGUF

Dataset used to train eaddario/Mistral-Small-3.2-24B-Instruct-2506-GGUF