> 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.records

SystemOne records for Nemotron Decision post-training: one-question encoding and one-decision JSONL conversion.

The recipe reads SystemOne records (`&#123;"id", "state", "questions", "answers"&#125;` plus optional `rewards`,
`soft_labels` and `meta`) and reads every question of a record through its own serving prompt. Simple
one-decision-per-line JSONL (`state`, `question`, `type`, `options`, `label`, optional `soft_labels` and
`group`) converts to single-question records, with `group` kept in `meta` for group-disjoint splits.

## Module Contents

### Functions

| Name                                                                                                     | Description                                                                                               |
| -------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| [`convert_simple_line`](#nemo_automodel-components-models-nemotron_decision-records-convert_simple_line) | Convert one simple decision line into a single-question SystemOne record.                                 |
| [`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.           |
| [`has_media`](#nemo_automodel-components-models-nemotron_decision-records-has_media)                     | True for records with images or videos (top-level, or `state.image`): never read as text decisions.       |
| [`in_heldout`](#nemo_automodel-components-models-nemotron_decision-records-in_heldout)                   | Deterministic group-disjoint split: hash of `seed\|meta.group` (or the state) below `fraction`.           |
| [`normalize_label`](#nemo_automodel-components-models-nemotron_decision-records-normalize_label)         | Normalize a gold/soft label key (noul labels are lower-case `true`/`false`).                              |
| [`read_jsonl`](#nemo_automodel-components-models-nemotron_decision-records-read_jsonl)                   | Read one JSON value per `\n`-terminated line (not `str.splitlines`: U+2028 is legal inside JSON strings). |
| [`write_jsonl`](#nemo_automodel-components-models-nemotron_decision-records-write_jsonl)                 | Write rows as UTF-8 JSONL, creating parent directories.                                                   |

### Data

[`NOUL_ALIASES`](#nemo_automodel-components-models-nemotron_decision-records-NOUL_ALIASES)

[`SIMPLE_QUESTION_ID`](#nemo_automodel-components-models-nemotron_decision-records-SIMPLE_QUESTION_ID)

### API

```python
nemo_automodel.components.models.nemotron_decision.records.convert_simple_line(
    line: dict[str, typing.Any],
    number: int = 0
) -> dict[str, typing.Any]
```

Convert one simple decision line into a single-question SystemOne record.

**Parameters:**

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

`&#123;"state", "question", "label"&#125;` plus optional `id`, `type` (default `choice`), `options`,
`soft_labels` and `group`.

---

**`number`** `int` — default: 0

Line number, used for the record ID when the line has none.

---

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

A record whose only question is `"decision"`. Soft labels are normalized over all options, and `group`

**Raises:**

* `ValueError`: If a field is missing or the label/options are inconsistent.

```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.records.has_media(
    record: dict[str, typing.Any]
) -> bool
```

True for records with images or videos (top-level, or `state.image`): never read as text decisions.

```python
nemo_automodel.components.models.nemotron_decision.records.in_heldout(
    record: dict[str, typing.Any],
    fraction: float,
    seed: str | int
) -> bool
```

Deterministic group-disjoint split: hash of `seed|meta.group` (or the state) below `fraction`.

```python
nemo_automodel.components.models.nemotron_decision.records.normalize_label(
    kind: str,
    label: typing.Any
) -> str
```

Normalize a gold/soft label key (noul labels are lower-case `true`/`false`).

```python
nemo_automodel.components.models.nemotron_decision.records.read_jsonl(
    path: str | pathlib.Path
) -> list[dict[str, typing.Any]]
```

Read one JSON value per `\n`-terminated line (not `str.splitlines`: U+2028 is legal inside JSON strings).

```python
nemo_automodel.components.models.nemotron_decision.records.write_jsonl(
    path: str | pathlib.Path,
    rows: typing.Iterable[dict[str, typing.Any]]
) -> None
```

Write rows as UTF-8 JSONL, creating parent directories.

```python
nemo_automodel.components.models.nemotron_decision.records.NOUL_ALIASES = {'true': 'true', 'yes': 'true', '1': 'true', 'false': 'false', 'no': 'false', '0...
```

```python
nemo_automodel.components.models.nemotron_decision.records.SIMPLE_QUESTION_ID = 'decision'
```