Fix Nemotron 3 SFT example: add Mamba modules to LoRA targets - #6775
Fix Nemotron 3 SFT example: add Mamba modules to LoRA targets#6775davidnichols-ops wants to merge 1 commit into
Conversation
NemotronH is a hybrid Mamba-Attention architecture. The previous target modules (q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj) only covered attention and MLP layers. gate_proj does not exist in NemotronH, and the Mamba layers (in_proj, out_proj) were missing entirely. Since Mamba layers are the majority in NemotronH models (e.g. 52/56 in Nemotron-Nano-9B-v2), omitting them from LoRA targets means most of the model is frozen during fine-tuning, resulting in zero learning. See huggingface/peft#3554
|
Your PR has been closed because it does not follow the required PR template. Please open a new PR following the template. See CONTRIBUTING.md for guidance. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a3e38df. Configure here.
| --lora_r 8 \ | ||
| --lora_alpha 16 \ | ||
| --lora_target_modules q_proj k_proj v_proj o_proj gate_proj up_proj down_proj | ||
| --lora_target_modules q_proj k_proj v_proj o_proj in_proj out_proj up_proj down_proj |
There was a problem hiding this comment.
Invalid Mamba LoRA out_proj target
High Severity
Adding out_proj to --lora_target_modules breaks NemotronH LoRA. Mamba mixers feed out_proj.weight into fused kernels, so LoRA on that module is skipped or rejected by PEFT, and adapters can fail at merge. Including in_proj is the useful Mamba change here; out_proj is not a valid target for this architecture.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit a3e38df. Configure here.


Summary
gate_projwithin_projandout_projin the LoRA target modules for the Nemotron 3 SFT exampleWhy
NemotronH is a hybrid Mamba-Attention architecture. The previous target modules (q_proj k_proj v_proj o_proj gate_proj up_proj down_proj) had two problems:
See huggingface/peft#3554 for the full analysis.
What Changed
Test plan
Note
Low Risk
Documentation and example CLI defaults only; no library or training runtime code changes.
Overview
Updates the Nemotron 3 SFT example so LoRA actually trains the hybrid model instead of mostly freezing it.
The sample
acceleratecommand now usesin_projandout_projinstead ofgate_proj, and keeps attention/MLP targets (q_proj,k_proj,v_proj,o_proj,up_proj,down_proj).gate_projis not part of NemotronH, and without the Mamba projections most layers stay frozen.A short module docstring explains why NemotronH needs both Mamba and attention/MLP modules in
--lora_target_modules, with a link to the PEFT issue.Reviewed by Cursor Bugbot for commit a3e38df. Bugbot is set up for automated code reviews on this repo. Configure here.