Geometry-Aware LoRA Optimization for Faster and Stable Convergence#1407
Draft
Koratahiu wants to merge 7 commits intoNerogar:masterfrom
Draft
Geometry-Aware LoRA Optimization for Faster and Stable Convergence#1407Koratahiu wants to merge 7 commits intoNerogar:masterfrom
Koratahiu wants to merge 7 commits intoNerogar:masterfrom
Conversation
torch.linalg.solve is more accurate, stable, faster, and cheaper than torch.linalg.inv (for this specific use case), and it's mathematically identical.
…into precond_lora
Contributor
Author
Update 1:
|
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.
This PR implements the gradient preconditioning technique proposed in Riemannian Preconditioned LoRA for Fine-Tuning Foundation Models.
Standard optimizers treat LoRA's$A$ and $B$ matrices as completely independent parameters. This method transforms how your optimizer sees the weights by accounting for their dependency (the actual low-rank manifold $W = BA$ ), essentially acting as a specialized, highly efficient second-order optimizer for low-rank adapters.
Important Notes:
_lora_pair) during initialization so the preconditioner can calculate the necessary matrix inversions on the fly.rank(e.g., inverting a 16x16 or 64x64 matrix), not the full parameter dimension, meaning it won't slow down yours/it.Other Notes:
Usage
Riemannian Preconditioningin LoRA Tab (we might change that name)