Experimental layer-wise quantization of watt-ai/watt-tool-8B
Using LLaMA C++ release b5150 for quantization.
Original model: watt-ai/watt-tool-8B
From the original model creators:
watt-tool-8B is a fine-tuned language model based on LLaMa-3.1-8B-Instruct, optimized for tool usage and multi-turn dialogue. It achieves state-of-the-art performance on the Berkeley Function-Calling Leaderboard (BFCL)
The model is specifically designed to excel at complex tool usage scenarios that require multi-turn interactions, making it ideal for empowering platforms like Lupan, an AI-powered workflow building tool. By leveraging a carefully curated and optimized dataset, watt-tool-8B demonstrates superior capabilities in understanding user requests, selecting appropriate tools, and effectively utilizing them across multiple turns of conversation.
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 custom versions of llama-imatrix
and llama-quantize
to identify the 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.
There’re two pull requests (imatrix & quantize) to merge these changes back into the core llama.cpp project. This may or may not ever happen so, until then, the modified versions will be available on GitHub.
For testing and comparison I'd normally use models produced by Unsloth (Daniel and Michael Han do some really advanced level stuff!) and Bartowski (see credits below), but they don't provide GGUF versions of this model, so 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 modeled, and it helps to counterbalance the negative effects of quantization and pruning.
The process to generate these models is roughly as follows:
- Convert the the original model's tensors to GGUF F16*
- Estimate the Perplexity score for the F16 model (baseline) using the wikitext-2-raw-v1 dataset, and save the logits
- Generate an imatrix from selected calibration datasets
- Determine tensor and layer Importance Score contribution using a modified version of
llama-imatrix
- Select an appropiate quant level for each tensor using a modified version of
llama-quantize
- Calculate Perplexity, KL Divergence, ARC (Easy+Challenge), HellaSwag, MMLU, Truthful QA and WinoGrande scores for each quantized model
- Keep versions with the best scores
- 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)
Model | Naive | Repo | Shrinkage |
---|---|---|---|
Watt-Tool-8B-IQ3_M | 3.78 | 3.69 | 2.4% |
Watt-Tool-8B-IQ3_S | 3.68 | 3.43 | 6.8% |
Watt-Tool-8B-IQ4_NL | 4.68 | 4.39 | 6.2% |
Watt-Tool-8B-Q3_K_L | 4.32 | 3.76 | 13.0% |
Watt-Tool-8B-Q3_K_M | 4.02 | 3.56 | 11.4% |
Watt-Tool-8B-Q3_K_S | 3.66 | 3.31 | 9.6% |
Watt-Tool-8B-Q4_K_M | 4.92 | 4.41 | 10.4% |
Watt-Tool-8B-Q4_K_S | 4.69 | 4.28 | 8.7% |
Watt-Tool-8B-Q5_K_M | 5.73 | 5.38 | 6.1% |
Watt-Tool-8B-Q5_K_S | 5.60 | 5.24 | 6.4% |
Watt-Tool-8B-Q6_K | 6.60 | 6.57 | 0.5% |
Watt-Tool-8B-Q8_0 | 8.54 | 7.73 | 9.5% |
Perplexity and KL Divergence scores
Model | μPPL | 𝜌PPL | μKLD | RMS Δp |
---|---|---|---|---|
Watt-Tool-8B-IQ3_M | 7.841948 ±0.049502 | 98.36% | 0.081774 ±0.000354 | 8.316 ±0.043 |
Watt-Tool-8B-IQ3_S | 8.253598 ±0.051864 | 97.71% | 0.117565 ±0.000433 | 10.385 ±0.045 |
Watt-Tool-8B-IQ4_NL | 7.516430 ±0.047275 | 99.30% | 0.034545 ±0.000172 | 5.270 ±0.035 |
Watt-Tool-8B-Q3_K_L | 8.274172 ±0.052402 | 97.60% | 0.114738 ±0.000483 | 10.050 ±0.048 |
Watt-Tool-8B-Q3_K_M | 8.459379 ±0.053550 | 97.26% | 0.131196 ±0.000539 | 10.892 ±0.050 |
Watt-Tool-8B-Q3_K_S | 8.869361 ±0.056188 | 96.40% | 0.171689 ±0.000675 | 12.587 ±0.055 |
Watt-Tool-8B-Q4_K_M | 7.553687 ±0.047468 | 99.32% | 0.033370 ±0.000164 | 5.188 ±0.033 |
Watt-Tool-8B-Q4_K_M (naive) | 7.409510 ±0.046740 | 99.65% | 0.017663 ±0.000107 | 3.658 ±0.032 |
Watt-Tool-8B-Q4_K_S | 7.570386 ±0.047455 | 99.27% | 0.036155 ±0.000172 | 5.421 ±0.034 |
Watt-Tool-8B-Q5_K_M | 7.337057 ±0.046220 | 99.81% | 0.009155 ±0.000052 | 2.680 ±0.024 |
Watt-Tool-8B-Q5_K_S | 7.347298 ±0.046298 | 99.80% | 0.009763 ±0.000056 | 2.763 ±0.024 |
Watt-Tool-8B-Q6_K | 7.275772 ±0.045822 | 99.93% | 0.003219 ±0.000027 | 1.585 ±0.020 |
Watt-Tool-8B-Q8_0 | 7.262551 ±0.045671 | 99.96% | 0.001873 ±0.000019 | 1.209 ±0.015 |
Watt-Tool-8B-F16 | 7.237090 ±0.045539 | 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 |
---|---|---|---|---|---|---|
Watt-Tool-8B-IQ3_M | 62.8000 ±1.7661 | 78.00 | 37.7333 ±1.7711 | 32.1333 ±1.7063 | 73.6000 ±1.6106 | 56.85 |
Watt-Tool-8B-IQ3_S | 62.0000 ±1.7736 | 76.26 | 37.3333 ±1.7674 | 30.4000 ±1.6807 | 72.9333 ±1.6235 | 55.79 |
Watt-Tool-8B-IQ4_NL | 63.4667 ±1.7594 | 77.73 | 39.6000 ±1.7870 | 31.4667 ±1.6968 | 75.4667 ±1.5722 | 57.55 |
Watt-Tool-8B-Q3_K_L | 61.7333 ±1.7759 | 77.20 | 38.5333 ±1.7783 | 32.4000 ±1.7100 | 71.8667 ±1.6430 | 56.35 |
Watt-Tool-8B-Q3_K_M | 61.0667 ±1.7816 | 77.20 | 38.5333 ±1.7783 | 33.3333 ±1.7225 | 73.0667 ±1.6209 | 56.64 |
Watt-Tool-8B-Q3_K_S | 58.2667 ±1.8018 | 75.60 | 38.1333 ±1.7748 | 33.2000 ±1.7207 | 73.6000 ±1.6106 | 55.76 |
Watt-Tool-8B-Q4_K_M | 65.7333 ±1.7342 | 77.73 | 39.4667 ±1.7860 | 30.9333 ±1.6889 | 74.0000 ±1.6027 | 57.57 |
Watt-Tool-8B-Q4_K_M (naive) | 62.5668 ±1.7707 | 77.73 | 42.0000 ±1.8034 | 36.8098 ±2.6753 | 73.6000 ±1.6106 | 58.54 |
Watt-Tool-8B-Q4_K_S | 65.8667 ±1.7325 | 78.00 | 39.4667 ±1.7860 | 30.5333 ±1.6828 | 73.2000 ±1.6184 | 57.41 |
Watt-Tool-8B-Q5_K_M | 65.7333 ±1.7342 | 78.66 | 40.9333 ±1.7967 | 33.7333 ±1.7276 | 75.0667 ±1.5808 | 58.83 |
Watt-Tool-8B-Q5_K_S | 65.7333 ±1.7342 | 78.66 | 41.6000 ±1.8010 | 33.6000 ±1.7259 | 74.5333 ±1.5919 | 58.83 |
Watt-Tool-8B-Q6_K | 66.1333 ±1.7292 | 79.33 | 40.1333 ±1.7910 | 33.0667 ±1.7190 | 74.5333 ±1.5919 | 58.64 |
Watt-Tool-8B-Q8_0 | 65.8667 ±1.7325 | 78.67 | 41.0667 ±1.7976 | 32.9333 ±1.7172 | 74.5333 ±1.5919 | 58.61 |
Watt-Tool-8B-F16 | 65.8667 ±1.7325 | 78.67 | 40.9333 ±1.7967 | 32.9333 ±1.7172 | 74.8000 ±1.5864 | 58.64 |
Tokens per Second - Benchmarks
Scores generated using llama-bench. Naive Q4_K_M quantization included for comparison.
model | size | params | backend | threads | test | t/s |
---|---|---|---|---|---|---|
Watt-Tool-8B-Q4_K_M | 4.10 GiB | 8.03 B | Metal,BLAS | 6 | pp512 | 313.03 ± 1.17 |
Watt-Tool-8B-Q4_K_M | 4.10 GiB | 8.03 B | Metal,BLAS | 6 | tg128 | 27.97 ± 0.08 |
Watt-Tool-8B-Q4_K_M | 4.10 GiB | 8.03 B | Metal,BLAS | 6 | pp1024+tg1024 | 44.64 ± 0.22 |
Watt-Tool-8B-Q4_K_M (naive) | 4.58 GiB | 8.03 B | Metal,BLAS | 6 | pp512 | 327.42 ± 0.47 |
Watt-Tool-8B-Q4_K_M (naive) | 4.58 GiB | 8.03 B | Metal,BLAS | 6 | tg128 | 26.18 ± 0.08 |
Watt-Tool-8B-Q4_K_M (naive) | 4.58 GiB | 8.03 B | Metal,BLAS | 6 | pp1024+tg1024 | 42.69 ± 0.09 |
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
A big Thank You! to Colin Kealty 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 for his amazing work with llama.cpp and the ggml/gguf libraries.
- Downloads last month
- 1,566
Model tree for eaddario/Watt-Tool-8B-GGUF
Base model
meta-llama/Llama-3.1-8B