Skip to content
module

OSF

4 members
lucid.peft.tuners.osf

lucid.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.

Paper

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.

Overview

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