bitsandbytes icon indicating copy to clipboard operation
bitsandbytes copied to clipboard

quantizer documentation

Open patelprateek opened this issue 3 years ago • 1 comments

Thanks for the amazing work. I am reading the documentation and it says : 8-bit quantization: Quantile, Linear, and Dynamic quantization In the code i also observe block wise quantization. Can you please share some documentation or pointer to these quantizers . Also curios if these quantizer preserve not just multiplication of matrices but also distance metrics like euclidean , ip, cosine . This would be helpful for ANN (approx nearest neighbour ) techniques as well.

patelprateek avatar Sep 27 '22 08:09 patelprateek

You can read more about these quantization methods in the 8-bit optimizer paper. You can find quantile quantization in the appendix.

None of the block-wise quantization methods preserve distances or multiplication of matrices since they are block-wise dependent.

You can use bnb.functional.double_quant for this which performs linear quantization for the full row and column of an input 2D tensor. As such, linear operations like distance or matrix multiplication preserve their values if you dequantize them after the operation.

TimDettmers avatar Oct 10 '22 01:10 TimDettmers

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

github-actions[bot] avatar Dec 20 '23 16:12 github-actions[bot]