Skip to content

Aanuf/2 3 bit training adjust lora params - #4287

Open
andreyanufr wants to merge 63 commits into
openvinotoolkit:developfrom
andreyanufr:aanuf/2_3_bit_training_adjust_lora_params
Open

andreyanufr wants to merge 63 commits into
openvinotoolkit:developfrom
andreyanufr:aanuf/2_3_bit_training_adjust_lora_params

Conversation

@andreyanufr

Copy link
Copy Markdown
Collaborator

Changes

Assign a backup mode for layers where at least one dimension is smaller than lora_rank — for cases using the Torch backend and QAD/QAT.

Reason for changes

Some models contain layers where the output dimension is smaller than the lora_rank value (for example, model.layers.*.mlp.shared_expert_gate.weight has a dimension of [1, 2048]), which triggers an exception. This issue can be resolved either by excluding such layers from the scope—a capability not currently supported in existing training pipelines—or automatically, which is what this PR achieves.

Related tickets

Tests

andreyanufr and others added 30 commits July 27, 2026 17:39
2) Removed 6bit from repacking.
…4164)

### Changes

Add TorchAO to GPTQModel Test Requirement and pin it to `0.17.0`

### Reason for changes

It was installed transitively before with torch. Recent release of
torchao(`0.18.0`) was being installed this way which caused unexpected
error. (Failing action:
https://github.com/openvinotoolkit/nncf/actions/runs/30928990933/job/92221632392)

### Related tickets

<!--- Post the numerical ID of the ticket, if available -->

### Tests

<!--- How was the correctness of changes tested and whether new tests
were added -->

[Test
examples](https://github.com/openvinotoolkit/nncf/actions/runs/30984266172)
- success
2) Added optional possibility to save torch checkpoint with dequantized weights.
2) Added README and requirements.txt
2) Added arg for deterministic cuda execution. This arg is optional because it can slow down the training.
andreyanufr and others added 22 commits October 7, 2026 11:57
2) Added test for 2-3 bit LoRA.
2) Expand FQ_LORA test for case 2 and 3 bit.
…modes before inserting FQ'

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@andreyanufr
andreyanufr requested a review from a team as a code owner October 26, 2026 13:31
Copilot AI balanced review requested due to automatic review settings October 26, 2026 13:31
@github-actions github-actions Bot added the NNCF PT Pull requests that updates NNCF PyTorch label Oct 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The fallback rejects valid grouped weights and still permits rank errors when all compressed weights use INT8 backup precision.

2 open issues
What changed in this PR

This PR adds automatic backup compression for Torch weights whose dimensions cannot support the requested LoRA rank, aiming to prevent rank errors during quantization-aware training and distillation.

Changes:

  • Track the compression backend and filter rank-incompatible weights out of primary compression candidates.
  • Add parameterized tests for both LoRA formats and unchanged DQ behavior.
File Description
tests/​torch/​function_hook/​quantization/​test_fq_lora.py Tests rank filtering across compression formats.
src/​nncf/​quantization/​algorithms/​weight_compression/​algorithm.py Adds backend-aware LoRA rank filtering before primary configuration assignment.

Review effort: Balanced

Comment thread src/nncf/quantization/algorithms/weight_compression/algorithm.py Outdated
ratio_defining_params, group_size_values
)

ratio_defining_params = self._handle_lora_rank_compatible_params_fallback(ratio_defining_params)
andreyanufr and others added 3 commits October 26, 2026 14:44
…ouped weight trailing dimensions'

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NNCF PT Pull requests that updates NNCF PyTorch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants