Advanced reasoning with Chain of Thought and Reflection
Fedor Zomba
Building Human-AI Collaboration at Scale | Enterprise GenAI Strategy | Microsoft Copilot Expert
?
Large Language Models (LLMs) often face challenges when it comes to reasoning tasks, especially those requiring preexisting knowledge about the real world and logical thinking. Consider this example:
If I pick up a transparent bottle, full of Diet COke, that has the label "sparklink water" on the lid, inspect the bottle carefully for a few minutes, and then drink from it, I would logically believe that I will be drinking (...).
Answer only with the missing text
If you try this out, it's very likely your ChatGPT/Claude/Copilot will fail. Despite their impressive capabilities, LLMs often struggle with simple reasoning tasks. These tasks often require more than just pattern recognition; they demand an understanding of logical sequences, causal relationships, and real-world knowledge and it might be a bit too much to ask from the language model trained on vast amounts of text.
?There is the way though: If we ramp up the prompt with Chain of Thought Reasoning - break down a problem into smaller more steps; and give the LLM space to reflect on its initial answer and reconsider its reasoning, we can often obtain more accurate and well-thought-out responses.
Let's try the same question but ask Copilot to use Chain of thought and Reflection within the prompt:
You are an AI assistant designed to provide detailed, step-by-step responses. Your outputs should follow this structure:
1. Begin with a <thinking> section.
2. Inside the thinking section:
? a. Briefly analyze the question and outline your approach.
? b. Present a clear plan of steps to solve the problem.
? c. Use a "Chain of Thought" reasoning process if necessary, breaking down your thought process into numbered steps.
3. Include a <reflection> section for each idea where you:
? a. Review your reasoning.
? b. Check for potential errors or oversights.
? c. Confirm or adjust your conclusion if necessary.
4. Be sure to close all reflection sections.
5. Close the thinking section with </thinking>.
6. Provide your final answer in an <output> section.
Always use these tags in your responses. Be thorough in your explanations, showing each step of your reasoning process. Aim to be precise and logical in your approach, and don't hesitate to break down complex problems into simpler components. Your tone should be analytical and slightly formal, focusing on clear communication of your thought process.
Remember: Both <thinking> and <reflection> MUST be tags and must be closed at their conclusion
Make sure all <tags> are on separate lines with no other text. Do not include other text on a line containing a tag.
Here is the question:
If I pick up a transparent bottle, full of Diet Coke, that has the label "sparklink water" on the lid, inpect the bottle carefully for a few minutes and then drink from it, What I would logically believe that I will be drinking?
?
?
The output is correct: now; when we gave a model a little space to think and reflect its capacity to produce logical answer improved!
?
LLMs are amazing, and what excites me the most about them is that they were not invented by humans, but rather discovered. We don't yet know their full capabilities but the more we test and the more we experiment, the more amazing discoveries we are getting.
Sources:
- Fantastic prompt shared by @rwl4z from Reddit community Excited to announce Reflection 70B, the world’s top open-source model : r/LocalLLaMA (reddit.com)
- Philip - AI Explained and his Coursera course that inspired me so much in my LLM journey. Example with Coke/sparkling water is coming from Module 5 on LLM reasoning. 8 Most Controversial Terms in AI, Explained - Deep Dive - Reasoning - Week 5 | Coursera.