Page contents
ToggleDecomposed Prompt, DECOMP
The DECOMP (Decomposed Prompting) modular approach is designed to address complex tasks by breaking them down into simpler, more manageable subtasks. This methodology leverages the capabilities of LLMs by creating a systematic process in which each subtask is managed by specialized managers. The approach not only simplifies the problem-solving process, but also improves the flexibility and efficiency of task management.
How DECOMP works
First, a decomposition prompt describes the process of solving a complex task through smaller subtasks. Each of these subtasks is then managed by specific subtask managers. These managers can:
- Use the decomposed prompt to further decompose the task,
- Use a simple prompt to solve the subtask, or
- Apply a function to handle the subtask.
This technique has three key advantages:
- Each subtask manager can receive richer and more targeted examples, leading to more accurate responses.
- Complex subtasks can be further simplified and solved.
- Subtask managers can be reused across multiple tasks.
Example
Let's take an example of prompt decomposition in action. Suppose we need to concatenate the first letter of each word in a string, using spaces as separators. This can be achieved by dividing the problem into three subtasks:
Split the string into a list of words.
Extract the first letter of each word.
Concatenate the extracted letters, using spaces as separators.
First, the decomposer specifies the sequence of questions and the corresponding subtasks:
QC: Concatenate the first letter of every word in "Jack Ryan" using spaces Q1: [split] What are the words in "Jack Ryan"? #1: ["Jack". "Ryan"] Q2: (foreach) [str_pos] What is the first letter of #1? #2: ["J", "R"] Q3: [merge] Concatenate #2 with spaces # 3: "JR" Q4: [EOQ]
The decomposer prompt determines the first subtask to be performed: word splitting in this case. The subtask is handled by the splitting subtask manager, and the generated answer is added to the decomposer prompt to obtain the second subtask. The process continues until the decomposer prompt produces [EOQ]. At this point, there are no more tasks remaining, and the last answer is returned as the solution.
Install DECOMP
The DECOMP process can be installed via the Dedicated GitHub.