Published: By: Max Dyrhage Reading time: 7 min

How do machine learning and A/B tests fit together in product development?

Artificial intelligence and machine learning are on everyone’s lips. Jobs being automated away, worlds ending and being saved, and industries being turned upside down. Even if some of the hype can be taken with a pinch of salt, the technology is here to stay and something to relate to.

This of course also applies to product development. Many companies have already integrated machine learning into their products and ways of working.

Starting to think about how our products work with machine learning (ML) is also quite different from how we have done things before. Why test our way to one solution that works reasonably well for everyone when we can personalise and create fully data-driven user experiences?

Those of us who have had the luxury of working with machine learning in production can clearly see how tightly ML and A/B tests are connected. Something that may feel counter-intuitive, but in practice it is crystal clear.

Here we go through how ML fits together with A/B tests:

  • How is ML used in products today and in the future?
  • Offline evaluation 101
  • Qualitative tests for machine learning?
  • How is machine learning A/B tested?
  • Succeeding with experiments: data, tools and culture

How is ML used in products today and in the future?

Even though large language models (LLMs) such as GPT and Llama are incredible and have surprised many of us, ML has for several years been a central part of products we use every day. And it’s not just LLMs either.

Here are some examples, and there will surely be more:

Recommendation systems

What: Give personalised recommendations based on user behaviour and preferences.

Examples: Streaming services that recommend new content, online retailers that suggest products, etc.

Predictive analytics

What: Predict scenarios and needs that are presented to users.

Examples: Weather apps that forecast the weather, taxi services that predict where vehicles should be, etc.

Image recognition

What: Create safer and faster user experiences based on images.

Examples: Ensuring how e-scooters are ridden and parked, scanning ID cards and faces when onboarding new users.

Natural Language Processing (NLP) / Chat interfaces

What: Instantly identify and categorise what customers are searching for, talking about or having problems with at the moment.

Examples: Travel sites that suggest new trips, language apps that provide personalised learning, etc.

Pricing

What: Dynamic pricing based on supply and demand.

Examples: Energy solutions that optimise the price of your electricity, taxi services that set prices based on supply and demand.

Content production

What: Using LLMs to generate text for products and marketing.

Examples: Press release services that automate news writing, marketing assistants that create campaigns, etc.

Fraud detection and security

What: Detect crooks and fraudsters in real time based on behavioural patterns and parameters that have previously led to negative consequences.

Examples: Payment services that assess risk profiles, rental services that identify shady hosts and guests.

Machine learning is, and will remain, a central part of how we build products and user experiences.

On top of that, it will affect internal processes, research, how we work and most other things. But let’s stick to product development here.

The technology is developing at breakneck speed and becoming more and more accessible, and it is no wild guess that product roadmaps and backlogs will contain more and more ML-related initiatives going forward.

Time and resources will be spent here, and the question then becomes: How can we know that ML initiatives create value?

Test before you go live – offline evaluation 101

There are a number of different ways to evaluate how an ML model works without releasing it into the wild. By evaluating how well the ML model performs based on established metrics and angles, we can get a good picture of how good the model is using historical data. It can be tested in minutes and hours.

Let’s look at some examples of how ML can be evaluated “offline” (warning: jargon ahead):

Model performance:

  • Precision: How often does the model make correct predictions?
  • Sensitivity (recall): How good is the model at identifying the actual positive cases?
  • F1 score: A combined assessment of precision and recall.
  • Generalisation ability: How does the model work with new, previously unseen data?

Operational aspects

  • Scalability: Can the model handle sufficiently large amounts of data efficiently?
  • Responsiveness: How quickly can the model give answers or predictions? Fast enough to provide a sensible user experience?
  • Robustness: How well does the model cope with uncertain or unusual data?
  • Cold start: Can the model give good enough recommendations even if it has limited history about the user, as in the case of new users?
  • Feedback loop: Does the model adapt and improve based on user feedback?

General

  • Explainability: Is it possible to understand why the model makes certain decisions? Can it be explained to other parts of the business that are affected by what the model spits out?
  • Diversity and ethics: How is the model affected by bias, and does it act in an ethically sustainable way?
  • Compatibility: How well can the model be integrated into existing systems and technical solutions?
  • Cost efficiency: What resources are needed to train, deploy and maintain the model?
  • Support and documentation: Are resources and guidance available so that more people in the company can work with the model?

Already at this stage we can judge whether the model can go live at all – which is great. At least with historical data, but more on that later. Many ML projects actually never even get past this phase.

Note: There are companies (DoorDash, for example) that use very sophisticated solutions for simulating test data (but even they A/B test their ML models).

Despite all this, there is still important information we are missing: What happens when we put this in front of real users?

Qualitative tests of machine learning?

One aspect where ML-based initiatives differ from “regular” product features is that they are harder to usability test in advance, before we release to real users. When the product adapts and looks different based on data, traditional qualitative testing methods become trickier. Imagine usability testing a personalisation algorithm that looks different for everyone.

Often, ML also solves problems that are not directly visible in the product, which makes user testing of prototypes even more complex.

However, qualitative methods still have an important role to play in the age of ML for understanding user needs, exploring important features and building empathy around user problems. But validating the effect of ML on your product and users becomes difficult when the product looks different for every user.

We want to be able to know how we create business and user value, and that is where A/B tests can help.

How are machine learning models A/B tested?

Despite all the offline metrics, many companies use A/B tests as an important part of their ML development. More about the reasons why below, but first we go through how A/B tests are used to evaluate ML:

Test model vs no model

A: A rule-based method that recommends products based on the same category tags.

B: An ML model trained on user data to automatically determine which products should be recommended for each individual user.

Metrics: Click-through rate on recommended products, conversion rate, average basket size etc.

Test two models against each other

E.g. which LLM should we use for our chatbot?

  1. Built with GPT’s Davinci model
  2. Built with the Curie model

Metrics: Highest share of resolved support cases, satisfied and returning customers, lifetime value

Test the building blocks of a model

  1. Current model
  2. Fine-tuned model
  3. Higher temperature
  4. More training data

Metrics: Actual business metrics such as revenue, profit and lifetime value

Why A/B test ML models?

Really, it is for the same reasons as A/B testing “regular” features and changes in products. But let’s go through it from an ML perspective.

Behaviour changes

Models are trained on historical data and, as mentioned, can be evaluated without going live. But historical data is no guarantee for the future. Users’ behaviours and preferences change, and it is only when we put the model in front of their eyes or in their hands that we know how it actually works.

Real outcome and impact matter more than output – as the saying goes, and that applies to ML models too.

Does the model create business value?

We want to understand whether our new model creates business value. We only know that once we release it to real users.

We don’t make money on fine accuracy or recall with our test data. We can simulate and guess as best we can, but the real evaluation happens in reality. Real business metrics, in other words, such as actual increased revenue, reduced costs and loyal and satisfied users.

Correlation and causation

We release our new model and our KPIs go through the roof – success!

At the same time you are launching new marketing campaigns, have a new design and on top of that it’s raining outside. Is it the model’s doing that all the metrics are pointing up?

To know whether it is specifically your new model that creates business value, we want to be able to isolate that change. A classic case where A/B tests shine, since we can test one thing at a time and understand the effect – all else being equal.

Minimise risk

We mentioned above that qualitative user tests become harder with ML-based features, and the same applies to general testing/QA. It can be hard to know and test all the possible ways an ML model affects the user experience. That increases the risk of us releasing something with unwanted effects.

This is where A/B tests (or gradual rollouts and feature flagging) shine. By testing on a small scale on a subset of your users, you reduce how many users are affected by your muddled personalisation contraption or unpleasant chatbot.

Justify maintenance

Adding new functionality usually comes at the cost of maintenance. More code, more complexity.

This can be even more relevant for ML features specifically. Monitoring that ML works in production requires both infrastructure and time. Even though MLOps is a field on the rise, you should expect quite a lot of maintenance costs when you put models into production.

Then you want to know that the upside is worth the cost, and A/B tests can help you prove that.

To improve the model

Test different building blocks of a model and understand how they play out in practice. New training data, other features, a faster model. By isolating the changes you make to the model itself, you can understand how they affect user experience and business.

Thanks to smart feature engineering, your new search algorithm is 20% better in theory but perhaps only gives 0.01% better findability compared with the previous one. That is nothing to celebrate, but at the same time we learn that spending time on feature engineering may not be the building block to prioritise for future development.

It is also easy to build our own bias into the development of our ML models. Through evaluation based on experiments, we can detect and measure this. We can then adjust our models or training data to reduce the influence of our own assumptions. By doing this, we make sure our ML products do not just replicate our prejudices, but learn and develop in a more balanced and fair way.

Succeeding with experiments and ML: data, tools and culture

So to succeed with ML initiatives, experiments should be part of your toolbox.

Succeeding with experiments is something we at Signific have worked on a great deal and talked about both here, there and with our Per.

Getting an effective process for experiments and A/B tests is an equal challenge of data, tools/infrastructure and culture.

Cloud platforms make it possible for more and more companies to collect large amounts of data and analyse A/B tests correctly. But succeeding with both ML and experiments also requires your data to be of good quality and available

On the technology and infrastructure side, lots of exciting things are happening in A/B testing, with new platforms such as Eppo and Spotify’s quiet launch of Confidence, among others.

But just as with ML, technology does not solve everything; it is also a question of culture and process to become a learning, experimenting organisation.

We have helped both small and large companies with exactly this.

We would love to talk about how you can bring ML and A/B tests together. Send an email to martina@signific.se or grab Max on LinkedIn and we will be happy to set up a meeting.

Want to work with this? We are looking for sharp, curious data nerds.