“It Works” and “It’s Allowed to Work” Are Different Statements
The hardest part of putting an AI system into production in a regulated market isn’t the AI. It’s the distance between a prototype that works and a system that is permitted to touch real transactions, and that distance is filled with work almost nobody writes about: governance, auditability, reproducibility, deciding where failures go, and the uncomfortable question of who is accountable when a model is wrong. I’ll keep this at the level of principles rather than specifics, for reasons that should be obvious, but the principles are the interesting part anyway.
The model is the least regulated part of the system
Coming out of college, I thought of the model as the system. In financial markets, the model is one component sitting inside several layers of controls, and most of the engineering effort lives in those layers. Three questions end up shaping almost every decision.
The first is where the data goes. Sensitive financial documents can’t leave controlled infrastructure, and that single requirement decides how you serve the model, how you log, how you evaluate and which third-party tools exist for you at all. Running inference inside the cloud boundary under identity-based access control isn’t a preference. It’s the precondition for the project existing. The second is whether you can explain a decision months later. Not whether the model can explain itself, but whether you, as an organisation, can reconstruct exactly why a particular output was produced on a particular day. That requires persisted traces of every stage, versioned prompts, pinned model identifiers and recorded validation results. Observability stops being a debugging convenience and becomes a compliance record. The third is who is accountable. For anything consequential, the answer is a person, which means human review isn’t a crutch you remove once the model improves. It’s a designed part of the control flow, with defined triggers and defined owners.
That framing changes what the interesting engineering problem is. The industry usually talks about human review as temporary, something to engineer away once the model is good enough. In a regulated setting that’s simply the wrong goal. The question isn’t how to remove the human. It’s how to route the right cases to a human with enough context for them to decide quickly: which confidence signals are trustworthy enough to act on, which failures can recover automatically and which must escalate, what a reviewer needs to see to make a decision in thirty seconds rather than ten minutes, and how their corrections flow back into the evaluation set. That last one is the most underrated, because every correction is a labelled example of exactly what your system finds hard.
Where compliance and good engineering agree
My favourite discovery here is how neatly regulatory pressure and good engineering point in the same direction. Regulators want reproducibility, and engineers want testability. Regulators want auditability, and engineers want to be able to debug. Both get what they want from the same decision, which is to keep the unpredictable part of the system as small as possible. Parse with libraries rather than models. Validate with schemas rather than judgment. Compute with code, never with the model. Render the output from templates, so it can be diffed and can’t invent a figure. The model ends up confined to the one thing it’s irreplaceable for, reading messy human-written documents and mapping them to meaning, and everything around it is ordinary, auditable software. I adopted this principle for engineering reasons when I joined. It turns out to be the compliance answer as well, which is probably not a coincidence.
Testing software that never gives the same answer twice
Traditional continuous integration rests on a comforting assumption: the same code with the same input produces the same output. LLM systems break that at the root, so the definition of a change has to widen. Behaviour can shift because of the application code, but also because of prompt text, few-shot examples, schema definitions, sampling parameters, the model version and even an update the provider makes quietly behind a model name that hasn’t changed. Everything that can be versioned has to be, and every prompt carries a version string that gets stamped into every trace. The provider-side updates can’t be versioned, so they have to be watched for instead.
Our quality gates come in three tiers. Every commit runs fast deterministic tests on the parsers, validators, business rules and prompt templates, plus a smoke run over a handful of canary documents; most of an LLM pipeline is ordinary code with ordinary bugs, and teams skip these tests precisely because the project has “AI” in its name. Every merge runs the full golden-set evaluation, scored per field and per document template against the current baseline. The sentence that blocks a merge is never “accuracy is 98%.” It’s something like “line-item extraction is up 2.1 points, but bank-detail detection dropped 4.3 points on template C,” because aggregate accuracy hides exactly the regressions that matter. Before a release, critical cases are run several times to check variance, and cost and latency get their own gates, since a prompt “improvement” that doubles the spend per document should fail loudly.
The detail that keeps these gates trustworthy is the noise floor. Pinned versions and a temperature of zero shrink variance, but they don’t remove it, so before gating on any metric we run the baseline several times and measure how much it moves on its own. If field accuracy wanders between 97.4 and 98.1 with no changes at all, a new prompt scoring 97.5 isn’t a regression, and one scoring 96.2 is. Skip that step and you get a flaky gate that everyone quietly learns to ignore within a month. This is research methodology applied to a build pipeline. After three years of reading papers that left out their error bars, I’m unusually insistent about it.
The failure that never announces itself
What worries me most isn’t a bad deployment, which at least announces itself. It’s the system slowly getting worse while nobody changes anything. A new client starts sending a different template, document formats drift, or a provider updates a model behind a stable name, and quality erodes with no commit to blame. The defences are dull and effective: track validation failures and repair rates for each stage over time, run scheduled evaluations against the live configuration rather than only on merges, and watch metrics per template, because degradation almost always starts in one segment long before it shows up in the average.
If someone asked me for advice before shipping their first regulated AI system, I’d tell them to build the evaluation harness before the system, which I’ve now learned three separate times and am still mildly annoyed about. I’d tell them to design the review queue on the first day, since it’s simultaneously their safety net, their accountability story and their best source of labelled data. And I’d warn them the model will be perhaps a fifth of the work. The rest is what makes it allowed to run. All of that leans on extraction having things to check against. My other system, the one people talk to, doesn’t.
Leave a Reply