8 Decompose-Process-Recompose: Handling large inputs with accuracy
Large inputs can overwhelm even capable models because their effective perception windows are limited, causing details to be missed, retrieval to become unreliable, and answers to drift into omissions or hallucinations. The chapter explains that this problem shows up in many settings, from long documents and extended conversations to video, audio, and high-resolution images, especially when the task requires precise attention to a small but important detail hidden inside a much larger whole.
To address this, the Decompose-Process-Recompose pattern applies a divide-and-conquer strategy: split the input into manageable fragments, process each fragment with appropriate model behavior, and then synthesize the partial results into one coherent answer. The decomposition can be spatial, temporal, semantic, or technical, depending on the input type, while recomposition is responsible for merging the fragment-level outputs into a final response that preserves the original global intent. The chapter emphasizes that this structure widens the effective working range of the system while keeping results more accurate and robust, often with modest overhead and sometimes with gains from parallelism and better bookkeeping.
The chapter also shows how DPR appears in practical variants and applications. Decompose-Voter is useful when many fragments should each produce a vote-like judgment, Decompose-Retriever helps search within very large unseen contexts, and Retriever-Process-Recompose supports deeper synthesis after retrieval from a broader knowledge base. Concrete examples include map-reduce summarization for long documents, multi-modal extraction that routes text, tables, and images to different processors, and sequential translation that maintains consistency through a rolling glossary and boundary smoothing. Across these cases, the central idea remains the same: handle massive inputs by breaking them down carefully, processing them intelligently, and recombining them into a single high-quality output.
The AFD of the DPR pattern. The input is first decomposed into fragments. Each fragment is then fed to an instance of the processor IE, which produces an intermediate result per fragment. The intermediate results are then gathered and passed into the recomposer, which produces the final result.
The AFD of the Decompose-Voter variant. The Decompose stage of DPR sub-divides the input into fragments, each of which is then fed into the worker IE of the Voter to produce a vote. Finally, the per-fragment votes are reconciled into one result.
The AFD of the Decompose-Retriever variant. Here, the Decompose stage of DPR serves as the data source for the retriever. Separately, a query is fed into the system, guiding the search performed by the Retriever. Ultimately, a subset of the processed fragments of the input is provided as the final output.
The AFD the of the Retriever-Process-Recomposer variant. The Retriever queries its data source for a set of relevant results. Then, each of the results is processed and recomposed into one, unified output. This has as a result a single, coherent outcome rather than set of separate results that would need to be comprehended by the user individually.
Summary
- Architectural constraints and limited perception windows in contemporary models cause performance degradation, hallucinations, and retrieval inaccuracies on large-scale inputs.
- Decompose-Process-Recompose (DPR) is a divide-and-conquer strategy that bridges massive data demands and model context limits by subdividing inputs into manageable fragments.
- DPR increases effective resolution by processing fragments with focused attention and then recomposing the intermediate results into a single, global answer.
- Decomposition can be spatial, temporal, semantic, or technical, so inputs fit a model’s architectural “sweet spot” while preserving the nuance of the source material.
- DPR variants—including Decompose-Voter, Decompose-Retriever, and Retriever-Process-Recompose—specialize the pattern for large-scale classification, on-demand retrieval over ad hoc corpora, and synthesis over retrieved knowledge.
- In map-reduce summarization, multi-modal extraction, and smoothened sequential translation, DPR maintains high-fidelity attention across large, dense inputs by hiding fragmentation behind recomposition.
Agent Design Patterns ebook for free