A/B Testing

Problem Statement

Choose from a pool of A/B variants and allocate different user segments to them to minimize user disruption while upholding statistical significance.

Full example scenario

You are a backend engineer at a software company preparing to run A/B tests on a new feature. The goal is to determine the optimal selection of 3 out of 10 possible test variants (V1 to V10), and to allocate different user segments to those chosen variants, in order to minimize total user disruption.

  • Choose exactly 3 out of the 10 possible variants.

  • Each chosen variant must have at least 100 users from each user segment, for statistical significance.

  • All users from each segment must be allocated to the variants that end up being chosen.

  • Within each user segment, the difference in allocation between any two chosen variants cannot be more than 300.

  • The user segments and disruption costs can be found in ab_testing.csv, with the columns User Segment,Total Users,Disruption in V1,Disruption in V2,...,Disruption in V10.

What an optimal solution looks like

Which users will test which variant.

New Users

1,000 users

Regular Users

1,500 users

Power Users

500 users

533 233 234 300 600 600 300 100 100

Variant #1

unused

Variant #3

1,133

533 New

300 Regular

300 Power

Variant #5

933

233 New

600 Regular

100 Power

Variant #8

934

234 New

600 Regular

100 Power

Variant #10

unused

New Users Regular Users Power Users
Not selected: Variants: #1, #2, #4, #6, #7, #9, #10 — the ⋯ marks where they sit in the pool. None of them receive a single user.

Built with Modeler

The problem above is stated as a single shot: you hand over the whole problem and get a model back. Modeler takes the other route — you start with the business question you actually have, and it works with you until the problem is pinned down, the data is in, the code runs, and the answer holds up when the problem changes.

The tabs below walk the same A/B testing problem through that route, one Modeler capability at a time.

Instead of writing the whole prompt up front, you start with the business question you actually have. Modeler searches the knowledge base, asks one clarifying question at a time — always the most important one first — and tells you which parts of the model are still missing. The options it offers come from examples in the knowledge base and from how similar problems are usually modeled in your industry, so you can answer with a number instead of prose.

We’re a backend engineering team about to run A/B tests on a new feature. We have several candidate test variants and multiple user segments, and we need to decide which variants to actually test and how to split our user segments across them. We want to keep user disruption as low as possible while still running a valid experiment. Can you help us build a model for this?

This is a joint variant-selection and allocation problem, not a plain allocation problem — the number of variants to pick is itself a decision. Let me check the knowledge base for similar A/B testing setups before asking anything, so the first question can offer realistic, grounded options rather than a generic one.

Great, this is a well-suited problem for mathematical optimization. I found a closely related reference in the knowledge base that will help guide the model design. Let me start gathering the details to build a precise specification for your use case.

Question 1: How many variants do you have in your candidate pool, and how many do you want to actually select and run in the experiment?

For example, a common setup is selecting 3 variants out of a pool of 10. Do you have a fixed number to select, or is it a range (e.g., “at least 2, at most 5”)?

We select exactly 3 out of 10 candidate variants (V1-V10). We have 3 user segments: New Users (1000 total users), Regular Users (1500 total users), and Power Users (500 total users) — every user in a segment has to end up allocated to one of the 3 chosen variants, no one left out. Each variant we actually pick needs at least 100 users from each segment for the result to be statistically meaningful. One more thing: within a segment, we don’t want the allocation to be too lopsided across the chosen variants — the difference between the biggest and smallest allocation for a segment shouldn’t exceed 300 users. And I’d also like the output to show, per segment, exactly how many users go to each chosen variant, not just which variants were picked.

That answer settles the selection count, the three segments and their totals, the minimum-users floor, and — volunteered on top — a balance rule and an output requirement. Recording all of it. What is still open is the one thing that actually drives the objective: how “disruption” is measured. Without a cost figure per segment-variant pair there is nothing to minimize yet, so that has to be the next question.

Good, the spec is saved. Now the most important piece remaining is the objective.

You mentioned keeping “user disruption as low as possible” — how would you like to define disruption quantitatively? Here are the most common interpretations, pick the one that fits best or describe your own:

  1. Minimize total users exposed to the test — keep the overall footprint of the experiment as small as possible.

  2. Minimize allocation imbalance — minimize the total spread (max minus min allocation) across variants, summed over all segments.

  3. Minimize the maximum single allocation — avoid any one variant receiving a disproportionately large share of users in any segment.

  4. Minimize deviation from a target allocation — each variant should receive as close to an equal share of each segment as possible, and you minimize the total deviation from that ideal split.

Modeler updates the specification after every answer, even while it is still incomplete — so you can always see what it has understood and what it is still waiting on. The objective question above is answered with the data file in the Bringing in your data tab, since the numbers that define “disruption” and the file that carries them arrive together.