LLM 1gateLLM 2LLM 3

Prompt chaining breaks a task into a fixed sequence of model calls. Each call does one small thing well and passes its output forward, and between steps I can put a programmatic check, a gate, that confirms the work is still on track before the next call spends tokens on it.

I reach for it when a task decomposes cleanly into steps I can name in advance. Write the outline, then the draft, then the translation. Extract the fields, then validate them, then format the result. If I can draw the steps on a whiteboard without any branching, a chain is usually the right shape.

The cost is latency. Three calls in a row take three times as long as one, and every gate adds code I have to maintain. The trade is worth it when each step gets measurably better because it only has to do one thing, and when a failure caught at step two is cheaper than a bad answer at the end.

Where it goes wrong is when the steps are not really independent. If step three needs to reconsider what step one decided, the chain has no way to go back, and I end up either stuffing more context into every prompt or bolting on retries that turn a simple pipeline into an unhappy loop.

In a good chain I look for gates that check something concrete, a schema, a word count, a required field, rather than asking another model whether the output looks fine. I also want each step to be testable on its own, with fixed inputs, so a regression tells me exactly which link broke.

Projects

Projects

No projects here yet.