Imported from yzj623/pplab (
basicagent-skill/skill_library/paperbench/stay-on-topic-with-classifier-free-guidance/skill/fudge_future_discriminators/fudge_logit_rescoring/SKILL.md). Install upstream withnpx skills add yzj623/pplab --skill fudge_logit_rescoring. Copyright stays with the author.
FUDGE Logit Rescoring
Use this skill when a base autoregressive generator supplies candidate next-token logits and a future discriminator can score each candidate-extended prefix. The skill implements logit' = base_logit + strength * log P(attribute | prefix+candidate).
Inputs
prefix_tokens.- Mapping of candidate token to base logit.
- Mapping/callable of candidate token to future probability.
- Optional
strength,top_k, and clipping epsilon.
Outputs
- Normalized probabilities over retained candidates.
- Audit trace with base logit, future probability, future log score, adjusted logit, and final probability.
Workflow
- Restrict to top-k base candidates if requested.
- Score each extended prefix with the future discriminator.
- Clip probabilities for numerical safety.
- Add future log scores to base logits.
- Softmax over retained candidates.
- Inspect the audit trace before claiming FUDGE was used.
Validation
Run python tests/test_rescoring.py.
Limitations
This helper does not load a language model. It is a deterministic FUDGE rescoring kernel.