---
title: "bitsandbytes | pypx"
description: "k-bit optimizers and matrix multiplication routines."
canonical_url: "https://pypx.app/packages/bitsandbytes"
meta:
  "og:description": "k-bit optimizers and matrix multiplication routines."
  "og:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_bitsandbytes%2Cversion_0.50.2%2Csummary_k-bit%2Boptimizers%2Band%2Bmatrix%2Bmultiplication%2Broutines.%2Clicense_MIT%2Cp_Ii9wYWNrYWdlcy9iaXRzYW5kYnl0ZXMi%2Cs_g8hKldje0HR37GsE.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "bitsandbytes 0.50.2"
  "twitter:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_bitsandbytes%2Cversion_0.50.2%2Csummary_k-bit%2Boptimizers%2Band%2Bmatrix%2Bmultiplication%2Broutines.%2Clicense_MIT%2Cp_Ii9wYWNrYWdlcy9iaXRzYW5kYnl0ZXMi%2Cs_g8hKldje0HR37GsE.png"
---

> Index of every page on this site: [llms.txt](https://pypx.app/llms.txt)

# **bitsandbytes**

v0.50.2

k-bit optimizers and matrix multiplication routines.

121 KB Python 3.10+ platform-specificMIT3 deps

[** Diff **](https://pypx.app/packages/bitsandbytes/diff)

`$ uv add 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](https://pytorch.org/get-started/locally/) 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](https://github.com/bitsandbytes-foundation/bitsandbytes/blob/0.50.0/README.md#accelerator-support).

##### Legend:

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

## :book: Documentation

- [Official Documentation](https://huggingface.co/docs/bitsandbytes/main)
- 🤗 [Transformers](https://huggingface.co/docs/transformers/quantization/bitsandbytes)
- 🤗 [Diffusers](https://huggingface.co/docs/diffusers/quantization/bitsandbytes)
- 🤗 [PEFT](https://huggingface.co/docs/peft/developer_guides/quantization#quantize-a-model)

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

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

## **Details **

<dl>

<dt>Version</dt>
<dd>0.50.2</dd>

<dt>License</dt>
<dd>MIT</dd>

<dt>Python</dt>
<dd>&gt;=3.10</dd>

<dt>Maintainer</dt>
<dd>Tim Dettmers &lt;dettmers@cs.washington.edu&gt;</dd></dl>

## **Links**

- [changelog](https://github.com/bitsandbytes-foundation/bitsandbytes/blob/main/CHANGELOG.md)
- [docs](https://huggingface.co/docs/bitsandbytes/main)
- [homepage](https://github.com/bitsandbytes-foundation/bitsandbytes)
- [issues](https://github.com/bitsandbytes-foundation/bitsandbytes/issues)
- [View on PyPI](https://pypi.org/project/bitsandbytes/)

## **Release Cadence **

**6**

releases in the past year

avg 24 days between releases

## **Platforms **

linuxarm64mac-armwin

## **Maintainers **

- Tim Dettmers · [dettmers@cs.washington.edu](mailto:dettmers@cs.washington.edu)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://pypx.app/#website","@type":"WebSite","description":"The Python Package Index, reimagined. Fast search, dependency insights, download trends, and changelogs — all in one place.","name":"pypx","url":"https://pypx.app/"},{"@id":"https://pypx.app/packages/bitsandbytes#webpage","@type":"WebPage","description":"k-bit optimizers and matrix multiplication routines.","name":"bitsandbytes","url":"https://pypx.app/packages/bitsandbytes","isPartOf":{"@id":"https://pypx.app/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://pypx.app/packages/bitsandbytes"]}]},{"@id":"https://pypx.app/packages/bitsandbytes#/schema/software-application/1","@type":"SoftwareApplication","applicationCategory":"DeveloperApplication","description":"k-bit optimizers and matrix multiplication routines.","license":"MIT","name":"bitsandbytes","softwareVersion":"0.50.2"}]}
```

## Sitemap

See the full [sitemap](https://pypx.app/sitemap.md) for all pages.
