Skip to navigation

Clef is Cloudflare’s 27B multimodal decision model, post-trained from Qwen3.8-27B. Its backbone, which uses the Qwen3.5 architecture, reads a record’s state and all of its questions in one forward pass. A small transformer, the joint schema head, then routes evidence from the state to each question and returns one logit per allowed option. NeMo AutoModel post-trains Clef with FSDP2 data parallelism. It can train the joint schema head on a frozen backbone, or train low-rank adaptation (LoRA) adapters on the language model together with the head. The recipe trains on text records. It does not support records with images or videos.

Post-Train Clef

Set up a source checkout of NeMo AutoModel as described in Run Decision Models with NeMo AutoModel. Then, from the repository root, generate the fictional alert-triage records that the example configurations read. The generator rejects an existing output directory, so skip this step if you already generated data/soc_triage for another decision model:

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.

The following commands use the LoRA configuration. To train only the joint schema head on a frozen backbone, replace clef_soc_triage_lora.yaml with clef_soc_triage_heads.yaml, and write to separate directories, such as runs/clef_heads/base, runs/clef_heads/sft, and runs/clef_heads/rl.

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

automodel examples/decision/clef_soc_triage_lora.yaml --nproc-per-node 8 --mode eval --output_dir runs/clef/base
automodel examples/decision/clef_soc_triage_lora.yaml --nproc-per-node 8 --mode train --loss.mode sft --output_dir runs/clef/sft

To continue with reinforcement learning (RL) on the per-option rewards, initialize the RL stage from the SFT checkpoint with the best validation score:

automodel examples/decision/clef_soc_triage_lora.yaml --nproc-per-node 8 --mode train --loss.mode rl \
--init_from runs/clef/sft/LOWEST_VAL --train.epochs 1 --optimizer.lr 2.0e-5 --head_optimizer.lr 1.0e-5 \
--train.eval_metric reward --output_dir runs/clef/rl

Each run writes metrics_validation.json and metrics_test.json to its output directory. The init_from setting loads only the weights of the selected checkpoint. The optimizer and the learning-rate schedule start fresh. Each training run needs a new output directory. To repeat a run, remove its directory or pass a different --output_dir.

Choose a Workflow

GoalStart Here
Train only the joint schema head on a frozen backboneUse the frozen-backbone configuration.
Train LoRA adapters on the language model together with the joint schema headUse the LoRA configuration.
Export a trained checkpoint in the layout of the Cloudflare release, merging any LoRA adaptersRun export_clef_release.py.
Run either workflow in a notebookFollow the Clef tutorial notebook, and set HEAD_ONLY to choose the workflow.

Configuration

SettingConfiguration
StrategyFSDP2 data parallelism only (tp_size, cp_size, and pp_size must be 1)
Processes8 per node in the example commands (--nproc-per-node 8). Other process counts work if train.global_batch_size is divisible by train.local_batch_size times the process count.
Trainable parametersJoint schema head (frozen-backbone configuration), or LoRA adapters (dim: 32, alpha: 64) and the joint schema head
Frozen weightsAll original backbone weights in both configurations. The LoRA configuration adds no adapters to the vision encoder or the LM head.
FeaturesActivation checkpointing (LoRA configuration), FP32 joint schema head replicated on every rank, validation-selected checkpoints
SFT objectiveLabel-smoothed cross-entropy, a Brier term, and a ranked-probability term for ordinal questions
RL objectiveExact expected reward (default) or group relative policy optimization (GRPO), selected with loss.rl_objective, with a Kullback-Leibler (KL) penalty to the starting checkpoint and a gold-answer anchor term (loss.anchor_weight)

Training requires checkpoint.enabled: true. Each training run saves a checkpoint directory (step_00000000, step_00000025, and so on) before the first step, after every train.val_every_steps steps, and at the end. Every checkpoint stores the joint schema head under head/. In the LoRA configuration, it also stores the LoRA adapters under model/. The LATEST pointer selects the most recent checkpoint, and LOWEST_VAL selects the checkpoint with the best validation score for train.eval_metric.

Model Reference

Model Architecture

PropertyValue
TaskTyped decision scoring: one probability for every allowed option of every question
ArchitectureQwen3_5ForConditionalGeneration backbone with a joint schema head
Backbone27B, post-trained from Qwen3.8-27B, with its vision encoder
Joint schema headAbout 128M parameters, trained in FP32

Available Models

  • Cloudflare/clef: the example configurations pin revision ed3eed331870db2eff4b0db01237128ede8a00ce.