> 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.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/automodel/_mcp/server.

# nemo_automodel.components.models.clm.prompting

CLM prompt layout: how a SystemOne record becomes state texts and candidate texts.

This mirrors `clm.schema` from the `contrastive-lm` package (Apache-2.0) exactly, because the released CLM heads
were trained on this layout: the state head sees `context + question`, the action head sees each option's own text.

## Module Contents

### Functions

| Name                                                                                     | Description                                                                                          |
| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| [`clm_candidates`](#nemo_automodel-components-models-clm-prompting-clm_candidates)       | `(option ids in CLM order, candidate text per option)` for one question.                             |
| [`clm_pairs`](#nemo_automodel-components-models-clm-prompting-clm_pairs)                 | `&#123;question_id: (state_text, option_ids, candidate_texts)&#125;` for every question of a record. |
| [`clm_state_text`](#nemo_automodel-components-models-clm-prompting-clm_state_text)       | Context first, question last: the layout CLM's state head was trained on.                            |
| [`prepare_tokenizer`](#nemo_automodel-components-models-clm-prompting-prepare_tokenizer) | Load the tokenizer with the publisher's CLM serving input contract.                                  |
| [`to_text`](#nemo_automodel-components-models-clm-prompting-to_text)                     | Render a JSON value as prose: objects become `key: value` lines, arrays become `- item` lines.       |

### Data

[`CLM_NOUL_KEYS`](#nemo_automodel-components-models-clm-prompting-CLM_NOUL_KEYS)

### API

```python
nemo_automodel.components.models.clm.prompting.clm_candidates(
    question: dict[str, typing.Any]
) -> tuple[list[str], list[str]]
```

`(option ids in CLM order, candidate text per option)` for one question.

```python
nemo_automodel.components.models.clm.prompting.clm_pairs(
    record: dict[str, typing.Any]
) -> dict[str, tuple[str, list[str], list[str]]]
```

`&#123;question_id: (state_text, option_ids, candidate_texts)&#125;` for every question of a record.

```python
nemo_automodel.components.models.clm.prompting.clm_state_text(
    state: typing.Any,
    instructions: typing.Any
) -> str
```

Context first, question last: the layout CLM's state head was trained on.

```python
nemo_automodel.components.models.clm.prompting.prepare_tokenizer(
    name_or_path: str,
    revision: str | None
) -> transformers.PreTrainedTokenizerBase
```

Load the tokenizer with the publisher's CLM serving input contract.

**Parameters:**

**`name_or_path`** `str`

Tokenizer repository ID or local directory.

---

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

Tokenizer revision recorded in the frozen-feature cache identity.

---

**Returns:** `PreTrainedTokenizerBase`

Tokenizer using right padding and left truncation, retaining the final

```python
nemo_automodel.components.models.clm.prompting.to_text(
    x: typing.Any,
    indent: int = 0
) -> str
```

Render a JSON value as prose: objects become `key: value` lines, arrays become `- item` lines.

```python
nemo_automodel.components.models.clm.prompting.CLM_NOUL_KEYS = ('false', 'true')
```