AdaLoRA
6 memberslucid.peft.tuners.adaloralucid.peft.tuners.adalora — AdaLoRA: LoRA whose rank per layer is allocated while it trains.
AdaLoRA (Zhang et al., 2023, arXiv:2303.10512) writes the update of a layer as a truncated SVD,
, with and
kept near-orthogonal by a penalty on the loss. It tracks how much each singular triplet
matters during training and masks the least important ones on a schedule, so a fixed parameter
budget goes to the layers that need it. Pick it over LoRA when you know the budget but not which
layers deserve the rank; call AdaLoraModel.update_and_allocate after each optimizer step.
Where the reference library keeps them, so isinstance(m, AdaLoraLayer) and from lucid.peft.tuners.adalora import AdaLoraConfig, SVDLinear read as they do there. One layer type
per module the method adapts: SVDLinear and SVDConv2d; RankAllocator is the budget
schedule. AdaLoraConfig and AdaLoraModel are here and exported from lucid.peft.
Importing the package registers the method (its config under PeftType.ADALORA, its tuner and
layers), which is what makes get_peft_model and PeftModel.from_pretrained know it.
Zhang, Qingru, et al. "Adaptive Budget Allocation for Parameter-Efficient Fine-Tuning." [arXiv:2303.10512](https://arxiv.org/abs/2303.10512), 2023.
AdaLoRA (Zhang et al., 2023, arXiv:2303.10512) writes the update of a
targeted nn.Linear (or nn.Conv2d) as a truncated SVD,
Classes
RankAllocator10 methodsDecides, on a schedule, how many singular triplets each AdaLoRA layer keeps.
AdaLoraConfig9 methodsHow lucid.peft.get_peft_model adapts a model with AdaLoRA.
AdaLoraLayer25 methodsAdapter bookkeeping shared by the AdaLoRA layers.
SVDConv2dAn nn.Conv2d whose update is an SVD-parameterised kernel, applied as the base applies its own.
SVDLinearAn nn.Linear with an SVD-parameterised update: .
AdaLoraModel21 methodsA model with AdaLoRA layers put into it, the rank allocation and the tools to take them out.