Skip to content
data

KasaConfig

KasaConfig(beta: float = 0.0001, gamma: float = 0.001)

Options of KaSA, which gives the LoRA update a learned singular-value diagonal.

KaSA (Wang et al., 2024, arXiv:2412.06071) reads a LoRA update as an SVD, ΔW=B diag(σ) A\Delta W = B\,\mathrm{diag}(\sigma)\,A, and adds two regularisers to the training loss: an L2 penalty on σ\sigma weighted by beta and a semi-orthogonality penalty ∥B⊤B−I∥F+∥AA⊤−I∥F\lVert B^\top B - I\rVert_F + \lVert A A^\top - I\rVert_F weighted by gamma. LoraConfig(kasa_config=...) is refused: the extension is not implemented.

Parameters

betafloat= 1e-4
Weight of the L2 penalty on the singular values; not negative.
gammafloat= 1e-3
Weight of the orthogonality penalty on the factors; not negative.

Raises

ValueError
beta or gamma is negative.

Examples

>>> from lucid.peft import KasaConfig
>>> config = KasaConfig(beta=1e-3)
>>> config.beta, config.gamma
(0.001, 0.001)

Used by 2