> This page is for version 0.7.0 · 26.10.
> 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.common.decision_reader

Model-owned reads for decision post-training.

The decision recipe reads every question of a SystemOne record on its own. A `DecisionReader` owns the two
model-specific steps of a read: encoding one question as model input, and returning that question's option logits.
`DecisionReaderConfig` is the YAML `reader:` block; the recipe calls `prepare` before it loads the model and
`build` after.

## Module Contents

### Classes

| Name                                                                                                    | Description                                                                 |
| ------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| [`DecisionRead`](#nemo_automodel-components-models-common-decision_reader-DecisionRead)                 | One question encoded for a model.                                           |
| [`DecisionReader`](#nemo_automodel-components-models-common-decision_reader-DecisionReader)             | Encodes questions for one model and scores them (see the module docstring). |
| [`DecisionReaderConfig`](#nemo_automodel-components-models-common-decision_reader-DecisionReaderConfig) | YAML `reader:` block of the decision recipe.                                |

### Data

[`ReadT`](#nemo_automodel-components-models-common-decision_reader-ReadT)

### API

```python
class nemo_automodel.components.models.common.decision_reader.DecisionRead(
    question_id: str,
    labels: tuple[str, ...]
)
```

Dataclass

One question encoded for a model.

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

Option IDs in the order of the model's logits.

---

**`question_id`** `str`

Key of the question in its record.

---

```python
class nemo_automodel.components.models.common.decision_reader.DecisionReader()
```

Abstract

**Bases:** `Generic[ReadT]`

Encodes questions for one model and scores them (see the module docstring).

**`max_input_tokens`** `int`

Longest read the checkpoint accepts.

---

```python
nemo_automodel.components.models.common.decision_reader.DecisionReader.encode(
    record: dict[str, typing.Any],
    question_id: str,
    shuffle_seed: int | None = None
) -> nemo_automodel.components.models.common.decision_reader.ReadT | None
```

abstract

Encode one question of a validated SystemOne record.

**Parameters:**

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

Validated SystemOne record that holds the question.

---

**`question_id`** `str`

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

---

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

Option-shuffle seed, or `None` for the model's own option order.

---

**Returns:** `ReadT | None`

The read, or `None` when this model cannot read the question; the recipe counts those as skipped.

```python
nemo_automodel.components.models.common.decision_reader.DecisionReader.identity() -> dict[str, typing.Any]
```

abstract

Model-specific stage fields; the recipe refuses to load a stage whose identity differs.

```python
nemo_automodel.components.models.common.decision_reader.DecisionReader.logits(
    read: nemo_automodel.components.models.common.decision_reader.ReadT
) -> torch.Tensor
```

abstract

Score one read.

**Parameters:**

**`read`** `ReadT`

A read returned by `encode`.

---

**Returns:** `torch.Tensor`

fp32 tensor of shape `[options]` in `read.labels` order.

```python
class nemo_automodel.components.models.common.decision_reader.DecisionReaderConfig()
```

Dataclass

Abstract

**Bases:** `Generic[ReadT]`

YAML `reader:` block of the decision recipe.

```python
nemo_automodel.components.models.common.decision_reader.DecisionReaderConfig._build(
    model: torch.nn.Module,
    tokenizer: transformers.PreTrainedTokenizerBase,
    model_path: str,
    revision: str | None,
    max_tokens: int,
    peft: bool,
    device: torch.device
) -> nemo_automodel.components.models.common.decision_reader.DecisionReader[nemo_automodel.components.models.common.decision_reader.ReadT]
```

abstract

Model-specific part of `build` (same arguments).

```python
nemo_automodel.components.models.common.decision_reader.DecisionReaderConfig.build(
    model: torch.nn.Module,
    tokenizer: transformers.PreTrainedTokenizerBase,
    model_path: str,
    revision: str | None,
    max_tokens: int,
    peft: bool,
    device: torch.device
) -> nemo_automodel.components.models.common.decision_reader.DecisionReader[nemo_automodel.components.models.common.decision_reader.ReadT]
```

Check the checkpoint contract, set the trainable parameters, and return the reader.

**Parameters:**

**`model`** `nn.Module`

The model as the recipe runs it (DDP or FSDP2); reads run their forward through it.

---

**`tokenizer`** `PreTrainedTokenizerBase`

Tokenizer of the checkpoint.

---

**`model_path`** `str`

Checkpoint directory or Hub ID.

---

**`revision`** `str | None`

Checkpoint revision, or `None`.

---

**`max_tokens`** `int`

Longest read to accept (`data.max_tokens`).

---

**`peft`** `bool`

Whether a PEFT adapter is configured.

---

**`device`** `torch.device`

Device of the reads.

---

**Returns:** `DecisionReader[ReadT]`

The reader.

**Raises:**

* `ValueError`: If `max_tokens` exceeds the checkpoint's read limit, or the checkpoint or configuration is
  outside the reader's contract.

```python
nemo_automodel.components.models.common.decision_reader.DecisionReaderConfig.prepare(
    model_path: str,
    revision: str | None
) -> None
```

abstract

Run the checks and setup that must happen before the model is loaded.

**Parameters:**

**`model_path`** `str`

Checkpoint directory or Hub ID.

---

**`revision`** `str | None`

Checkpoint revision, or `None`.

---

```python
nemo_automodel.components.models.common.decision_reader.ReadT = TypeVar('ReadT', bound=DecisionRead)
```