RoAd
4 memberslucid.peft.tuners.roadlucid.peft.tuners.road — RoAd: a rotation and scaling of pairs of output features.
RoAd (Liao and Monz, 2024, arXiv:2409.00119 — 2D Rotary Adaptation) pairs the output features of a
layer into 2-D vectors, within groups of group_size (element with element
), and rotates and scales each pair by a learned angle and scale. The
rotation folds into the weight and the bias at no inference cost. Pick it for an adapter with very
few parameters (about half a number per output feature) that merges into the weight.
Where the reference library keeps them, so isinstance(m, RoadLayer) and from lucid.peft.tuners.road import RoadConfig, Linear read as they do there. One layer type for the one
module the method adapts, nn.Linear. RoadConfig and RoadModel are here and exported from
lucid.peft. Importing the package registers the method (its config under PeftType.ROAD, its
tuner and layer), which is what makes get_peft_model and PeftModel.from_pretrained know it.
Liao, Baohao, et al. "3-in-1: 2D Rotary Adaptation for Efficient Finetuning, Efficient Batching and Composability." [arXiv:2409.00119](https://arxiv.org/abs/2409.00119), 2024.
RoAd (Liao and Monz, 2024, arXiv:2409.00119 — 2D Rotary Adaptation) pairs the output features of a layer into 2-D vectors and rotates and scales each pair (section 3.2, Eq. 3),
Classes
RoadConfig9 methodsHow lucid.peft.get_peft_model adapts a model with RoAd.
LinearAn nn.Linear whose output a RoAd rotation turns: .
RoadLayer20 methodsAdapter bookkeeping and the rotation shared by the RoAd layers.
RoadModel15 methodsA network whose linear layers turn their outputs by learned 2-D rotations, and the tools to undo that.