Skip to content

Implement peft.fuse_params / unfuse_params for LoRA weight fusion - #764

Open
Ayush7614 wants to merge 1 commit into
google-deepmind:mainfrom
Ayush7614:feat/peft-fuse-unfuse-params
Open

Implement peft.fuse_params / unfuse_params for LoRA weight fusion#764
Ayush7614 wants to merge 1 commit into
google-deepmind:mainfrom
Ayush7614:feat/peft-fuse-unfuse-params

Conversation

@Ayush7614

@Ayush7614 Ayush7614 commented Jul 28, 2026

Copy link
Copy Markdown

Summary

  • Implements the documented but stubbed peft.fuse_params / peft.unfuse_params APIs so LoRA adapters can be folded into base kernel / w weights for LoRA-free inference.
  • Supports Dense (kernel += a @ b), Einsum, and DenseGeneral layouts (including Gemma w weight names and rank-contract + permute when needed).
  • Keeps adapters in the tree so unfuse_params can reverse the merge; split_params can then drop them for deployment.
  • Adds unit tests for forward equivalence vs live LoRA, round-trip fuse/unfuse, w-named einsum fusion, no-op trees, and unsupported layouts.
  • Updates peft/README.md with a concrete usage example.

Test plan

  • python -m pytest gemma/peft/_tree_utils_test.py -v (7 passed)
  • Reviewers: run the same tests in CI

@google-cla

google-cla Bot commented Jul 28, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

These public APIs were documented and exported but raised NotImplementedError,
blocking LoRA-free inference after fine-tuning. Fold a@b into kernel/w with a
reversible unfuse path, covering Dense, Einsum, and DenseGeneral layouts.
@Ayush7614
Ayush7614 force-pushed the feat/peft-fuse-unfuse-params branch 2 times, most recently from e20042b to d4abc31 Compare July 28, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant