Skip to content
module

BOFT

5 members
lucid.peft.tuners.boft

lucid.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 mm sparse orthogonal factors in butterfly order, M=Mm−1⋯M0M = M_{m-1}\cdots M_0, 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.

Paper

Liu, Weiyang, et al. "Parameter-Efficient Orthogonal Finetuning via Butterfly Factorization." [arXiv:2311.06243](https://arxiv.org/abs/2311.06243), 2023.

Overview

BOFT (Liu et al., 2023, arXiv:2311.06243 — Butterfly Orthogonal Finetuning) factors the orthogonal matrix OFT builds block-diagonally into a product of mm sparse orthogonal factors in butterfly order, so a small number of parameters spans a dense rotation of the input space:

M=Mm−1⋯M1M0,Mi=Pi Bi Pi⊤,\qquad M = M_{m-1}\cdots M_1 M_0,\quad M_i = P_i\,B_i\,P_i^\top,

Classes