Last updated on September 27, 2024
Welcome to the decomposition section of the advanced Prompt Engineering Guide.
In this section, you'll explore advanced prompting techniques that break down complex problems into simpler, manageable sub-tasks. This decomposition approach, inspired by human problem-solving strategies, enhances the performance of GenAI models. While these techniques build on the principles of Chain-of-Thought (CoT) Prompting, they go a step further by explicitly decomposing tasks, significantly improving the problem-solving abilities of Large Language Models (LLMs).
Here's the list of techniques we'll explore:
Decomposed (DecomP) Prompting: Breaks complex tasks into sub-tasks that LLMs or handlers can solve, improving accuracy and efficiency.
Plan-and-Solve (PS) Prompting: Introduces a planning phase before problem-solving, reducing errors in reasoning steps.
Program of Thoughts Prompting: Separates reasoning from computation, enabling models to express solutions as executable code for better accuracy.
Faithful Chain-of-Thought Reasoning: Ensures the reasoning chain directly leads to the final answer, increasing trust and clarity.
Skeleton-of-Thought Prompting: Creates a basic outline first, expanding responses in parallel for faster, more accurate answers.
Tree of Thoughts (ToT) Prompting: Allows exploration of multiple reasoning paths, enabling backtracking and more flexible problem-solving.
Recursion of Thought Prompting: Splits complex tasks into smaller sub-tasks to address context length limits in LLMs.
Chain-of-Thought (CoT) Prompting was one of the first techniques to apply reasoning steps to LLMs. It guided the LLM to unfold its reasoning leading to more accurate and interpretable results.
Zero-Shot Chain-of-Thought (CoT) Prompting expanded on this idea by introducing the simple phrase, "Let's think step-by-step," which led to significant performance improvements in multi-step reasoning tasks such as symbolic reasoning, math problems, and logic puzzles.
However, this method has a few common issues:
The decomposition techniques discussed in this section address these issues from different angles. Letβs briefly explore each of them.
Decomposed Prompting (DECOMP) breaks down complex tasks into simpler sub-tasks and assigns them to LLMs or handlers better suited to solve them. These handlers can:
On the Decomposition page, you'll learn more about how Decomposed Prompting works and specific examples
Plan-and-Solve (PS) prompting enhances reasoning by addressing missing step errors in Zero-Shot CoT prompting. This method introduces an intermediate planning phase, where the model devises a plan before solving the problem step-by-step. This addition of a planning phase improves the model's ability to avoid skipping critical reasoning steps.
On the Plan-and-Solve page, you'll learn how to use Plan-and-Solve Prompting, what is Plan-and-Solve Plus Prompting and how it reduces calculation errors.
In contrast to CoT prompting, Program-of-Thoughts (PoT) Prompting separates reasoning from computation. Instead of solving math or logic problems directly, PoT allows the model to express its reasoning as a program (e.g., Python), which is then executed by an interpreter for a more accurate solution.
LLMs are prone to computational errors, struggle with complex math, and are inefficient with iterative processes, which makes PoT a valuable approach for such tasks.
On the Program-of-Thoughts page, you'll learn more about how PoT works.
Faithful Chain-of-Thought (CoT) addresses the issue that LLM doesnβt always reflect the true process behind the final answer when they are prompted with Chain-of-Thought (CoT). Faithful CoT ensures that the final answer is derived directly from the reasoning chain, increasing trust and interpretability.
On the Faithful Chain-of-Thought page, you'll learn how Faithful Chain-of-Thought (CoT) works and how to use it with specific examples.
Skeleton-of-Thought (SoT) prompting improves response efficiency by generating a basic outline or "skeleton" of the answer first, and then expanding it in parallel. This two-stage approach reduces latency and improves the quality of the final answer.
On the Skeleton-of-Thought page, you'll learn what is a skeleton in SoT, what are the two stages of SoT and how it delivers speed improvement.
Tree of Thoughts (ToT) prompting allows LLM to explore multiple reasoning paths in a structured, tree-like manner. This method mimics human problem-solving by allowing models to propose various solutions and then evaluate which path is likely to yield the best result. The tree structure allows for backtracking when a path seems unproductive, making the model more flexible and capable of correcting its course.
On the Tree of Thoughts, you'll learn how to leverage the Tree of Thoughts (ToT) technique and how it excels in creative problem-solving tasks like math reasoning, writing, and puzzles.
Recursion of Thought (RoT) prompting addresses context length limitations by breaking down complex tasks into smaller sub-problems, each processed within separate contexts. This divide-and-conquer method allows LLMs to handle tasks that exceed their context window limits.
On the Recursion of Thought page, you'll learn how to apply RoT and how it is particularly effective for large-scale tasks like multi-digit arithmetic and complex sequences.
As youβve seen, these advanced prompting techniques offer various ways to enhance the problem-solving capabilities of LLMs, each addressing specific challenges like reasoning, accuracy, and interpretability. By understanding and applying these decomposition methods, you can unlock the potential of language models in complex scenarios.
Feel free to explore the links provided for a deeper dive into each technique, and start experimenting with them in your own projects. Happy prompting!
Patel, P., Mishra, S., Parmar, M., & Baral, C. (2022). Is a Question Decomposition Unit All We Need? https://arxiv.org/abs/2205.12538 β©
Jason Wei. (2022). Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. β©
Wei, J., Wang, X., Schuurmans, D., Bosma, M., Ichter, B., Xia, F., Chi, E., Le, Q., & Zhou, D. (2022). Chain of Thought Prompting Elicits Reasoning in Large Language Models. β©
Kojima, T., Gu, S. S., Reid, M., Matsuo, Y., & Iwasawa, Y. (2022). Large Language Models are Zero-Shot Reasoners. β©
Tushar Khot. (2023). Decomposed Prompting: A Modular Approach for Solving Complex Tasks. β©
Lei Wang. (2023). Plan-and-Solve Prompting: Improving Zero-Shot Chain-of-Thought Reasoning by Large Language Models. β©
Wenhu Chen. (2022). Program of Thoughts Prompting: Disentangling Computation from Reasoning for Numerical Reasoning Tasks. β©
Qing Lyu. (2023). Faithful Chain-of-Thought Reasoning. β©
Xuefei Ning. (2023). Skeleton-of-Thought: Prompting LLMs for Efficient Parallel Generation. β©
Shunyu Yao. (2023). Tree of Thoughts: Deliberate Problem Solving with Large Language Models. β©
Soochan Lee, G. K. (2023). Recursion of Thought: A Divide-and-Conquer Approach to Multi-Context Reasoning with Language Models. β©