Artificial intelligence

Spend anomaly detection: rules or AI?

Duplicates, split orders, new suppliers paid too fast: what a rule blocks at entry, where a model helps, and a complete decision table to copy.

Spend anomaly detection: rules or AI?
Contents
  1. Run the duplicate test on twelve months of payments
  2. Flag after the fact or refuse at entry: what difference does it make?
  3. How do you tell whether an anomaly calls for a rule?
  4. What should your system block before any AI?
  5. Where does a model earn its place?
  6. Why do too many alerts cancel out the control?
  7. The decision table, anomaly by anomaly
  8. Does an energy distributor need the AI module it is being offered?
  9. FAQ
  10. Sources

For most of the anomalies an AI vendor offers to detect in your spend, a rule written into the system does a better job, because a rule can refuse the transaction when it is entered instead of flagging it after the money has left. That covers invoices paid twice, orders split to stay under an approval threshold, a supplier created yesterday who receives a large transfer today, and an invoice above its purchase order. The test fits in one sentence: if you can write the condition without ambiguity, it's a rule, and it should block. A statistical model earns its place on what nobody can write down, provided your team can absorb its false alarms.

An anomaly flagged after payment means getting the money back, by chasing the supplier or asking for a credit note, with an outcome that depends on the supplier's goodwill. A system that raises more alerts than the team can read ends up ignored. Internal audit then finds a documented control that nobody performs, which is worse than no control at all, since management believes it is covered. And a model whose alerts nobody can explain is hard to defend when the external auditor asks why one invoice was held and another wasn't.

Run the duplicate test on twelve months of payments

The test needs a report accounts payable can already produce and one column added in a spreadsheet. It answers one plain question: does your system already stop an invoice from being paid twice?

  1. Pull the supplier invoices paid over twelve months, with the supplier, their invoice reference, the date, the amount including VAT and the payment date.
  2. Add a normalised reference: no spaces, hyphens, slashes or leading zeros, all in upper case.
  3. Find the rows that share supplier, normalised reference and amount.
  4. Then find the rows that share supplier and amount within thirty days of each other, with different references.
  5. For each pair, check the bank statement to see whether both payments went out.

The pairs from step 3 should have been refused by a simple rule. Each one points to a rule that is missing, badly configured or bypassed. The pairs from step 4, on the other hand, mix real duplicates, like an invoice re-sent under a new number, with legitimate recurring amounts, like a monthly subscription. That second pile is the only place where a model can start to justify itself.

Flag after the fact or refuse at entry: what difference does it make?

A rule forbids, because it runs inside the transaction itself. The invoice isn't recorded or the payment order isn't created, and the person keying it fixes the problem while the document is still in front of them.

A model only flags, and it usually works in a batch, overnight or the following week, on data that has already been recorded. It produces a list of exceptions that someone has to read and act on, and in the meantime the invoice has often been paid. You could run it at entry, but few companies accept a score they can't explain blocking a supplier payment. When a condition can be forbidden, forbid it.

How do you tell whether an anomaly calls for a rule?

Try writing the condition down. "The system refuses to record an invoice whose supplier, normalised reference and amount including VAT match an invoice already recorded" can be tested case by case. It's a rule. "The system flags unusual invoices" isn't one, since nobody can say what unusual means before seeing the data.

Plenty of conditions look fuzzy only until someone sets a parameter. "A new supplier receiving a large payment" becomes a rule as soon as you decide what new and large mean for you. Every threshold and time window in this article is a parameter to agree internally; none of them comes from a standard. The model keeps what is left, deviations in shape with no threshold anyone can write, such as a price drifting slowly or two near-identical invoices where no single field matches exactly.

What should your system block before any AI?

For exact duplicates, SAP's standard check in logistics invoice verification compares six attributes (supplier, currency, company code, gross amount, reference and invoice date), and SAP's own help notes that it only runs if the reference has been entered. Make the reference mandatory, normalise it, and check that every route by which invoices enter the system goes through the check.

Split orders are handled with a running total. The system adds up orders from the same requester with the same supplier over a few working days, and once the total crosses the threshold, the next order goes to the approval level that matches the cumulative amount. Splitting then stops being worth the trouble.

A new supplier paid fast and large needs a second approval, from someone other than the person who created the supplier record. The same logic applies to bank details changed just before a transfer, which our article on locking supplier bank details covers in detail.

An invoice above its PO is blocked by matching, with a tolerance set per spend category. Add a consistency check between committed and invoiced spend that refuses any invoice taking the billed total above what remains on the PO or contract.

Where does a model earn its place?

Near-duplicates are the first case. An invoice re-sent under a different number gets past the exact rule, and the wide rule (same supplier, same amount, within thirty days) also holds every legitimate recurring amount. A model that compares all the fields and the supplier's history sorts that batch better. On a category of several hundred items with no contract price, nobody can write a threshold per item either, while a model can spot prices that move away from their history.

It also helps choose what to review after payment. In a pilot in Brittany on French central government spending checks, according to Acteurs publics (February 2020), targeting checks with a predictive model raised the share of checked spending that actually contained an anomaly from 1.6% to 3.6%. The yield more than doubled, and yet the vast majority of the spending examined was still fine. Cases where a model is justified are a full AI project, which we handle in our AI transformation work.

Why do too many alerts cancel out the control?

Every alert takes someone's time: open the document, compare, decide, record a reason. When volume exceeds what the team can read, unopened alerts pile up, and the control shrinks to whichever alerts someone had time to handle.

Before you sign, ask the vendor to run the tool on your last twelve months and give you two numbers: alerts per week, and the share confirmed after review. Compare the first with what your team actually handles per week. Track the second monthly, because a falling confirmation rate means a team that is about to stop reading. Also require every alert to be closed with a reason from a closed list. Without that, internal audit can never tell an alert someone examined from one dismissed unread.

The decision table, anomaly by anomaly

N and X are parameters you set.

AnomalyRule that catches itWhen and effectWhat a model addsCost of a false positive
Exact duplicateSupplier, normalised reference and amount already recordedEntry, refusedNothingLow
Near-duplicateSame supplier, same amount, within N daysEntry, put on holdYes, if recurring amounts swamp the ruleMedium
Split ordersRunning total per requester and supplier over N working daysApproval, escalatedIf the splitting runs through several requestersLow
New supplier paid fastFirst payment above X within N days of creationPayment, second approvalRarelyMedium
Invoice above the POVariance beyond the category toleranceEntry, payment blockedRarelyLow
Invoice above remaining commitmentBilled total above the committed amountEntry, payment blockedRarelyLow
Invoice with no PO or contractMandatory reference, closed list of exceptionsEntry, quarantineRarelyLow
Bank details changed before a transferChange within N days before a paymentPayment, call-backRarelyMedium
Price driftNone, unless there is a contract priceMonthly reviewYes, comparison with historyHigh
Unusual behaviourNoneAfter payment, sampleYes, to rank what to reviewHigh, cap it

For a tender, give this table to each vendor with four columns to fill in for every control: its nature (rule or model), when it runs (entry, approval, payment or after payment), what it does (blocks, holds or flags), and alerts per month measured on your own history. Any control placed in the model column that you could write in one sentence deserves a question.

If you would rather replay these rules on your own payments before answering a vendor, we can do it with you in a free audit, from the data extract through to the alert volume your team would have to absorb, then track the indicators on a management dashboard.

Does an energy distributor need the AI module it is being offered?

A fuel and bottled gas distributor pays 24,000 supplier invoices a year. The company and the figures below are invented for illustration. Its software vendor is offering an AI anomaly detection module, whose pilot, run on the last twelve months, produced 2,400 alerts.

Before signing, the CFO has four rules replayed on the same year. The exact duplicate rule, after normalising references, finds 11 invoices paid twice. The ten-working-day running total turns up 37 groups of orders, each below the 50,000 dirham approval threshold, whose total exceeded it (spare parts for service stations, protective equipment, chartered transport). Six suppliers received more than 200,000 dirhams within thirty days of being created, two of them with no supporting file. And 212 invoices exceeded their PO beyond tolerance. The four rules produce 266 items to review (11 duplicate invoices, 37 order groups, 6 suppliers, 212 invoices), each with a readable reason, and every one of them could have been stopped at entry or approval.

The AI module finds 9 of the 11 exact duplicates, plus 3 the rule missed: invoices a haulier re-sent under a new number three weeks after the first. Its 2,400 alerts come to about 46 a week, for an accounts payable team that can handle 30 a week on top of its normal work. Over the year, 1,560 alerts would have been read and 840 left waiting.

The four rules become blocking controls in the ERP. The model is kept for one job: every Monday it ranks the invoices paid the previous week and surfaces the 30 most worth a second look, which matches the team's real capacity and covers the near-duplicates.

FAQ

Can generative AI read our invoices and spot anomalies on its own?

It can extract the fields from a scanned invoice or a PDF, and that helps the controls, because a cleanly captured reference and amount make the duplicate rule reliable. Deciding that an invoice will not be paid, on the other hand, stays with an explicit rule that you can show an auditor and test before go-live.

How should we judge the false positive rate a vendor quotes?

A rate measured at other companies doesn't carry over to your suppliers or your spend categories, which is why the tool should run on your last twelve months and report alerts per week. Have your team review a sample of those alerts to establish the share actually confirmed, then compare the volume with what your accounts payable team can read.

Who should handle the alerts: purchasing, accounts payable or internal audit?

A refusal at entry is handled by the person entering the document, since the reason appears in front of them. Alerts raised after payment need a named owner, a handling deadline and a closed list of closing reasons. Internal audit reviews those closures and counts repeats, without handling alerts itself, so that it stays independent.

Sources

Last verified: 2 November 2026.

On the agenda for your next purchasing committee, put a single line: the number of invoices paid twice over the last twelve months, taken from the duplicate test, with the rule that should have stopped each one.

Read next

  1. Artificial intelligence

    Supplier invoice OCR: automate and check data capture

    Field-level confidence thresholds, checks against the PO and supplier master, a validation queue and an error log, so invoice OCR never pays a wrong amount.

    11 min read

  2. Artificial intelligence

    Business Automation Software: Choosing Your Stack

    RPA, no-code, AI agents, native ERP/CRM automation: a comparison of the four software families to help you pick the right automation stack.

    8 min read

  3. Artificial intelligence

    Certified AI Training in Morocco: What Actually Counts

    OFPPT, Microsoft, Google, AWS, UM6P: which AI certifications actually matter to Moroccan employers, real prices, and which ones to skip in 2026.

    8 min read

  4. Artificial intelligence

    Free vs Paid AI Training in Morocco: What to Pick

    Free MOOCs, OFPPT programs, paid bootcamps: a comparison of adoption, follow-up and timelines to help you pick the right AI training path for your team in Morocco.

    8 min read

Let's discuss your priorities

A free audit of your information system.

For companies of 50 people or more, or with several sites, with a decision-maker present. Two to four hours of interviews, then a written report that is yours to keep.

* Required field

Only if you'd rather we called you.

A few words are enough. Don't include passwords or sensitive data.

We use this information to reply to your inquiry and, if you've accepted cookies, to measure how well our campaigns perform. To find out how it's stored and how to exercise your rights, see our privacy policy.

Would you rather talk it through?Call us on +212 715 659 190