LLM Basics
Lesson 8 of 8

Prompt Chaining

Every technique in this course has been about controlling what goes into a single context window before the model answers. Prompt chaining is the same idea applied across multiple calls. Instead of asking a model to do several distinct jobs at once, you break the task into steps, and feed each step's real output into the next step's context window as a fresh, focused prompt.

Predict before you look

Same two-part task, summarize an article, then translate the summary, done as one combined prompt versus two separate chained calls. Before you look, do you expect the chained version's translation to be a translation of the exact same sentence the single-prompt version summarized?

Both routes produced a reasonable summary and a reasonable French translation, this is a task the model handles fine either way, and chaining isn't always strictly necessary here. However, look at what's structurally different. In the single-prompt version, the model juggles two instructions, "summarize, then translate," inside one generation, and if the summary drifts even slightly, the translation compounds that drift with no checkpoint in between. In the chained version, step 2's context window contains only the literal, real text step 1 produced, a plain string substitution, no hidden reasoning, which means you could inspect, log, or even edit the intermediate summary before it ever reaches the translation call.

That inspectability is chaining's real payoff, and it scales with task complexity. The harder and more multi-stage the task, the more valuable it becomes to have a clean, focused context window, and a checkpoint you can verify, at every step, rather than one context window trying to hold the entire task at once.

That closes the loop on this course, and it's worth stepping back to see the whole shape of it. Every lesson here was really the same one fact, examined from a different angle, a prompt is just tokens in a context window, and attention is what makes those tokens useful. Examples, reasoning steps, role framing, sampling more than once, chaining calls together, none of these are separate tricks with separate explanations. They're all just different, deliberate ways of deciding what the model gets to look at before it answers. Once you see prompting this way, you stop hunting for magic phrases and start asking a much more useful question, what does the model actually need in front of it to get this right.

What's the main structural advantage of a 2-step chained prompt over 1 combined prompt doing the same two jobs?