Break It Down
Have you ever asked an AI to tackle a complex task only to receive a mediocre response? Me too. While LLMs like ChatGPT can do a lot, they stumble over complex tasks. The solution, prompt chaining, is similar to how we, as humans, handle complex tasks. As a technique, prompt chaining is key to developing AI applications, and for individual use of tools like ChatGPT, it can add depth and quality to your outputs.
What is Prompt Chaining?
Prompt chaining, at its core, is about breaking down complex tasks into a series of smaller, more manageable prompts. By guiding the AI through a sequence of focused prompts, we can dramatically improve the quality and relevance of its outputs.
Applying Prompt Chaining in Day-to-day Prompts
This technique isn't just for AI enthusiasts or developers; it's a powerful tool for anyone using AI in their daily life or work. Whether you're using ChatGPT for creative writing, data analysis, or problem-solving, prompt chaining can help you achieve more accurate and nuanced results.
1. Summarizing a Long Document
Instead of asking: "Summarize this 50-page research paper on climate change."
Try this approach:
- For a person with the role of ____, what are 5 key questions they would have for this research paper on climate change?
- Within each section, what is most relevant to this person?
- What are the 3-5 most significant points discussed in each section?
- Identify any conflicting points of view or incomplete thoughts in this paper.
- Provide a summary that answers the questions relevant to ____, including the most significant points from each section, noting conflicting and incomplete information. The summary should be succinct but maintain important details.
2. Analyzing a Dataset
Instead of asking: "Analyze this sales dataset and give me insights."
Try this approach:
- Summarize the variables in this sales dataset.
- Are there possible data issues or problems with this data?
- My revenue goals are X, Y, and Z. What are the top 3 trends you notice in the data relevant to me?
- How do the variables relate to one another?
- Based on the data issues, trends, and relationships observed in the data, suggest 3-5 possible exemptions.
- Suggest 2-3 actionable recommendations based on these insights.
3. Planning a Trip
Instead of asking: "Plan a 7-day trip to Japan for me."
Try this approach:
- List the top 5 must-visit destinations in Japan for a 7-day trip.
- For the first destination, suggest 3 key attractions and 2 local restaurants.
- Now, create a rough 2-day itinerary for this destination, including transportation options.
- Repeat steps 2-3 for the remaining destinations until you have a full 7-day plan.
This step-by-step approach allows the AI to focus on each aspect individually. In addition to different prompts, each step could also be combined with actions like code completion, searching the web, and generating images, resulting in final outputs that are not just thoughtful but comprehensive.
Prompt Chaining in AI Product Development
The beauty of prompt chaining is that its versatility allows product teams to break down a task on behalf of users to create an experience that is both magical and simple. There is no need for you to be an expert prompt engineer—it’s under the hood. Within the user experience, this complexity may be completely abstracted, or there may be a “human-in-the-loop” providing feedback and making adjustments at each step.
- Gamma.ai — a presentation-building tool that uses prompt chaining to create beautiful slides. The tool first reads an input document or prompt and identifies individual sections and the slides within each section. It then builds out the content for each slide, including generating accent images. The user can change the order and delete sections before slides are generated.
- ChatGPT will write code, check its code, fix issues, analyze data, and generate a chart and summary.
As AI products mature, I expect individuals may not have as much prompt engineering expertise, but at its core, knowing when and how to break a prompt into smaller, more targeted prompts will always be valuable. So next time you're unhappy with your outputs, review your ask. If you tackle the request in parts, it’s likely a complex task that will benefit from being broken down into smaller asks.