-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
INT8 support - SmoothQuant #71
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
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.
Background
When measuring throughput, it has become apparent that the INT4 quantized weights fall behind FP16 when you increase data parallelism. This is due to the overhead of dequantizing, thus becoming compute-bound. In vLLM PR 1032, the overall throughput of INT4 has been documented to be 33% lower.
Introducing INT8: Instead of being compute-bound and performing worse than FP16 on throughput, we can make use of the INT8 Tensor Cores that modern GPUs use. Using vLLM PR #1112, you will be able to achieve 20% higher throughput.
SmoothQuant
We adapt SmoothQuant to AWQ and also take the bare minimum necessary to enable SmoothQuant. We use the original AWQ loss function to figure out the optimal scales for the weights while letting the SmoothQuant method find the optimal scales for inputs.
SmoothQuant works by quantizing the inputs to linear layers to INT8 by smoothing the inputs that have very large values compared to the rest, i.e. it removes outliers. Additionally, SmoothQuant does not use
group_size
and it does not usezero_point
quantization. This is clever because it enables us to use the CUTLASS INT8 kernels for fast inference, and we do not have to write our own GEMM kernels.Paper: https://arxiv.org/pdf/2211.10438.pdf
torch-int (adapted): https://github.com/casper-hansen/torch-int
SmoothQuant (adapted): https://github.com/AniZpZ/smoothquant/tree/llama-dev
TODO