add blockwise rotation. - #2087
Open
lkk12014402 wants to merge 3 commits into
Open
Conversation
Signed-off-by: lkk12014402 <kakao.lv@intel.com>
for more information, see https://pre-commit.ci
Contributor
Author
Accuracy results — Qwen3-8B · MXFP4 (RTN, iters=0) · PIQA
|
Contributor
|
Could you help move hadamard's entry (apply_rotation) to composer.py, I guess placing it in prepare_run function is doable https://github.com/intel/auto-round/blob/main/auto_round/algorithms/composer.py#L542 |
wenhuach21
reviewed
Jul 27, 2026
| # Block Lifecycle Hooks (layer-wise / block-wise rotation) | ||
| # ------------------------------------------------------------------ | ||
|
|
||
| def _on_block_ready(self, block: torch.nn.Module, block_name, block_idx: int) -> None: |
Contributor
There was a problem hiding this comment.
better follow the new arch and move the rotation func to rotation folder
wenhuach21
reviewed
Jul 27, 2026
| m, _, _ = self.alg_composer.dispatch_block(m, input_ids, input_others) | ||
|
|
||
| # ── Layer-wise rotation: rotate this block before reference collection ── | ||
| self._on_block_ready(m, block_name_or_names, i) |
Contributor
There was a problem hiding this comment.
Please follow the architecture to decouple the different algorithms. You can discuss with Heng how to support this feature with less coupling.
wenhuach21
reviewed
Jul 27, 2026
| memory_monitor.log_summary() | ||
| pbar.update(1) | ||
|
|
||
| self._finalize_block_processing(self.model) |
Contributor
|
Also, please fix this issue ASAP: #2036. It's a critical issue that should be prioritized. |
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.
Description
This change adds block-wise (layer-wise) rotation to AutoRound's QuaRot/SpinQuant
rotation quantization, enabling rotation to be applied per decoder block, in lock-step
with AutoRound's block-wise quantization, instead of rotating the whole model up front.
Enabled via a single top-level switch:
Motivation
The standard QuaRot/SpinQuant flow rotates the entire model first (R1 fused into
embedding/all linears, R2 into attention, R3/R4 as online hooks), then quantizes. This:
Block-wise rotation aligns rotation with block-wise quantization so only one block needs
to be on-device at a time.