AI engineering glossary · Transformers LLM architecture
What is contrastive decoding?
Contrastive decoding: A decoding method that favours tokens a strong model finds much more likely than a weaker model does, while filtering out implausible tokens. It aims to reduce generic, repetitive or hallucinated text by subtracting what a small model would say anyway.
Contrastive decoding: an example
A large model's log-probability minus a small model's log-probability is used to rank the next tokens.
Related terms
More Transformers LLM architecture terms
Where you learn it
Contrastive decoding is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.