Qualcomm AI Engine Direct - Decouple quantization and compile graphs for faster VLM/LLM PTQ#19220
Open
DannyYuyang-quic wants to merge 1 commit intopytorch:mainfrom
Open
Qualcomm AI Engine Direct - Decouple quantization and compile graphs for faster VLM/LLM PTQ#19220DannyYuyang-quic wants to merge 1 commit intopytorch:mainfrom
DannyYuyang-quic wants to merge 1 commit intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19220
Note: Links to docs will display an error until the docs builds have been completed.
|
Contributor
Author
|
Hi @abhinaykukkadapu, |
Contributor
Author
|
@pytorchbot label "release notes: qualcomm" |
faster VLM/LLM PTQ Summary: - Calibrate decoder using prefill stage only (full chunk input_ids) - Remove need for AR-N calibration loops - Significantly reduce calibration overhead
c3f07e0 to
a447ba2
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in 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.
Summary
Time(sec)
Time(sec)
This change decouples the quantization graph from the graph used for subsequent lowering, so calibration no longer depends on the AR-N decoding flow.
Previously, we were running calibration directly on the graph shaped for lowering (with fixed AR-N constraints). That forced us into an autoregressive loop (AR1 per step), which was both inefficient and slow since we never saw the full sequence context in a single pass.
With this update, calibration is done once during the prefill stage using the full tokens chunk. This gives us much better coverage in a single run and completely removes the need for iterative decoding during calibration.
After quantization, we take the KV cache encodings from the output, override the input KV cache encodings, and then propagate those into the graph that will later be lowered. This keeps everything consistent without needing to recalibrate on that graph.
Result: same accuracy, significantly faster calibration, and a much cleaner separation between quantization and lowering
Test plan
Test CI in
TestExampleLLMScriptandTestExampleMultimodalityScript