Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Run the Nemotron-3.5 Lightning Text2SQL LoRA fine-tuning tutorial (NeMo Megatron-Bridge) end-to-end for the user on a single node: data prep, checkpoint conversion, LoRA fine-tuning of the 30B-A3B hybrid Mamba-Transformer MoE, and merging the adapter back to a Hugging Face checkpoint. Use when the user wants to run this cookbook, fine-tune Nemotron-3.5 Lightning with LoRA, or adapt the notebook to their own machine.
.claude/skills/nvidia-nemo-nemotron-3-5-lightning-text2sql-lora/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 110% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 17% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 28% | 0% |
| case-19 | ✗→✓ | ▲ Improved | 5% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 27% | 0% |
This skill helps you run the cookbook in this directory (mbridge_lora_cookbook.ipynb) on the user's behalf. Your job is to gather a few environment details, pick a GPU configuration that fits their hardware, run the four steps in order, and confirm each one produced what it should.
Four steps, in order. Only step 3 needs a GPU — this is the single most useful thing to know when planning the run.
training.jsonl from the no-reasoning andreasoning splits, formatted with Nemotron-3.5's chat template.
Face checkpoint.
Ask for these up front, in one batch:
download it and where to put it. It is ~62 GB.
$HF_TOKEN) so BIRD can be downloaded during data prep. Reference it byenvironment variable; never print it.
The model's 128 experts are split across GPUs with expert parallelism, so n_devices is the only knob that really matters — set EP = n_devices. Measured peak memory per GPU on 80GB H100s at seq_length=2048:
| GPUs | Peak/GPU | One epoch | Recommendation | | --- | --- | --- | --- | | 1 | 78.8 GB | ~62 min | Works only with REDUCE_MTP_HEADS=1. ~0.4 GB margin — fine if that is all they have. | | 2 | 51.0 GB | ~34 min | Default to this when available. Stock recipe, ~28 GB margin. | | 4 | 34.8 GB | ~18 min | Good if available. | | 8 | 26.8 GB | ~8 min | Fastest. |
All measured over a full epoch (189 iterations, GBS 32, seq_length=2048) on the complete 12,544-example dataset. Final loss lands within ~2% across all four, so choose on hardware availability and how long the user is willing to wait — not on expected quality.
If the user has GPUs smaller than 80 GB, scale by the same logic: peak memory is roughly (model weights ÷ EP) + ~12 GB of overhead. Spare memory is best spent raising seq_length, which increases how much of the dataset survives the length filter — not just headroom.
$HF_TOKENexposed. Use the docker run invocation in the notebook's first cell as the template.
n_devices) — it is the only cell thatshould need editing.
open, and do not stream the full log.
You can also run the steps directly rather than through the notebook — each is a plain script driven by environment variables (MODEL_ID, MAX_SEQ_LEN, DATAPREP_OUTPUT_DIR for data prep; HF_MODEL, MEGATRON_MODEL_PATH for convert; and N_DEVICES, EP, DATASET_DIR, TRAINING_OUTPUT_DIR, EXPERIMENT_NAME for training).
$DATAPREP_OUTPUT_DIR/training.jsonl exists with ~12,500 rows at seq_length=2048.Spot-check one record: input should end with <think>\n (reasoning) or <think></think> (non-reasoning), and output should continue directly from there.
$MEGATRON_MODEL_PATH/latest_checkpointed_iteration.txt plus an iter_* directoryexist (~62 GB).
iter_* adapter checkpoint under $TRAINING_OUTPUT_DIR/$EXPERIMENT_NAME, and thelog shows lm loss trending down.
model-*.safetensors shards, config.json, and thetokenizer files, and the log ends with Success: All tensors from the original checkpoint were written.
Report per-step status, wall-clock time, and the final training loss.
train.py callsthe shipped PEFT recipe and overrides only local paths, parallelism, dataset, and schedule. Don't hand-write LoRA target modules — the recipe's already cover the Mamba projections, attention, and both routed and shared experts.
alltoall rather than the recipe's default flex/DeepEP, forportability. Only change this if DeepEP is known good on the user's system.
async_save=False) is deliberate.training.jsonl exists; convert skips if thecheckpoint exists.
and the MoE warms up. Subsequent iterations are seconds. Do not cancel the job.
Failed to import Triton kernels, MimoModelConfig isexperimental, Unable to import torchao, and torch_dtype is deprecated all appear on healthy runs. Judge by the sanity checks.
RECOMPUTE_ACTIVATIONS. It lowers memory but fails at iteration 2 with anassertion in Megatron's gradient buffer. If the user is out of memory, add a GPU or lower seq_length instead.
REDUCE_MTP_HEADS reduces to one head, it cannot disable MTP. The hybrid model assertsmtp_num_layers > 0.
a dataset config accepts exactly one source. train.py already does this; preserve it if you refactor.
transformers.generate() currently fails inside the model's bundled remote code — on the base checkpoint too, so don't diagnose it as a fine-tuning problem.
if __name__ == "__main__": guard. vLLM spawns workers; without itthe failure surfaces as Engine core initialization failed wrapping a multiprocessing bootstrap error that never mentions vLLM.
Serving the merged checkpoint and prompting it the way data prep formatted training examples should yield bare SQL, e.g. SELECT T2.dept_name FROM employees AS T1 INNER JOIN .... The base model instead answers conversationally with fenced SQL and a prose explanation. If the fine-tuned model still explains itself, something upstream went wrong — suspect the chat-template format first.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-18 | pass→pass | 18,671 | 3,865 | -79% | 1 | 1 | 0% | 2,327 | 2,620 | +13% | 0 | 0 | — |
case-01 | fail→pass | 18,946 | 13,106 | -31% | 1 | 1 | 0% | 1,626 | 3,422 | +110% | 0 | 0 | — |
case-02 | fail→fail | 26,052 | 18,478 | -29% | 1 | 1 | 0% | 5,179 | 2,488 | -52% | 0 | 0 | — |
case-03 | fail→fail | 31,366 | 8,042 | -74% | 1 | 1 | 0% | 5,530 | 2,384 | -57% | 0 | 0 | — |
case-04 | fail→pass | 22,057 | 12,531 | -43% | 1 | 1 | 0% | 2,819 | 3,294 | +17% | 0 | 0 | — |
case-05 | fail→pass | 12,325 | 9,415 | -24% | 1 | 1 | 0% | 2,141 | 2,733 | +28% | 0 | 0 | — |
case-19 | fail→pass | 30,019 | 9,546 | -68% | 1 | 1 | 0% | 2,668 | 2,793 | +5% | 0 | 0 | — |
case-06 | pass→pass | 15,928 | 8,560 | -46% | 1 | 1 | 0% | 1,757 | 2,565 | +46% | 0 | 0 | — |
case-07 | fail→pass | 12,414 | 9,189 | -26% | 1 | 1 | 0% | 2,025 | 2,567 | +27% | 0 | 0 | — |
case-08 | fail→pass | 14,405 | 5,466 | -62% | 1 | 1 | 0% | 2,319 | 2,883 | +24% | 0 | 0 | — |
case-09 | pass→pass | 18,776 | 6,347 | -66% | 1 | 1 | 0% | 2,301 | 2,985 | +30% | 0 | 0 | — |
case-10 | fail→pass | 21,801 | 8,128 | -63% | 1 | 1 | 0% | 2,975 | 3,495 | +17% | 0 | 0 | — |
case-11 | pass→pass | 19,420 | 12,390 | -36% | 1 | 1 | 0% | 1,925 | 3,198 | +66% | 0 | 0 | — |
case-12 | pass→pass | 8,300 | 2,781 | -66% | 1 | 1 | 0% | 1,421 | 2,282 | +61% | 0 | 0 | — |
case-13 | fail→pass | 13,186 | 6,055 | -54% | 1 | 1 | 0% | 2,088 | 2,946 | +41% | 0 | 0 | — |
case-14 | fail→pass | 13,006 | 4,396 | -66% | 1 | 1 | 0% | 2,255 | 2,689 | +19% | 0 | 0 | — |
case-15 | fail→pass | 20,287 | 3,918 | -81% | 1 | 1 | 0% | 2,648 | 2,692 | +2% | 0 | 0 | — |
case-16 | pass→pass | 21,094 | 10,738 | -49% | 1 | 1 | 0% | 2,296 | 2,953 | +29% | 0 | 0 | — |
case-17 | fail→pass | 13,756 | 7,402 | -46% | 1 | 1 | 0% | 1,443 | 2,185 | +51% | 0 | 0 | — |
case-20 | pass→pass | 23,346 | 18,471 | -21% | 1 | 1 | 0% | 4,421 | 5,571 | +26% | 0 | 0 | — |
case-21 | pass→pass | 19,336 | 17,029 | -12% | 1 | 1 | 0% | 2,744 | 4,108 | +50% | 0 | 0 | — |
case-22 | pass→pass | 46,246 | 30,939 | -33% | 1 | 1 | 0% | 8,210 | 7,339 | -11% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 20 counted toward the lift figure. The other 2 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +50 percentage points is the difference between those two pass rates over the 20 comparable cases. 2 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.