The Stretto Execution Engine for LLM-Augmented Data Systems

Gabriele Sanmartino, Matthias Urban, Paolo Papotti, Carsten BinnigarXiv 2026

TL;DR

Stretto is a novel query execution engine for LLM-augmented databases that provides strict end-to-end precision and recall guarantees while minimizing runtime. By combining a global gradient-based optimizer with a dense spectrum of physical operators powered by compressed KV-caches, Stretto achieves a 42% average speedup over state-of-the-art baselines without violating user-defined quality targets.

What Problem Does This Paper Address?

As large language models (LLMs) are increasingly integrated into data management stacks, systems can now execute "semantic" queries directly over unstructured data (e.g., filtering medical images or extracting text diagnoses from clinical reports). However, LLM operators introduce a massive runtime–accuracy trade-off: larger models are highly accurate but slow and expensive, while smaller models are fast but error-prone.

Current LLM-augmented data systems struggle to navigate this trade-off effectively due to two major limitations:

  1. No Global Quality Guarantees: Existing systems optimize operators locally (in isolation) or rely on heuristics. They fail to provide end-to-end query guarantees because they ignore how errors propagate across a pipeline of multiple semantic operators.
  2. Coarse-grained Operator Choices: Optimizers typically only choose between discrete model families (e.g., an 8B vs. a 70B model). This creates a wide "granularity gap" along the cost-quality curve, forcing the system to pick massive, expensive models even when a slightly modified intermediate option would suffice.

Methods

Stretto addresses these challenges by co-designing a global query optimizer and a fine-grained physical operator layer:

  • Global Gradient-Based Optimization: Instead of splitting a user's quality target evenly across operators, Stretto formulates query planning as a global constrained optimization problem. It applies a continuous relaxation to the search space—using sigmoid-based "pick factors" to turn discrete choices (like model selection) into continuous parameters. This allows a gradient-based optimizer (Adam) to jointly optimize thresholds and model selections across the entire pipeline. To safely navigate this space during iterative optimization without p-hacking, Stretto utilizes Bayesian credible intervals rather than frequentist confidence bounds.
  • KV-Cache-Enabled Operators: To bridge the granularity gap, Stretto treats the LLM Key-Value (KV) cache as a persistent, materializable database resource. In an offline phase, it precomputes KV caches for the dataset and applies query-agnostic compression (via Expected Attention) to generate a "ladder" of compressed KV-cache profiles (e.g., 0.5, 0.8 compression ratios).
  • Multi-Operator Cascades: At runtime, Stretto bypasses the expensive LLM "prefill" phase by loading these precomputed caches. It executes queries using cascades of increasingly expensive physical operators. Cheap, highly compressed models filter out easy tuples early, forwarding only "unsure" tuples to larger, uncompressed models.
Figure 1: Overview of Stretto. The input is a user query as a logical plan with semantic operators, which are globally optimized by selecting model sizes, KV caches, and thresholds. The optimizer allocates error budgets across operators to minimize runtime while meeting the global constraints. On the right, the navigable search space enabled by precomputed compressed KV caches exposes cost–quality trade-offs and allows the optimizer to explore different configurations for each model, modality and compression ratio. The final physical plan executes cascades of increasingly expensive operators so that cheap operators filter most tuples before invoking high-cost models. These cascades involve multiple physical implementations of the same logical operator, with tuples marked as unsure being passed to progressively more accurate and expensive operators.

Datasets

The authors evaluated Stretto using 300 queries across five datasets spanning multiple modalities:

  • Artwork: Images of paintings paired with tabular metadata (from Caesura).
  • Rotowire: Tabular basketball data paired with natural-language match reports (from Caesura/Eleet).
  • Email: Real-world corporate emails from the Enron corpus (from Palimpzest).
  • Movies: Textual movie reviews (from SemBench).
  • E-Commerce: A multi-modal dataset containing product images and text descriptions (from SemBench).

To ensure robust statistical evaluation, the authors expanded the limited query sets of the original benchmarks by generating 60 complex queries per dataset using structured templates.

Key Insights and Ideas

  • Dynamic Error Budgeting: Optimizing globally allows the system to realize when one operator has an "easy" task. If a lightweight vision model can filter lung scans with near-perfect recall, the optimizer dynamically reallocates the remaining error budget to a harder text-filtering operator downstream, avoiding the need for an expensive model there.
  • KV-Caches as Materialized Views: Rather than viewing KV-caching purely as an ephemeral inference-engine trick, Stretto treats it as a persistent database asset. Compressing and storing these caches offline effectively transforms a sparse physical design space into a dense, navigable continuum of cost-accuracy trade-offs.
  • Differentiable Query Planning: Turning discrete operator selections into continuous "soft decisions" allows standard deep learning optimization techniques to solve classic database query routing problems efficiently.

Key Results

  • Reliable Guarantees: Stretto was the only engine that consistently met user-specified global precision and recall targets. In contrast, state-of-the-art baselines like Lotus missed targets in up to 7.6% of queries due to flawed operator independence assumptions.
  • Significant Speedups: Stretto achieved an average 42% speedup over state-of-the-art baselines. On text-heavy datasets like Movies, Stretto achieved speedups of up to an order of magnitude by successfully routing tuples through fine-grained KV-cache cascades rather than defaulting to massive uncompressed models.

Limitations and Future Work

Currently, Stretto handles semantic joins naively by converting them into a Cartesian product followed by a semantic filter. Additionally, the system does not yet support semantic group-by or aggregation operations. The authors note that extending global gradient-based optimization to handle the unique threshold-tuning and routing complexities of these advanced operators remains a non-trivial direction for future work.

Summary updated

BibTeX
@misc{sanmartino2026stretto,
  author = {Gabriele Sanmartino and Matthias Urban and Paolo Papotti and Carsten Binnig},
  title = {{The Stretto Execution Engine for LLM-Augmented Data Systems}},
  year = {2026},
  eprint = {2602.04430},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.04430},
}
Figure