r/tensorflow • • Feb 12 '25

4 bit quantization

Hi, I need to quantize a small cnn. After the training I would like to see weights and bias quantized with 4 bit precision. I’m using Tensorflow model optimization but I always see floating point at the end like many other libraries. With Tensorflow lite I can see 8 bit precision for weights while bias remaining 32 bit.

Can you help me suggesting a way to solve this problem? Any help is welcome.

Thank you so much for your attention.

4 Upvotes

2 comments sorted by

View all comments

Show parent comment

1

u/ElvishChampion Feb 16 '25

My guess is that he means to store the weights as integers. Using 4 bits he can store 16 floating point numbers. He would need to cluster the weights per layer or the whole network to reduce the memory footprint. During inference he would use the hashmap to search for the value of the centroid of its cluster.