Skip to content

Document CUDA rounding differences in matmul_4bit - #2152

Open
emme1t wants to merge 1 commit into
bitsandbytes-foundation:mainfrom
emme1t:docs/matmul-4bit-kernel-rounding
Open

emme1t wants to merge 1 commit into
bitsandbytes-foundation:mainfrom
emme1t:docs/matmul-4bit-kernel-rounding

Conversation

@emme1t

@emme1t emme1t commented Nov 21, 2026

Copy link
Copy Markdown

Addresses the documentation request in #2121. Document how CUDA dispatch can change floating-point rounding in bitsandbytes.matmul_4bit, and expose the docstring on the 4-bit linear layers reference page.

I compared NF4 matmul_4bit with dequantize_4bit followed by torch.nn.functional.linear on an RTX 3070 Laptop (sm_86), using bitsandbytes 0.50.2, PyTorch 2.11.0+cu128 and a 14336 × 4096 weight. Across eight row counts each for FP16 and BF16, all six fallback cases matched bit for bit and eight of ten fused cases differed.

The 384 CUDA cases for test_matmul_4bit and all ten pre-commit hooks passed. The documentation target resolved to the updated public function.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant