-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
4.6 quantization scheme #4
Comments
Quite interesting! Thank you for the pointer! 👍 It seems that this mainly pays off when quantizting also the activations in the same way. Right now I usually have large activations (e.g. 16 bit) and only quantize the weights. Need to review again later. Right now I am working on optimizing quantization clipping. |
If you want to implement optmized inference code based on microkernel muls, just go ahead. This would already work with 4 bit quantization. According to my obervations, 4 bit is already pretty good if the clipping is optimized. |
Little proto for (31, 17):
which gives nice 10 instructions per weights unrolled code:
I suspect it could be trimmed to 9 instructions by pre-shifting/masking activations in ReLUNorm, but this would necessitate increasing the activations to int16_t. |
What's great about the LUT approach is that it enables the spreading of weight statistics by using techniques such as gamma. By the way, are you planning to use the 2K memory of the bootloader? Is it as fast as the main memory? |
Nice! Yeah, when a LUT is used, it would allow to use an optimized numerical representation, like NF4 in this paper: Alternative idea, use exp/log: Activations can be logarithmized during Relu. Weights are stored as log. |
I have not considered using the bootloader memory yet. The flash is not as fast in general. The LUT should ideally also reside in SRAM to reduce waitstates, but not sure that would fit. |
I added NF4 quantization now. There is some benefit, but not much. |
If you have plans to develop this project further, I would like to suggest a 4.6-bit scheme.
https://www.mdpi.com/2227-7390/12/5/651
I think this is an interesting schematic that fits very well on a tiny devices.
The (255, 3) and (31, 17) encodings look particularly interesting.
Fast multiplication can be done simply with a tiny 1k LUT table.
The text was updated successfully, but these errors were encountered: