
The problem
Anomaly detection in business systems is usually solved with hand-authored rules. "Flag invoices above €10,000." "Flag any vendor without a PO." "Flag amounts that deviate more than 2σ from the supplier's mean." The rules are honest, they are auditable, and they catch a portion of the real anomalies — but they also flag a lot of false positives, and they miss the cases where the surface fields look fine but the combination is wrong.
The combination is where the anomalies actually live. A €1,200 invoice from a stationery vendor is normal; a €1,200 invoice from a stationery vendor coded to the IT-infrastructure GL account is not. The amount is unremarkable; the vendor is unremarkable; the combination is the anomaly. Rules do not catch this because rules look at one field at a time.
The predictive system catches it because the predictive system knows what to expect from the combination. If the prediction is confident and gives the actual posting little probability, it is not just unusual — it is contradictory.
How it works
Inverse prediction is the simplest anomaly pattern in Aito. The system predicts what a normally-coded transaction should look like given its surrounding fields. The actual posted value is then looked up in that prediction: its probability p gives the anomaly score, (1 − p) × 100. A value the history often uses scores low; one it rarely uses scores high; one that is not among the listed alternatives at all gets at most the smallest listed probability. In the ERP demo, 85 and above is high severity and 60 and above medium.
The same query that drives auto-routing on a forward prediction drives anomaly detection on a backward check. No separate anomaly model; the same _predict is read in two directions. The system runs the check at posting time, before the entry is committed, so the anomaly is caught while it is still cheap to fix.
The ERP demo shows it beside two related checks: amount-spike (how few of the supplier's past POs were this large) and unknown-vendor (no purchase on file names the vendor). Those two read the history with _search rather than _predict, but all three are scored on the same (1 − p) × 100 scale, so they rank in one list.
{
"from": "purchases",
"predict": "account_code",
"where": {
"supplier": "Wärtsilä Components"
},
"select": [
"$p",
"$value",
{
"$why": {
"highlight": {
"posPreTag": "«",
"posPostTag": "»"
}
}
}
],
"limit": 10
}
// Look up the actual account_code among these hits. Its $p is p;
// if it is absent, p is at most the smallest listed $p.
// Score = (1 - p) * 100; 85 and above is flagged high.For the full architecture, see the technology overview. For the broader narrative across multiple use cases, read The Predictive Application.
See it live
This use case runs in 2 live demos today, the 📋 ERP and 🧾 Accounting demos. Each link opens the view that shows it, where you can inspect the queries that produce the result.
Frequently asked
How does this compare to rule-based anomaly detection?
Rules catch a portion of real anomalies and create a lot of false positives. Inverse prediction catches what rules miss: anomalies in the combination of fields. The system is not predicting "what is unusual" — it is predicting "what should be normal here," then flagging when the actual value contradicts the prediction. The two are complementary; mature deployments run both.
How accurate is anomaly detection on first-time vendors?
First-time vendors (or first-time combinations) return low prediction confidence — the system correctly says "no prediction yet" rather than guessing. Those rows route to manual review via the unknown-vendor subtype rather than being mis-flagged as anomalous. Mature deployments rarely auto-flag a first-time vendor as an anomaly; they route it to a clerk to confirm.
What is the false-positive rate?
The false-positive rate at a given threshold depends on your data; measure it on history, where the outcome of each flagged row is known, before choosing the threshold.
Can the system explain why something was flagged?
Yes. The flag states what the prediction expected and with what probability, next to the probability of the actual value. Every prediction also returns $why with the base probability and per-feature lift factors, so the reviewer can see in one glance why the actual did not match.
Does this work for non-financial anomalies (HR, support tickets, fraud detection)?
Yes. Any domain where a "normal" outcome is statistically determined by surrounding fields supports inverse prediction. HR onboarding fields, support-ticket routing, project staffing, fraud signals — all run the same anomaly pattern. The threshold tuning differs per domain but the mechanism is the same.



