Skip to content
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 AA from the top right-singular vectors.

Parameters

rhofloat= 2.0
Maximum rank redistribution multiplier (>= 1.0); a layer of rank r may receive up to round(r * rho) components.
taufloat= 0.99
Cosine-similarity convergence threshold in [0, 1] between consecutive SVD steps.
use_label_maskbool= True
Ignore token positions where labels == label_mask_value during the SVD.
label_mask_valueint= -100
Label value marking ignored positions when use_label_mask=True.
whitenbool= False
Divide each singular vector by the square root of its singular value.
adjust_scaling_factorsbool= True
Scale lora_alpha proportionally when a layer's rank changes during redistribution.

Raises

ValueError
rho < 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)

Used by 2