liveBook · Manning

Iterative prompting

As explained in Coding with AI

A prompting technique that repeatedly revises inputs based on model outputs until the response better satisfies the intended goal.

Iterative prompting treats model interaction as a conversation: send a prompt, inspect the result, revise the request, and repeat until the output better fits the goal. It is especially useful when a first answer is confidently wrong or incomplete. section 9.4.5

Improving a multiplication answer

For 234 × 432, the bare prompt produces 98,136, and “What is 234 multiplied by 432?” produces 96,072. A stronger revision asks for three calculation methods, selection of the most accurate method, common long-multiplication steps, and shown work. The prompts become progressively more specific instead of treating the first response as reliable. section 9.4.5 section 9.4.5

A practical iteration loop is:

  • Start with the simplest prompt that expresses the task. section 9.4.5
  • Inspect the response for accuracy and identify what additional guidance it needs. section 9.4.5
  • Add explicit instructions, alternative methods, and requested work when these may improve reliability. section 9.4.5

How Coding with AI covers it

How deep it goes
Demonstrates successive prompts and outputs for arithmetic, but stops short of a general evaluation framework.
Examples
Uses 234 × 432, two incorrect answers, and a revised request for three methods with shown work.
What it assumes
Assumes a basic task and model interaction, while teaching prompt refinement from a simple request.
What you can do after
Apply iterative prompting to refine model requests when an initial response is inaccurate or fails to meet the goal.
How it connects
Connects prompt engineering with large language models, arithmetic accuracy, and chain-of-thought-style requests for shown work.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Coding with AI. The section links point to the parts of the book it draws on.