BOFT
5 memberslucid.peft.tuners.boftlucid.peft.tuners.boft — BOFT: OFT as a butterfly product of sparse rotations.
BOFT (Liu et al., 2023, arXiv:2311.06243 — Butterfly Orthogonal Finetuning) factors the
block-diagonal orthogonal matrix of OFT into a product of sparse orthogonal factors in
butterfly order, , so few parameters span a dense rotation of the
input space; a learned row scale rides on it. With boft_n_butterfly_factor=1 it is OFT. Pick
it over OFT when block-diagonal rotations are too local and a dense one costs too much.
Where the reference library keeps them, so isinstance(m, BOFTLayer) and from lucid.peft.tuners.boft import BOFTConfig, Linear read as they do there. One layer type per module
the method adapts: Linear and Conv2d. BOFTConfig and BOFTModel are here and
exported from lucid.peft. Importing the package registers the method (its config under
PeftType.BOFT, its tuner and layers), which is what makes get_peft_model and
PeftModel.from_pretrained know it.
Liu, Weiyang, et al. "Parameter-Efficient Orthogonal Finetuning via Butterfly Factorization." [arXiv:2311.06243](https://arxiv.org/abs/2311.06243), 2023.
BOFT (Liu et al., 2023, arXiv:2311.06243 — Butterfly Orthogonal Finetuning) factors the orthogonal matrix OFT builds block-diagonally into a product of sparse orthogonal factors in butterfly order, so a small number of parameters spans a dense rotation of the input space:
Classes
BOFTConfig9 methodsHow lucid.peft.get_peft_model adapts a model with BOFT.
BOFTLayer20 methodsAdapter bookkeeping and the butterfly rotation shared by the BOFT layers.
Conv2dAn nn.Conv2d with a BOFT rotation of its flattened in x kernel axis and a scale of its filters.
LinearAn nn.Linear with a BOFT rotation of its input and a scale of its output: .
BOFTModel15 methodsA model with BOFT layers in it, and the tools to take them out again.