Introduce 6-bit quantization for Llama in torchchat #1007
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Introducing the ability to use 6-bit quantization in torchao. Torchchat is PyTorch's solution for local LLM inference (https://github.com/pytorch/torchchat). With torchchat, users can quantize a large language model like Llama and run it locally on their machine. Quantization is a way to convert the model weights from float32 to something that takes less space (e.g., 4-bit integers), but still does not compromise the model quality too much.
We currently offer 2, 3, 4, and 5 bit model quantization in torchchat. This task is about adding a new 6 bit quantization scheme.
Main changes:
Added uint6.h that contains the internal helper functions to pack-unpack 8 bytes, 64 and 128 bytes of uint6s.
Modified bitpack.h to add case statements for 6-bit quantization in the general functions that perform vectorized packing/unpacking on ARM neon vectors. (32, 64, 128 values)
CONTEXT
Refer to previous diffs introducing 2-5 bit quantization. 2-bit: D62133659
Reviewed By: metascroy
Differential Revision: D63792020