GeDi Multi-class Control
When to use
Use this skill when adapting GeDi to many labels or topic control without one forward pass per class. It is appropriate for AG-News-like labels and zero-shot topic words.
Inputs
- A label or topic string.
- Text or prompt.
- Positive control token, default
true. - Negative control token, default
false.
Outputs
- Positive/control sequence.
- Negative/anti-control sequence.
- Metadata including label, token count hint, and
control_passes=2.
Workflow
- Normalize the label without changing its semantic content.
- Build
true <label> <text>andfalse <label> <text>. - During training, use true pairs for matching class/text and false pairs for nonmatching class/text.
- During generation, use true as desired control and false as anti-control.
- Record whether the label is seen or zero-shot when that information is supplied.
Validation
Run:
python tests/test_multiclass.py
Limitations
This skill formats the control-code pairs; it does not tokenize with a model or evaluate topic relevance.