OSF
4 memberslucid.peft.tuners.osflucid.peft.tuners.osf — OSF: constrained full fine-tuning in the weight's low singular directions.
OSF (Nayak et al., 2025, arXiv:2504.07097 — Sculpting Subspaces) takes the SVD of each weight, freezes its top singular directions, which carry what the model already knows, and trains the rest, with the gradients projected onto the complement of the frozen directions so that a new task does not overwrite an old one. Nothing is added to the model: the trained tensors are the weight's own low part. Pick it for learning several tasks in sequence without keeping an adapter per task.
Where the reference library keeps them, so isinstance(m, OSFLayer) and from lucid.peft.tuners.osf import OSFConfig, Linear read as they do there. One layer type for the one
module the method adapts, nn.Linear. OSFConfig and OSFModel are here and exported from
lucid.peft. Importing the package registers the method (its config under PeftType.OSF, its
tuner and layer), which is what makes get_peft_model and PeftModel.from_pretrained know it.
Nayak, Nikhil Shivakumar, et al. "Sculpting Subspaces: Constrained Full Fine-Tuning in LLMs for Continual Learning." [arXiv:2504.07097](https://arxiv.org/abs/2504.07097), 2025.
OSF (Orthogonal Subspace Fine-tuning; Nayak et al., 2025, arXiv:2504.07097 — Sculpting Subspaces, section 3)
is constrained full fine-tuning for continual learning. It takes the SVD of each weight, freezes the top
effective_rank singular directions, which carry what the model already knows, and trains the rest, with
gradients projected orthogonally to the frozen directions so that a new task does not overwrite an old one.
The trainable rank is min(weight.shape) - effective_rank; no parameter is added to the model.
Classes
OSFConfig9 methodsHow lucid.peft.get_peft_model adapts a model with OSF.
LinearAn nn.Linear whose low singular directions train: .
OSFLayer20 methodsAdapter bookkeeping and the split weight shared by the OSF layers.
OSFModel16 methodsA network whose weights train in their low singular directions, with the gradients kept off the high ones.