Skip to content
data

LoraGAConfig

LoraGAConfig(direction: Literal['ArBr', 'A2rBr', 'ArB2r', 'random'] = 'ArB2r', scale: Literal['stable', 'weight_svd', 'gd_scale', 'unit'] = 'stable', stable_gamma: int = 16)

Configuration for LoRA-GA (Gradient Approximation) initialisation.

LoRA-GA (Wang et al., 2024, arXiv:2407.05000) estimates full-model weight gradients over a calibration step (lucid.peft.preprocess_loraga), aligned via low-rank SVD into AA and BB, and subtracts s BAs\,BA from the base weight so the adapted layer starts at the pretrained function while its first gradient step matches full fine-tuning.

Parameters

direction(ArBr, A2rBr, ArB2r, random)= "ArBr"
How the top-2r2r singular vectors of the gradient are partitioned between AA and BB.
scale(stable, weight_svd, gd_scale, unit)= "stable"
How the initialised factors are scaled.
stable_gammaint= 16
Denominator hyperparameter γ\gamma for scale="stable".

Raises

ValueError
direction or scale is unknown, or stable_gamma <= 0.

Examples

>>> from lucid.peft import LoraGAConfig
>>> cfg = LoraGAConfig(direction="ArB2r", scale="stable", stable_gamma=16)
>>> cfg.direction, cfg.scale
('ArB2r', 'stable')

Used by 2