Task Cascades for Efficient Unstructured Data Processing

Shreya Shankar, Sepanta Zeighami, Aditya Parameswaran

TL;DR

Large Language Models (LLMs) are incredibly powerful for processing unstructured data, but running them on millions of documents can be prohibitively expensive. This paper introduces Task Cascades, a framework that slashes inference costs by dynamically varying not just the model used, but also the specific sub-task and the fraction of the document processed at each stage. Across eight real-world datasets, this approach cuts costs by an average of 48.5% compared to standard model cascades while maintaining strict statistical accuracy guarantees.

What Problem Does This Paper Address?

Modern data systems increasingly use LLMs to execute natural language queries over unstructured text columns (e.g., filtering legal contracts or classifying customer reviews). However, calling top-tier models like GPT-4o on massive datasets is financially draining.

To save money, developers often turn to model cascades: a cheap proxy model (like GPT-4o-mini) processes the text first, and the system only escalates "uncertain" cases to an expensive "oracle" model.

The authors point out that traditional model cascades leave massive savings on the table because of two rigid assumptions:

  1. They always process the full document, even when a small snippet contains the answer.
  2. They always attempt the original, complex operation, even when a simpler, highly correlated question could filter out easy cases much more cheaply.

Methods

The Task Cascades framework generalizes model cascades by breaking a complex query down into an ordered sequence of simpler tasks. Each stage in the cascade specifies a model, a document fraction, a modified "surrogate" operation, and a confidence threshold.

The framework consists of three core components:

  • Document Restructuring: Documents are split into chunks, scored by a lightweight relevance classifier, and reordered so that the most important text is front-loaded. This allows subsequent stages to exploit LLM prefix-caching discounts when they need to read further into the text.
  • Agentic Task Generation Loop: An LLM agent (such as OpenAI's o1-mini) iteratively analyzes the failure cases of the current cascade to propose simpler "surrogate operations" (e.g., checking for specific keywords or prerequisite conditions).
  • Greedy Cascade Assembly: Finding the mathematically optimal sequence of tasks is NP-Hard. To bypass this, the authors design a greedy algorithm that sequentially adds the task that minimizes overall inference cost while satisfying accuracy constraints.

Additionally, the framework incorporates a threshold adjustment algorithm using advanced statistical concentration bounds to guarantee that the final cascade meets a user-specified accuracy target with a bounded failure probability.

Figure 1: Task vs. model cascade for determining whether a Supreme Court opinion overturns a lower court decision in Theorem 1.1. In a task cascade (left), each stage (or task) is defined by a document fraction (𝑓), a model (𝑚), and an operation (𝑜). Surrogate operations may be reused at different document fractions (as in tasks 1 and 3). The final oracle task applies the original user-specified operation (𝑜∗) on the full document (𝑓= 1.0) with the oracle model (𝑚=gpt-4o) if prior tasks cannot confidently resolve the input. In contrast, a model cascade (right) applies the same operation 𝑜∗to the full document at each stage, varying only the model.
Figure 2: Overview of our approach. A user poses a complex classification query over long documents. Our approach restructures each document to prioritize relevant chunks, then iteratively proposes surrogate operations and assembles a cost-effective task cascade to meet accuracy constraints.

Datasets

The authors evaluated Task Cascades on eight diverse document classification workloads:

  • agnews: Short news article summaries (multi-class).
  • court: Long, complex U.S. Supreme Court opinions.
  • enron: Corporate emails to identify executive senders.
  • fever: Fact extraction and verification claims.
  • games: Video game reviews comparing multiple titles.
  • legal: Legal contracts to detect specific clauses.
  • pubmed: Long biomedical articles (multi-class).
  • wiki_talk: Wikipedia Talk-page discussions predicting edit reverts.

Key Insights and Ideas

  • Change the Task, Not Just the Model: A cheap model might fail miserably at a complex task (like determining if a legal opinion overturns a ruling) but excel at a simpler prerequisite check (like checking if a lower court is even mentioned). If it isn't mentioned, the system can exit early without ever invoking the expensive oracle.
  • Prefix Caching as a First-Class Optimization: Front-loading relevant text means that if a document needs to be evaluated across multiple stages with increasing document fractions, the model can reuse the KV-cache of the prefix, drastically lowering token costs.
  • Iterative Failure Analysis Beats One-Shot Prompting: Rather than asking an LLM agent to guess good surrogate tasks up front, the framework achieves much better results by showing the agent actual "hard examples" that slipped through previous cascade stages.

Key Results

  • Massive Cost Reductions: At a 90% target accuracy, Task Cascades reduced inference costs by 48.5% on average compared to standard model cascades with identical statistical guarantees, and by 86.2% compared to using the oracle model alone.
  • High-Impact on Long Texts: On workloads with significant irrelevant text (like enron and legal), inference costs dropped by up to 6× relative to traditional model cascades.
  • Rapid Break-Even: The upfront optimization cost pays off quickly, breaking even after processing an average of only 2,986 documents. A lightweight "Lite" variant reduces this break-even threshold to just 678 documents while preserving 95% of the inference savings.

Limitations and Future Work

  • Fixed Output Spaces: The current optimization framework focuses primarily on classification tasks with a fixed set of output classes. Extending task cascades to open-ended generation or structured extraction tasks remains an open challenge.
  • Optimization Latency: Building the cascade requires an offline phase involving multiple LLM calls and training a classifier, which can take time (though acceptable for large-scale batch processing).
  • Prompt Engineering for Surrogates: The authors note that systematic prompt engineering or fine-tuning the agent specifically for surrogate generation could yield even more effective cascades in the future.

Summary updated

BibTeX
@article{shankar2026task,
  author = {Shreya Shankar and Sepanta Zeighami and Aditya Parameswaran},
  title = {{Task Cascades for Efficient Unstructured Data Processing}},
  journal = {Proc. ACM Manag. Data},
  year = {2026},
  doi = {10.11453786702},
}
Figure