Allan Ramos
← Blog

Testing software when behaviour is probabilistic

Unit tests that expect one golden sentence break on every model bump. That does not mean “skip tests.” It means change what you assert. Probabilistic components need a testing strategy that admits variance while still protecting the business from harm.

Quality engineering for AI is still engineering. It just uses different oracles.

A practical pyramid

Deterministic core: still classic tests—rules, calculations, authz, schema, workflow transitions. AI edges: curated cases with acceptable bands, semantic checks, and adversarial prompts. End-to-end: critical journeys with human review sampling and clear severity labels.

Track offline eval scores the same way you track coverage—imperfect, but trending matters. A single average “helpfulness” number is usually too coarse; split by journey and risk class.

Define failure in business terms

Wrong tone is not the same as wrong balance or leaked PII. Severity should drive release gates. Build a taxonomy: cosmetic, misleading, financially wrong, privacy-breaking, unsafe instruction followed. Gate releases on the classes that hurt.

Involve domain experts in labelling. Purely engineering-built sets under-represent rare but expensive cases operations already fears.

Fixtures, judges, and humans

Use fixed fixtures for extraction and classification where ground truth exists. Use secondary models or rule judges carefully—and calibrate them. Use human review for high-severity samples and for disagreements.

Automate what is stable; sample what is fuzzy. Do not pretend a judge model removes the need for human accountability on regulated outcomes.

Regression and change management

Every prompt, model, and tool-policy change should run the relevant eval packs before promotion. Keep a holdout set the team does not tune against weekly. Record versions alongside results so you can explain a regression.

When a provider changes a model under a stable name, treat it as a dependency upgrade: re-run gates. Silent upgrades are silent production changes.

Testing the shell around the model

Many production failures are not “the model was dumb.” They are timeouts, tool permission errors, retrieval misses, and bad fallbacks. Test those paths with the same seriousness as the happy prompt.

Chaos and latency injection belong here. If your journey cannot survive a slow model, your tests should say so before your customers do.

Culture

Make failing evals a normal, blameless reason to block release. Celebrate teams that catch severity bugs in eval rather than in complaints. Probabilistic software can be engineered carefully—or it can be demoed carefully and operated recklessly. Testing is how you choose.

How this plays out in delivery

In practice, the difference between a slide and an operable change is whether teams can point to owners, controls, and evidence under pressure. That pressure arrives as an incident, an audit question, a vendor outage, or a steering committee that wants to scale a demo. If those answers are improvisations, the feature was never production-ready—regardless of how polished the interface looked in a pilot.

Delivery leaders should therefore reserve explicit capacity for the boring work: contracts, runbooks, evaluation packs, fallback paths, and decision records. Boring work is what makes ambitious AI and platform change survivable. Skipping it to protect a velocity chart is how organizations repurchase the same programme every three years under a new name.

Questions worth asking in design review

Who owns the outcome after launch? What fails first when the dependency is slow or wrong? Which data classes are in motion, and under which policy? What would make us pause or roll back within an hour? What evidence will we examine weekly to know quality is holding?

If a proposal cannot answer those questions without hand-waving, keep the scope in a controlled experiment. Experiments are useful. Unowned production traffic is not an experiment—it is a risk acceptance you forgot to record.

Working habits that keep quality compounding

Write short decision records when you cross a boundary. Keep a living list of invariants for each critical capability. Review with a checklist that targets blast radius rather than style. Instrument silent failure modes, not only HTTP errors. Revisit model, prompt, and vendor changes with the same seriousness as database migrations.

None of these habits require a new framework brand. They require leadership attention and a refusal to confuse demos with operable systems. Teams that practice them can adopt assistants, agents, and new platforms without losing the enterprise plot.

A note on language and accountability

Replace slogans with operational nouns: capability, owner, control, fallback, evidence, exit. Language shapes governance. Teams that speak only in broad transformation slogans struggle to assign accountability. Teams that speak in capabilities can fund, staff, measure, and stop work when the evidence says stop.

Hold that vocabulary in architecture forums and programme boards. Over time it becomes the shared spine that lets software development absorb AI tools without fragmenting into disconnected experiments.

Closing

The through-line is simple: treat AI-related change as architecture and operations work, not as magic. Make ownership explicit, put uncertainty where blast radius is acceptable, measure what can silently fail, and refuse to scale what you cannot run. That discipline is how software organizations get durable value from new techniques instead of a temporary theatre of progress.

How this plays out in delivery

In practice, the difference between a slide and an operable change is whether teams can point to owners, controls, and evidence under pressure. That pressure arrives as an incident, an audit question, a vendor outage, or a steering committee that wants to scale a demo. If those answers are improvisations, the feature was never production-ready—regardless of how polished the interface looked in a pilot.

Delivery leaders should therefore reserve explicit capacity for the boring work: contracts, runbooks, evaluation packs, fallback paths, and decision records. Boring work is what makes ambitious AI and platform change survivable. Skipping it to protect a velocity chart is how organizations repurchase the same programme every three years under a new name.

Questions worth asking in design review

Who owns the outcome after launch? What fails first when the dependency is slow or wrong? Which data classes are in motion, and under which policy? What would make us pause or roll back within an hour? What evidence will we examine weekly to know quality is holding?

If a proposal cannot answer those questions without hand-waving, keep the scope in a controlled experiment. Experiments are useful. Unowned production traffic is not an experiment—it is a risk acceptance you forgot to record.

Working habits that keep quality compounding

Write short decision records when you cross a boundary. Keep a living list of invariants for each critical capability. Review with a checklist that targets blast radius rather than style. Instrument silent failure modes, not only HTTP errors. Revisit model, prompt, and vendor changes with the same seriousness as database migrations.

None of these habits require a new framework brand. They require leadership attention and a refusal to confuse demos with operable systems. Teams that practice them can adopt assistants, agents, and new platforms without losing the enterprise plot.

A note on language and accountability

Replace slogans with operational nouns: capability, owner, control, fallback, evidence, exit. Language shapes governance. Teams that speak only in broad transformation slogans struggle to assign accountability. Teams that speak in capabilities can fund, staff, measure, and stop work when the evidence says stop.

Hold that vocabulary in architecture forums and programme boards. Over time it becomes the shared spine that lets software development absorb AI tools without fragmenting into disconnected experiments.

Closing

The through-line is simple: treat AI-related change as architecture and operations work, not as magic. Make ownership explicit, put uncertainty where blast radius is acceptable, measure what can silently fail, and refuse to scale what you cannot run. That discipline is how software organizations get durable value from new techniques instead of a temporary theatre of progress.

Building an evaluation kit

Start with twenty to fifty high-value cases per critical journey, labelled by severity. Add adversarial and empty-retrieval cases. Automate scoring where stable; sample the rest. Grow the kit from production disagreements weekly. Freeze a holdout set.

Own the kit like a product. Without ownership, evals rot and teams stop trusting them—then they bypass the gate and you are back to vibes.

CI integration patterns

Run fast smoke evals on every prompt change. Run fuller packs nightly or pre-release. Block on severity-class failures. Allow known flaky cosmetic checks to warn without blocking, but keep that list tiny and reviewed.

Store results with versions so you can explain why a release was blocked or approved. Auditors and future you will ask.

Human review sampling

For customer-facing generative flows, sample daily outputs for expert review even when offline scores look fine. Distribution shift is real. Sampling is how you catch new failure modes before complaint volumes spike.

Feed sampled failures back into fixtures. This is the quality flywheel. Without it, testing is a gate you argue with rather than a system that learns.

Putting it into the operating rhythm

None of this sticks if it appears only in a one-off workshop. Put the checkpoints into existing forums: design authority, risk intake, sprint reviews, and operations reviews. Assign named owners. Review the same metrics until the behaviour becomes muscle memory. Tools change. Operating rhythm is how architecture survives tool change.

When you expand scope—new channel, new market, new model provider—re-run the same questions rather than assuming last quarter’s controls still fit. Scope expansion is where quiet regressions hide. A short re-certification beats a long incident report.

What good looks like after six months

You can name owners for each AI-touched capability. You can show evaluation trends and cost trends. You can pause a feature without heroics. Engineers can explain the boundaries without opening a chat history. Sponsors hear outcome language and evidence, not only model brand names. That is the standard. Aim for it deliberately.

Field notes from programmes that stuck

The programmes that keep their gains share a few unglamorous traits. They name a single accountable owner for each capability touched by AI or platform change. They keep a thin evidence pack current: what the feature does, which data it uses, how quality is measured, and how to pause it. They review cost and quality on a fixed weekly or biweekly cadence instead of waiting for a quarterly surprise.

They also refuse to expand scope while basic controls are missing. That refusal feels slow in the week it happens and fast in the year it saves. Sponsors accept it more readily when you offer a dated path: we can widen to segment B when override rates stay under threshold and fallback drills pass. Conditional speed is still speed—just adult speed.

Common failure modes to watch for

Eternal pilots that serve real customers without on-call. Prompt edits in production with no version history. Retrieval corpora that mix clearance levels. Success metrics that count messages sent instead of outcomes achieved. Architecture reviews that only admire diagrams after contracts are signed. Cleanup work that is always scheduled after this critical launch.

Each failure mode is preventable with a small control. The danger is not that teams cannot invent controls. The danger is that delivery pressure makes skipping them look rational until the incident report is written.

A ninety-day improvement plan

Days 1 to 30: inventory AI-touched journeys, owners, and gaps in logging, evaluation, and fallback. Publish the list without blame. Days 31 to 60: close the top three blast-radius gaps; stand up a short design-authority slot for new use cases; put cost alerts in place. Days 61 to 90: run one controlled promotion from pilot to production using a written exit report; kill or contain at least one unmanaged experiment.

At day ninety, present evidence trends rather than tool logos. Leaders can fund what they can see. Visibility is a prerequisite for sustained investment in quality.

How this article should change Monday morning

Pick one capability you touch. Write the owner, the invariant that must not break, the fallback if the AI dependency fails, and the metric you will check next week. Share it with the people who can correct you. Then make one concrete backlog item that turns a gap into a control.

Long articles do not improve estates. Changed operating habits do. Use this piece as a mirror, not as literature. If nothing in your plan of record moves after reading it, the reading did not count.