Skip to content
AI.info

Generative AI

Task Decomposition and Workflow Prompting

Design multi-stage generative workflows with explicit contracts, deterministic steps, and intermediate validation.

By the end you can

Example

One prompt hides five different jobs

A procurement assistant receives a contract. It has to identify obligations, compare policy, calculate deadlines, assign risk, and draft an email. One fluent response does all five at once. When the answer is wrong, there is nowhere to look.

  • Extraction: Identify clauses and exact source spans.
  • Normalization: Convert dates, entities, and units into a consistent representation.
  • Policy comparison: Check clauses against an approved rule set.
  • Decision support: Assign severity and route uncertain cases.
  • Communication: Draft a user-facing summary from validated findings.

Comparison

Monolithic and staged workflows fail differently

The staged design costs more to run. In exchange you can see inside it and steer it. That trade has been measured, not merely argued.

"AI Chains", in 2022, chained LLM steps so that each step's output became the next step's input, then put the result in front of users. The abstract reports: “In a 20-person user study, we found that Chaining not only improved the quality of task outcomes, but also significantly enhanced system transparency, controllability, and sense of collaboration.” Transparency and controllability were not decorative by-products of the chain. They were what the participants used it for, debugging unexpected outputs by “unit-testing” sub-components of a chain. Intermediate contracts are testable because people actually tested them.

The middle option — asking one model to narrate a plan inside a single response — buys the appearance of that without the substance. A 2023 paper, "Language Models Don't Always Say What They Think", tested it. The authors introduced biasing features that the model never mentions, such as reordering multiple-choice options so that the answer was always "(A)". The abstract: “This causes accuracy to drop by as much as 36% on a suite of 13 tasks from BIG-Bench Hard, when testing with GPT-3.5 from OpenAI and Claude 1.0 from Anthropic.” The models went on generating explanations that rationalised the biased answers. A rationale that omits the real cause of the answer is not an audit trail, however well organised it looks. And nothing outside that single context window is in a position to contradict it.

FigureComparison · 3 columns

Single generative pass

Ask one model call to perform the entire task.

  • Fast to prototype
  • Minimal orchestration
  • Failures are entangled
  • Difficult to validate and retry selectively

Prompted internal outline

Request a plan or intermediate structure inside one response.

  • Can improve task organization
  • Still shares one context and failure surface
  • Visible rationale may be unreliable
  • Limited independent enforcement

Application workflow

Separate model calls, tools, validators, and state transitions.

  • Intermediate contracts are testable
  • Retries target the failed stage
  • Permissions can differ by step
  • Adds latency and engineering complexity

Visual

Decompose at boundaries where evidence or authority changes

A stage earns its place by producing an artifact that another component can check. The distance between doing that and not doing it can be the whole benchmark.

Least-to-most prompting decomposes each problem into ordered subproblems. The paper that introduced it, at ICLR 2023, records the result: “A notable finding is that when the GPT-3 code-davinci-002 model is used with least-to-most prompting, it can solve the compositional generalization benchmark SCAN in any split (including length split) with an accuracy of at least 99% using just 14 exemplars, compared to only 16% accuracy with chain-of-thought prompting.” At least 99% against 16%. Same model, same benchmark, every split including the length split. The specialised neuro-symbolic models the paper compares against had been trained on the full set of over 15,000 examples. Least-to-most used 14 exemplars. The ordering of subproblems was the intervention.

The first stage, acquiring evidence, carries its own measurement. ReAct interleaved reasoning traces with tool actions, and its abstract reports: “On two interactive decision making benchmarks (ALFWorld and WebShop), ReAct outperforms imitation and reinforcement learning methods by an absolute success rate of 34% and 10% respectively, while being prompted with only one or two in-context examples.” Acting against a Wikipedia API, the authors reported, overcame the hallucination and error propagation seen in pure chain-of-thought. The external call is not an ornament on the reasoning. It is the thing that stops the reasoning drifting. That is exactly why the boundary between acquiring evidence and generating interpretation is worth paying for.

FigureProcess · 6 steps
  1. 1

    Acquire evidence

    Retrieve documents, user data, and tool results under permissions.

  2. 2

    Extract structure

    Convert unstructured material into typed candidate facts.

  3. 3

    Apply deterministic logic

    Calculate, join, filter, or enforce exact business rules.

  4. 4

    Generate interpretation

    Explain results or draft language within the validated boundary.

  5. 5

    Review and act

    Use human or policy authority for consequential decisions.

  6. 6

    Record outcomes

    Capture traces, corrections, and labels for later evaluation.

Intermediate state is part of the product contract

A workflow stage takes one artifact in and puts a different one out. The schema should record source identifiers, confidence or validation status, policy version, and unresolved fields. Passing only natural-language summaries between stages can erase provenance and uncertainty. Typed state makes it easier to prevent an unverified claim from becoming a trusted fact downstream.

What happens when provenance travels as prose has been counted in shipped commercial products. A 2023 audit had humans check the answers of Bing Chat, NeevaAI, perplexity.ai and YouChat against the citations attached to them. The abstract: “We find that responses from existing generative search engines are fluent and appear informative, but frequently contain unsupported statements and inaccurate citations: on average, a mere 51.5% of generated sentences are fully supported by citations and only 74.5% of citations support their associated sentence.” These are systems whose entire product promise is the citation. On average barely half of their sentences were fully supported by the ones they carried. A citation rendered into text is a claim about provenance made by the same component that wrote the sentence. A source identifier held in a typed field and checked at the stage boundary is provenance, because something other than the generator has to sign for it.

Key idea

A later model cannot repair evidence that an earlier stage discarded

If retrieval misses the controlling document or extraction drops a negation, later reasoning sees a distorted world. Additional fluent analysis may make the error harder to notice.

This has been made measurable. "Faith and Fate" decomposed multiplication into computation graphs and scored the intermediate steps instead of the answer: “There are signs of memorization even when restoration errors are near zero: 82.3% of the final correct answers for 4-digit by 2-digit multiplications (a setting unseen during training) had at least one error in the computation graph, but still produced correct answers.” Most of the right answers were sitting on broken working. On 3-digit by 3-digit multiplication the same paper found off-the-shelf ChatGPT and GPT4 reaching only 55% and 59% accuracy. An end-to-end scorer would have logged that 82.3% as success and learned nothing.

Evidence can also be discarded without ever being dropped. "Lost in the Middle" measured a U-shaped position curve in multi-document QA. The paper states: “For example, GPT-3.5-Turbo’s multi-document QA performance can drop by more than 20%—in the worst case, performance in 20- and 30-document settings is lower than performance without any input documents (i.e., closed-book performance; 56.1%).” The relevant document was retrieved and handed on intact. It simply sat in the middle of the context. In the worst case the model did worse than it would have done with no documents at all. A retrieval stage that reports what it fetched but not where it placed it has passed the failure downstream in a shape no later component can see.

Stage-level evaluation should therefore measure what each stage retrieved and what it kept before it measures the final answer. End-to-end success alone cannot localize the bottleneck.

Validate information preservation at every boundary where later stages depend on earlier evidence.

Case

Better at single hops, no better across two

The effect has a name. Press and colleagues called it the compositionality gap at EMNLP 2023. Larger GPT-3 models answered single-hop questions better without closing the multi-hop gap.

Case

Handing the arithmetic to an interpreter beat the larger model

Structure helps where scale does not. PAL, at ICML 2023, offloaded arithmetic to a Python interpreter and beat chain-of-thought PaLM-540B by 15 points on GSM8K. Self-Refine, at NeurIPS 2023, reported about 20 points of absolute average gain from iterative self-feedback.

Steps

Turn a complex prompt into a testable workflow

Use the smallest number of stages that creates useful control boundaries. List the distinct claims. Mark which source each one requires. Assign each to code, a tool, a model or a person. Define the stage schemas so they carry provenance and unresolved fields. Specify what is retried and what escalates. Then evaluate the components as well as the whole.

That last step is the one teams treat as optional, and the field report on treating it that way is specific. Barnett and colleagues drew on three deployed case studies — in research, education and biomedicine — and catalogued seven distinct failure points. Their conclusion: “The two key takeaways arising from our work are: 1) validation of a RAG system is only feasible during operation, and 2) the robustness of a RAG system evolves rather than designed in at the start.” Stage metrics are not a pre-launch checklist item to be discharged and closed. They are the instrument you keep running. On this evidence, the failure points reveal themselves only once real traffic is passing through the stages.

FigureProcess · 6 steps
  1. 1. List distinct claims

    Separate extraction, calculation, judgment, and communication.

  2. 2. Mark evidence dependencies

    Identify which source each claim requires.

  3. 3. Assign the right component

    Use code for invariants, tools for current data, models for ambiguity, and people for authority.

  4. 4. Define stage schemas

    Record provenance, validation state, and unresolved fields.

  5. 5. Add retries and stops

    Specify recoverable errors, clarification, and escalation.

  6. 6. Evaluate components and whole

    Measure stage quality plus final workflow outcomes.

Decomposition is valuable when it creates evidence and control

Splitting a task into more model calls is not automatically better. Each stage should exist because it isolates a failure, permission, data source, or validation rule.

The next lesson examines reasoning and test-time computation. Letting the model deliberate internally can improve some tasks, while external workflow structure makes intermediate evidence easier to inspect.

Key takeaways