Twenty AI Agents Run 350 Experiments in Four Days to Tune a Search Engine

Original title: 20个AI Agents组队,4天狂跑350次实验,超越ClickBench最佳公开成绩
78AI Score

TabbyML deployed a 20-agent AI engineering team against the open-source search engine Quickwit, letting the agents find bottlenecks, propose designs and review each other's code without line-level instructions. In four days they ran roughly 350 experiments and kept six reviewed optimizations, cutting hot-query time on a 100M-row dataset from 40.5s to 27.9s, with some queries 87% faster, and surpassing all prior public ClickBench data-lake hot-query results.

Full Report

Contents8 sections

Quickwit total query time reduced by 31%, up to 87%

Yunzhong, from Aofeisi

QuantumBit | WeChat Official Account QbitAI

AI writing code is no longer anything new.

But what if you let 20 AI Agents form an engineering team, without telling them which specific line of code to change, and let them find performance bottlenecks, propose technical solutions, design experiments, and even review each other's code?

How far can they go?

Recently, AI startup TabbyML published a rather interesting piece of work. They put a systems engineering team composed of 20 AI Agents to work on a real open-source search engine, Quickwit.

Humans set the optimization goals and engineering constraints, and the rest of the work was left to the AI.

Four days later, this AI team delivered a report card:

  • Autonomously conducted approximately 350 engineering experiments;
  • Ultimately retained 6 optimizations that passed review;
  • In tests with hundreds of millions of records, total hot query time dropped from 40.5 seconds to 27.9 seconds, a decrease of 31%;
  • Some queries saw time reductions of up to 87%.

More importantly, in the data lake category of the database performance benchmark ClickBench, the AI-optimized Quickwit surpassed all previously public results in the same-caliber hot query score comparison.

This time, what the AI did was not just write code—it began to take on the work of a professional systems engineering team.

20 AI Agents Take On the Performance of a Real System

The system chosen for optimization this time was Quickwit, an open-source search engine that TabbyML uses in its actual business.

Quickwit is a search engine designed for large-scale logs and observability data. It is built on top of Tantivy, a full-text search library written in Rust, and can directly use cloud object storage to process massive amounts of data.

TabbyML uses it to store and retrieve the execution traces of AI Agents.

Unlike ordinary software development tasks, system performance optimization is a rather complex engineering effort.

Engineers not only need to understand a massive codebase, but also need to deeply analyze low-level mechanisms such as CPU, memory, data structures, and storage access.

In many cases, the real performance bottleneck is not where intuition points.

And an optimization that appears effective may also cause performance regressions in another scenario, or even introduce extremely hard-to-detect bugs. To measure the AI team's work, the TabbyML team chose ClickBench, a well-known performance benchmark in the database field.

On a test set containing 100 million rows of data, the AI team optimized the 40 queries supported by Quickwit. In the end, Quickwit's hot query geomean score dropped from 403 milliseconds to 304 milliseconds.

Recalculated over the same set of 40 queries, the optimized Quickwit achieved a hot query geomean of 304 milliseconds, 16% faster than Duckflight's public result of 354 milliseconds.

The TabbyML team also reproduced the unoptimized results of ClickHouse and Quickwit (the fourth and fifth rows in the figure): Quickwit's hot query geomean was 304 milliseconds, and ClickHouse's was 392 milliseconds.

It is worth noting that the AI did not redesign the entire search engine. Instead, it went deep into the underlying implementation of the existing system and searched one by one for performance bottlenecks that could be eliminated.

The 20 AI Agents carried out optimizations around multiple areas, including cache configuration, data structures, decompressor reuse, and memory allocation mechanisms.

After about 350 explorations and experiments, they ultimately produced 6 effective performance optimizations.

Building the AI a Real Engineering Team

What happens if you directly let 20 AI Agents modify a codebase at the same time?

They may duplicate work, overwrite each other's code changes, or mistake random fluctuations in tests for performance improvements.

Even worse, in pursuit of higher benchmark scores, the AI may gradually find ways to game the system.

TabbyML's solution is to have the AI divide labor and collaborate like a real engineering team.

The entire team is divided into three roles.

The first: Investigator Agent

These Agents are not responsible for modifying code, but focus on performance analysis.

They read code, analyze profiling data, look for potential bottlenecks, and propose optimization hypotheses.

Multiple Agents can explore different directions simultaneously, from data decoding to memory management, from aggregation operations to storage access.

The second: Lead Agent

It is responsible for reviewing each optimization proposal.

Does this proposal really solve a general engineering problem? Could it be merely gaming the benchmark? How can the optimization be proven effective? Which existing behaviors must remain unchanged?

In TabbyML's system, every experiment must establish a clear "experiment contract" before it officially begins.

It must specify not only performance goals, but also constraints such as correctness, compatibility, and memory usage.

Only proposals that pass review can proceed to the next stage.

The third: Verification Agent

These Agents implement optimizations in mutually isolated experiment environments and run unit tests, microbenchmarks, and full performance tests.

Interestingly, they do not mechanically execute the tasks assigned by the technical lead.

If, while reading the code, they find problems with the original proposal, they can even question the technical lead's judgment and request that the experiment plan be redrawn.

The results of each round of experiments, whether successful or failed, are returned to the technical lead and become the basis for subsequent exploration.

Successful optimizations enter the next round's code baseline. Failed experiences become shared knowledge for the entire team.

In this way, the AI team forms an engineering loop that continuously proposes hypotheses, verifies hypotheses, corrects errors, and keeps improving.

Humans no longer need to break down a complex engineering goal step by step into specific programming tasks.

Exploring problems and decomposing tasks themselves also become the AI's work.

All 40 Query Results Matched, Q36 Was 11% Faster, but the Lead Agent Rejected the Change

The most interesting moment in the entire experiment occurred in experiment number E251.

The AI found that when executing a certain query, Quickwit needed to process about 100 million intermediate records. But what users actually needed was only the 10 IP addresses with the most visits.

So the AI proposed a seemingly very reasonable solution: first filter out the 10 final results needed, and then perform subsequent data transformation.

This would save a large amount of unnecessary computation.

The test results were also quite impressive. Microbenchmarks showed a 3.02x speedup, and target query latency dropped by 11%. More importantly, all 40 ClickBench queries passed result validation. If benchmark scores alone were the criterion, this optimization would seem ready to merge.

However, the Lead Agent responsible for review halted it. The reason: the AI discovered that this optimization had quietly changed the way IP addresses were compared.

For example, suppose there are two IP addresses with exactly the same access count:

  • 10.0.0.10
  • 10.0.0.2

Under string comparison, the former ranks first. But under numeric comparison, the latter ranks first.

This subtle difference did not cause errors in the current benchmark data.

But if IP addresses with the same access count appear in real-world workloads, this optimization could change the final query results returned.

In other words, all tests passed and performance improved, but the code could still have correctness issues.

Ultimately, the Lead Agent rejected this optimization and recorded the finding to prevent subsequent Agents from making the same mistake again.

This may be more noteworthy than the performance results themselves.

In this multi-Agent team, producing good numbers and deciding whether code can be merged are two different jobs.

The Verification Agent delivers evidence of speedup; the Lead Agent must also ask: could all tests be green simply because the tests never covered the cases that would fail? The E251 change stopped at this gate.

The value of multi-Agent division of labor lies not only in being able to try more approaches in parallel, but also in having someone specifically verify: can faster code still produce the same answers?

350 experiments, only 6 optimizations retained

Out of approximately 350 experiments, only 6 optimizations were ultimately retained.

At first glance, this does not seem like a very high ratio. But for real-world system performance engineering, a large number of failed explorations is precisely the norm.

Another experiment, E094, is a typical example.

The AI discovered that the system was generating many unnecessary memory allocations when processing large numbers of small data groups. So it proposed a new data structure.

Target query latency dropped by 28%, but at the same time it caused a 9% performance regression in another query.

This time, the AI did not directly accept the change. Instead, in a follow-up experiment E119, it narrowed the scope of the optimization, using the new data structure only in scenarios that would genuinely benefit. Ultimately, the team retained the performance gains while eliminating the regression.

Similar processes kept recurring. In the subsequent E237 experiment, the Verification Agent even discovered an error in an optimization plan approved by the tech lead.

The temporary memory buffer initially believed to be the bottleneck was actually cleared every 2,048 documents and would never grow large enough to cause the expected problem.

The real performance overhead came from another continuously growing array. The Verification Agent did not mechanically execute its task; instead, it fed the finding back to the Lead Agent and pushed the team to revise the plan.

The corrected optimization ultimately reduced target query latency from 5.891 seconds to 3.131 seconds, a reduction of 47%.

AI proposes hypotheses, AI verifies hypotheses, AI questions other AIs' conclusions, and then AI conducts the next round of experiments. The many failures were not discarded but became the foundation for subsequent optimizations.

Ultimately, the 6 optimizations that passed review were stacked one after another, gradually reducing the system's total hot query time from 40.5 seconds to 27.9 seconds.

img

△ The first bar is unoptimized Quickwit (vanilla); the remaining six bars show the total time for 40 hot queries after each change is stacked on top of the previous ones

This also reveals another difference between this system and how ordinary Coding Agents work.

Its work is not one-off code generation, but autonomous engineering exploration that can last for days or even longer.

Every experiment has a corresponding hypothesis, measurement results, and review record.

Even a failed experiment can provide new information for the next round of work.

What truly matters is not the success of any single experiment, but the system's ability to continuously accumulate optimization results.

The AI was not told the answer, yet it found a performance bottleneck already known to open-source maintainers

After ClickBench, the TabbyML team continued to communicate with Quickwit maintainers and shifted focus from query speed to indexing efficiency in SearchBench.

The question was straightforward: if you add more CPUs to a server, will log indexing definitely get faster?

During communication before launching the experiment, Quickwit maintainers mentioned that once CPU reaches a certain level, adding more makes it hard to speed things up further.

One known bottleneck is the WAL (write-ahead log) write lock: more CPUs cannot enable multiple writes to acquire the same lock at the same time. Knowing where the bottleneck is and having the time to verify optimizations along that write path are two different things.

TabbyML set optimization goals and a reproducible validation environment for the AI Agents, but did not disclose that the WAL write lock was a known bottleneck, nor did it specify which part of the code to change.

The Investigator Agent performed profiling on its own, traced latency along the write path, and independently located the same WAL write lock. The Agents then tried compressing larger WAL records before writing, reducing the amount of data that needed to be written while holding the lock.

In interim internal testing, the write phase of index construction for 100 million logs was shortened by nearly 60%. The team is continuing to explore further optimization gains.

The most noteworthy aspect of this work is that the capabilities of the AI Agents team can reach the level of a Senior Engineer and can replace many day-to-day tasks of human systems engineers.

Given goals and a reproducible validation environment, AI Agents can go from locating problems to validating optimizations on their own, advancing work that would otherwise require specially allocated engineering time.

From AI Coding to AI Engineering: system optimization enters a new paradigm

Over the past few years, the development of AI Coding has mainly revolved around one question:

How can developers write code faster?

But in the field of systems engineering, what is truly expensive is often not writing the code itself, but finding performance bottlenecks, exploring different technical approaches, and repeatedly conducting experiments and validation.

Interestingly, system performance optimization is precisely a field naturally suited for AI Agents to work autonomously.

Clear optimization goals, quantifiable performance metrics, a reproducible experimental environment, and strict correctness constraints provide AI with a feedback loop that enables continuous exploration, self-correction, and ongoing accumulation of results.

Every experiment can provide feedback through real performance data. Every failure can become the starting point for the next round of exploration. Every effective optimization can become the foundation for the entire system to continue improving.

It may be difficult for human engineers to devote days or even weeks to exploring hundreds of potential optimization approaches in a low-level component, but AI Agents can.

They can explore different technical paths in parallel 24/7, enabling optimization work that was previously shelved due to labor and time costs to actually be carried out.

And such opportunities are widespread in modern software infrastructure.

Database query latency, search engine indexing efficiency, distributed system resource scheduling, data processing pipeline throughput, and the computational efficiency of AI inference frameworks...

In software infrastructure running at large scale, even relatively small performance improvements can bring considerable savings in computing resources and reductions in infrastructure costs.

Quickwit is just a starting point.

At present, TabbyML has built a mature multi-agent system around autonomous systems engineering and is scaling it for application to various types of real infrastructure software.

These AI Agents operate continuously, autonomously discovering performance bottlenecks, conducting optimization experiments, and delivering validated code improvements, helping enterprises improve software system performance and reduce infrastructure costs.

This means that system performance optimization is expected to transform from an engineering task that relies on scarce expert resources and is carried out intermittently into an infrastructure capability that runs continuously and is executed at scale.

In the past, enterprises needed to dedicate engineering resources specifically to system performance optimization. In the future, continuous optimization itself can become a standard capability of software infrastructure.

In the future, enterprise software infrastructure will not only be able to run 24/7, but also be optimized 24/7.

From helping engineers write code to enabling AI to autonomously drive the continuous evolution of software systems, TabbyML is exploring the next form of AI Engineering.

Reference materials: https://www.tabbyml.com/blog/beating-clickbench-sota-with-a-team-of-agentic-systems-engineers/

*This article is published by QuantumBit with authorization, and the views are solely those of the original author.

One-click triple action**"Like" "Repost" "Little Heart"**

Welcome to leave your thoughts in the comments section!

— End —

🌟 Light up the star 🌟

See the latest advances in technology every day

Jump to WeChat to open