nemo_automodel.components.models.nemotron_decision.serving_prompt
nemo_automodel.components.models.nemotron_decision.serving_prompt
The decision prompt of a Nemotron 3.5 Decision checkpoint: one question per read, one trailing mask token.
The checkpoint owns its prompt contract, and training reads each question exactly as the checkpoint does:
decision.jsongives the option codes per question type and the read limits;decision_template.jinjarenders the prompt arounddecision_content, the JSON{"state", "question", "options": [{"code", "label", "meaning"}]};- options keep the question’s order (
choice: criteria order;noul:false,true;score: level 0 upwards) and take the type’s codes by position; - control tokens inside the user content are encoded as plain text, so only the template’s own control tokens are special;
- the template ends with the mask token, and the answer is the head’s distribution at that mask restricted to the option codes.
An optional, explicit option shuffle (training only) permutes the options and re-codes them by position, so the model
learns option meanings rather than codes. The permutation seed is crc32(f"{seed}|perm"), independent of the coin
that decides whether a row is shuffled.
Module Contents
Classes
Functions
Data
API
A checkpoint’s decision prompt contract (decision.json and decision_template.jinja).
Option codes per question type, in position order.
Longest read the checkpoint accepts, mask included.
Identity of the contract (template, codes and limit).
The Jinja decision template; it renders decision_content and ends with the mask token.
Load and validate the contract of a local checkpoint directory or Hugging Face repository.
Raises:
ValueError: If a file is missing or the contract is malformed.
One tokenized decision prompt (without the trailing mask) and its option readout.
Special tokens plus the declared (or, if none are declared, template-literal) added tokens.
Encode a rendered chat: marked control tokens as plain text, everything else normally.
Encode text through the backend’s normalizer, pre-tokenizer and model, matching no added token.
Token ids of option codes, which must be distinct single known tokens.
Raises:
ValueError: If a code is not exactly one known token or two codes share a token.
Option-permutation seed, independent of the shuffle coin drawn from random.Random(shuffle_seed).
Render one question with the checkpoint’s decision template, optionally with shuffled, re-coded options.
Parameters:
Tokenizer of the checkpoint.
The checkpoint’s decision contract.
JSON-serializable evidence shared by the question.
Key of the question (used in errors).
{"type", "instructions", "criteria"} of a choice, noul or score question.
The checkpoint’s mask token, which the template must write exactly once, at the end.
When set, permute the options with perm_seed(shuffle_seed) and re-code them by position;
None keeps the checkpoint’s option order.
Returns: PreparedQuestion
The prepared prompt; token ids exclude the trailing mask.
Raises:
ValueError: If the question is malformed, has more options than codes, or the template does not end in exactly one mask token.
(labels, meanings) of a question in checkpoint order (noul: false, true; score: level indices).
Raises:
ValueError: If the question has unsupported fields, an unknown type or criteria that do not fit the type.
Every token id a question can read at its mask (all option codes of every type), sorted.
Token ids of template rendered around content, with control tokens in content encoded as text.