TL;DR
AI-Driven Research for Systems (ADRS) uses Large Language Models (LLMs) to automatically generate highly optimized database code, but the approach is severely bottlenecked by the hours it takes to evaluate each candidate solution. This paper introduces a co-evolutionary framework that breaks this bottleneck by automatically refining the evaluation pipeline (simulators, cost models, and workloads) in an outer loop alongside the code-generation inner loop. The resulting white-box database algorithms significantly outperform state-of-the-art baselines across buffer management, index selection, and query rewriting.
What Problem Does This Paper Address?
Modern database workloads and hardware configurations are becoming too complex for human engineers to optimize manually. While traditional machine learning approaches treat the database as a black box (e.g., replacing components with neural networks or using ML to tune knobs), they introduce high runtime inference overhead and unpredictable worst-case behavior.
ADRS offers an alternative by using LLMs to autonomously generate clean, deployable, white-box source code. However, ADRS relies on a tight feedback loop: the LLM generates a solution, an evaluator tests it, and the performance metrics guide the next iteration. In database systems, this evaluation step is a massive bottleneck. Running full end-to-end benchmarks requires recompiling code, loading gigabytes of data, and executing complex queries—a process that can take hours per candidate. While researchers use shortcuts like simulators or simplified cost models to speed things up, designing these proxy evaluators manually is often just as difficult as solving the original optimization problem.
Methods
The authors propose a co-evolutionary framework that automates the design of the evaluation pipeline itself. Instead of using a static, hand-written evaluator, the system runs two nested loops:
- The Inner Loop (Solution Generation): An LLM (such as GPT-5 or Claude Sonnet 4.5) generates and refines candidate database algorithms directly in source code.
- The Outer Loop (Evaluator Optimization): The system analyzes the gaps between the proxy evaluation metrics and true end-to-end performance, dynamically updating the evaluator's structural constraints, workloads, or search spaces.
The authors validate this approach across three classic database optimization problems, each targeting a different axis of the evaluation pipeline:
- Buffer Cache Optimization (System Axis): Co-evolving a trace-based cache simulator alongside eviction policies by calibrating against multiple ground-truth baselines.
- Index Selection (Performance Model Axis): Co-evolving an end-to-end performance model that filters out non-deterministic runtime noise to provide a stable fitness signal.
- Query Rewriting (Workload & Search Space Axis): Dynamically selecting targeted query workloads and pruning the combinatorial search space based on prior empirical successes.
Datasets
The framework was evaluated using standard industry benchmarks:
- TPC-H: Used to evaluate the buffer cache policies (at scale factor 10, ~10GB) and index selection generalization.
- TPC-DS & DSB (Data-Scale Benchmark): Used for training and testing the index selection and query rewrite policies.
- Benchbase: Utilized as the underlying workload generator for the index selection experiments.
Key Insights and Ideas
- "More is More" for Simulators: When building a proxy simulator for the buffer cache, calibrating against a single baseline leads to oversimplified models that trap the LLM in local optima. Exposing multiple diverse baselines (e.g., Clock, PBM-Sampling) bounds the search space and forces the simulator to capture essential runtime metadata like scan contexts.
- "Mind the Gap" in Performance Models: Database query planners often rely on theoretical cost estimates that ignore caching and hardware realities. The outer loop discovered that tracking denoised, isolated query latency is a much better proxy for true system performance than the optimizer's internal cost metrics.
- "Go Off What You Know": Exhaustive search over query rewrite rules is computationally intractable. By instructing the outer loop to expand specifically from observed performance wins to structurally similar queries, the system avoids wasting cycles on ineffective rule combinations.
Key Results
The co-evolved white-box code achieved substantial performance gains over state-of-the-art human-designed and AI-assisted baselines:
- Buffer Cache: The evolved eviction policy achieved up to a 19.8% higher hit rate and 11.4% I/O volume savings compared to the state-of-the-art PBM-Sampling algorithm in PostgreSQL.
- Index Selection: The generated policy reduced query latency by 6.3% on TPC-DS and 5.8% on TPC-H, while executing 2.2× faster than the competitive Extend baseline.
- Query Rewriting: The evolved deterministic policy outperformed the LLM-based runtime rewriter R-Bot, delivering up to a 6.8× reduction in query latency on DSB and a 5.4× reduction on TPC-H. Crucially, because the solution compiles to native Java code, it eliminates the massive runtime LLM inference overhead incurred by R-Bot (sub-millisecond vs. minutes per query).
Limitations and Future Work
- Semantic Verification Constraints: The current framework is restricted to performance problems where correctness can be easily verified (e.g., ensuring a rewritten query returns the exact same rows).
- Complex Subsystems: Applying ADRS to stateful, highly critical subsystems like concurrency control or write-ahead logging (WAL) remains an open challenge, requiring the future integration of formal verification or exhaustive fuzz testing pipelines.
- Implicit Application Semantics: Optimizing workloads outside the database engine introduces a specification problem, as application correctness is often implicit in code rather than explicitly declared as database constraints.
- AI-Native Database Architecture: The authors note that future database systems might need to be redesigned from scratch to prioritize modularity and predictability, making it easier for AI frameworks to cleanly swap and evaluate individual components.
Summary updated