Twenty AI Agents Team Up to Cut Quickwit Query Time by 31%
TabbyML assembled 20 AI agents into an autonomous engineering team that optimized the open-source search engine Quickwit without being told which code to change, handling bottleneck discovery, solution design and peer code review on its own. In four days the team ran roughly 350 experiments and kept 6 reviewed optimizations, cutting total hot-query time on a 100M-row dataset from 40.5s to 27.9s, with some queries dropping 87%, and surpassing all prior public results in the ClickBench data-lake hot-query category.
Full Report
Contents6 sections
Quickwit total query time drops 31%, with a maximum drop of 87%
Yunchong, from SiFei Temple 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, the 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 is left to AI.
Four days later, this AI team delivered a report card:
- Autonomously carried out about 350 engineering experiments;
- Ultimately retained 6 optimizations that passed review;
- In tests on data at the hundred-million scale, total hot query time dropped from 40.5 seconds to 27.9 seconds, a decrease of 31%;
- For some queries, the time drop was as high as 87%.
More importantly, in the data lake category of the database performance benchmark ClickBench, the AI-optimized Quickwit, in a like-for-like hot query score comparison, surpassed all previously public results.
This time, what 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 fairly complex engineering effort.
Engineers not only need to understand a huge 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 regression 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's hot query geomean is 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 is 304 milliseconds, and ClickHouse's is 392 milliseconds.
It is worth noting that AI did not redesign the entire search engine, but instead went deep into the underlying implementation of the existing system and looked for performance bottlenecks that could be eliminated one by one.
These 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 AI a real engineering team
What would happen if you directly let 20 AI Agents modify a codebase at the same time?
They might 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, AI might gradually find ways to game the system.
TabbyML's solution is to let 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 at the same time, from data decoding to memory management, from aggregation operations to storage access.
The second: Lead Agent
It is responsible for reviewing each optimization proposal.
Can this proposal really solve a general engineering problem? Is it possible that it is only gaming the Benchmark? How can the optimization be proven effective? Which existing behaviors must remain unchanged?
In TabbyML's system, before each experiment officially begins, a clear "experiment contract" must be formulated.
It must specify not only performance goals, but also constraints such as correctness, compatibility, and memory usage.
Only proposals that pass review can move on 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 that the original proposal has problems, they can even question the technical lead's judgment and request that the experiment plan be re-formulated.
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 of the 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 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.
AI discovered that when Quickwit executes a certain query, it needs to process about 100 million intermediate records. But what the user actually needs is just the 10 most frequently accessed IP addresses.
So the AI proposed a plan that looked very reasonable: first filter out the 10 final results needed, then perform the subsequent data transformation.
This would save a large amount of unnecessary computation.
The test results were also quite impressive. The microbenchmark was 3.02x faster, and the target query latency dropped by 11%. More importantly, all 40 ClickBench query results passed validation. If Benchmark scores alone were the criterion, this optimization would seem ready to merge directly.
However, the Lead Agent responsible for review stopped it. The reason was that the AI discovered 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 comes first. But under numeric comparison, the latter comes 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 business scenarios, 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 this 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 results and deciding whether code can be merged are two different jobs.
The Verification Agent delivers evidence of speedup; the Lead Agent also has to ask: could all tests being green simply be because the places where errors would occur were not tested? The E251 change stopped at this gate.
The value of multi-Agent division of labor is not only that more approaches can be tried in parallel, but also that someone specifically checks: can code that runs faster still give the same answer?
350 experiments, only 6 optimizations kept
Out of about 350 experiments, only 6 optimizations were ultimately retained.
At first glance, this does not seem like a very high ratio. But for real system performance engineering, a large number of failed explorations is precisely the norm.
Another experiment, E094, is a typical example.
The AI discovered that when the system processed a large number of small data groups, it produced many unnecessary memory allocations. So it proposed a new data structure.
The 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 subsequent experiment, E119, it narrowed the scope of the optimization and used the new data structure only in scenarios that could actually benefit. In the end, the team retained the performance gain while eliminating the regression.
Similar processes kept happening. In the subsequent E237 experiment, the Verification Agent even discovered that an optimization approved by the technical lead was wrong.
The temporary memory buffer initially believed to be the bottleneck was actually cleared every 2048 documents and would never grow to a scale large enough to cause the expected problem.
The real performance overhead came from another continuously growing array. The Verification Agent did not mechanically execute the task, but instead fed the finding back to the Lead Agent and pushed the team to revise the plan.
The corrected optimization ultimately reduced the 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 carries out the next round of experiments. A large number of failures were not discarded, but became the basis for subsequent optimizations.
In the end, the 6 optimizations that passed review were continuously stacked, gradually reducing the system's total hot query latency from 40.5 seconds to 27.9 seconds.

△The first bar is unoptimized Quickwit (vanilla), and the remaining six bars show the total latency of 40 hot queries after each change is stacked in sequence
This also reveals another difference between this system and the way 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 result, and review record.
Even if an experiment fails, it can provide new information for the next round of work.
What really matters is not the success of any single experiment, but the system's ability to continuously accumulate optimization results.
Without telling the AI the answer, it still found a performance bottleneck already known to open-source maintainers
After ClickBench, the TabbyML team continued to communicate with the Quickwit maintainers and shifted focus from query speed to SearchBench indexing efficiency.
The question was straightforward: if you add more CPUs to a server, will log indexing definitely become faster?
During communication before starting the experiment, the Quickwit maintainers mentioned that after adding CPUs to a certain point, adding more would hardly improve speed.
One known bottleneck is the WAL (write-ahead log) write lock: more CPUs cannot make multiple writes acquire the same lock at the same time. Knowing where the blockage is and having the time to verify optimizations along this write path are two different things.

TabbyML set optimization goals and a reproducible validation environment for the AI Agents, but did not reveal that the WAL write lock was a known bottleneck, nor did it specify which piece of code should be changed.
The Investigator Agent did its own performance profiling, traced latency along the write path, and independently located the same WAL write lock. The Agents then tried compressing larger WAL records before writing to reduce the amount of data that needed to be written while holding the lock.
In staged internal tests, the write phase of index construction for 100 million logs was shortened by nearly 60%. The team is still exploring further optimization gains.
The most noteworthy aspect of this work is that the AI Agents team's capability can reach the level of a Senior Engineer and can replace many of the daily 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 normally require specially allocated engineering time.
From AI Coding to AI Engineering: System Optimization Ushers in a New Paradigm
Over the past few years, the development of AI Coding has centered primarily on one question:
How can developers write code faster?
But in the field of systems engineering, what is truly expensive is often not the act of writing code itself, but rather finding performance bottlenecks, exploring different technical approaches, and repeatedly conducting experiments and validation.
Interestingly, system performance optimization is precisely a domain naturally suited for AI Agents to work autonomously.
Clear optimization goals, quantifiable performance metrics, reproducible experimental environments, and strict correctness constraints provide AI with a feedback loop that enables continuous exploration, self-correction, and cumulative progress.
Every experiment can yield 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.
Human engineers may find it difficult to invest days or even weeks exploring hundreds of potential optimization approaches within a single low-level component, but AI Agents can.
They can explore different technical paths in parallel, 7×24, enabling optimization work that was previously shelved due to human and time costs to actually be carried out.
And such opportunities exist widely in modern software infrastructure.
Query latency in databases, indexing efficiency in search engines, resource scheduling in distributed systems, throughput of data processing pipelines, and computational efficiency of AI inference frameworks...
In software infrastructure running at scale, even relatively modest performance improvements can bring substantial savings in computational resources and reductions in infrastructure costs.
Quickwit is just a starting point.
Currently, TabbyML has built a mature multi-agent system around autonomous systems engineering and is scaling it across various types of real-world infrastructure software.
These AI Agents operate continuously, autonomously discovering performance bottlenecks, conducting optimization experiments, and delivering validated code improvements to help enterprises enhance software system performance and reduce infrastructure costs.
This means that system performance optimization is poised to transform from an engineering effort that relies on scarce expert resources and is conducted intermittently into a continuously operating, scalable infrastructure capability.
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 run 7×24, but also be optimized 7×24.
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: https://www.tabbyml.com/blog/beating-clickbench-sota-with-a-team-of-agentic-systems-engineers/
This article is published by QuantumBit with authorization. The views expressed are solely those of the original author.