Prompt Chaining For Incremental Improvement of AI Outputs
By Frederick Lowe, July 21, 2025
Complex prompts often produce good results up to a point, after which additional refinements can reduce output quality. This happens because additional instructions create competing attention patterns in the transformer's processing.
In this post I explain how to improve AI output without risking changes to proven base prompts, using an approach I call Prompt Chaining.
Prompt Chaining treats prompting as a publishing workflow with at least two AI stages:
- A Generative Stage - a proven base prompt.
- An Enhancement Stage - in which you prompt an LLM to improve output from the Generative Stage.
Prompt Chaining works well with JSON Meta-Prompting. For a practical example, you can try the following Generative Stage prompt in your LLM Chat client of choice:
Generative Stage Example
Prompt 1
{
"Summary": "Replace this field with a 128 to 196 word summary explaining the joys of visiting {%attraction%} in or around {%city%}, {%state%}",
"Location": "{%city%}, {%state%}",
"Attractions": "Replace this field with three Attractions in the selected city, each representing a popular {%attraction%} located there. Structure each Attraction as an object as follows: { \"Name\": \"Replace this field with the name of the {%attraction%}\", \"Link\": \"Replace this field with a link to the {%attraction%}\", \"Description\": \"Replace this field with a 96 to 128 word description the {%attraction%}\", \"Fun Fact\": \"Replace this field with a 48 to 96 word fun fact about the {%attraction%}. Fun facts can be historical, cultural, or location-adjacent. If the {%attraction%} doesn't have a bona-fide fun fact, omit the Fun Fact field entirely.\"}",
"Getting Here": "Replace this field with a 96 to 128 word providing information about how a person in the City can get to the {%attraction%}.",
"Closing": "Close the article by re-iterating key points without redundancy."
}
Output 1
For this particular Article, given:
- attraction = "Art Gallery"
- city = "Chicago"
- state = "Illinois"
Anthropic's Claude 4.5 (Sonnet) produces a usable article about Chicago's art scene with detailed information about the Art Institute of Chicago, Museum of Contemporary Art, and Wrightwood 659:
{
"Summary": "Chicago's art gallery scene offers an extraordinary blend of world-class institutions and intimate spaces that showcase everything from ancient artifacts to cutting-edge contemporary works. The city's galleries benefit from Chicago's architectural grandeur, with many housed in stunning buildings that are artworks themselves. Whether you're exploring the massive collections of major museums or discovering emerging artists in neighborhood galleries, Chicago provides an accessible and diverse art experience. The city's central location and walkable downtown make gallery-hopping a joy, while the Midwest's welcoming culture ensures even first-time visitors feel at home. From the iconic works at the Art Institute to innovative exhibitions in West Loop galleries, Chicago's art scene rewards both casual browsers and serious collectors with memorable encounters that reflect the city's creative energy.",
"Location": "Chicago, Illinois",
"Attractions": [
{
"Name": "The Art Institute of Chicago",
"Link": "https://www.artic.edu/",
"Description": "The Art Institute of Chicago stands as one of the world's great encyclopedic museums, housing nearly 300,000 works spanning 5,000 years of human creativity. Located in Grant Park along Michigan Avenue, the museum's iconic bronze lion guardians welcome visitors into galleries filled with treasures including Grant Wood's \"American Gothic,\" Edward Hopper's \"Nighthawks,\" and Georges Seurat's \"A Sunday on La Grande Jatte.\" The museum's Impressionist and Post-Impressionist collection ranks among the finest outside Paris, while strong holdings in American art, Asian art, and contemporary works ensure something captivating around every corner. The Modern Wing, designed by Renzo Piano, added 264,000 square feet in 2009 and features a stunning third-floor bridge with skyline views.",
"Fun Fact": "The Art Institute's two bronze lions, sculpted by Edward Kemeys in 1894, have become beloved Chicago symbols and seasonal fixtures. During Chicago Bears playoff runs, museum staff outfit the lions with oversized team helmets, a tradition that draws crowds and photo opportunities. The lions also wear wreaths during the holidays and have been known to sport other festive accessories throughout the year, making them Instagram favorites beyond their role as museum guardians."
},
{
"Name": "Museum of Contemporary Art Chicago",
"Link": "https://mcachicago.org/",
"Description": "The Museum of Contemporary Art Chicago presents cutting-edge works by established and emerging artists in a striking building designed by Josef Paul Kleihues. Located steps from the Magnificent Mile and Water Tower Place, the MCA focuses exclusively on post-1945 art, with rotating exhibitions that challenge conventional thinking and showcase diverse perspectives. The museum's collection includes works by Andy Warhol, Cindy Sherman, Kara Walker, and Jeff Koons, while its exhibition program features international artists addressing contemporary social and political issues. The MCA also hosts performances, lectures, and film screenings that complement its visual art offerings. The museum's intimate scale compared to larger institutions allows for focused viewing experiences, while the on-site Marisol restaurant provides upscale dining with sculpture garden views.",
"Fun Fact": "The MCA's building sits on the former site of a National Guard armory that played a controversial role in Chicago history. During the 1968 Democratic National Convention, guardsmen deployed from this armory to confront protesters in Grant Park. Today, the museum that replaced it serves as a space for free expression and social discourse through art, representing a dramatic transformation from military deployment site to cultural beacon."
},
{
"Name": "Wrightwood 659",
"Link": "https://wrightwood659.org/",
"Description": "Wrightwood 659 occupies a transformed 1920s apartment building in Lincoln Park, reimagined by Pritzker Prize-winning architect Tadao Ando into a serene exhibition space for architecture and socially engaged art. This intimate gallery presents just two or three exhibitions annually, each running for extended periods to allow deep engagement with complex themes. The building itself exemplifies Ando's signature style, with concrete walls, precise geometry, and carefully controlled natural light creating a contemplative atmosphere. Unlike traditional museums, Wrightwood 659 focuses on the intersection of art, architecture, and social issues, hosting exhibitions that explore topics from urban planning to cultural identity. The gallery's renovation preserved the building's historic facade while creating modern exhibition spaces that feel both monumental and intimate.",
"Fun Fact": "The building's transformation by Tadao Ando marks his first permanent structure in Chicago, a city famous for architectural innovation. Ando completely gutted the interior while maintaining the exterior's historic character, then inserted his distinctive concrete volumes and light wells within the original shell. The project took nearly six years to complete, with Ando personally overseeing details down to the texture of the concrete surfaces and the angles of light penetration."
}
],
"Getting Here": "Chicago's gallery district concentrates around the Loop and River North, making most major venues easily accessible via the CTA's 'L' trains. The Art Institute sits directly above the Adams/Wabash station on the Brown, Green, Orange, Pink, and Purple lines, while the Red Line's Chicago station puts you blocks from the MCA. For West Loop galleries, take the Green or Pink lines to Morgan or Clinton stops. Chicago's flat terrain and grid system make walking between galleries pleasant, especially along Michigan Avenue's museum campus or through River North's gallery corridor on Superior and Huron streets. The city's Divvy bike-share system offers another option for gallery-hopping. Most major galleries cluster within a 2-mile radius downtown, though neighborhood galleries in areas like Pilsen and Logan Square reward those willing to venture further via public transit.",
"Closing": "Chicago's art galleries deliver world-class collections in architecturally significant buildings, from the Art Institute's encyclopedic treasures to the MCA's contemporary edge and Wrightwood 659's thoughtful exhibitions. The city's compact gallery district and excellent public transit make experiencing multiple venues in a single visit effortless, while the diversity of offerings ensures discovery for every taste and interest."
}
All frontier LLMs will consistently emit an article like the one above from this prompt, structured in a way that makes it easy to generate a web page and associated metadata.
Still, there's a good chance the article will lack style, or contain fabricated information (hallucinations). It might be too floral, or the examples too generic to be useful to a reader. For this specific, relatively simple prompt, it's possible that minor changes to the prompt itself will resolve these issues. But for more complex subject matter, or highly-detailed refinements, additional work on this prompt may not improve things. In fact, it may actually decrease the quality of the output.
Enhancement Stage Example
The content from the Generative stage becomes a part of the input, with inspection and improvement applied at the field level:
Prompt 2
Use the following prompt to improve the utility and quality of the JSON article appearing below it. When you are finished, re-emit the article JSON with a new field "changeSummary", summarizing any changes or improvements you have made. If you have not made any changes, use the value "No changes applied".
{
"Summary": "Ensure this field contains a 128 to 196 word summary explaining the joys of visiting {%attraction%} in {%city%}, {%state%}.",
"Location": "Ensure the city and state names used in the article are spelled correctly, including use of accents (if any)",
"Attractions": "Ensure there are three Attractions, and that each Attraction listed is structured as follows: { \"Name\": \"Ensure the attraction is an actual attraction with correct spelling. Ensure the attraction is noteworthy. If it is not, replace it.\", \"Link\": \"Ensure the link is valid and functioning. If it is not, convert it to a Google search link. Annotate each link by parenthesizing the link target. For example, if the link is a Google Search link, annotate it using (Google). If it is a direct link to the attraction, annotate it using (Direct)\", \"Description\": \"Ensure this field contains a 96 to 128 word description of the {%attraction%}. Replace obscure or floral language with more graspable terms.\", \"Fun Fact\": \"If present, ensure this field contains a 48 to 96 word fun fact about the {%attraction%} that is historical, cultural, or location-adjacent. If the provided fun fact doesn't seem bona-fide, remove the Fun Fact field. If there is no Fun Fact field, ignore this instruction.\"}",
"Getting Here": "If the article mentions resources or services (such as transit, access passes) that may help the reader, and you can confidently provide a link to those resources, select contextually-appropriate article text and link it to the resource using markdown (i.e. [text](link)). Link only the first mention of a given resource."
}
Output 2
For this particular Article, Anthropic's Claude 4.5 (Sonnet) enforced the publishing standard implied in the Enhancement prompt, and enhanced the article with relevant links to transit and other referenced resources:
{
"Summary": "Chicago's art gallery scene offers an extraordinary blend of world-class institutions and intimate spaces that showcase everything from ancient artifacts to cutting-edge contemporary works. The city's galleries benefit from Chicago's architectural grandeur, with many housed in stunning buildings that are artworks themselves. Whether you're exploring the massive collections of major museums or discovering emerging artists in neighborhood galleries, Chicago provides an accessible and diverse art experience. The city's central location and walkable downtown make gallery-hopping a joy, while the Midwest's welcoming culture ensures even first-time visitors feel at home. From the iconic works at the Art Institute to innovative exhibitions in West Loop galleries, Chicago's art scene rewards both casual browsers and serious collectors with memorable encounters that reflect the city's creative energy.",
"Location": "Chicago, Illinois",
"Attractions": [
{
"Name": "The Art Institute of Chicago",
"Link": "https://www.artic.edu/ (Direct)",
"Description": "The Art Institute of Chicago stands as one of the world's great encyclopedic museums, housing nearly 300,000 works spanning 5,000 years of human creativity. Located in Grant Park along Michigan Avenue, the museum's iconic bronze lion guardians welcome visitors into galleries filled with treasures including Grant Wood's \"American Gothic,\" Edward Hopper's \"Nighthawks,\" and Georges Seurat's \"A Sunday on La Grande Jatte.\" The museum's Impressionist and Post-Impressionist collection ranks among the finest outside Paris, while strong holdings in American art, Asian art, and contemporary works ensure something captivating around every corner. The Modern Wing, designed by Renzo Piano, added 264,000 square feet in 2009 and features a stunning third-floor bridge with skyline views.",
"Fun Fact": "The Art Institute's two bronze lions, sculpted by Edward Kemeys in 1894, have become beloved Chicago symbols and seasonal fixtures. During Chicago Bears playoff runs, museum staff outfit the lions with oversized team helmets, a tradition that draws crowds and photo opportunities. The lions also wear wreaths during the holidays and have been known to sport other festive accessories throughout the year, making them Instagram favorites beyond their role as museum guardians."
},
{
"Name": "Museum of Contemporary Art Chicago",
"Link": "https://mcachicago.org/ (Direct)",
"Description": "The Museum of Contemporary Art Chicago presents cutting-edge works by established and emerging artists in a striking building designed by Josef Paul Kleihues. Located steps from the Magnificent Mile and Water Tower Place, the MCA focuses exclusively on post-1945 art, with rotating exhibitions that challenge conventional thinking and showcase diverse perspectives. The museum's collection includes works by Andy Warhol, Cindy Sherman, Kara Walker, and Jeff Koons, while its exhibition program features international artists addressing contemporary social and political issues. The MCA also hosts performances, lectures, and film screenings that complement its visual art offerings. The museum's intimate scale compared to larger institutions allows for focused viewing experiences, while the on-site Marisol restaurant provides upscale dining with sculpture garden views.",
"Fun Fact": "The MCA's building sits on the former site of a National Guard armory that played a controversial role in Chicago history. During the 1968 Democratic National Convention, guardsmen deployed from this armory to confront protesters in Grant Park. Today, the museum that replaced it serves as a space for free expression and social discourse through art, representing a dramatic transformation from military deployment site to cultural beacon."
},
{
"Name": "Wrightwood 659",
"Link": "https://wrightwood659.org/ (Direct)",
"Description": "Wrightwood 659 occupies a transformed 1920s apartment building in Lincoln Park, reimagined by Pritzker Prize-winning architect Tadao Ando into a serene exhibition space for architecture and socially engaged art. This intimate gallery presents just two or three exhibitions annually, each running for extended periods to allow deep engagement with complex themes. The building itself exemplifies Ando's signature style, with concrete walls, precise geometry, and carefully controlled natural light creating a contemplative atmosphere. Unlike traditional museums, Wrightwood 659 focuses on the intersection of art, architecture, and social issues, hosting exhibitions that explore topics from urban planning to cultural identity. The gallery's renovation preserved the building's historic facade while creating modern exhibition spaces that feel both monumental and intimate.",
"Fun Fact": "The building's transformation by Tadao Ando marks his first permanent structure in Chicago, a city famous for architectural innovation. Ando completely gutted the interior while maintaining the exterior's historic character, then inserted his distinctive concrete volumes and light wells within the original shell. The project took nearly six years to complete, with Ando personally overseeing details down to the texture of the concrete surfaces and the angles of light penetration."
}
],
"Getting Here": "Chicago's gallery district concentrates around the Loop and River North, making most major venues easily accessible via the [CTA's 'L' trains](https://www.transitchicago.com) (Direct). The Art Institute sits directly above the Adams/Wabash station on the Brown, Green, Orange, Pink, and Purple lines, while the Red Line's Chicago station puts you blocks from the MCA. For West Loop galleries, take the Green or Pink lines to Morgan or Clinton stops. Chicago's flat terrain and grid system make walking between galleries pleasant, especially along Michigan Avenue's museum campus or through River North's gallery corridor on Superior and Huron streets. The city's [Divvy bike-share system](https://divvybikes.com) (Direct) offers another option for gallery-hopping. Most major galleries cluster within a 2-mile radius downtown, though neighborhood galleries in areas like Pilsen and Logan Square reward those willing to venture further via public transit.",
"Closing": "Chicago's art galleries deliver world-class collections in architecturally significant buildings, from the Art Institute's encyclopedic treasures to the MCA's contemporary edge and Wrightwood 659's thoughtful exhibitions. The city's compact gallery district and excellent public transit make experiencing multiple venues in a single visit effortless, while the diversity of offerings ensures discovery for every taste and interest.",
"changeSummary": "Added link annotations to all attraction links showing (Direct). Added markdown links in Getting Here section for CTA transit system and Divvy bike-share system with (Direct) annotations."
}
The Enhancement stage produces specific improvements like primary link annotations and links to external references mentioned in the previous output. The changeSummary field provides operational visibility into what the enhancement stage modified.
Trade-offs and Implementation
Prompt Chaining represents a trade-off in AI design. It introduces operational complexity through multi-stage orchestration, increased debugging requirements, and higher resource utilization.
However, these drawbacks are often outweighed by its practical benefits. The approach allows teams to incrementally improve AI output quality without risking changes to proven base prompts. Its loose coupling principle enables independent optimization of each stage, reducing the risk that changes to one prompt will break the entire workflow.
When enhancement stages do degrade output, the prior stage output remains available for fallback or manual review. For teams already using automation pipelines, this alignment with existing practices can simplify adoption and maintenance despite the additional complexity.