> This page is for version Nightly (default).
> For other versions, use one of these documentation indexes:
> - Nightly (default): https://docs.nvidia.com/nemo/automodel/nightly/llms.txt
> - Latest: https://docs.nvidia.com/nemo/automodel/latest/llms.txt
> - 0.7.0 · 26.10: https://docs.nvidia.com/nemo/automodel/v0.7/llms.txt
> - 0.5.0 · 26.06: https://docs.nvidia.com/nemo/automodel/v0.5/llms.txt
> - 0.4.0 · 26.04: https://docs.nvidia.com/nemo/automodel/v0.4/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/automodel/llms.txt.

# nemo_automodel.recipes.decision.train_nemotron_decision

Post-train Nemotron 3.5 Decision checkpoints on SystemOne records (LoRA or backbone fine-tuning).

Every question of a record is its own read, rendered with the checkpoint's own decision contract
(`decision_template.jinja` and `decision.json`: the question's option order and the checkpoint's codes), which
ends in the mask token. The bidirectional Ministral 3 encoder reads it, and the frozen decision head's logits at the
mask, restricted to the option codes, give the answer distribution. Supervision, the objective and the metrics are the shared decision
components: `question_targets` aligns answers, rewards and soft labels with each prompt's option order,
`assemble_decision_batch` and `DecisionLoss` (`loss.mode: sft`) compute the loss, and `DecisionEvaluator`
scores validation and test. Training reads keep the checkpoint's option order unless `train.canonical_fraction` is
below 1, in which case the remaining share is shuffled and re-coded by position.

* `peft` set: LoRA on the attention/MLP projections; embeddings and the decision head stay frozen.
* `peft: null`: backbone fine-tuning of the encoder blocks and final norm; embeddings and the decision head stay frozen.
* `mode: eval` scores the configured checkpoint (or `init_from` stage) on validation and test.

Validation selects the published stage (`LOWEST_VAL`): most correct validation decisions, then lowest NLL; for LoRA
the starting checkpoint (step 0) is a saved, selectable stage; backbone fine-tuning selects among trained stages. Report
the test split separately; the validation split is not an untouched test. Export a selected stage as a complete
servable checkpoint with `examples/decision/export_nemotron_decision.py`.

Run with::

automodel examples/decision/nemotron_decision_support_routing_lora.yaml --nproc-per-node 1

## Module Contents

### Classes

| Name                                                                                                                  | Description                                                                             |
| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| [`TrainNemotronDecisionRecipe`](#nemo_automodel-recipes-decision-train_nemotron_decision-TrainNemotronDecisionRecipe) | LoRA or full post-training of Nemotron 3.5 Decision checkpoints (see module docstring). |
| [`_Decision`](#nemo_automodel-recipes-decision-train_nemotron_decision-_Decision)                                     | One supervised question of a record, encoded in the checkpoint's option order.          |

### Functions

| Name                                                                                          | Description                                                                                                 |
| --------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| [`main`](#nemo_automodel-recipes-decision-train_nemotron_decision-main)                       | CLI entry point: `python -m nemo_automodel.recipes.decision.train_nemotron_decision --config &lt;yaml&gt;`. |
| [`selection_value`](#nemo_automodel-recipes-decision-train_nemotron_decision-selection_value) | Lower-is-better scalar that orders stages by correct validation decisions, then by lower cross-entropy.     |

### Data

[`MODES`](#nemo_automodel-recipes-decision-train_nemotron_decision-MODES)

[`STAGE_FORMAT`](#nemo_automodel-recipes-decision-train_nemotron_decision-STAGE_FORMAT)

[`logger`](#nemo_automodel-recipes-decision-train_nemotron_decision-logger)

### API

```python
class nemo_automodel.recipes.decision.train_nemotron_decision.TrainNemotronDecisionRecipe(
    cfg: nemo_automodel.recipes._typed_config.RecipeConfig | nemo_automodel.components.config.loader.ConfigNode
)
```

**Bases:** [BaseRecipe](/nemo/automodel/nemo-automodel/nemo_automodel/recipes/base_recipe#nemo_automodel-recipes-base_recipe-BaseRecipe)

LoRA or full post-training of Nemotron 3.5 Decision checkpoints (see module docstring).

**`cfg`**

---

```python
nemo_automodel.recipes.decision.train_nemotron_decision.TrainNemotronDecisionRecipe._encode_split(
    records: list[dict[str, typing.Any]],
    train: bool
) -> tuple[list[nemo_automodel.recipes.decision.train_nemotron_decision._Decision], int]
```

Encode every supervised question of `records` in the checkpoint's option order.

Training keeps the questions the objective weights (a gold answer, or soft labels when they replace the
gold target); evaluation keeps the questions the evaluator scores (a gold answer or rewards).

**Parameters:**

**`records`** `list[dict[str, Any]]`

Validated SystemOne records of one split.

---

**`train`** `bool`

Whether the split trains the model.

---

**Returns:** `list[_Decision]`

The decisions, and the number of questions this model cannot read (media, a question that does not fit

```python
nemo_automodel.recipes.decision.train_nemotron_decision.TrainNemotronDecisionRecipe._load_stage(
    path: pathlib.Path
) -> None
```

Initialize weights from a published stage of the same base, method and readout contract.

```python
nemo_automodel.recipes.decision.train_nemotron_decision.TrainNemotronDecisionRecipe._log(
    name: str,
    record: dict[str, typing.Any]
) -> None
```

```python
nemo_automodel.recipes.decision.train_nemotron_decision.TrainNemotronDecisionRecipe._logits(
    prompt: nemo_automodel.components.models.nemotron_decision.serving_prompt.PreparedQuestion
) -> torch.Tensor
```

Option logits of `prompt`, fp32 tensor of shape `[options]` in prompt order.

```python
nemo_automodel.recipes.decision.train_nemotron_decision.TrainNemotronDecisionRecipe._report(
    split: str
) -> None
```

Write `metrics_&#123;split&#125;.json` (evaluator summary) and `predictions_&#123;split&#125;.jsonl` on the main rank.

```python
nemo_automodel.recipes.decision.train_nemotron_decision.TrainNemotronDecisionRecipe._save_stage(
    path: pathlib.Path,
    validation: dict[str, typing.Any] | None
) -> None
```

Publish the trainable weights (LoRA adapter or consolidated full weights) as an immutable stage.

```python
nemo_automodel.recipes.decision.train_nemotron_decision.TrainNemotronDecisionRecipe._target(
    record: dict[str, typing.Any],
    prompt: nemo_automodel.components.models.nemotron_decision.serving_prompt.PreparedQuestion
) -> nemo_automodel.components.datasets.decision.records.QuestionTarget
```

staticmethod

Supervision of `prompt`'s question, aligned with the prompt's option order.

```python
nemo_automodel.recipes.decision.train_nemotron_decision.TrainNemotronDecisionRecipe._targets(
    record: dict[str, typing.Any],
    target: nemo_automodel.components.datasets.decision.records.QuestionTarget,
    device: torch.device | None = None
) -> nemo_automodel.components.loss.decision_batch.DecisionTargets
```

One-question loss targets with the configured question weights, on `device` (CPU by default).

```python
nemo_automodel.recipes.decision.train_nemotron_decision.TrainNemotronDecisionRecipe._train() -> pathlib.Path
```

Train; returns the validation-selected stage (the last stage when there is no validation split).

```python
nemo_automodel.recipes.decision.train_nemotron_decision.TrainNemotronDecisionRecipe._validate(
    step: int
) -> dict[str, typing.Any] | None
```

Selection record of the current weights on the validation split, or `None` without one.

```python
nemo_automodel.recipes.decision.train_nemotron_decision.TrainNemotronDecisionRecipe.evaluate(
    split: str
) -> tuple[dict[str, typing.Any], list[dict[str, typing.Any]]]
```

Score every decision of `split` with the shared `DecisionEvaluator`.

Every rank runs the same number of forwards; padded duplicates are scored once.

**Returns:** `tuple[dict[str, Any], list[dict[str, Any]]]`

The evaluator summary and its per-decision predictions, identical on every rank.

```python
nemo_automodel.recipes.decision.train_nemotron_decision.TrainNemotronDecisionRecipe.run_train_validation_loop() -> None
```

Evaluate (`mode: eval`) or train, then report validation and test metrics of the selected weights.

```python
nemo_automodel.recipes.decision.train_nemotron_decision.TrainNemotronDecisionRecipe.setup() -> None
```

Check the checkpoint contract, build the model, encode the splits and the optimizer.

```python
class nemo_automodel.recipes.decision.train_nemotron_decision._Decision(
    record: dict[str, typing.Any],
    prompt: nemo_automodel.components.models.nemotron_decision.serving_prompt.PreparedQuestion,
    target: nemo_automodel.components.datasets.decision.records.QuestionTarget
)
```

Dataclass

One supervised question of a record, encoded in the checkpoint's option order.

**`prompt`** `PreparedQuestion`

Serving prompt of the question (option labels and codes in prompt order).

---

**`record`** `dict[str, Any]`

The validated SystemOne record that holds the question.

---

**`target`** `QuestionTarget`

Supervision aligned with `prompt.labels`.

---

```python
nemo_automodel.recipes.decision.train_nemotron_decision.main(
    config_path: str | None = None
) -> None
```

CLI entry point: `python -m nemo_automodel.recipes.decision.train_nemotron_decision --config &lt;yaml&gt;`.

```python
nemo_automodel.recipes.decision.train_nemotron_decision.selection_value(
    correct: int,
    cross_entropy: float
) -> float
```

Lower-is-better scalar that orders stages by correct validation decisions, then by lower cross-entropy.

The cross-entropy term lies in `[0, 0.99]`, below the gap of one correct decision, so the order is exactly
lexicographic for any validation size (every stage is scored on the same validation decisions).

**Parameters:**

**`correct`** `int`

Number of correctly decided labelled validation questions.

---

**`cross_entropy`** `float`

Mean validation cross-entropy, the evaluator's `nll` (clipped to 99).

---

```python
nemo_automodel.recipes.decision.train_nemotron_decision.MODES = ('eval', 'train')
```

```python
nemo_automodel.recipes.decision.train_nemotron_decision.STAGE_FORMAT = 'nemotron-decision-stage-v1'
```

```python
nemo_automodel.recipes.decision.train_nemotron_decision.logger = logging.getLogger(__name__)
```