Experimental GGUF quantized versions of MadeAgents/Hammer2.1-7b

Using LLaMA C++ release b4801 for quantization.

Original model: MadeAgents/Hammer2.1-7b

From the original model creators:

Hammer refers to a series of lightweight Large Action Models. Currently, we are releasing Hammer 2.1 models (0.5B, 1.5B, 3B, and 7B) with strong function calling capability. These models are based on the Qwen 2.5 coder series and utilize function masking techniques and other advanced technologies. Hammer 2.1 series bring significant enhancements, while still maintaining the basic functionality of Hammer 2.0's Single-Turn interaction and further strengthening other capabilities.

The Hammer 2.1 models, fine-tuned from the Qwen 2.5 coder series, inherit Hammer 2.0's advantages and are enhanced as follows:

  • Multi-Step Function Calling: The assistant can perform multiple internal function calls to handle a single user request, actively planning and gathering information to fulfill complex tasks.
  • Multi-Turn Function Calling: Enables continuous and context-aware interactions over multiple exchanges, with each turn potentially containing multiple steps, for a more natural conversation experience.
  • Enhanced Irrelevant Information Inspection: Better at identifying when provided functions are irrelevant to a user query, by providing a non-function call response.

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, 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.

The process of 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!).

Another approach is to prune 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!

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.

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:

  1. Convert the 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. Quantize & prune versions of the base model
  5. Calculate Perplexity, KL Divergence, ARC (Easy+Challenge), HellaSwag, MMLU, Truthful QA and WinoGrande scores for each quantized model
  6. Keep versions with the best scores
  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.

*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
Hammer2.1-7b-IQ3_M 3.57 3.47 8.2%
Hammer2.1-7b-IQ3_S 3.50 3.34 9.2%
Hammer2.1-7b-IQ4_NL 4.44 4.35 7.7%
Hammer2.1-7b-Q3_K_L 4.09 4.01 7.0%
Hammer2.1-7b-Q3_K_M 3.81 3.70 8.0%
Hammer2.1-7b-Q3_K_S 3.49 3.35 8.5%
Hammer2.1-7b-Q4_K_M 4.68 4.59 6.7%
Hammer2.1-7b-Q4_K_S 4.46 4.36 7.0%
Hammer2.1-7b-Q5_K_M 5.44 5.34 6.8%
Hammer2.1-7b-Q5_K_S 5.31 5.21 7.0%
Hammer2.1-7b-Q6_K 6.25 6.13 7.1%
Hammer2.1-7b-Q8_0 8.10 7.82 8.4%

Perplexity and KL Divergence scores

Model μPPL 𝜌PPL μKLD RMS Δp
Hammer2.1-7b-IQ3_M 10.511302 ±0.075491 97.82% 0.138301 ±0.000410 9.594 ±0.040
Hammer2.1-7b-IQ3_S 10.536311 ±0.075790 97.80% 0.139837 ±0.000416 9.634 ±0.040
Hammer2.1-7b-IQ4_NL 9.689751 ±0.069052 99.33% 0.041211 ±0.000134 5.262 ±0.025
Hammer2.1-7b-Q3_K_L 10.521151 ±0.076540 98.01% 0.123969 ±0.000369 9.140 ±0.039
Hammer2.1-7b-Q3_K_M 10.562569 ±0.076862 97.91% 0.129660 ±0.000389 9.338 ±0.040
Hammer2.1-7b-Q3_K_S 10.928250 ±0.079514 97.35% 0.161692 ±0.000497 10.577 ±0.045
Hammer2.1-7b-Q4_K_M 9.626296 ±0.068786 99.41% 0.036492 ±0.000124 4.987 ±0.024
Hammer2.1-7b-Q4_K_S 9.629625 ±0.068723 99.36% 0.039281 ±0.000129 5.159 ±0.024
Hammer2.1-7b-Q5_K_M 9.563019 ±0.068143 99.55% 0.028058 ±0.000083 4.315 ±0.019
Hammer2.1-7b-Q5_K_S 9.571020 ±0.068197 99.54% 0.028654 ±0.000086 4.352 ±0.019
Hammer2.1-7b-Q6_K 9.564250 ±0.068123 99.60% 0.025837 ±0.000077 4.143 ±0.017
Hammer2.1-7b-Q8_0 9.542922 ±0.067890 99.61% 0.025043 ±0.000073 4.070 ±0.017
Hammer2.1-7b-F16 9.366577 ±0.066397 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. Naive (llama-quantize with no optimization) Q4_K_M quantization included for comparison.

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
Hammer2.1-7b-IQ3_M 57.8667 ±1.8042 70.93 37.7333 ±1.7711 30.1333 ±1.6766 69.6000 ±1.6807
Hammer2.1-7b-IQ3_S 57.4667 ±1.8065 70.66 38.0000 ±1.7736 30.1333 ±1.6766 70.0000 ±1.6744
Hammer2.1-7b-IQ4_NL 57.0667 ±1.8086 70.93 38.9333 ±1.7816 30.6667 ±1.6849 70.6667 ±1.6636
Hammer2.1-7b-Q3_K_L 57.0667 ±1.8086 70.66 37.6000 ±1.7699 29.8667 ±1.6723 69.3333 ±1.6849
Hammer2.1-7b-Q3_K_M 56.1333 ±1.8132 70.13 36.6667 ±1.7608 30.4000 ±1.6807 69.3333 ±1.6849
Hammer2.1-7b-Q3_K_S 55.7333 ±1.8149 69.73 37.0667 ±1.7648 29.8667 ±1.6723 68.6667 ±1.6949
Hammer2.1-7b-Q4_K_M 57.8667 ±1.8042 71.60 39.2000 ±1.7838 30.2667 ±1.6787 70.4000 ±1.6680
Hammer2.1-7b-Q4_K_M (Naive) 58.0000 ±1.8034 71.46 38.8000 ±1.7805 30.1333 ±1.6766 70.9333 ±1.6591
Hammer2.1-7b-Q4_K_S 57.7333 ±1.8050 71.73 38.8000 ±1.7805 29.6000 ±1.6680 70.5333 ±1.6658
Hammer2.1-7b-Q5_K_M 58.0000 ±1.8034 71.73 38.9333 ±1.7816 30.5333 ±1.6828 70.9333 ±1.6591
Hammer2.1-7b-Q5_K_S 57.8667 ±1.8042 71.73 38.9333 ±1.7816 30.6667 ±1.6849 71.2000 ±1.6546
Hammer2.1-7b-Q6_K 58.5333 ±1.8002 71.60 39.0667 ±1.7827 30.6667 ±1.6849 69.8667 ±1.6766
Hammer2.1-7b-Q8_0 58.1333 ±1.8026 71.73 39.0667 ±1.7827 30.8000 ±1.6869 70.5333 ±1.6658
Hammer2.1-7b-F16 58.9333 ±1.7976 72.13 39.0667 ±1.7827 30.4000 ±1.6807 70.5333 ±1.6658

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
Hammer2.1-7b-Q4_K_M 4.04 GiB 7.61 B Metal,BLAS 6 pp512 355.15 ± 0.39
Hammer2.1-7b-Q4_K_M 4.04 GiB 7.61 B Metal,BLAS 6 tg128 28.62 ± 0.09
Hammer2.1-7b-Q4_K_M 4.04 GiB 7.61 B Metal,BLAS 6 pp1024+tg1024 47.45 ± 0.29
Hammer2.1-7b-Q4_K_M (Naive) 4.35 GiB 7.61 B Metal,BLAS 6 pp512 354.94 ± 0.12
Hammer2.1-7b-Q4_K_M (Naive) 4.35 GiB 7.61 B Metal,BLAS 6 tg128 28.09 ± 0.07
Hammer2.1-7b-Q4_K_M (Naive) 4.35 GiB 7.61 B Metal,BLAS 6 pp1024+tg1024 46.17 ± 0.94

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 orignal 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 gguf file format.

Downloads last month
2,473
GGUF
Model size
7.61B params
Architecture
qwen2

3-bit

4-bit

5-bit

6-bit

8-bit

16-bit

Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.
The model cannot be deployed to the HF Inference API: The model has no library tag.

Model tree for eaddario/Hammer2.1-7b-GGUF

Base model

Qwen/Qwen2.5-7B
Quantized
(9)
this model

Dataset used to train eaddario/Hammer2.1-7b-GGUF