data
EvaConfig
EvaConfig(rho: float = 2.0, tau: float = 0.99, use_label_mask: bool = True, label_mask_value: int = -100, whiten: bool = False, adjust_scaling_factors: bool = True)Configuration for Explained Variance Adaptation (EVA) data-driven LoRA initialisation.
EVA (Paischer et al., 2024, arXiv:2410.07170) runs an incremental SVD over calibration activations to redistribute the LoRA rank budget across layers according to their explained variance ratios and initialise from the top right-singular vectors.
Parameters
rhofloat= 2.0Maximum rank redistribution multiplier (
>= 1.0); a layer of rank r
may receive up to round(r * rho) components.taufloat= 0.99Cosine-similarity convergence threshold in
[0, 1] between consecutive
SVD steps.use_ label_ maskbool= TrueIgnore token positions where
labels == label_mask_value during the SVD.label_ mask_ valueint= -100Label value marking ignored positions when
use_label_mask=True.whitenbool= FalseDivide each singular vector by the square root of its singular value.
adjust_ scaling_ factorsbool= TrueScale
lora_alpha proportionally when a layer's rank changes during
redistribution.Raises
ValueErrorrho < 1.0 or tau is outside [0.0, 1.0].Examples
>>> from lucid.peft import EvaConfig
>>> cfg = EvaConfig(rho=1.5, tau=0.95, whiten=True)
>>> cfg.rho, cfg.whiten
(1.5, True)