Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
B

bitsandbytes

> AI 编程
Open source

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

8.4K stars0 likes1 views
WebsiteGitHub

About

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

bitsandbytes

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

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, 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 ◻️ CPU AVX2 ✅ ✅ ✅
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 ◻️ CPU Apple M1+ ✅ * ✅ ✅
⬜ Metal
mps
Apple M1+ ✅ * ✅
* While supported, these marked features may lack in performance optimizations.

:book: Documentation

  • Official Documentation
  • Transformers
  • Diffusers
  • PEFT

: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.

License

bitsandbytes is MIT licensed.

How to cite us

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

QLoRA

bibtex
@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()

bibtex
@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

bibtex
@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}
}

Issues· 94 open

View all issuesOpen on GitHub
  • #1849

    Failed to quant MoE models with fused expert weights in transformers v5

    Hugging Face IntegrationUpdated Sep 28, 2026
  • #2047

    CPU dequantize_4bit returns shape (1, n) for even-length 1-D inputs; all other backends return (n,)

    Updated Sep 28, 2026
  • #2010

    Adam/AdamW/LAMB/AdEMAMix: weight decay applied in wrong order in default and Triton backends, diverging from CUDA kernel

    OptimizersCUDAUpdated Sep 27, 2026
  • #2064

    CPU `gemm_4bit_forward` kernel is requested without `backend="cpu"`, so it never loads on a CUDA torch build

    Updated Sep 27, 2026
  • #2067

    quantize_4bit fails with "invalid configuration argument" (ops.cu:54) for tensors of exactly >= 2^31 elements

    Updated Sep 27, 2026
  • #2075

    AdEMAMix32bit and PagedAdEMAMix32bit allocate a single-size state1 and fail on the first step

    Updated Sep 27, 2026
  • #2080

    [Bug] FSDP1 wrapping changes AdamW8bit state precision through the flattened shard size

    Updated Sep 27, 2026
  • #2084

    Several tests fail: fixture 'device' not found

    Updated Sep 27, 2026
  • #2086

    NF4 reconstruction is worse than affine int4 below blocksize 64

    Updated Sep 27, 2026
  • #2011

    Offer to help improve the MPS backend fallbacks

    Updated Sep 23, 2026

> Tags

Pythonllmmachine-learningpytorchqlora

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
CategoryAI 编程
PricingOpen source

> Related tools

G
GitHub Copilot
GitHub 官方 AI 编程助手,覆盖补全、Chat 与 Agent 模式。
C
Cursor
AI 原生代码编辑器,对话改代码、多文件 Agent 与规则体系是其核心。
S
skills
Skills for Real Engineers. Straight from my .agents directory.