Inspiration

On 28 October 2026, at Urda (Toledo), the LZB train protection system failed on a stretch of high-speed line. The rulebook is clear about what happens next: every train stops, and it can only move on on sight, at 40 km/h at most. At 08:36 the control room told an AVE to "proceed normally". The Iryo ahead reported at 08:41 and again at 08:48 that it was still stopped. Another driver even corrected the control room on the radio: "It can't be normal running. It has to be line-of-sight." At 08:53 the two trains collided. At least 69 people died.

That was 17 minutes, three people next to the operator, and both trains visible on the screens. ASFA, LZB and ERTMS protect a train from a red signal. Nothing checks the controller's words. Spain's own accident investigators had already warned that this last barrier "depends entirely on the human factor". On 3 November the Council of Ministers approved an AI agent to monitor driver–controller conversations, with no supplier, no budget and no timeline. We are four Spanish students, so we decided to build it.

What it does

Copi sits in the control room, next to the controller. It:

  1. Listens to the radio between controller and driver, and reads the train data the control room already gets.
  2. Knows the rule: it works out which protocol applies (for example, LZB down and track occupied).
  3. Spots the error: when an order breaks that protocol, it flags it to the controller in seconds.
  4. Leaves the decision to the human. Copi never touches the brakes or the signals, and needs no hardware on the train.

Replaying Urda with Copi: it hears "proceed normally", knows the rule is on sight, 40 km/h, and flags the mismatch at 08:36, 17 minutes before the crash.

How we built it

  • Protocol model. We turned the relevant articles of Spain's railway rulebook (Reglamento de Circulación Ferroviaria, RD 664/2015, annex 5ET3 on LZB failure, checked against the consolidated BOE text) into six testable rules. We generated synthetic control-room logs, both compliant and violating, and fine-tuned Qwen3.5-4B with LoRA on Adaption AutoScientist. It reads a timestamped log and answers VERDICT / RULES / STEP / REASON.
  • Live drill. A two-seat simulation built with FastAPI: one person is the control room, the other is the driver, and they talk only by voice over LiveKit. Claude reads the radio and the train state and writes a short flag to the controller only when something goes wrong ("Train A cleared for 160 km/h. LZB is down: on sight, 40 at most"). It stays silent otherwise and every flag can be acknowledged.
  • Design. A white, one-sentence-per-screen identity, so the controller sees a single clear flag and not a dashboard.
  • Business case. ADIF runs 19 regional control centres; we estimate about 240 control positions. At €40k per position per year:

$$ 240 \text{ positions} \times \text{€}40{,}000 \approx \text{€}9.6\text{M per year} $$

That is less than 5% of a single ERTMS signalling contract (€214M for Murcia–Almería).

Results

On 200 held-out synthetic logs with phrasing the model never saw in training:

Untuned + rules in prompt Fine-tuned
Verdict accuracy 60% 86%
Verdict and rule exactly right 11% 86%
Precision 56% 81%
Violation recall 100% 95%

Fine-tuning took about 43 minutes over two AutoScientist iterations.

Challenges

  • No real data. DaVinci, ADIF's traffic-management platform, has no public API, and real radio recordings are not public. We had to build every scenario from the rulebook and from press reports, which are still preliminary.
  • False alarms against missed errors. A supervisor that cries wolf gets switched off. Raising precision from 56% to 81% mattered more to us than squeezing out the last point of recall.
  • Being honest about the demo case. On the real Urda log our model gets the verdict right (violation) but blames the wrong rule. We report that rather than hide it.
  • Spanish. Accuracy is 95% in English but 78% in Spanish, and Spanish is the language of the control room. That is the first thing to fix.
  • Staying on the right side of the law. Under the EU AI Act this is likely a high-risk system. That is why Copi only advises: the human keeps the decision, and ADIF keeps the responsibility.

What we learned

  • The hard part is not the AI. It is encoding the protocol precisely enough that a machine and an investigator would agree on what "following it" means.
  • For narrow, rule-based judgement, fine-tuning beats prompting: the same 4B model went from 60% to 86% accuracy. And a 4B model is small enough to run inside the control room, without the data leaving it.
  • In safety-critical systems, advise, don't act is a feature: it makes the system easier to certify, easier to trust and easier for controllers to accept.

What's next

A paid pilot in one ADIF control centre, running in parallel without sending alerts at first, to measure precision on real traffic. Then the rest of Europe and the UK, where the same gap exists. Then air traffic control, and any critical system where a single human carries the full responsibility.

Built With

  • adaption
  • claude
  • codex
  • disaster
Share this project:

Updates