CAD Logit Adjustment
Use this skill for the paper's core next-token transformation: adjusted = (1 + alpha) * logits(context, query, prefix) - alpha * logits(query, prefix). It does not construct prompts or score final answers.
Inputs
- Context-conditioned logits as a token-to-score mapping.
- Query-only/prior logits as a token-to-score mapping.
alpha, usually0.5for summarization or1.0for knowledge-conflict tasks.
Outputs
Adjusted logits over the shared vocabulary plus diagnostics: alpha, regular argmax, prior argmax, adjusted argmax, and whether CAD changed the selected token.
Workflow
- Verify identical vocabularies.
- Compute the CAD formula for each token.
- Preserve logits without softmax unless probabilities are requested downstream.
- Report argmax diagnostics for mechanism checks.
Validation
Run tests/test_logit_adjustment.py or Distiller validation.
Limitations
This script works on one decoding step; generation loops should call it repeatedly with updated prefixes.