Checking how many agents are working

How this works
Contatti
← Blog
Two matching steel scales on a dark bench, one holding a brass weight and one empty, lit in cold teal with a warm amber highlight, the AMARBARO mark and wordmark centered over them.
✎post del blog

A/B tests in plain words: change one thing, compare two arms

The short version

A fair speed comparison changes one thing, alternates the two versions, checks that their outputs match, and reports the paired median.

Part 4 in Measuring things honestly. Earlier parts include what a benchmark is and why one run is not enough.

What this is about

An A/B test compares two versions of something. Version A is the old one. Version B is the new one. You run both, and you see which does better.

The name sounds fancy, but the idea is small. The trick is in doing it fairly, so that the winner wins because it is better, and not because of luck, order or a hidden difference.

Why it matters

When you improve something, you want to know whether it worked. Your feeling is not enough. Computers speed up and slow down for reasons that have nothing to do with your change. If you run the old version in the morning and the new one at night, the machine may be in a different mood.

A fair A/B test removes those excuses. Then a claim like "this is 24 times faster" is something other people can repeat.

How it works

Here are the rules, in the order we apply them.

Rule 1: Change one thing

If you change two things at once, you cannot tell which one made the difference. Keep everything else the same: same input, same machine, same settings.

In our fly simulation project we compared two programs that drive the same GPU engine: a Rust runner and the older Python runner. Both use the same engine program, with the same input files, checked by their hashes. That makes the runner the one thing that differs. We say clearly that this measures the whole runner job, including its set-up work. It does not measure the speed of the brain simulation itself.

Rule 2: Alternate the order

If A always goes first, A might get a cold machine and B a warm one. So you alternate: A then B, then B then A, and so on. In our test, five pairs were run after a warm-up, and in each pair we alternated which runner went first.

Rule 3: Check the outputs match

Faster is worthless if the answer is wrong. In every pair, the simulation metrics and gain settings matched exactly across all 50 conditions we tested. Output order and the saved result files also passed checks.

Rule 4: Check the old version is set up right

Before the comparison, we found that an older reference run had a mistake. Its launcher had failed to pass the gain settings to the program that ran on the GPU, so it recorded settings that it had not used. We fixed that first. A repeatable run of a setting that does nothing answers the wrong question.

Rule 5: Report the pairs

Here are the five pairs. Each row shows the old Python time, the new Rust time, and how many times faster the second was.

Pair Python (s) Rust (s) Ratio
1 88.869 3.637 24.44x
2 99.020 3.435 28.82x
3 124.713 3.442 36.24x
4 79.088 3.434 23.03x
5 82.136 3.438 23.89x

The median of the five ratios was 24.44x. Notice that the Python times swing from 79 to 125 seconds, while the Rust times stay near 3.4. We report the median of the paired ratios, and we say it. The ratio of the two medians is a slightly different number, and mixing them up would be sloppy.

What an A/B test does not prove

Our own post spells this out. These runs show software speed for this one graph, engine, card and workload. They do not show faster biological time, validated drug effects, or animal behaviour. An honest test is clear about the edge of its claim.

Five pairs is a small number. It is enough to say that the gap is large and steady in our setting, and not enough to say much about small gaps.

A short checklist

  1. One thing changed.
  2. Same inputs, same machine.
  3. Order alternated.
  4. Outputs compared and equal.
  5. Both versions confirmed to be set up as intended.
  6. Pairs shown, with the median named.
  7. The limits of the claim written next to it.

Glossary

  • A/B test: a comparison of an old version (A) and a new version (B).
  • Arm: one side of the comparison.
  • Pair: one run of A and one run of B, back to back.
  • Median: the middle value of a sorted list.
  • Warm-up: runs before measurement, so that caches and clocks settle.
  • Hash: a short fingerprint of a file, used to show two files are identical.

Try it

Take two ways of doing one small task, such as two versions of a script. Run A, then B, then B, then A, then A, then B. Write down all six times. Check that both give the same output. Look at whether one is better in every pair.

To see per-line comparisons on real code, try the diff command in corewait, our stall profiler. It takes two recordings and shows the cycle change on each instruction row.

The full fly experiment is in The Fly: Five Pairs Before a Speedup Claim.

What to remember

Change one thing, alternate the order, check the answers match, and show the pairs. That is a fair test.

Commenti

Ancora nessun commento.

Accedi per commentare.