IA3
6 memberslucid.peft.tuners.ia3lucid.peft.tuners.ia3 — (IA)^3: one learned rescaling vector per layer.
(IA)^3 (Liu et al., 2022, arXiv:2205.05638 — Infused Adapter by Inhibiting and Amplifying Inner Activations) learns a vector per adapted layer that rescales its output channels, , or, for a block's feed-forward layers, its input, . It starts at ones, so the adapted model starts as the base, and it folds into the weight. Pick it for an adapter of one vector per layer, when rescaling channels is enough; that carries less than a low-rank update.
Where the reference library keeps them, so isinstance(m, IA3Layer) and from lucid.peft.tuners.ia3 import Linear read as they do there. One layer type per module the method
adapts: Linear and the convolutions Conv2d / Conv3d. IA3Config and IA3Model are
here and exported from lucid.peft. Importing the package registers the method (its config under
PeftType.IA3, its tuner and layers), which is what makes get_peft_model and
PeftModel.from_pretrained know it.
Liu, Haokun, et al. "Few-Shot Parameter-Efficient Fine-Tuning is Better and Cheaper than In-Context Learning." [arXiv:2205.05638](https://arxiv.org/abs/2205.05638), 2022.
(IA)^3 (Liu et al., 2022, arXiv:2205.05638 — "Infused Adapter by Inhibiting and Amplifying Inner Activations") freezes the model and learns one vector per targeted layer that rescales its output channels, ; for the feed-forward layers of a block it rescales the input instead, . The vector starts at ones, so the adapted model starts as the base, and it folds into the weight (and bias), so a merged model costs what the base does.
Classes
Conv2d20 methodsAn nn.Conv2d with an (IA)^3 vector over its channels: (1, channels, 1, 1).
Conv3d20 methodsAn nn.Conv3d with an (IA)^3 vector over its channels: (1, channels, 1, 1, 1).
IA3Layer22 methodsAdapter bookkeeping shared by the (IA)^3 layers.
LinearAn nn.Linear with an (IA)^3 vector: , or .
IA3Config9 methodsHow lucid.peft.get_peft_model adapts a model with (IA)^3.
IA3Model16 methodsA model with (IA)^3 layers put into it, and the tools to take them out.