My AI Tied a Two-Line RuleWhat an honest benchmark for robot failure analysis looks like
I built an AI agent that analyses robot failures, and then spent most of my time trying to prove it wasn't as good as it looked. On held-out flights it ended up tied with a rule I could write in two lines. This post is about why I think that's the result worth publishing.
For the past few weeks I've been building a proof of concept for a tool that analyses failures in robot fleets. The person I keep in mind is a fleet manager at a robot integrator: someone running a mixed fleet from several vendors, who gets a ticket that says "F-231 handled badly on approach, Marta thinks it was the wind" and has to work out what actually happened. The tool takes that ticket, finds the relevant moment across the recordings, cross-checks the sensors, and writes a report in which every claim cites a recording and a timestamp.
In an earlier post I argued that an evaluation metric is a business decision wearing a mathematical costume. This post is the practical side of that argument. Before you can say an AI system is good at something, you have to build an evaluation it can't cheat, and then measure the dumbest methods that could plausibly do the job. That's where most of my effort went, and where the most interesting things happened.
The dataset: a drone with real, injected failures
The first benchmark is ALFA [1], a public dataset from Carnegie Mellon's AirLab. A small fixed-wing aircraft (a Carbon Z T-28) flew with an autopilot, and during flight the authors injected failures in software: the engine cut out, or an aileron, the rudder or the elevator froze, or several of these at once. The recordings are ROS bags with the autopilot's telemetry (attitude, position, airspeed, the commands sent to each servo), and a status topic records when each failure started. That gives labelled failure types and labelled onset times, which is rare in public robot data.
I converted everything into one format (MCAP plus Parquet tables with a shared schema), so the analysis code never needs to know which dataset a signal came from, and I checked each conversion signal by signal against the original. Three properties of ALFA shaped everything that followed:
- Engine failures dominate. 23 of the 37 labelled failures are engine failures, so a method that always answers "engine" gets the type right most of the time. Every type accuracy below is shown next to that number.
- The data is sparse. In the processed bags, actuator outputs arrive at about 2.5–3 Hz and attitude at about 19 Hz. A failure can't be detected faster than the next sample.
- The recordings stop shortly after the failure. That turned out to matter a lot.
What counts as finding a failure
I wanted the scoring to be simple and strict. A hit is an alarm within 10 seconds after the labelled onset (with 1 second of tolerance before it, because the labels come from a 2 Hz topic). An alarm before the onset counts as early, and an alarm on a flight with no failure is a false alarm. From those I compute precision, recall and F1 per flight, plus how often the method names the right failure type.
I split the evaluation into a dev set, which I'm allowed to look at and tune on, and a test set, which I score once at the end with a frozen configuration. That rule is easy to state and surprisingly hard to keep, as the next section shows.
My first evaluation leaked
The first version of my evaluation produced numbers I'm very glad I never published. While I was building the agent's tools, I kept finding ways the evaluation itself gave the answer away:
- Recording length. ALFA recordings end about 16 seconds after the failure, and failure flights are longer than normal ones. A baseline that reads no sensor at all ("on long recordings, raise an alarm 10.5 seconds before the end") scored F1 0.56 on the first test set. The best single-sensor rule scored 0.55. A method that knew nothing about the aircraft matched one that read its altitude.
- Dates. The authors tested one kind of failure per day. From the date alone you could tell an engine failure from a control-surface failure on 17 of 20 test flights.
- Split. 12 source flights had been cut into several segments, and 9 of them had segments on both sides of the dev/test split.
- Tickets. The synthetic teammate hypotheses were always wrong. An agent that rejected every hypothesis would look perceptive, and I couldn't tell that apart from one that actually checked.
- Clocks. One topic carried GPS time, which gave away the real date, which gave away the failure kind.
None of these is exotic. Each is the kind of structure any real dataset has: recordings start and stop for operational reasons, test campaigns happen on particular days, and people label things in batches. An AI model with tools will find that structure if you leave it there, and you won't see it happening unless you build the baseline that exploits it on purpose.
Rebuilding it
The second version of the evaluation (v2) tackles each of those leaks. Every flight is now a window cut from a source recording, with window lengths drawn from one distribution for failures and normal flights alike. Windows taken before the failure become extra normal examples, so "this flight is long" no longer means "this flight failed". The split groups everything by source flight. Dates and flight numbers are synthetic and in random order. Teammate hypotheses are right half the time and scored both ways. The GPS clock is hidden, and message counters restart in each window.
One leak I can't remove. The public data stops 8–16 seconds after each failure, so in every failure window the failure sits near the end. I didn't want to pad recordings with synthetic signal, so I kept the no-signal baseline as a permanent measurement of what that position is worth. On the v2 test set it still catches most failures, but it now raises an alarm on 20 of 21 normal windows, for an F1 of 0.57. Duration no longer separates failure from normal. Only the signals can.
Baselines before the agent
Before running the agent even once, I measured three baselines, each tuned on dev and scored once on test:
- No signal, described above: F1 0.57.
- The best single-signal threshold. I searched every numeric field the agent can see for the one signal and threshold that best separates failure from normal on dev. The winner is altitude below 44.9 m. On test it catches 8 of 18 failures (F1 0.55), and for an obvious reason: when the engine cuts out, the plane comes down. A frozen aileron doesn't change the altitude, so this rule never sees it.
- An expert rule: raise an alarm if any control-surface output stops moving for five samples, or the throttle output drops to idle. On test it finds 17 of 18 failures (plus one early alarm), with 3 false alarms in 21 normal windows, F1 0.87, and the failure type right 17 times out of 18.
The expert rule deserves an honest footnote. I found it by looking at the dev labels and the raw servo commands, where the injected faults are unmistakable: a frozen servo sits at exactly 1500 µs, or at exactly 1900 µs when the rudder is stuck hard right. The rule works because ALFA's faults are injected so cleanly. On dev, where I found it, it scored 0.95. On test it dropped to 0.87, which is still the strongest method I have.
The agent
The agent uses Claude Haiku, the smallest and cheapest model in its family. I chose it on purpose: if the context is right, I want to know how far a small model gets before I pay for a bigger one. It never sees raw files. It works through a few tools: search the recordings, describe one, query signals, detect events (including "this output stopped moving"), compute a derived signal (the difference between two channels, a rolling standard deviation), compare a value with the rest of the fleet, and plot. It also gets a short glossary of what the aircraft's channels mean and a history of past cases.
Everything the model sees is filtered. It gets public flight numbers, never the dataset's file names, which contain the answer (…_engine_failure). The status topics that record the ground truth are hidden, and so are any topics whose mere presence correlates with the failure kind. Times are seconds from the start of the window.
The output is a structured report: whether a failure was found, its type, its onset, a verdict on the teammate's hypothesis, a summary, next steps, and a list of claims. Each claim must cite a specific recording, topic, fields and time window, or a fleet statistic or past case. A checker re-reads the data for every citation and verifies it. If the agent cites something that doesn't hold, it gets one chance to fix it.
On dev I ran the frozen configuration five times (the API has no seed, so identical runs differ): F1 0.91 on average (range 0.90–0.92), with 3.2 false alarms in 25 normal windows. Then I froze everything and ran the test set once, with three identical runs.
The result
| Method | Failures found (of 18) | False alarms (of 21) | F1 | Type right |
|---|---|---|---|---|
| AI agent (Haiku), mean of 3 runs | 16 in every run | 2.7 (2–3) | 0.87 (0.84–0.89) | 82% (78–89%) |
| Expert rule | 17, plus 1 early | 3 | 0.87 | 94% |
| Best single signal | 8, plus 1 early | 2 | 0.55 | 56% |
| No signal | 16, plus 2 early | 20 | 0.57 | 56% |
| Always "engine" | — | — | — | 56% |
At finding failures, the agent and the rule are tied. The difference in F1 (0.865 against 0.872) is smaller than the spread between the agent's own runs. With 18 failure windows the uncertainty is wide either way: 16 of 18 has a 95% interval of roughly 67–97%.
At naming what failed, the rule wins. The agent missed two aileron failures that the rule caught: one left-aileron failure in all three runs, and one where both ailerons froze together in two of three. It also called the left-rudder failure "right" in all three runs. There was no rudder failure in the dev set, so nothing about rudders was ever tuned. The rule gets that same flight wrong too. On engine failures, the agent named the type correctly 29 times out of 30.
All of the agent's false alarms land on windows taken from before a real failure, on flights that were about to fail. Of the seven that come with a time, five sit 13 to 83 seconds before the window's end, far from where failures fall. The other two sit 9 to 11 seconds from the end, where failures usually are, so I can't rule out that position plays some part.
What the rule doesn't do
If detection were the whole job, this post would end with "just write the rule". But a fleet manager doesn't receive a boolean. They receive a ticket, and what they need back is an explanation they can act on and defend. That's where the comparison stops being symmetrical:
- Every claim is checkable. Across the three test runs the agent made 1,748 citations, and all 1,748 held up when the checker re-read the data. In every failure report, the cited evidence covers the labelled moment of the failure, not just the moment the agent claimed.
- It argues with the ticket. When a ticket carried a teammate's wrong guess, the agent contradicted it 12 times out of 12. When the guess was right and named a part ("it's the elevator"), it confirmed it 10 times out of 12.
- It doesn't need to know the failure in advance. The rule exists because I'd seen how these faults were injected. An integrator with robots from five vendors doesn't get to read the fault injection code before the first incident.
- It costs about a cent. The full test run, 39 tickets three times, cost $1.28, about $0.011 per analysis.
There's one weakness that doesn't show up in the table. When the teammate's hypothesis is "it was just the wind" and the flight really was normal, the agent never says "supported". In 8 of 9 cases it says "inconclusive". It correctly finds nothing wrong, but it won't claim the wind did it, which is arguably the right call given what the telemetry can show. I'm counting that as a flaw in my ticket design rather than in the agent, and I'm reporting it separately instead of redefining the score after seeing the test.
The caveats
A result like this is only as useful as its limits are clear, so here they are in one place:
- The test set isn't never-seen. v2 fixes the leaks I found, but I looked at every ALFA recording during earlier work, and the first test set was scored twice. A clean held-out number needs a dataset I haven't touched yet.
- The timing isn't comparable. The agent's median onset error is close to zero seconds against the rule's 0.6 s, but the agent reads the whole window after the fact, while the rule could run live. This is a post-incident analysis tool, not an alarm.
- The samples are small. With 18 failure windows, every percentage here has an interval of 15–30 points. I report the mean of identical runs, never the best one.
- The faults are clean. Injected faults produce a servo frozen at an exact value. Real failures are noisier, slower and messier, and that's where I expect rules to struggle. I haven't measured that yet.
- The type list was closed. The agent picked from ALFA's list of failure types. Real tickets don't come with answer options. The open-ended version is measured on dev but not yet on test.
- The tickets are synthetic. The flights are real. The tickets, the teammates and their hypotheses are generated, and flagged as such everywhere.
What this means
The honest takeaway isn't "the AI is as good as an expert". It's narrower and, I think, more useful: on a benchmark with cleanly injected faults, detection is close to solved by a rule, so detection alone can't show what an AI analyst adds. If your benchmark can be nearly solved in two lines, it's measuring detection, not diagnosis. The value has to show up in the parts a rule doesn't attempt: the evidence trail, the disagreement with a wrong hypothesis, and the ability to work on a robot nobody wrote a rule for.
An AI agent with good tools and the cheapest model available matched the best rule I could write on ALFA, and it did so with a report where every claim checks out. That's a smaller claim than the ones usually made about AI in industry, and I'd rather make a claim that survives a careful reader. The open question is what happens when the failures stop being tidy. That's the next post.
If you run a mixed robot fleet, or you've ever had to explain a robot failure to someone who wasn't there, I'd like to hear from you.
References
- A. Keipour, M. Mousaei and S. Scherer, "ALFA: A Dataset for UAV Fault and Anomaly Detection", The International Journal of Robotics Research, 2021. arXiv:1907.06268. Dataset: CMU AirLab, figshare, DOI 10.1184/R1/12707963, CC BY 4.0.