> This page is for version 0.4.0 · 26.04.
> 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.components.models.nemotron_decision

Typed-decision post-training support for Nemotron 3.5 Decision checkpoints.

## Submodules

* **[`nemo_automodel.components.models.nemotron_decision.export`](/nemo/automodel/v0.4/nemo-automodel/nemo_automodel/components/models/nemotron_decision/export)**
* **[`nemo_automodel.components.models.nemotron_decision.model`](/nemo/automodel/v0.4/nemo-automodel/nemo_automodel/components/models/nemotron_decision/model)**
* **[`nemo_automodel.components.models.nemotron_decision.records`](/nemo/automodel/v0.4/nemo-automodel/nemo_automodel/components/models/nemotron_decision/records)**
* **[`nemo_automodel.components.models.nemotron_decision.scorer`](/nemo/automodel/v0.4/nemo-automodel/nemo_automodel/components/models/nemotron_decision/scorer)**
* **[`nemo_automodel.components.models.nemotron_decision.serving_prompt`](/nemo/automodel/v0.4/nemo-automodel/nemo_automodel/components/models/nemotron_decision/serving_prompt)**

## Package Contents

### Classes

| Name                                                                                                      | Description                                                                               |
| --------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| [`DecisionContract`](#nemo_automodel-components-models-nemotron_decision-serving_prompt-DecisionContract) | A checkpoint's decision prompt contract (`decision.json` and `decision_template.jinja`).  |
| [`NemotronForDecision`](#nemo_automodel-components-models-nemotron_decision-model-NemotronForDecision)    | Bidirectional Ministral 3 encoder plus a vocabulary head read at the decision mask token. |
| [`PreparedQuestion`](#nemo_automodel-components-models-nemotron_decision-serving_prompt-PreparedQuestion) | One tokenized decision prompt (without the trailing mask) and its option readout.         |

### Functions

| Name                                                                                                            | Description                                                                                              |
| --------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| [`encode_question`](#nemo_automodel-components-models-nemotron_decision-records-encode_question)                | Encode one question of a record as its decision prompt, or `None` if this model cannot read it.          |
| [`prepare_question`](#nemo_automodel-components-models-nemotron_decision-serving_prompt-prepare_question)       | Render one question with the checkpoint's decision template, optionally with shuffled, re-coded options. |
| [`require_decision_config`](#nemo_automodel-components-models-nemotron_decision-scorer-require_decision_config) | Reject checkpoints whose runtime contract this recipe does not implement.                                |

### API

```python
class nemo_automodel.components.models.nemotron_decision.serving_prompt.DecisionContract(
    template: str,
    labels: dict[str, tuple[str, ...]],
    max_input_tokens: int
)
```

Dataclass

A checkpoint's decision prompt contract (`decision.json` and `decision_template.jinja`).

**`labels`** `dict[str, tuple[str, ...]]`

Option codes per question type, in position order.

---

**`max_input_tokens`** `int`

Longest read the checkpoint accepts, mask included.

---

**`sha256`** `str`

Identity of the contract (template, codes and limit).

---

**`template`** `str`

The Jinja decision template; it renders `decision_content` and ends with the mask token.

---

```python
nemo_automodel.components.models.nemotron_decision.serving_prompt.DecisionContract.from_pretrained(
    path: str | pathlib.Path,
    revision: str | None = None
) -> nemo_automodel.components.models.nemotron_decision.serving_prompt.DecisionContract
```

classmethod

Load and validate the contract of a local checkpoint directory or Hugging Face repository.

**Raises:**

* `ValueError`: If a file is missing or the contract is malformed.

```python
class nemo_automodel.components.models.nemotron_decision.model.NemotronForDecision(
    config: transformers.models.ministral3.configuration_ministral3.Ministral3Config,
    kwargs: typing.Any = {}
)
```

**Bases:** `PreTrainedModel`

Bidirectional Ministral 3 encoder plus a vocabulary head read at the decision mask token.

**`_no_split_modules`** `= ['Ministral3DecoderLayer']`

---

**`base_model_prefix`** `= 'encoder'`

---

**`diffusion_head`**

---

**`encoder`** `= Ministral3BidirectionalModel(config)`

---

**`tie_word_embeddings_support`** `TieSupport = TieSupport.UNTIED_ONLY`

---

```python
nemo_automodel.components.models.nemotron_decision.model.NemotronForDecision.forward(
    input_ids: torch.LongTensor | None = None,
    attention_mask: torch.Tensor | None = None,
    position_ids: torch.LongTensor | None = None,
    inputs_embeds: torch.FloatTensor | None = None,
    output_last_hidden_states_only: bool = False,
    kwargs: typing.Any = {}
) -> transformers.modeling_outputs.BaseModelOutput | transformers.modeling_outputs.MaskedLMOutput
```

Read the sequence bidirectionally.

**Parameters:**

**`input_ids`** `torch.LongTensor | None` — default: None

Token ids `[batch, sequence]`.

---

**`attention_mask`** `torch.Tensor | None` — default: None

Optional padding mask `[batch, sequence]`.

---

**`position_ids`** `torch.LongTensor | None` — default: None

Optional positions `[batch, sequence]`; defaults to `0..sequence-1`.

---

**`inputs_embeds`** `torch.FloatTensor | None` — default: None

Optional embeddings instead of `input_ids`.

---

**`output_last_hidden_states_only`** `bool` — default: False

Return the encoder's last hidden state without projecting the
`[batch, sequence, vocab]` logits.

---

**`**kwargs`** `Any` — default: \{}

Passed to the encoder (`use_cache` is ignored; decision reads keep no cache).

---

**Returns:** `BaseModelOutput | MaskedLMOutput`

`BaseModelOutput(last_hidden_state)` or `MaskedLMOutput(logits)`.

```python
nemo_automodel.components.models.nemotron_decision.model.NemotronForDecision.get_input_embeddings() -> torch.nn.Embedding
```

Token embeddings of the encoder.

```python
nemo_automodel.components.models.nemotron_decision.model.NemotronForDecision.get_output_embeddings() -> torch.nn.Linear
```

The decision readout head.

```python
nemo_automodel.components.models.nemotron_decision.model.NemotronForDecision.set_input_embeddings(
    value: torch.nn.Embedding
) -> None
```

Replace the encoder's token embeddings.

```python
nemo_automodel.components.models.nemotron_decision.model.NemotronForDecision.set_output_embeddings(
    value: torch.nn.Linear
) -> None
```

Replace the decision readout head.

```python
nemo_automodel.components.models.nemotron_decision.model.NemotronForDecision.supports_config(
    config: typing.Any
) -> bool
```

classmethod

True for text Ministral 3 decision checkpoints (no vision tower, no quantization).

```python
class nemo_automodel.components.models.nemotron_decision.serving_prompt.PreparedQuestion(
    question_id: str,
    kind: str,
    labels: tuple[str, ...],
    code_token_ids: tuple[int, ...],
    input_ids: tuple[int, ...]
)
```

Dataclass

One tokenized decision prompt (without the trailing mask) and its option readout.

**`code_token_ids`** `tuple[int, ...]`

---

**`input_ids`** `tuple[int, ...]`

---

**`kind`** `str`

---

**`labels`** `tuple[str, ...]`

---

**`question_id`** `str`

---

```python
nemo_automodel.components.models.nemotron_decision.records.encode_question(
    tokenizer: typing.Any,
    contract: nemo_automodel.components.models.nemotron_decision.serving_prompt.DecisionContract,
    record: dict[str, typing.Any],
    question_id: str,
    mask_token_id: int,
    max_tokens: int,
    shuffle_seed: int | None = None
) -> nemo_automodel.components.models.nemotron_decision.serving_prompt.PreparedQuestion | None
```

Encode one question of a record as its decision prompt, or `None` if this model cannot read it.

A question is not readable when the record carries media, the question does not fit the checkpoint's contract (no
instructions, unsupported fields, or more options than codes), or the prompt plus its mask is longer than
`max_tokens`. The caller counts these questions.

**Parameters:**

**`tokenizer`** `Any`

Tokenizer of the checkpoint.

---

**`contract`** `DecisionContract`

The checkpoint's decision contract.

---

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

Validated SystemOne record that holds the question.

---

**`question_id`** `str`

Key of the question in `record["questions"]`.

---

**`mask_token_id`** `int`

The checkpoint's mask token.

---

**`max_tokens`** `int`

Longest allowed prompt including the mask slot.

---

**`shuffle_seed`** `int | None` — default: None

Option-shuffle seed (`None` keeps the checkpoint's option order).

---

```python
nemo_automodel.components.models.nemotron_decision.serving_prompt.prepare_question(
    tokenizer: typing.Any,
    contract: nemo_automodel.components.models.nemotron_decision.serving_prompt.DecisionContract,
    state: typing.Any,
    question_id: str,
    question: dict[str, typing.Any],
    mask_token_id: int,
    shuffle_seed: int | None = None
) -> nemo_automodel.components.models.nemotron_decision.serving_prompt.PreparedQuestion
```

Render one question with the checkpoint's decision template, optionally with shuffled, re-coded options.

**Parameters:**

**`tokenizer`** `Any`

Tokenizer of the checkpoint.

---

**`contract`** `DecisionContract`

The checkpoint's decision contract.

---

**`state`** `Any`

JSON-serializable evidence shared by the question.

---

**`question_id`** `str`

Key of the question (used in errors).

---

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

`&#123;"type", "instructions", "criteria"&#125;` of a choice, noul or score question.

---

**`mask_token_id`** `int`

The checkpoint's mask token, which the template must write exactly once, at the end.

---

**`shuffle_seed`** `int | None` — default: None

When set, permute the options with `perm_seed(shuffle_seed)` and re-code them by position;
`None` keeps the checkpoint's option order.

---

**Returns:** `PreparedQuestion`

The prepared prompt; token ids exclude the trailing mask.

**Raises:**

* `ValueError`: If the question is malformed, has more options than codes, or the template does not end in exactly
  one mask token.

```python
nemo_automodel.components.models.nemotron_decision.scorer.require_decision_config(
    config: typing.Any
) -> None
```

Reject checkpoints whose runtime contract this recipe does not implement.

The recipe trains Nemotron 3.5 Decision checkpoints: a text Ministral 3 encoder read with fully bidirectional
attention, one question per read, and the decision head at the mask token. Vision and quantized variants need
their own input and storage paths and are not run silently as the text model.

**Parameters:**

**`config`** `Any`

Hugging Face config (attribute access) of the checkpoint.

---

**Raises:**

* `ValueError`: If the architecture, attention or storage format is unsupported.