Thirty days live, measured, and reproducible from the repository
Millions of card payments an hour, each decided in milliseconds before the money moves. What happens when the fraud changes?
When you tap a card, the bank has a few dozen milliseconds to approve the payment, send it
to a person to check, or decline it. Deciding that fast is the easier problem. The harder one
is that fraud keeps changing, so a model that was right last month starts making mistakes,
usually because the traffic it learned from no longer looks like the traffic it sees. This
platform is the machinery around the model. For thirty days it decided every transaction in
milliseconds, noticed when the traffic shifted, retrained, and promoted no new model until a
person had reviewed the evidence.
A thirty-day live window
Open the dashboardRead the codeA snapshot of the live Grafana dashboard, with all thirty days of the window's data. This page explains the numbers.
to decide 99 transactions in every 100, over thirty days liveagainst a 50 ms budget
transactions an hour, and it kept upfour times the live stream's average, one scorer, every run
Same dayevery fraud shift flagged on the day it beganand nothing flagged in the clean week before the first one
more fraud caught a year by the same eight analystsby ranking the review queue on expected loss instead of score
The live stream is synthetic. A generator plays card transactions over an entity graph of
200,000 cards, 150,000 devices and 4,000 merchants, with three kinds of fraud acting on it,
and no real payment data is involved. A public fraud competition's data runs through the
same pipeline offline. Every number on this page says which of the two it came from and
carries a 95 percent confidence interval.
See how it's built in four diagrams.
See it running
The platform in a short video, with sound.
What happens in those few milliseconds
Each transaction goes through the same five steps. The times are the 99th percentile of each
step, measured on the live machine with the live configuration: the champion model deciding,
a challenger scoring beside it in shadow, and every decision written to history. Pick a load
to see where the time goes as it rises.
The model is the smallest part.
The sixteen features the model sees, in plain words
A feature is a fact about the recent past, such as how busy this card has been or how many
different cards this device has carried. Each one is computed once, by one piece of code,
and written in the same call to the store training reads and the store serving reads, so
the model is never trained on a number it will not be given in production. A test
recomputes them from the raw log and fails if any of them could have seen the future.
How fast, and how much it can take
Five runs at each load, on the live machine (4 virtual CPUs). The lines are the typical
decision (p50), the slowest one in twenty (p95) and the slowest one in a hundred (p99),
timed from the moment a transaction is sent to the moment its decision is on the stream.
The whiskers are the 95 percent interval across runs. Point at a load to read it.
A load test times every decision exactly, but only for twenty seconds.
Running for days, the platform shares the machine with its own housekeeping, and the
dashboard estimates its percentiles from histogram buckets instead of timing each
decision, so its p99 reads higher. The next section is measured that way, across every
day of the live window.
The live window, day by day
Every decision since the live window opened, counted from the metrics the stack kept. Each
bar is one UTC day, and its height is the share of that day's decisions that took longer
than the 50 ms budget, from the moment a transaction was sent to the moment its decision
was on the stream. A bar below the dashed line is a day whose p99 was inside the budget.
The thirty days ended on 29 October; the stack ran on until 7 November so the last week's
fraud labels could arrive, and those days are drawn too. Point at a day to read it.
Every day as a table
Fraud changes. Does anyone notice?
A fraud model learns from the past. When fraudsters change tactics, the payments it sees
stop looking like the ones it learned from, and its decisions get worse without any error
to say so. Every day the platform checks 17 signals for this: the sixteen facts the model
is given about each payment, such as how many cards a device has used in the last hour,
plus the model's own fraud score. For each one it asks whether the day's values still look
like those of the week the model was trained on. A signal that has moved too far counts as
shifted, which is what "drift" means here.
To test the monitors, the generator played fifty days of payments, 86 million of them, and
changed the fraud three times on days the monitors were not told about. The top of the
chart shows what each change did: card testing doubled how common fraud was, the next
change raised payment amounts by a third while fraud stayed where it was, and account
takeovers moved more of it online. Below that, each row is one of the 17 signals and each
column a day. A coloured square means that signal had shifted that day. The dotted line
marks the day the monitors asked for a new model.
Every change is flagged on the day it starts, and the quiet week flags nothing.
The second shift matters most. Amounts move while the share of fraud stays the same, so
an alarm on the fraud rate would see nothing, yet the model is now scoring traffic unlike
anything it was trained on. The thresholds are published conventions, fixed before any
drift was seen and not revisited after these results.
How a day is judged, and why two days are needed
What retraining can and cannot do about it
The alarm opens a retraining request. The job fits a new candidate, compares it with the
current champion on transactions neither has seen, writes the evidence into a pull request,
and stops. The score is PR-AUC, how well a model puts fraud above everything else; 1.0 is
perfect, and 0.03 is what guessing would score on this stream.
Nothing promotes itself
1Drift on two days running opens a request, and an email says so.
2A candidate is fitted once enough of the new days' labels have arrived, and compared on rows neither model saw.
3A pull request carries the model file and its evidence. Merging it is the approval to run it in shadow.
4A week in shadow: it scores live traffic beside the champion and decides nothing. Or, sooner, a replay: it scores recorded days it was never trained on, from the features the scorer served, beside the scores the champion gave live.
5The promotion gate needs its whole confidence interval to clear a non-inferiority margin, then opens a second pull request.
6A person flips the flag. Rolling back is the same flag: from the flip to the old champion deciding again.
During the live window the platform opened these pull requests itself, on
the repository's pull requests page,
where the evidence it wrote each day can still be read.
The first live model was wrong from the first day
The champion that opened the window had been trained on a scaled-down copy of the stream,
4,000 cards and 80 merchants. Live, among 200,000 cards and 4,000 merchants, its inputs
took values it had never seen, and it flagged far more transactions than it should while
catching little more fraud than chance. Nothing caught this at first. The drift monitors
compare the stream with its own first days, so a model that is wrong from day one looks
normal to them, and the labels that say which transactions were fraud arrive a week late.
Once the labels were in, the platform measured the model, retrained on the window's own
history, and judged the new model on days it had never seen. A person approved it on
12 October.
Then the fraud shifted
The retrained model decided for ten days. From 10 October the monitors flagged a shift in
the average amounts per card, device and merchant, and a second candidate, fitted on the
shift's first two days, went through the same replay and the same person.
The monitors flagged the stream again on 27 and 28 October, in the same amount averages
and in how many cards a device carries in a day. A third
candidate was fitted on those days. A person merged it to run in shadow on
6 November, but the stack was shut down the next day before it could be replayed, so it
never decided anything. Its pull request is on
the repository's pull requests page.
Who should the analysts look at first?
The bug it caught on the first day
A costly mistake in fraud modelling is training on information the model will not have at
decision time. Such a model scores well in testing and badly in production. The test for it
was written a week before the first feature existed, and it failed on the day the features
were written.
12:00:00.000payment A
12:00:00.000payment B sees A in its own past
12:05:00.000payment C
Two payments on one card can carry the same timestamp. The engine counted the first as
history when it scored the second, which a model in production could never know at that
instant. On the public competition data it served a wrong value on
65 of 590,540 rows, about one in nine thousand: too rare for any
accuracy figure to show, and permanent once trained on.
What happens when the machine is taken away
The platform was built to run on a spot instance: spare cloud capacity at a fraction of the
price, which AWS can take back with two minutes' notice. For 72 hours before go-live the
whole stack ran at the live rate, and AWS took the machine away
times. Each mark below is one of them, and its length is
how long the platform took to decide on time again.
Transactions wait in the stream while a new machine boots. The scorer
saves its feature state to a disk that survives the machine, so a replacement restores
what every card, device and merchant has been doing and does not treat them all as
strangers for a day. The minutes of catch-up count against uptime and are reported beside
the latency.
Spot did not survive the live window. The window opened on a 16 GB spot
machine on 28 September, and in its first 28 hours AWS took the machine back thirteen
times. The platform recovered by itself from twelve. The thirteenth exposed two faults, a
restore that ran the machine out of memory and state files left empty by the hard stop,
and the window was stopped. It restarted on 29 September for thirty days on an on-demand
machine with 32 GB, which AWS does not take back. The repository's ADR 31 has the details.
How to read the dashboard
The dashboard was the platform's own monitoring, public and read-only while the stack ran.
The live one went down with the stack on 7 November. The button at the top opens
the same dashboard
as a Grafana snapshot with the thirty days of the window saved into it, and the repository's
deploy/archive/serve.sh serves the archived metrics again in full. This is what
each part shows and what normal looked like.
The six numbers across the top
The median, p95 and p99 of event to decision over the last 30 days and the last 7, each
drawn over a trend of the same figure. A number turns red while it is over the 50 ms
budget. On 31 October the 30-day p99 was 46.6 ms and the 7-day p99 49.4 ms.
Decisions a second
Between about 775 and 1,450 in the window's last week. The traffic follows a daily
cycle, quietest around 08:00 UTC and busiest in the evening, with some noise each hour,
as real card traffic has.
Event to decision, p99, last five minutes
The latency right now, estimated from histogram buckets. Over the last week it read
about 25 ms at the quietest times and about 46 ms at the middle of the range, and it
passed the 50 ms budget in the busiest evening hours, when the history compactor
competes with the scorer for four virtual CPUs. The load test reads 8 ms because it
times each decision exactly with nothing else running.
A gap, then a burst
A scorer restart, usually to roll out a new image. Decisions stop and "since the last
decision" climbs for five or six minutes while the scorer restores its state, then it
works off the backlog faster than it arrives. Every transaction is still decided, and
the late ones count as late. On the spot machine before 29 September, the same shape
meant AWS had taken the machine back.
While caught up
The same latency with every catch-up left out, which shows how the platform performs
when it is current. The live report leaves out only catch-ups after a reclaim AWS
announced, and says how many.
Scorer hops
The scorer's own work, split into features, model, rules and writing the decision. Each
is well under a millisecond, so a hop that climbs points to a regression in the code.
Model deciding
Which model version made the decisions. It changes only when a person promotes or rolls
back a model, and each change is a merged pull request you can read.
Sealed before it started
A drift monitor tuned to the shifts it will face proves nothing. So the live window's fraud
schedule (when each shift comes and what it does) is derived from a secret sealed before the
window opened. Its fingerprints were committed to the repository, and the secret was kept
where the platform's builder could not read it. It was revealed on 7 November 2026, after
the stack stopped, and checks against the fingerprints below. The schedule changed the fraud
on 9 October at 18:11, 19 October at 14:11 and 27 October at 04:11 UTC; the drift monitors,
never told, flagged each on its first full day (10, 20 and 27 October) and nothing on the
days between. The revealed schedule and the comparison.
What did not work
Five things the measurements refuted, each told in full in its section above and in the
repository's architecture decision records.
Training on a scaled-down stream
The first live champion learned from 4,000 cards and 80 merchants. Among 200,000 cards it caught little more fraud than chance, and it was retrained on the window's own history.
Retraining the moment drift is flagged
Fraud labels arrive about a week late, so a candidate fitted at the alarm has seen nothing of the change. The gate refused it.
A live window on spot machines
AWS took the 16 GB spot machine back thirteen times in 28 hours, and the window failed on its second day. The thirty days ran on an on-demand machine.
Payments that share a timestamp
The feature engine counted the first as history when it scored the second. The leakage test caught it on the day the features were written.
A neural challenger
The FT-Transformer loses to the gradient-boosted champion on both tracks, by an interval that excludes zero, so the gate refuses it.
What this page does not show
The stream is synthetic, and how hard it is depends on its size. On the
scaled-down copy the first champion was trained and tested on offline (4,000 cards, 80
merchants), it scored PR-AUC. On the full live stream
of 200,000 cards and 4,000 merchants the same sixteen features separate fraud far less
well: . Guessing would score about 0.03. On the public
competition data, using only the card and amount features a stream could compute, with a
median of one transaction per card, the offline champion scores
. None of these says how well fraud can be caught in
general; the stream exists to exercise the platform.
The neural challenger loses on both tracks, by an interval that excludes
zero, so the promotion gate refuses it on both.
One region, one machine, one scorer. The architecture decision records
say what would change at ten times the scale. None of it is built.
The review queue's dollars depend on stated prices (the cost of a review,
the share of fraud recovered anyway). Which ranking catches more holds when the prices
change; the dollar amounts do not.
How it is engineered
The code is typed and tested, and every figure on this page is exported from the same
committed reports the README cites, so a stranger can rebuild both from the repository.
architecture decision records, each citing its public sources
1command writes the README's tables from the committed reports
0requests to another origin: the host's policy allows none, and a test holds the page to it
Redpanda, Kafka-compatible streaming
XGBoost
ONNX
FT-Transformer challenger
Point-in-time features, computed once
Leakage test
Shadow deployment
Rollback flag
PSI and Kolmogorov-Smirnov drift monitors
Bootstrap confidence intervals
Expected-loss ranking
Terraform
AWS EC2
Docker Compose
Prometheus
Grafana
Cloudflare Tunnel
mypy --strict
ruff
pytest
For the technical reader: the choices that are easy to get wrong
Each feature is computed once, by one dataflow, and written in the same call to the store training reads and the store serving reads, so the two cannot disagree.
The leakage test recomputes every feature from the raw log and fails on any value a transaction could not have known at the time. It was written before the first feature.
The scorer marks a batch done only after its decisions are on the stream, so stopping it can never leave half a batch decided, and a ledger drops any transaction already seen.
A challenger is promoted only when its whole confidence interval clears a non-inferiority margin, and then only by a pull request a person merges.
A retraining request needs the same signal shifted on two days running, because a single odd day is often noise.
Latency while serving and availability are reported as two numbers, so minutes spent catching up count against uptime instead of disappearing from the latency.
How this was built
I designed this platform and made the calls in it. The model is the smallest part on
purpose: what organisations usually lack is the platform around a model, so most of my
decisions are about that. The scorer reads from the stream instead of sitting behind an
HTTP endpoint. The feature engine is written here, so that training and serving compute
every feature with the same code. The promotion gate judges a challenger on its whole
confidence interval and can only open a pull request for a person to merge. The leakage
test was written a week before the first feature existed, and it caught a real leak on
the day the features were written. The live window tested the decisions too. When the
spot machine failed on the second day, I stopped the window, reported it as it happened,
and restarted the thirty days on an on-demand machine. When the first champion turned out
to be wrong from the first day, I had it retrained on the window's own history through
the platform's own path, so the replacement faced the same gate as any other model.
I used an AI coding assistant (Claude Code) for implementation and drafting, which is now
standard practice in software, data science and machine learning work. Every number on
this page can be reproduced from
the repository, and the
fraud schedule the drift monitors faced was sealed before the window opened and can be
checked against its published fingerprints.
Everything here is built from public data and public problem statements: the repository's
own synthetic generator, and the IEEE-CIS Fraud Detection competition data, used under its
terms and never redistributed. The drift thresholds are published credit-scoring
conventions, fixed before any drift was seen, and every architecture decision record cites
its public sources.
Glossary
p50, p95, p99
The time within which half, 95 in 100 and 99 in 100 decisions were made. A p99 of 45.8 ms means one decision in a hundred took longer.
Latency budget
The longest a decision may take: 50 milliseconds here.
Champion and challenger
The champion is the model that makes the decisions. A challenger scores the same transactions beside it and decides nothing, so the two can be compared on identical traffic.
Shadow
Running a new model on live traffic without letting it decide anything.
PR-AUC
How well a model puts fraud above everything else, from 0 to 1. Guessing scores about the share of fraud, about 0.03 on this stream.
Drift
When the payments a model sees stop looking like the ones it learned from, so its decisions get worse without any error to say so.
Population stability index, Kolmogorov-Smirnov statistic
Two standard measures of how far one day's values have moved from a reference week's. Credit scoring has used both, with fixed cut-offs, for decades.
Non-inferiority margin
How much worse a new model is allowed to be before it is refused. The gate promotes only when the whole confidence interval clears it.
Confidence interval
The range a measured number would likely fall in if the measurement were repeated. Here it is a 95 percent bootstrap interval: the data is resampled many times and the middle 95 percent of the results is kept.
Leakage
Training a model on information it would not have at decision time. Such a model looks good in testing and fails in production.
Expected loss
The chance a transaction is fraud, times the money at stake, less what a chargeback would recover anyway, less the cost of a review.
Spot instance
Spare cloud capacity rented at a fraction of the price, which the provider can take back with two minutes' notice.
Redpanda
A message stream compatible with Kafka. It keeps every transaction until it is decided, so nothing is lost when the scorer restarts.
ONNX
A standard file format for trained models, so a model trained in one tool can be served by another.
SHA-256
A fingerprint of a file. Change one character and the fingerprint changes completely.