MCPcopy Create free account
hub / github.com/bitsandbytes-foundation/bitsandbytes

github.com/bitsandbytes-foundation/bitsandbytes

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.50.0 ↗ · + Follow · compare 4 versions
915 symbols 2,524 edges 85 files 213 documented · 23% updated 3d ago0.50.2 · 2026-08-27★ 8,44739 open issues

Browse by type

Functions 720 Types & classes 117 Endpoints 78
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

bitsandbytes

<a href="https://github.com/bitsandbytes-foundation/bitsandbytes/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/bitsandbytes-foundation/bitsandbytes.svg?color=blue"></a>
<a href="https://pepy.tech/project/bitsandbytes"><img alt="Downloads" src="https://static.pepy.tech/badge/bitsandbytes/month"></a>
<a href="https://github.com/bitsandbytes-foundation/bitsandbytes/actions/workflows/tests-nightly.yml"><img alt="Nightly Unit Tests" src="https://img.shields.io/github/actions/workflow/status/bitsandbytes-foundation/bitsandbytes/tests-nightly.yml?logo=github&label=Nightly%20Tests"></a>
<a href="https://github.com/bitsandbytes-foundation/bitsandbytes/releases"><img alt="GitHub Release" src="https://img.shields.io/github/v/release/bitsandbytes-foundation/bitsandbytes"></a>
<a href="https://pypi.org/project/bitsandbytes/"><img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/bitsandbytes"></a>

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.49.2 tag.

Legend:

🚧 = Planned | 〰️ = Partially Supported | ✅ = Supported | ❌ = Not Supported

Platform Accelerator Hardware Requirements LLM.int8() QLoRA 4-bit 8-bit Optimizers
🐧 Linux, glibc >= 2.24
x86-64 ◻️ CPU Minimum: AVX2 Optimized: AVX512F, AVX512BF16
🟩 NVIDIA GPU cuda SM60+ minimum SM75+ recommended
🟥 AMD GPU cuda CDNA: gfx908, gfx90a, gfx942, gfx950 RDNA: 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 ◻️ CPU AVX2
🟩 NVIDIA GPU cuda SM60+ minimum SM75+ recommended
🟥 AMD GPU cuda RDNA: gfx103X, gfx110X, gfx115X, gfx120X
🟦 Intel GPU xpu Arc A-Series (Alchemist) Arc B-Series (Battlemage)
arm64 ◻️ CPU
🍎 macOS 14+
arm64 ◻️ CPU Apple 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}
}

Core symbols most depended-on inside this repo

browse all functions →

Shape

Function 456
Method 264
Class 116
Route 78
Enum 1

Languages

Python83%
C++17%

Modules by API surface

csrc/pythonInterface.cpp79 symbols
bitsandbytes/nn/modules.py77 symbols
tests/test_functional.py55 symbols
bitsandbytes/functional.py54 symbols
tests/test_ops.py38 symbols
tests/test_parametrize.py34 symbols
csrc/cpu_ops.cpp33 symbols
bitsandbytes/optim/optimizer.py33 symbols
tests/test_modules.py29 symbols
tests/test_linear4bit.py23 symbols
bitsandbytes/cextension.py23 symbols
csrc/cpu_ops.h21 symbols

Dependencies from manifests, versioned

numpy1.17 · 1×
packaging20.9 · 1×

For agents

$ claude mcp add bitsandbytes \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page