Sequence Generation
Sequence generation produces an ordered output such as text, code, protein sequence, SMILES, action sequence, or symbolic plan.
Autoregressive generation factorizes the output distribution as:
At inference time, the model chooses tokens using a decoding rule:
Decoding Choices
- Greedy decoding chooses the most likely token at each step.
- Beam search keeps several high-scoring partial sequences.
- Sampling uses temperature, top-, or nucleus filtering.
- Constrained decoding restricts outputs to valid syntax or domain objects.
Validity Function
Many sequence tasks have constraints:
where means the generated sequence is valid. Examples include parseable code, valid JSON, valid SMILES, plausible protein sequence constraints, executable plans, or answers supported by evidence.
Constrained decoding changes the effective output space:
Training vs Inference
Teacher-forced likelihood trains on gold prefixes:
At inference, the model conditions on its own previous outputs:
This train-inference mismatch can cause error accumulation, invalid syntax, repetition, or drift away from the conditioning input.
Evaluation Boundary
Sequence generation metrics should match the use case:
- likelihood or perplexity for distribution modeling;
- exact match or edit distance for canonical outputs;
- validity, uniqueness, diversity, and novelty for generated objects;
- execution success for code or action sequences;
- grounding and citation support for answers;
- downstream property or utility for protein, molecule, or design sequences.
Checks
- Is the output space open-ended or constrained?
- What makes a generated sequence valid?
- Does decoding optimize likelihood, diversity, exactness, or utility?
- Are invalid molecules, invalid actions, or unsupported claims filtered?
- Is evaluation based on sequence match, functional property, human preference, or downstream execution?
- Is decoding part of the reported method or only an implementation detail?
- Are invalid generations counted in the denominator?
- Does the decoder use constraints that are also available at deployment time?
- Is diversity measured separately from quality and utility?