Standard Chain-of-Thought (CoT) only demonstrates correct paths. However, models often get tripped up by common edge cases or anti-patterns (e.g. off-by-one errors in coding or sign errors in math).
Contrastive Chain of Thought (CCoT) guides the model by providing few-shot examples that contain both an incorrect reasoning path (highlighting the mistake) and a correct reasoning path.
Showing the model what not to do alongside what to do dramatically improves reasoning accuracy and prevents repetitive regressions.
You are a staff backend engineer. We need a function to transfer funds between accounts.
Here is a contrastive demonstration of reasoning:
INCORRECT REASONING EXAMPLE: Task: Transfer money securely. Bad Logic:
CORRECT REASONING EXAMPLE: Task: Transfer money securely. Good Logic:
Write a Python function to transfer $100 from account 12 to 34 using this contrastive logic.
Claude reacts strongly to contrastive examples. Highlight contrastive examples using XML tags like <incorrect_example> and <correct_example>.