# bitsandbytes

- **Canonical URL:** https://getaimath.com/dictionary/bitsandbytes/
- **Topics:** [Quantization & Model Compression](https://getaimath.com/dictionary/category/quantization-and-model-compression/)
- **Last updated:** 2026-11-25

## What is bitsandbytes?

**In one sentence:** bitsandbytes is a popular Python library for loading and training models in 8-bit or 4-bit on NVIDIA GPUs.

It plugs into Hugging Face Transformers, so you can load a big model in fewer bits with one setting. It also enables QLoRA, which fine-tunes 4-bit models cheaply.

![Quantization: Vacuum-Packing a Giant AI into a Carry-On Bag — Simple cartoon showing a huge 16 GB AI model with long fussy decimals (3.14159265) squeezed by a vacuum-seal press into a compact 4 GB model with rounded numbers (3.1) that fits on a laptop.](https://getaimath.com/diagrams/quantization-and-model-compression.png)
*Napkin Diagram (Quantization & Model Compression): By rounding long fussy decimals to neat short numbers, quantization shrinks a model about 4× with only a small loss in smarts.*

## What is an example of bitsandbytes?

Loading a model with "load_in_4bit=True" in Transformers uses bitsandbytes.

## Why does bitsandbytes matter?

It made low-memory fine-tuning available to people with a single GPU.

## Related Concepts

- [EXL2](https://getaimath.com/dictionary/exl2/): EXL2 is a quantization format for the ExLlamaV2 engine that lets you pick any average bit level, like 4.65 bits per weight.
- [HQQ](https://getaimath.com/dictionary/hqq/): HQQ, or Half-Quadratic Quantization, is a fast quantization method that does not need any calibration data.
- [AWQ](https://getaimath.com/dictionary/awq/): AWQ, or Activation-aware Weight Quantization, protects the most important weights so a model stays accurate at 4 bits.
- [NF4](https://getaimath.com/dictionary/nf4/): NF4, or 4-bit NormalFloat, is a 4-bit number format designed for neural network weights, used in QLoRA.
- [GPTQ](https://getaimath.com/dictionary/gptq/): GPTQ is a method for quantizing models to 4 bits or fewer after training, while carefully keeping quality high.
- [Q4_K_M](https://getaimath.com/dictionary/q4-k-m/): Q4_K_M is a popular GGUF quantization level that uses about 4 to 5 bits per weight with smart mixing, giving a good balance of size and quality.

---
Source: The AI Math Dictionary (https://getaimath.com/dictionary/bitsandbytes/)
