diff --git a/bitsandbytes/autograd/_functions.py b/bitsandbytes/autograd/_functions.py index 8a069bd10..a155d96a6 100644 --- a/bitsandbytes/autograd/_functions.py +++ b/bitsandbytes/autograd/_functions.py @@ -411,6 +411,13 @@ def matmul_4bit( out: Optional[torch.Tensor] = None, bias: Optional[torch.Tensor] = None, ): + """Apply a linear transformation to `A` using the packed 4-bit weights `B`. + + On CUDA, the input shape, GPU architecture, and dtype influence whether the + operation uses a fused kernel or dequantizes the weights before calling + `torch.nn.functional.linear`. Floating-point rounding can differ between + these paths, including when a change in batch size switches kernels. + """ if quant_state is None: raise ValueError("quant_state is required") if len(quant_state.shape) != 2: diff --git a/docs/source/reference/nn/linear4bit.mdx b/docs/source/reference/nn/linear4bit.mdx index 7630236c9..44a678ab1 100644 --- a/docs/source/reference/nn/linear4bit.mdx +++ b/docs/source/reference/nn/linear4bit.mdx @@ -21,3 +21,7 @@ [[autodoc]] bitsandbytes.nn.Params4bit - __init__ + +## matmul_4bit + +[[autodoc]] bitsandbytes.matmul_4bit