nemo_automodel.recipes.decision.train_clm_heads
nemo_automodel.recipes.decision.train_clm_heads
Post-train Contrastive Language Model (CLM) decision heads on SystemOne records.
CLM keeps its Qwen3-8B encoder frozen (the released heads, the clm-serve action cache and the vLLM pooling server
all depend on the exact encoder embedding space), so post-training touches only the two projection heads and the
logit scale. The recipe therefore runs in two phases:
-
Embed every unique state / option text once with
NeMoAutoModelBiEncoder(last-token pooling, L2 normalisation and causal attention, matching theclm-serveinput contract). Texts are sharded across all ranks and cached on disk, so re-running SFT / RL / eval never re-encodes. -
Train or evaluate the heads on rank 0 (they have ~20M parameters):
mode: evalscoresheads.init_checkpointon validation/test (the before numbers).mode: trainwithloss.mode: sftfits a custom typed-decision SFT objective: label-smoothed CE plus Brier and RPS terms. This does not implement the publisher’s soft preference-target fine-tuning objective.mode: trainwithloss.mode: rlmaximises the per-option reward tables (exact expected reward or GRPO) with a KL penalty to the heads the stage started from.
The trained heads are written in the contrastive-lm checkpoint format, so CLM_CKPT=<out>/heads.pt clm-serve
serves them unchanged.
Run with::
automodel examples/decision/clm_soc_triage.yaml —nproc-per-node 8 —mode train —loss.mode sft
Module Contents
Classes
Functions
Data
API
Bases: BaseRecipe
Embed-once, train-heads recipe for CLM decision models (see module docstring).
Embed texts with the frozen encoder, sharded over all ranks, and cache the result.
Score records while retaining actual question and option output order.
Parameters:
CLM state/action projection heads.
Records in input batch order.
Returns: list[list[QuestionLogits]]
Identified logits and targets grouped by record. Each logit values
Propagate cache filesystem failures before any rank enters the next phase.
Train heads in place; return a copy of the best heads by validation train.eval_metric.
Return (summary, per-question predictions) for records.
Evaluate (eval) or train (sft/rl) the heads, then report before/after metrics.
Initialise distributed state, load data, and make sure every text has a cached embedding.
CLI entry point: python -m nemo_automodel.recipes.decision.train_clm_heads --config <yaml>.