Quantization-Aware Healing: a compressed, 4-bit model that outperforms its full-precision original
Quantization-Aware Healing (QAH) recovers structurally compressed, 4-bit LLMs by distilling directly from the original pre-compression model via KL divergence on logits, rather than from the recovered bfloat16 checkpoint or with a task loss as in QAT. Applied to GPT-OSS 120B pruned to 60B and quantized to MXFP4, the 4-bit model beats its own bfloat16 checkpoint on 7 of 9 benchmarks, with the largest gains on AA-LCR (+7.4) and AIME 2025 (+5.6). In a matched comparison on a 9B model, QAH reaches a peak similar to QAT about 7x faster (100 vs 700 steps) and stays stable, while QAT drops nearly 19 points with continued training. A commenter notes the headline comparison lacks a control that gives the bf16 model the same extra distillation pass, and that the teacher itself is MXFP4.
Related posts
- Making LLMs even more accessible with bitsandbytes, 4-bit quantization and QLoRA
Hugging Face mediumAdeptbitsandbytes now integrates 4-bit quantization into Hugging Face transformers, letting most accelerate-loadable models (text, vision, multimodal) run in 4-bit and be fine-tuned via QLoRA, which backpropagates through a frozen 4-bit base model into LoRA adapters. QLoRA stores weights in NF4 and dequantizes to bfloat16 for compute, adds double quantization (saving ~0.4 bits per parameter) and paged optimizers, and matches 16-bit fine-tuning while fitting a 33B model on a 24GB GPU or 65B on a 48GB GPU. The post explains FP8/FP4 bit layouts and shows BitsAndBytesConfig usage. Recommended defaults are NF4 for precision, double quant for memory pressure, and a 16-bit compute dtype for speed.
- Fine-tuning LLMs to 1.58bit: extreme quantization made easy
Hugging Face hardMasterExisting LLMs can be fine-tuned into BitNet's 1.58-bit ternary format (-1, 0, 1) instead of pre-training from scratch, and a Llama3 8B fine-tuned this way on 100B tokens outperforms Llama 1 7B on MMLU. Training uses BitLinear layers with absmean per-tensor weight quantization, absmax per-token 8-bit activation quantization, layer normalization before activation quantization, and a straight-through estimator implemented via detach(). Inference quantizes weights without rescaling and runs matrix multiplication through efficient kernels. The resulting models load in Transformers through a new 'bitnet' quantization method with no API changes, and pre-training experiments show layer normalization lowering validation perplexity from 6.3 to 5.9.
- Making LLMs lighter with AutoGPTQ and transformers
Hugging Face mediumAdeptAutoGPTQ is now integrated into Hugging Face Transformers (via Optimum), letting users quantize and run LLMs at 8, 4, 3 or 2 bits with the GPTQ post-training method. GPTQ needs a calibration dataset and quantizes only the weights: int4 weights are dequantized on the fly in a fused kernel while compute stays in fp16. That gives nearly 4x memory savings with negligible accuracy loss at 4-bit. On an A100 at batch size 1, Llama-2-7B with the exllama kernel dropped peak memory from about 29 GB to 10.5 GB with slightly better per-token latency than fp16. Text-Generation-Inference can now serve a 70B model on a single 80GB GPU and PEFT adapters can be fine-tuned on top, but the kernels slow down at larger batch sizes and W4A8 or Triton kernels remain open work.
- Overview of natively supported quantization schemes in 🤗 Transformers
Hugging Face mediumAdeptbitsandbytes and GPTQ (via auto-gptq), the two quantization schemes built into Transformers, trade off differently. bitsandbytes needs no calibration data, works on any model with nn.Linear layers across modalities, and lets LoRA adapters merge without degradation. GPTQ supports serialization at any bit width, AMD GPUs and much faster text generation, up to 2x at batch size 4 with KV caching on Llama-2-7B. Benchmarks show bitsandbytes is faster for adapter fine-tuning and both lose little accuracy on Open LLM Leaderboard tasks, especially at 13B. The suggested workflow is to fine-tune adapters on a bitsandbytes base, merge them, then quantize the merged model with GPTQ for deployment.
- Unlocking Longer Generation with Key-Value Cache Quantization
Hugging Face mediumAdeptHugging Face Transformers adds KV cache quantization, inspired by the KIVI paper, that stores keys and values per-token in int2/int4/int8 via quanto or HQQ backends. A residual cache of the most recent tokens (128 by default) stays in full precision to avoid re-quantizing on every step and to preserve accuracy. On Llama-2-7B, int4 matches fp16 on PG-19 perplexity and LongBench, while int2 degrades noticeably. Int4 gives roughly 2.5x memory savings and, with FlashAttention on an 80GB A100, raises max context from 40k to 128k tokens, at the cost of slower generation at larger batch sizes and about 3x slowdown when combined with weight quantization.