VeRA
4 memberslucid.peft.tuners.veralucid.peft.tuners.vera — VeRA: two learned vectors per layer over shared random projections.
VeRA (Kopiczko et al., 2023, arXiv:2310.11454 — Vector-based Random Matrix Adaptation) draws one
random pair , once and shares it, frozen, across every adapted layer; a layer
learns only a vector of length r and a vector of its output
width, . Far fewer parameters than LoRA at the
same rank, so ranks run much higher; the projections can be regenerated from projection_prng_key
(save_projection=False), so a file can hold only the vectors. Pick it for the smallest
adapters, or many adapters on one base.
Where the reference library keeps them, so isinstance(m, VeraLayer) and from lucid.peft.tuners.vera import VeraConfig, Linear read as they do there. One layer type for the
one module the method adapts, nn.Linear. VeraConfig and VeraModel (which holds the
shared projections) are here and exported from lucid.peft. Importing the package registers the
method (its config under PeftType.VERA, its tuner and layer), which is what makes
get_peft_model and PeftModel.from_pretrained know it.
Kopiczko, Dawid J., et al. "VeRA: Vector-based Random Matrix Adaptation." [arXiv:2310.11454](https://arxiv.org/abs/2310.11454), 2023.
VeRA (Kopiczko et al., 2023, arXiv:2310.11454 — Vector-based Random Matrix Adaptation) freezes the model and the low-rank pair: one random matrix and one are drawn once and shared by every targeted layer (sliced to its size), and a layer learns only two vectors,
Classes
VeraConfig9 methodsHow lucid.peft.get_peft_model adapts a model with VeRA.
LinearAn nn.Linear with a VeRA update: .
VeraLayer23 methodsAdapter bookkeeping shared by the VeRA layers.
VeraModel17 methodsA model with VeRA layers put into it, the projections they share, and the tools to take them out.