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

# CLM-v0.1-8B

> Post-train the CLM-v0.1-8B projection heads with NeMo AutoModel: embed states and options once with a frozen Qwen3-8B encoder, then train the heads with SFT and RL.

[CLM-v0.1-8B](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B) is a Contrastive Language Model (CLM): two small
projection heads (a state head and an action head) on top of a frozen
[Qwen3-8B](/nemo/automodel/model-coverage/large-language-models/qwen/Qwen3-8B) encoder. The encoder embeds the state together with a
question, and it embeds each option separately. The score of an option is the scaled cosine similarity between the
projected state and option embeddings, and a softmax over the options of a question gives its answer distribution.
Because options are embedded separately, their embeddings can be cached and reused.

NeMo AutoModel keeps the encoder frozen, because the released heads and the action cache of the Contrastive-LM
`clm-serve` server depend on its exact embedding space. The recipe embeds every unique state and option text once,
sharded across all GPUs, and caches the embeddings on disk. It then trains or evaluates only the heads (about 20M
parameters) on rank 0.

## Post-Train CLM-v0.1-8B

Set up a source checkout of NeMo AutoModel as described in
[Run Decision Models with NeMo AutoModel](/nemo/automodel/model-coverage/decision-models/overview#run-decision-models-with-nemo-automodel).
Then, from the repository root, generate the fictional alert-triage records that the example configuration reads.
The generator rejects an existing output directory, so skip this step if you already generated `data/soc_triage` for
another decision model:

```bash
PYTHONPATH=tutorials/decision_models uv run --no-project python -m decision_tutorial.data \
    --output-dir data/soc_triage --seed 7
```

For the record format, see [Prepare Decision Records](/nemo/automodel/model-coverage/decision-models/overview#prepare-decision-records).

Evaluate the released heads to record the baseline, and then run supervised fine-tuning (SFT):

```bash
automodel examples/decision/clm_soc_triage.yaml --nproc-per-node 8 --mode eval --output_dir runs/clm/base
automodel examples/decision/clm_soc_triage.yaml --nproc-per-node 8 --mode train --loss.mode sft --output_dir runs/clm/sft
```

To continue with reinforcement learning (RL) on the per-option rewards, start from the SFT heads:

```bash
automodel examples/decision/clm_soc_triage.yaml --nproc-per-node 8 --mode train --loss.mode rl \
    --heads.init_checkpoint runs/clm/sft/heads.pt --optimizer.lr 1.0e-4 --train.epochs 10 \
    --train.eval_metric reward --output_dir runs/clm/rl
```

Each run writes `metrics_validation.json` and `metrics_test.json` to its output directory. Training runs also save the
heads with the best validation score for `train.eval_metric` as `heads.pt`. The RL command sets
`--train.eval_metric reward`, so the RL stage keeps the heads with the best validation reward. If no epoch improves on
the starting heads, `heads.pt` contains the starting heads. The file uses the checkpoint format of the
`contrastive-lm` package, so the Contrastive-LM `clm-serve` server can load it through the `CLM_CKPT` environment
variable, for example `CLM_CKPT=runs/clm/rl/heads.pt clm-serve`.

> **Note**
>
> The SFT stage trains on the gold answers with the NeMo AutoModel decision objective: label-smoothed cross-entropy, a
> Brier term, and a ranked-probability term for ordinal questions. It does not implement the Contrastive-LM fine-tuning
> objective, which by default trains against annotator distributions (soft targets).

## Choose a Workflow

| Goal                                                                          | Start Here                                                                                                                                            |
| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| Evaluate and fine-tune the released heads, and then continue training with RL | Use the [recipe configuration](https://github.com/NVIDIA-NeMo/Automodel/blob/main/examples/decision/clm_soc_triage.yaml).                             |
| Run the baseline, SFT, and optional RL stages in a notebook                   | Follow the [CLM tutorial notebook](https://github.com/NVIDIA-NeMo/Automodel/blob/main/tutorials/decision_models/01_clm_supervised_and_utility.ipynb). |
| Train the heads with a contrastive objective on cached features               | Follow the [contrastive-heads notebook](https://github.com/NVIDIA-NeMo/Automodel/blob/main/tutorials/decision_models/03_clm_contrastive_heads.ipynb). |

### Configuration

| Setting              | Configuration                                                                                                                                                                                                                    |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Strategy             | Data-parallel embedding on every rank, then head training on rank 0                                                                                                                                                              |
| Processes            | 8 per node in the example commands (`--nproc-per-node 8`)                                                                                                                                                                        |
| Trainable parameters | State head, action head, and logit scale (about 20M parameters)                                                                                                                                                                  |
| Frozen weights       | The Qwen3-8B encoder                                                                                                                                                                                                             |
| Encoding             | Last-token pooling, L2 normalization, and a 2,048-token window that keeps the last tokens of longer inputs                                                                                                                       |
| Feature cache        | `encode.cache_dir`, on a file system that every rank can access, including ranks on other nodes                                                                                                                                  |
| SFT objective        | Label-smoothed cross-entropy, a Brier term, and a ranked-probability term for ordinal questions                                                                                                                                  |
| RL objective         | Exact expected reward (default) or group relative policy optimization (GRPO), selected with `loss.rl_objective`, with a Kullback-Leibler (KL) penalty to the starting heads and a gold-answer anchor term (`loss.anchor_weight`) |

The cache key covers the encoder and tokenizer names and revisions, the input texts, the truncation, pooling,
normalization, attention, and precision settings, and the installed Transformers version. Changing any of them creates
a new cache instead of reusing stale embeddings. Set the encoder and tokenizer revisions to full 40-character commit
IDs. The recipe rejects other values, such as the branch name `main`.

## Model Reference

### Model Architecture

| Property         | Value                                                                                                                |
| ---------------- | -------------------------------------------------------------------------------------------------------------------- |
| Task             | Typed decision scoring: one probability for every allowed option of every question, from state and option similarity |
| **Architecture** | Frozen Qwen3-8B encoder with two CLM projection heads                                                                |
| Projection heads | About 20M parameters                                                                                                 |

### Available Models

* [`Contrastive-LM/CLM-v0.1-8B`](https://huggingface.co/Contrastive-LM/CLM-v0.1-8B): the released projection heads (`CLM_v0.1-8B.pt`). The recipe loads them at revision `e939398d4556fcd9400c76fa8c5a513202f42b0a`, and the example configuration pins the Qwen3-8B encoder to revision `b968826d9c46dd6066d109eabc6255188de91218`.

## Related Resources

* [Decision Models overview](/nemo/automodel/model-coverage/decision-models/overview)
* [Decision post-training examples](https://github.com/NVIDIA-NeMo/Automodel/blob/main/examples/decision/README.md)
* [Decision-model tutorials](https://github.com/NVIDIA-NeMo/Automodel/blob/main/tutorials/decision_models/README.md)
* [CLM source code and checkpoint format](https://github.com/Contrastive-LM/CLM)