Same Input, Same Output: Engineering Reproducibility Into AI Systems

Read Time: 6 minutes
Authored by: Matt Katz
Innovation & Tech
All Segments

Summary

Reproducibility is how a business knows a number is true. Matt Katz, Field CTO at Arcesium, explains where an AI model belongs in a financial workflow, why every calculation with a right answer runs in deterministic code, how to test a step that will not repeat, and when the engineering stops paying for itself.

Where does the idea of reproducibility come from in software engineering? How does it affect the use of AI for investment management? And how do you test something that won’t give you the same answer twice? Matt Katz explains in this Q&A.

1. Where does the idea of reproducibility come from, and what does it mean for a financial system?

Reproducibility comes from scientific testing, and the question of how we know when something is true. People think about science as a set of laws like the law of gravity. But there is no law. It’s just something we strongly think is true. We think so because experiments keep matching our hypothesis.

When you get to investment management, what you want to be true is how much money is in your portfolio, what you made, how many shares you have, and when a corporate action happened, what you elected. Financial reproducibility in that sense is very similar to the scientific version.

Agentic AI has increased the interest of both developers and users in the topic. People want to know whether an agent makes the right or true decisions. They can tell if it does by running it multiple times; it does the same thing each time, and that’s what everyone agreed they wanted to happen.

2. Where should an AI model do the work in a financial workflow, and where should conventional software take over?

Agents, or large language models (LLMs) in general, are great for some tasks, like writing code, recognizing handwriting, or reading text. What you look for in those is whether a similar prompt yields code that roughly does what you expected.

A lot of what agents and harnesses intend to do is to make sure you get something that matches what you expected. A “harness” simply refers to code that coordinates the work, clarifying the task, sending it out to be done, evaluating it against criteria, and then calling it done or sending it back for improvement. Because LLMs are, to some extent or another, text generators, the same prompt gives you a different thing. A harness gives you a way to tell whether what came back is what you expected, whether the code compiles, and whether it runs the right kind of tests.

That makes a lot of sense in coding and in character recognition and OCR, where you can feed in a sample set of invoices, documents, or prospectuses you want to read and see whether you get the kind of values you expect over time. The inputs are hard to understand, so you want a system that turns them into simple sets of data, and then applies deterministic rule sets over them. For most financial systems, you’re interested in absolutely deterministic outcomes, even if the outside world is complicated.

Because of that, when a step has to be probabilistic, you test it repeatedly, across multiple rounds, and you run it past a second check rather than trusting one pass. What you’re building toward is a set of rules you can rely on. The harness enforces those rules, and once they hold, a step that looked non-deterministic starts behaving deterministically. What’s deterministic, underneath, is a bunch of if-else conditions.

You want to enforce determinism as far as you can for the kinds of problems where there are right answers. And you want to use creative tools, including LLMs, to help you discover the rule sets that get you there.

3. How do you test something that won’t give the same answer twice, and how do you keep that affordable?

You don’t run the same test 20 times if you can avoid it. It’s expensive, and the only time it’s worth it is when the situation is inherently non-deterministic.

Most code isn’t. If a function takes two strings and hands back string A concatenated with string B, you write one deterministic test, and it keeps working until somebody changes the implementation.

What’s harder is something like picking out the central thesis of an investment brief prospectus. You and I might read the same thing and phrase it differently, but there’s no way to settle the difference mathematically. Human teams resolve this by asking for additional opinions and seeking consensus. For AI, the equivalent is to run it many times and look at what comes back. If most of the runs that summarize a brief come back the same and one wanders off somewhere else, the consensus is your answer. That’s how you get closer to reproducibility without a deterministic system underneath.

The same split shows up when I interview developers. I give them code to write, because I want to see how they solve problems, and they can solve the same problem many different ways. Whether the code is correct is testable. Whether it’s maintainable, whether it uses variable names everyone on my team can work with, is a judgment, so I ask a couple of people, and if everybody agrees it’s good, it’s good. If we disagree, that is interesting, and we then explore why we don’t agree.

Our friends in the risk departments have been doing this for a long time. They tweak model parameters a little bit here and a little bit there, run all the possibilities, average them out, and say, most of the time, you’re not bankrupt. Then they call it a good model. Most of the time, you get to keep the money. You can’t protect against everything, but you can cover some bases and get closer to what is true.

4. Does the standard of reproducibility change depending on what you’re using the model for?

Think about writing emails. It seems like a slam dunk, but different prompts lead to different outputs, and some will perform better with your recipients than others.

If you were building an email drafting agent, you wouldn’t give it one task, watch it reply, and decide it’s ready to write to everybody who matters most in your business. You’d give it the same task several times and see what came back differently each time. What you’re looking for is the rare run.

Every once in a while, it misuses a word, and you don’t want that in a business email. Every once in a while, it uses offensive language. Or it decides it’s okay to share company secrets. You only find those by running it enough times to see them.

For creative tasks, you might get variable output while still achieving a reproducible result within certain bounds. For things that are financial, you don’t want the numbers to add up differently on different days.

5. Is there a point where reproducibility is over-engineering?

If you’re writing a business plan and using an LLM to help you think it through, you’re still producing the document. It’s one-off work, where you are driving. It’s going to work, or it’s not. You don’t need it to be reproducible.

The same goes for a lot of code written by quants for very specific market events, or by scientists trying to solve specific problems. By software engineering standards, it doesn’t hold up. It isn’t testable, it isn’t reproducible, it can’t easily be changed tomorrow, and it isn’t well documented.

They don’t care, and they’re right not to. They need to get from this piece of data to that piece of data, they’re deeply involved at every step, and they’re using it as a power tool to get the job done. They are the check, so the code doesn’t have to be.

That’s the difference between someone hand-making a beautiful single chair and what IKEA does. They’ve got a factory, and they’re pressing sawdust into chair shapes at great speed. Everything must be reproducible at the level of a factory, because they’re doing the same thing over and over.

It comes down to how many times you’re going to run it. A thousand times, and reproducibility pays for itself. Once, with you involved at every step, and you’ve built a factory to make one chair. That’s just not worth it.

Developers figured out how to make AI reliable. Finance can borrow the playbook.

Matt Katz's profile photo
Authored By

Matt Katz

As Arcesium's Field CTO, Matt leads Arcesium's Forward Deployed Software Engineering and Client Success teams. His work to empower clients and simplify technical challenges stems from a 25-year career in financial technology working with clients and software. Outside of work, he enjoys books, bikes, and boards.

View Author Profile

Share This Post

Subscribe Today

No spam. Just the latest releases and tips, interesting articles, and exclusive interviews in your inbox every week.