-
Notifications
You must be signed in to change notification settings - Fork 3.4k
KappaTune-LoRA feature #15579
Description
Feature request
Is your feature request related to a problem? Please describe.
Manually choosing target_modules for LoRA (e.g. linear_qkv, linear_proj, etc.) becomes impractical on very large models (70B+). The recent KappaTune paper introduces a simple, principled way to automatically select the best target modules: compute the matrix condition number κ (σ_max / σ_min) for every nn.Linear layer and keep the most isotropic ones (lowest κ). This gives better or comparable performance to full LoRA while using fewer modules.
A clean implementation of KappaTuneSelector (with full 4-bit bitsandbytes support) has already been contributed to Hugging Face PEFT:
→ huggingface/peft#3106
Describe the solution you'd like
Add a lightweight utility similar to KappaTuneSelector (or integrate it directly into NeMo's LoRA/PEFT recipe system) so users can do:
from nemo.collections.llm import LoRA
# After loading your NeMo model
from nemo.collections import llm
from kappatune_selector_nemo import find_kappa_target_modules
selector = KappaTuneSelector(model) # or use find_kappa_target_modules
stable_modules = find_kappa_target_modules(model, top_p=0.2)
lora_config = llm.peft.LoRA(
target_modules=stable_modules, # ← NeMo accepts the full names automatically
dim=64, # rank
alpha=128,
dropout=0.05,
)