Chapter 8: Decompose-Process-Recompose: Handling large inputs with accuracy
This introduction explains why large inputs degrade model performance and how Decompose-Process-Recompose (DPR) produces one reliable answer by analyzing smaller fragments and combining the results.
After this chapter you will be able to
- Large-input failure modes. Explain why a model can miss important details in a large input or a growing conversation, even when the input technically fits its context window. Describe how downsampling or saturated attention can cause omissions, hallucinations, and inaccurate retrieval.
- Focused fragment processing. Describe DPR’s divide-and-conquer approach: split an input along boundaries suited to its medium, then process each smaller fragment with greater local focus. Give examples of spatial, temporal, semantic, or technical decomposition.
- Single-answer recomposition. Explain why DPR must combine fragment results into one response reflecting the original query, rather than return disconnected observations. Distinguish a simple recomposition, such as reporting a detected object's coordinates, from synthesis that reconciles contradictions and removes redundancies in a legal review.
- Large-input perception limits. Explain that a worker IE’s effective perception window may be insufficient for complex tasks across large inputs, and that DPR addresses this by splitting the input into manageable pieces, processing them separately, and recomposing the results.
- Three-stage DPR workflow. Trace decomposition, processing, and recomposition: a large input is split into fitting fragments, a worker IE processes each fragment, and the results are aggregated. Explain that this widens the worker IE’s effective perception window with linear cost scaling.
- Reassemblable fragments and focused processing. Explain that decomposition aims to make fragments that can be reassembled nearly or completely without information loss, while processing is injective and often projects just one facet of each fragment, such as its classification.
- Coherent recomposition and component choices. Describe how recomposition merges multiple processed results into reduced information while concealing that the input was handled in fragments. State that decomposition is usually procedural, processing uses an IE that may also handle short inputs directly, and recomposition may be procedural, IE-driven, or sometimes handled by a Retriever.
- DPR benefits and overhead. Explain that DPR can sometimes improve robustness, can reduce latency when fragments are processed in parallel, and can improve interpretability when intermediate results are tracked, while usually adding a small constant cost per fragment.
- DPR implementation sequence. Trace a generic DPR instance from decomposing an input, through asynchronous processing of its fragments, to intelligently assembling the final output. Describe simple decomposition as splitting text into roughly 4096-character blocks, preferably at sentence boundaries.
- Global context parallelism limit. Explain that asynchronous parallel fragment processing is possible in the generic sketch, but more sophisticated DPR instances may need global context when processing each fragment and therefore cannot process those fragments in parallel.
- Detail-sensitive large-input analysis. Explain why DPR is useful when a large input must be examined closely, as in code vulnerability detection or legal contract analysis.
- Information-preserving transcription. Describe transcription as transforming information without reducing its amount, and explain why fragmented transcription may need boundary smoothing and sequential global context built through compaction errands.
- Modality-specific fragment processing. Trace how DPR handles a large mixed-modality input: separate fragments by modality, choose a suitable processing IE for each, and aggregate the results in the final output modality.
- DPR versus Voter inputs. Distinguish DPR’s decomposition of one input into fragments from Voter’s use of potentially perturbed copies of an input for separate voting trajectories worked on by the worker IE.
- DPR versus Orchestrator coordination. Explain that DPR dispatches work on fragments and synchronizes it before recomposition, but does not otherwise orchestrate the work on individual fragments as Orchestrator does.
- DPR variants and hybrids. Explain that dividing-and-conquering approaches have many variants, but these do not substantially change DPR. Describe how the Decompose-Process or Process-Recompose portions of the full pattern can be combined with other patterns, including Voter, Orchestrator, and Planner.
- Decompose-Voter processing flow. Trace how the Decomposer divides an input into logical, thematic, or temporal fragments, sends each fragment to a Voter worker IE, and reconciles the worker outputs into one result instead of using DPR’s usual Process and Recompose stages.
- On-demand searchable fragments. Describe how the Decomposer partitions a long input into searchable fragments that serve as an on-demand data source, and how the Retriever searches those fragments for information relevant to a query. Distinguish this from retrieval over a fixed or pre-indexed database.
- Retrieval replacing decomposition. Trace how the Retriever-Process-Recompose variant replaces DPR’s Decomposer with a Retriever, independently processes the retrieved fragments, and recomposes them into one reply.
- Map-reduce summarization pipeline. Trace how a decomposer splits a document into overlapping chunks, a processor summarizes each chunk, and a recomposer synthesizes those summaries into a coherent executive summary.
- Large-document coverage rationale. Explain why this approach is used for documents beyond a single model call’s effective context window: overlapping chunks protect boundary context, while processing every chunk helps the final summary reflect the whole input rather than lose material in the middle.
- Modality-specific DPR pipeline. Trace how the decomposer splits input by modality, the processing stage sends text to a standard LM and tables or charts to specialized VLMs or OCR engines, and the recomposer merges the insights into a structured JSON or Markdown report.
- Rolling glossary across fragments. Explain why translating chapters in isolation can produce inconsistent tone or terminology, and how sequential fragments and a rolling global glossary address that problem.
- Unidirectional boundary smoothing. Describe how recomposition compares the end of an already-processed translation with the start of the next fragment, editing only that next fragment to improve continuity.
What it builds on
- The pain point: Limits on context length (chapter 3) · Introduces context-length limits as a constraint on agent workflows.
- Compaction errands (chapter 3) · Compaction errands, which can help construct global context.
- How the Voter pattern works (chapter 6) · The Voter pattern and its voting trajectories.
- How the Retriever pattern works (chapter 7) · The Retriever pattern
Section by section
Introduction
This introduction explains why large inputs degrade model performance and how Decompose-Process-Recompose (DPR) produces one reliable answer by analyzing smaller fragments and combining the results.
- Large-input failure modes: Explain why a model can miss important details in a large input or a growing conversation, even when the input technically fits its context window. Describe how downsampling or saturated attention can cause omissions, hallucinations, and inaccurate retrieval.
Why it matters: The failure mode explains why a larger context window alone does not solve precision-sensitive tasks. - Focused fragment processing: Describe DPR’s divide-and-conquer approach: split an input along boundaries suited to its medium, then process each smaller fragment with greater local focus. Give examples of spatial, temporal, semantic, or technical decomposition.
Why it matters: Choosing useful fragments lets a model apply its perceptive capacity to details a coarse global pass might miss. - Single-answer recomposition: Explain why DPR must combine fragment results into one response reflecting the original query, rather than return disconnected observations. Distinguish a simple recomposition, such as reporting a detected object's coordinates, from synthesis that reconciles contradictions and removes redundancies in a legal review.
Why it matters: Recomposition turns local findings into the coherent answer the user actually requested.
Key terms: lost in the middle, downsampled, growing context, needle-in-a-haystack, Decompose-Process-Recompose (DPR), divide and conquer, spatial decomposition, temporal decomposition, semantic decomposition, technical decomposition
8.1 The pain point: Large inputs creating inaccurate, unreliable, and fragmented output
This section explains why DPR uses divide-and-conquer to make work across large inputs more accurate and reliable.
- Large-input perception limits: Explain that a worker IE’s effective perception window may be insufficient for complex tasks across large inputs, and that DPR addresses this by splitting the input into manageable pieces, processing them separately, and recomposing the results.
Why it matters: This is the problem-and-solution relationship behind the DPR pattern.
Key terms: worker IE, effective perception window, divide-and-conquer, DPR
8.2 How the DPR pattern works
This section explains how DPR handles large inputs by splitting them into fragments, processing each fragment, and recombining the results into a coherent output.
- Three-stage DPR workflow: Trace decomposition, processing, and recomposition: a large input is split into fitting fragments, a worker IE processes each fragment, and the results are aggregated. Explain that this widens the worker IE’s effective perception window with linear cost scaling.
Why it matters: The three stages explain how a worker can handle an input too large to process directly. - Reassemblable fragments and focused processing: Explain that decomposition aims to make fragments that can be reassembled nearly or completely without information loss, while processing is injective and often projects just one facet of each fragment, such as its classification.
Why it matters: These properties distinguish faithful splitting of the input from the focused information produced for recomposition. - Coherent recomposition and component choices: Describe how recomposition merges multiple processed results into reduced information while concealing that the input was handled in fragments. State that decomposition is usually procedural, processing uses an IE that may also handle short inputs directly, and recomposition may be procedural, IE-driven, or sometimes handled by a Retriever.
Why it matters: A DPR output must read as a unified result, not a visible collection of independently processed pieces.
Key terms: DPR, decomposition, processing, recomposition, worker IE, effective perception window, isomorphic or near-isomorphic decompositions, processing injectivity, fragments, many-to-one compositionality
8.2.1 Tradeoffs
This section weighs DPR’s possible gains in robustness, latency, and interpretability against its per-fragment processing cost.
- DPR benefits and overhead: Explain that DPR can sometimes improve robustness, can reduce latency when fragments are processed in parallel, and can improve interpretability when intermediate results are tracked, while usually adding a small constant cost per fragment.
Why it matters: These tradeoffs help you decide whether DPR is worthwhile for a particular workload.
Key terms: DPRs, robustness, constant overhead per fragment, latency, parallelized, interpretability
8.2.2 Implementation sketch
This section sketches the Decompose-Process-Recompose workflow and explains why some implementations cannot process fragments in parallel.
- DPR implementation sequence: Trace a generic DPR instance from decomposing an input, through asynchronous processing of its fragments, to intelligently assembling the final output. Describe simple decomposition as splitting text into roughly 4096-character blocks, preferably at sentence boundaries.
Why it matters: The sequence shows how a large input becomes a coherent output. - Global context parallelism limit: Explain that asynchronous parallel fragment processing is possible in the generic sketch, but more sophisticated DPR instances may need global context when processing each fragment and therefore cannot process those fragments in parallel.
Why it matters: Whether each fragment needs the whole input determines if processing can be parallelized.
Key terms: Decompose-Process-Recompose, decomposer, fragments, asynchronous processing, global context, parallel processing, input fragments
8.2.3 When and where to use DPR
This section identifies three situations suited to DPR: detail-sensitive analysis of large inputs, information-preserving transcription, and mixed-modality processing.
- Detail-sensitive large-input analysis: Explain why DPR is useful when a large input must be examined closely, as in code vulnerability detection or legal contract analysis.
Why it matters: A small detail in a large input can change the result of the analysis. - Information-preserving transcription: Describe transcription as transforming information without reducing its amount, and explain why fragmented transcription may need boundary smoothing and sequential global context built through compaction errands.
Why it matters: Processing a translation in fragments still has to produce a coherent, information-preserving result. - Modality-specific fragment processing: Trace how DPR handles a large mixed-modality input: separate fragments by modality, choose a suitable processing IE for each, and aggregate the results in the final output modality.
Why it matters: Text, charts, and tables may need different processing components even when they belong to one document.
Key terms: large-input analysis, DPR, large-input transcription, smoothing, boundaries of fragments, compaction errands, mixed-modality input processing, decomposer, processing IE, recomposer
8.2.4 How DPR works with other patterns
This section distinguishes DPR from Voter and Orchestrator by what it splits and how much coordination it performs.
- DPR versus Voter inputs: Distinguish DPR’s decomposition of one input into fragments from Voter’s use of potentially perturbed copies of an input for separate voting trajectories worked on by the worker IE.
Why it matters: The distinction clarifies whether workers receive different parts of one input or copies of it. - DPR versus Orchestrator coordination: Explain that DPR dispatches work on fragments and synchronizes it before recomposition, but does not otherwise orchestrate the work on individual fragments as Orchestrator does.
Why it matters: This sets a boundary on what coordination the DPR pattern itself provides.
Key terms: DPR, Voter, fragments, voting trajectories, worker IE, Orchestrator, dispatch, synchronization, recomposition
8.3 DPR pattern Variants
Introduces DPR variants as hybrid uses of parts of the three-stage pattern rather than substantial changes to the pattern itself.
- DPR variants and hybrids: Explain that dividing-and-conquering approaches have many variants, but these do not substantially change DPR. Describe how the Decompose-Process or Process-Recompose portions of the full pattern can be combined with other patterns, including Voter, Orchestrator, and Planner.
Why it matters: This distinction helps you recognize a hybrid without treating it as a fundamentally new DPR mechanism.
Key terms: Decompose-Process-Recompose, Decompose-Process, Process-Recompose, hybrid pattern instances, Voter, Orchestrator
8.3.1 Decompose-Voter
This section explains how Decompose-Voter turns a large input into one representative result by voting across results from its fragments.
- Decompose-Voter processing flow: Trace how the Decomposer divides an input into logical, thematic, or temporal fragments, sends each fragment to a Voter worker IE, and reconciles the worker outputs into one result instead of using DPR’s usual Process and Recompose stages.
Why it matters: This flow distinguishes Decompose-Voter from ordinary DPR processing. - Representative result use case: Explain why Decompose-Voter suits a very large input when the desired output is one categorical or numerical result, such as an overall sentiment-like rating, rather than a synthesis of each fragment’s unique content.
Why it matters: The desired output determines whether voting across fragments is a good fit.
Key terms: Decompose-Voter, Decomposer, worker IE, Process, Recompose, Voter, categorical or numerical response, sentiment-like quality, representative rating, large-scale classification
8.3.2 Decompose-Retriever
This section explains how Decompose-Retriever makes a large, previously unindexed input searchable so an agent can find the information needed for a query without processing the whole input.
- On-demand searchable fragments: Describe how the Decomposer partitions a long input into searchable fragments that serve as an on-demand data source, and how the Retriever searches those fragments for information relevant to a query. Distinguish this from retrieval over a fixed or pre-indexed database.
Why it matters: This is the defining workflow of the Decompose-Retriever variant. - Selective processing of sparse information: Explain why the variant suits needle-in-a-haystack inputs with low information density: retrieval narrows a large context to the information needed for a query, preserving precision without feeding the entire context into the processor IE’s perception window.
Why it matters: It explains when this variant is useful and what problem selective retrieval avoids.
Key terms: Decompose-Retriever, Decomposer, Retriever, searchable fragments, on-demand database creator, low information density, needle-in-a-haystack, processor IE’s perception window, high precision
8.3.3 Retriever-Process-Recompose
This section explains how Retriever-Process-Recompose turns selected knowledge-base fragments into a unified answer without processing the entire database.
- Retrieval replacing decomposition: Trace how the Retriever-Process-Recompose variant replaces DPR’s Decomposer with a Retriever, independently processes the retrieved fragments, and recomposes them into one reply.
Why it matters: The retrieved results are inputs to synthesis, not the finished answer. - Prefiltered synthesis benefits: Explain why retrieving relevant fragments before synthesis costs less than processing an entire database, and describe the kinds of systems that use this structure.
Why it matters: Prefiltering reserves the more expensive synthesis work for relevant information.
Key terms: Retriever-Process-Recompose, Retriever, Decomposer, Processor IE, Recomposer, pre-filters, deep research tools, in-house document search tools, complex Q&A systems
8.4 DPR in action: Use-case examples
8.4.1 Map-reduce document summarization
This section shows how map-reduce summarization applies DPR to documents too large for one effective model call.
- Map-reduce summarization pipeline: Trace how a decomposer splits a document into overlapping chunks, a processor summarizes each chunk, and a recomposer synthesizes those summaries into a coherent executive summary.
Why it matters: The sequence explains how a large document becomes a single usable summary. - Large-document coverage rationale: Explain why this approach is used for documents beyond a single model call’s effective context window: overlapping chunks protect boundary context, while processing every chunk helps the final summary reflect the whole input rather than lose material in the middle.
Why it matters: This is the reliability problem that makes chunk-by-chunk summarization useful.
Key terms: map-reduce, decomposer, processor, recomposer, overlapping chunks, executive summary, effective context window, lost-in-the-middle phenomenon
8.4.2 Multi-modal content extraction
Shows how DPR extracts information from a document containing text, tables, and charts by processing each modality appropriately and combining the results.
- Mixed-modality extraction limits: Explain why a single text-only information extractor or vision-language model may be unreliable for a PDF report containing dense text, complex tables, and charts.
Why it matters: The limitations explain why the input needs to be split by modality. - Modality-specific DPR pipeline: Trace how the decomposer splits input by modality, the processing stage sends text to a standard LM and tables or charts to specialized VLMs or OCR engines, and the recomposer merges the insights into a structured JSON or Markdown report.
Why it matters: Matching each segment to a suitable processor helps the final report represent the varied source material faithfully.
Key terms: mixed-modality inputs, text-only IE, vision-language model, modality splitter, standard LM, specialized VLMs, OCR engines, recomposer, structured JSON or Markdown report
8.4.3 Smoothened sequential translation
This section shows how DPR translates a long manuscript while keeping terminology and style consistent across chapter boundaries.
- Rolling glossary across fragments: Explain why translating chapters in isolation can produce inconsistent tone or terminology, and how sequential fragments and a rolling global glossary address that problem.
Why it matters: The glossary carries decisions such as names and stylistic choices forward without requiring the whole manuscript in each step. - Unidirectional boundary smoothing: Describe how recomposition compares the end of an already-processed translation with the start of the next fragment, editing only that next fragment to improve continuity.
Why it matters: One-way edits smooth transitions without undoing work already accepted in earlier sections.
Key terms: sequential fragments, global glossary, rolling state, named entities, stylistic choices, unidirectional pairwise smoothing, recomposition, stable, already-processed chunk, (n+1)-st fragment
8.5 Summary
The section recaps how DPR handles large inputs by processing manageable fragments and recomposing them into a coherent answer, then names its variants and use cases.
Concepts explained in this chapter
- DPR patternAn agent design pattern whose described components include a Decomposer that dispatches work and a Recomposer that combines partial intermediaries into a single outcome.
- decompositionThe division of a complex task or workflow into smaller, focused units.
- recompositionThe unification of outputs from separate processing steps into a final response that reflects the original task's global context.
- context windowA context window is the maximum amount of input information a language model can consider in a single invocation.
- costCost is the expenditure associated with operating an AI agent, summarized here primarily by resource usage or monetary charges.
- interpretabilityInterpretability is the extent to which an agent's internal routines and outcomes can be understood by a developer or user.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
