bitsandbytes-foundation/bitsandbytes
Accessible large language models via k-bit quantization for PyTorch.
What it solves
It reduces the memory requirements for running and training large language models (LLMs), making them more accessible by allowing them to run on hardware with limited VRAM/RAM.
How it works
The library uses k-bit quantization to compress model weights and optimizer states. It provides three primary methods:
- 8-bit Optimizers: Uses block-wise quantization to reduce the memory cost of optimizers while maintaining 32-bit performance.
- LLM.int8(): An 8-bit quantization method for inference that uses vector-wise quantization for most features and 16-bit matrix multiplication for outliers to prevent performance loss.
- QLoRA: A 4-bit quantization method for training that compresses the model to 4-bits and adds small, trainable low-rank adaptation (LoRA) weights.
Who it’s for
Developers and researchers who need to run or fine-tune large models on consumer-grade hardware or limited compute resources.
Highlights
- Support for 4-bit and 8-bit quantization primitives.
- Broad hardware support across Linux, Windows, and macOS, including NVIDIA, AMD, and Intel GPUs, as well as CPUs.
- Integration with popular libraries like Hugging Face Transformers, Diffusers, and PEFT.
Related
- Project
- Project
- Project
- Project
- Project