functional.mdx 1.33 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Overview
The `bitsandbytes.functional` API provides the low-level building blocks for the library's features.

## When to Use `bitsandbytes.functional`

* When you need direct control over quantized operations and their parameters.
* To build custom layers or operations leveraging low-bit arithmetic.
* To integrate with other ecosystem tooling.
* For experimental or research purposes requiring non-standard quantization or performance optimizations.

## LLM.int8()
[[autodoc]] functional.int8_double_quant

[[autodoc]] functional.int8_linear_matmul

[[autodoc]] functional.int8_mm_dequant

[[autodoc]] functional.int8_vectorwise_dequant

[[autodoc]] functional.int8_vectorwise_quant


## 4-bit
[[autodoc]] functional.dequantize_4bit

[[autodoc]] functional.dequantize_fp4

[[autodoc]] functional.dequantize_nf4

[[autodoc]] functional.gemv_4bit

[[autodoc]] functional.quantize_4bit

[[autodoc]] functional.quantize_fp4

[[autodoc]] functional.quantize_nf4

[[autodoc]] functional.QuantState

## Dynamic 8-bit Quantization

Primitives used in the 8-bit optimizer quantization.

For more details see [8-Bit Approximations for Parallelism in Deep Learning](https://arxiv.org/abs/1511.04561)

[[autodoc]] functional.dequantize_blockwise

[[autodoc]] functional.quantize_blockwise

## Utility
[[autodoc]] functional.get_ptr

[[autodoc]] functional.is_on_gpu