TimDettmers/bitsandbytes

Accessible large language models via k-bit quantization for PyTorch.

8,474

stars

1,194

commits

Python

primary language

Sep 7, 2026

updated

huggingface.co/docs/bitsandbytes/main/en/index
llm
machine-learning
pytorch
qlora
quantization

README

bitsandbytes

License Downloads Nightly Unit Tests GitHub Release PyPI - Python Version

bitsandbytes enables accessible large language models via k-bit quantization for PyTorch. We provide three main features for dramatically reducing memory consumption for inference and training:

  • 8-bit optimizers uses block-wise quantization to maintain 32-bit performance at a small fraction of the memory cost.
  • LLM.int8() or 8-bit quantization enables large language model inference with only half the required memory and without any performance degradation. This method is based on vector-wise quantization to quantize most features to 8-bits and separately treating outliers with 16-bit matrix multiplication.
  • QLoRA or 4-bit quantization enables large language model training with several memory-saving techniques that don't compromise performance. This method quantizes a model to 4-bits and inserts a small set of trainable low-rank adaptation (LoRA) weights to allow training.

The library includes quantization primitives for 8-bit & 4-bit operations, through bitsandbytes.nn.Linear8bitLt and bitsandbytes.nn.Linear4bit and 8-bit optimizers through bitsandbytes.optim module.

System Requirements

bitsandbytes has the following minimum requirements for all platforms:

  • Python 3.10+
  • PyTorch 2.4+
    • Note: While we aim to provide wide backwards compatibility, we recommend using the latest version of PyTorch for the best experience.

Accelerator support:

Note: this table reflects the status of the current development branch. For the latest stable release, see the document in the 0.50.0 tag.

Legend:

🚧 = Planned | 〰️ = Partially Supported | βœ… = Supported | ❌ = Not Supported

PlatformAcceleratorHardware RequirementsLLM.int8()QLoRA 4-bit8-bit Optimizers
🐧 Linux, glibc >= 2.24
x86-64◻️ CPUMinimum: AVX2
Optimized: AVX512F, AVX512BF16
βœ…βœ…βœ…
🟩 NVIDIA GPU
cuda
SM60+ minimum
SM75+ recommended
βœ…βœ…βœ…
πŸŸ₯ AMD GPU
cuda
CDNA: gfx908, gfx90a, gfx942, gfx950, gfx1250
RDNA: gfx101X, gfx103X, gfx110X, gfx115X, gfx120X
βœ…βœ…βœ…
🟦 Intel GPU
xpu
Data Center GPU Max Series
Arc A-Series (Alchemist)
Arc B-Series (Battlemage)
βœ…βœ…βœ…
πŸŸͺ Intel Gaudi
hpu
Gaudi2, Gaudi3βœ…γ€°οΈβŒ
aarch64◻️ CPUβœ… *βœ…βœ…
🟩 NVIDIA GPU
cuda
SM75+βœ…βœ…βœ…
πŸͺŸ Windows 11 / Windows Server 2022+
x86-64◻️ CPUAVX2βœ…βœ…βœ…
🟩 NVIDIA GPU
cuda
SM60+ minimum
SM75+ recommended
βœ…βœ…βœ…
πŸŸ₯ AMD GPU
cuda
CDNA: gfx908, gfx90a
RDNA: gfx101X, gfx103X, gfx110X, gfx115X, gfx120X
βœ…βœ…βœ…
🟦 Intel GPU
xpu
Arc A-Series (Alchemist)
Arc B-Series (Battlemage)
βœ…βœ…βœ…
arm64◻️ CPUβœ…βœ…βœ…
🟩 NVIDIA GPU
cuda
SM121βœ…βœ…βœ…
🍎 macOS 14+
arm64◻️ CPUApple M1+βœ… *βœ…βœ…
⬜ Metal
mps
Apple M1+βœ… *βœ…πŸš§
* While supported, these marked features may lack in performance optimizations.

:book: Documentation

:heart: Sponsors

The continued maintenance and development of bitsandbytes is made possible thanks to the generous support of our sponsors. Their contributions help ensure that we can keep improving the project and delivering valuable updates to the community.

Hugging Face

License

bitsandbytes is MIT licensed.

How to cite us

If you found this library useful, please consider citing our work:

QLoRA

@article{dettmers2023qlora,
  title={Qlora: Efficient finetuning of quantized llms},
  author={Dettmers, Tim and Pagnoni, Artidoro and Holtzman, Ari and Zettlemoyer, Luke},
  journal={arXiv preprint arXiv:2305.14314},
  year={2023}
}

LLM.int8()

@article{dettmers2022llmint8,
  title={LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale},
  author={Dettmers, Tim and Lewis, Mike and Belkada, Younes and Zettlemoyer, Luke},
  journal={arXiv preprint arXiv:2208.07339},
  year={2022}
}

8-bit Optimizers

@article{dettmers2022optimizers,
  title={8-bit Optimizers via Block-wise Quantization},
  author={Dettmers, Tim and Lewis, Mike and Shleifer, Sam and Zettlemoyer, Luke},
  journal={9th International Conference on Learning Representations, ICLR},
  year={2022}
}

Contributors

(top 30 of 129)

TimDettmers

336 commits

matthewdouglas

219 commits

justheuristic

55 commits

TimDettmers/bitsandbytes

Accessible large language models via k-bit quantization for PyTorch.

8,474

stars

1,194

commits

Python

primary language

Sep 7, 2026

updated

huggingface.co/docs/bitsandbytes/main/en/index
llm
machine-learning
pytorch
qlora
quantization

README

bitsandbytes

License Downloads Nightly Unit Tests GitHub Release PyPI - Python Version

bitsandbytes enables accessible large language models via k-bit quantization for PyTorch. We provide three main features for dramatically reducing memory consumption for inference and training:

  • 8-bit optimizers uses block-wise quantization to maintain 32-bit performance at a small fraction of the memory cost.
  • LLM.int8() or 8-bit quantization enables large language model inference with only half the required memory and without any performance degradation. This method is based on vector-wise quantization to quantize most features to 8-bits and separately treating outliers with 16-bit matrix multiplication.
  • QLoRA or 4-bit quantization enables large language model training with several memory-saving techniques that don't compromise performance. This method quantizes a model to 4-bits and inserts a small set of trainable low-rank adaptation (LoRA) weights to allow training.

The library includes quantization primitives for 8-bit & 4-bit operations, through bitsandbytes.nn.Linear8bitLt and bitsandbytes.nn.Linear4bit and 8-bit optimizers through bitsandbytes.optim module.

System Requirements

bitsandbytes has the following minimum requirements for all platforms:

  • Python 3.10+
  • PyTorch 2.4+
    • Note: While we aim to provide wide backwards compatibility, we recommend using the latest version of PyTorch for the best experience.

Accelerator support:

Note: this table reflects the status of the current development branch. For the latest stable release, see the document in the 0.50.0 tag.

Legend:

🚧 = Planned | 〰️ = Partially Supported | βœ… = Supported | ❌ = Not Supported

PlatformAcceleratorHardware RequirementsLLM.int8()QLoRA 4-bit8-bit Optimizers
🐧 Linux, glibc >= 2.24
x86-64◻️ CPUMinimum: AVX2
Optimized: AVX512F, AVX512BF16
βœ…βœ…βœ…
🟩 NVIDIA GPU
cuda
SM60+ minimum
SM75+ recommended
βœ…βœ…βœ…
πŸŸ₯ AMD GPU
cuda
CDNA: gfx908, gfx90a, gfx942, gfx950, gfx1250
RDNA: gfx101X, gfx103X, gfx110X, gfx115X, gfx120X
βœ…βœ…βœ…
🟦 Intel GPU
xpu
Data Center GPU Max Series
Arc A-Series (Alchemist)
Arc B-Series (Battlemage)
βœ…βœ…βœ…
πŸŸͺ Intel Gaudi
hpu
Gaudi2, Gaudi3βœ…γ€°οΈβŒ
aarch64◻️ CPUβœ… *βœ…βœ…
🟩 NVIDIA GPU
cuda
SM75+βœ…βœ…βœ…
πŸͺŸ Windows 11 / Windows Server 2022+
x86-64◻️ CPUAVX2βœ…βœ…βœ…
🟩 NVIDIA GPU
cuda
SM60+ minimum
SM75+ recommended
βœ…βœ…βœ…
πŸŸ₯ AMD GPU
cuda
CDNA: gfx908, gfx90a
RDNA: gfx101X, gfx103X, gfx110X, gfx115X, gfx120X
βœ…βœ…βœ…
🟦 Intel GPU
xpu
Arc A-Series (Alchemist)
Arc B-Series (Battlemage)
βœ…βœ…βœ…
arm64◻️ CPUβœ…βœ…βœ…
🟩 NVIDIA GPU
cuda
SM121βœ…βœ…βœ…
🍎 macOS 14+
arm64◻️ CPUApple M1+βœ… *βœ…βœ…
⬜ Metal
mps
Apple M1+βœ… *βœ…πŸš§
* While supported, these marked features may lack in performance optimizations.

:book: Documentation

:heart: Sponsors

The continued maintenance and development of bitsandbytes is made possible thanks to the generous support of our sponsors. Their contributions help ensure that we can keep improving the project and delivering valuable updates to the community.

Hugging Face

License

bitsandbytes is MIT licensed.

How to cite us

If you found this library useful, please consider citing our work:

QLoRA

@article{dettmers2023qlora,
  title={Qlora: Efficient finetuning of quantized llms},
  author={Dettmers, Tim and Pagnoni, Artidoro and Holtzman, Ari and Zettlemoyer, Luke},
  journal={arXiv preprint arXiv:2305.14314},
  year={2023}
}

LLM.int8()

@article{dettmers2022llmint8,
  title={LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale},
  author={Dettmers, Tim and Lewis, Mike and Belkada, Younes and Zettlemoyer, Luke},
  journal={arXiv preprint arXiv:2208.07339},
  year={2022}
}

8-bit Optimizers

@article{dettmers2022optimizers,
  title={8-bit Optimizers via Block-wise Quantization},
  author={Dettmers, Tim and Lewis, Mike and Shleifer, Sam and Zettlemoyer, Luke},
  journal={9th International Conference on Learning Representations, ICLR},
  year={2022}
}

Contributors

(top 30 of 129)

TimDettmers

336 commits

matthewdouglas

219 commits

justheuristic

55 commits

Languages

Python

68.5%

Cuda

19.8%

C++

9.8%

CMake

1.9%