Analogical Prompting: Definition and Examples
Prompt engineering technique that consists of asking the model to generate or rely on analogical examples before solving a problem, drawing inspiration from human reasoning by analogy.
Full definition
Analogical Prompting is an advanced prompt engineering technique introduced by researchers at Google DeepMind in 2023. It relies on a fundamental cognitive principle: humans often solve new problems by drawing on similar situations they have already encountered. This method asks the language model to generate analogous problems and their solutions before tackling the target problem.
Unlike classic few-shot prompting, where the user manually provides examples, Analogical Prompting lets the model produce its own relevant examples. The model identifies structurally similar problems, solves them step by step, then transfers the reasoning to the given problem. This self-generation of analogies exploits the model's internal knowledge in a more targeted and contextual way.
The process generally unfolds in three phases: first, the model recalls or constructs analogous problems; second, it details the resolution of these analogies; finally, it applies the identified reasoning patterns to the original problem. This approach proves particularly effective for tasks involving mathematical reasoning, programming, and complex problem-solving.
Analogical Prompting represents a significant evolution because it combines the advantages of zero-shot (no need to provide examples) with those of few-shot (benefiting from concrete examples to guide reasoning). Studies show it often outperforms standard Chain-of-Thought prompting on reasoning benchmarks like GSM8K and MATH.
Etymology
The term combines "analogical", from the Greek analogia meaning "proportion" or "correspondence", and "prompting". It directly refers to reasoning by analogy studied in cognitive science, where one solves a problem by comparing it to a known problem of similar structure.
Concrete examples
Solving a complex math problem
Before solving the following problem, recall similar problems you know. Generate 2-3 analogous problems with their detailed solutions, then use these reasonings to solve: "A train leaves Paris at 9 am at 120 km/h. Another leaves Lyon at 10 am at 150 km/h in opposite direction. The distance Paris-Lyon is 450 km. At what time do they meet?"
Debugging code by relying on similar bugs
Before analyzing this bug, think of analogous debugging situations you have encountered. Describe 2 similar bugs in structure and how they were resolved, then apply this reasoning to my problem: [CODE_WITH_BUG]
Software architecture design
I need to design a distributed queue system. Before proposing an architecture, generate 2-3 examples of analogous systems (distributed systems with similar constraints), explain their architectural choices, then propose a solution for my case building on these analogies.
Practical usage
To apply Analogical Prompting, add an instruction in your prompt asking the model to generate similar problems before answering. For example: "Before answering, recall 2-3 analogous situations and their solutions, then apply this reasoning to my problem." This technique is particularly useful for complex reasoning problems where classic zero-shot lacks precision.
Related concepts
FAQ
What is the difference between Analogical Prompting and few-shot prompting?
Does Analogical Prompting work with all language models?
When to use Analogical Prompting instead of Chain-of-Thought?
See also
How to use this prompt
- Copy the prompt with the button above.
- Paste it into ChatGPT, Claude or your favorite AI assistant.
- Replace the bracketed variables with your details, then refine the result.
About Prompt Guide
Prompt Guide is a free library of 2500+ ready-to-use prompts for ChatGPT, Claude and other AIs, with guides to learn prompting and tools to build and optimize your own prompts.
More definitions
Anthropic: Definition and Examples
Anthropic is an American artificial intelligence research company, founded in 2021, specializing in the development of safe and responsible AI systems, notably the Claude model family.
Artificial General Intelligence: Definition and Examples
Artificial General Intelligence (AGI) refers to a hypothetical artificial intelligence capable of performing any intellectual task that a human being can.
Attention: Definition and Examples
The attention mechanism allows AI to dynamically weight each word in a sequence. Definition, operation, and examples for ChatGPT and Claude.
Attention Mechanism: Definition and Examples
Discover the attention mechanism, a key component of modern LLMs (GPT, Claude, Gemini). Self-attention, multi-head, cross-attention explained simply.
Audio LLM: Definition and Examples
An Audio LLM is a large language model capable of processing, understanding, and generating audio content (speech, music, sounds) in addition to text, enabling
AutoGen: Definition and Examples
AutoGen is an open-source framework developed by Microsoft Research for creating conversational multi-agent systems where multiple AI agents coll
Get new prompts every week
Join our newsletter.