Skip to content
module

VB-LoRA

4 members
lucid.peft.tuners.vblora

lucid.peft.tuners.vblora — VB-LoRA: low-rank factors mixed from one shared vector bank.

VB-LoRA (Li et al., 2024, arXiv:2405.15179 — Vector Bank LoRA) cuts the LoRA factors of every layer into sub-vectors and builds each as a softmax-weighted mix of the top-kk vectors of a single bank shared by the whole model; the learned logits that pick and weight them, and the bank, are the trained parameters. The adapter stores logits and a bank, not per-layer factors, so it holds far fewer numbers than LoRA's. Unlike LoRA it does not start as the base. Pick it when storage per adapter is the constraint.

Where the reference library keeps them, so isinstance(m, VBLoRALayer) and from lucid.peft.tuners.vblora import VBLoRAConfig, Linear read as they do there. One layer type for the one module the method adapts, nn.Linear. VBLoRAConfig and VBLoRAModel (which holds the bank) are here and exported from lucid.peft. Importing the package registers the method (its config under PeftType.VBLORA, its tuner and layer), which is what makes get_peft_model and PeftModel.from_pretrained know it.

Paper

Li, Yang, et al. "VB-LoRA: Extreme Parameter Efficient Fine-Tuning with Vector Banks." [arXiv:2405.15179](https://arxiv.org/abs/2405.15179), 2024.

Overview

VB-LoRA (Li et al., 2024, arXiv:2405.15179 — Vector Bank LoRA) builds every low-rank factor of every layer out of one shared vector bank V∈RN×bV \in \mathbb{R}^{N \times b} of NN vectors of length bb. The factors A∈Rr×dinA \in \mathbb{R}^{r \times d_{in}} and B∈Rdout×rB \in \mathbb{R}^{d_{out} \times r} are cut into sub-vectors of length bb; each sub-vector is a softmax-weighted mix of the top-kk bank vectors picked by learned logits,

softmax(ℓij)t Vt,y=Wx+b+BA x,\mathrm{softmax}(\ell_{ij})_t\, V_t, \qquad y = W x + b + B A\,x ,

Classes