ArticleslgStudy

computer science

A/B testing

A/B testing is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand A/B testing rather than just read about it. In short: A/B testing (also known as bucket testing, split-run testing or split testing) is a user-experience research method. A/B tests consist of a randomized experiment that usually involves two variants (A and B), although the concept can be also extended to multiple variants of the same variable.

A/B testing — main illustration
A/B testing — illustration

Key takeaways

  • A/B testing belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect A/B testing to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of A/B testing from memory before moving on to harder problems.

Reference excerpt

A/B testing (also known as bucket testing, split-run testing or split testing) is a user-experience research method. A/B tests consist of a randomized experiment that usually involves two variants (A and B), although the concept can be also extended to multiple variants of the same variable. It includes application of statistical hypothesis testing or "two-sample hypothesis testing" as used in the field of statistics. A/B testing is employed to compare multiple versions of a single variable, for example by testing a subject's response to variant A against variant B, and to determine which of the variants is more effective. Multivariate testing or multinomial testing is similar to A/B testing but may test more than two versions at the same time or use more controls. Simple A/B tests are not valid for observational, quasi-experimental or other non-experimental situations—commonplace with survey data, offline data, and other, more complex phenomena.

Definition "A/B testing" is a shorthand for a simple randomized controlled experiment, in which a number of samples (e.g. A and B) of a single vector-variable are compared. A/B tests are widely considered the simplest form of controlled experiment, especially when they only involve two variants. However, by adding more variants to the test, its complexity grows. The following example illustrates an A/B test with a single variable: A company has a customer database of 2,000 people and launches an email campaign with a discount code in order to generate sales through its website. The company creates two versions of the email with different calls to action (the part of the copy that encourages customers to act—in the case of a sales campaign, make a purchase) and identifying promotional codes.

To 1,000 people, the company sends an email with the call to action stating "Offer ends this Saturday! Use code A1", To the remaining 1,000 people, it sends an email with the call to action stating "Offer ends soon! Use code B1". All other elements of the emails' copy and layout are identical. The company then monitors which campaign has the higher success rate by analyzing the use of the promotional codes. The email using the code A1 has a 5% response rate (50 of the 1,000 people emailed used the code to buy a product), and the email using the code B1 has a 3% response rate (30 of the recipients used the code to buy a product). The company therefore determines that in this instance, the first call to action is more effective and will use it in future sales. A more nuanced approach would involve applying statistical testing to determine whether the differences in response rates between A1 and B1 were statistically significant (highly likely that the differences are real, repeatable and not the result of random chance). In the previous example, the purpose of the test is to determine the more effective strategy for encouraging customers to make a purchase. If, however, the aim of the test had been to determine which email would generate a higher click-through rate (the percentage of people who actually click the link after receiving the email), the results might have been different. For example, even though more of the customers receiving the code B1 accessed the website, because the call to action did not state the end date of the promotion, many recipients may feel no urgency to make an immediate purchase. Consequently, if the purpose of the test had been simply to determine which email would bring more traffic to the website, the email containing code B1 might well have been more successful. An A/B test should have a defined, measurable outcome, such as sales converted, clickthrough rate or registration rate.

Common test statistics Two-sample hypothesis tests are appropriate for comparing the two samples in which the samples are divided by the two control cases in the experiment. Z-tests are appropriate for comparing means under stringent conditions regarding normality and a known standard deviation. Student's t-tests are appropriate for comparing means under relaxed conditions when less is assumed. Welch's t-test assumes the least and is therefore the most commonly used two-sample hypothesis test in which the mean of a metric is to be optimized. While the mean of the variable to be optimized is the most common choice of estimator, others are regularly used. Fisher's exact test can be employed to compare two binomial distributions, such as a click-through rate.

Segmentation and targeting A/B tests most commonly apply the same variant (e.g., user interface element) with equal probability to all users. However, in some circumstances, responses to variants may be heterogeneous. While a variant A might have a higher response rate overall, variant B may have an even higher response rate within a specific segment of the customer base. For instance, in the above example, the breakdown of the response rates by gender could have been:

In this case, while variant A attracted a higher overall response rate, variant B actually elicited a higher response rate among men. As a result, the company might select a segmented strategy as a result of the A/B test, sending variant B to men and variant A to women in the future. In this example, a segmented strategy would yield a 30% increase in expected response rates from 5%=40+10500+500 to 6.5%=40+25500+500. If segmented results are expected from the A/B test, the test should be properly designed at the outset to be evenly distributed across key customer attributes, such as gender. The test should contain a representative sample of men vs. women and assign men and women randomly to each “variant” (variant A vs. variant B). Failure to do so could lead to experiment bias and inaccurate conclusions. This segmentation and targeting approach can be further generalized to include multiple customer attributes rather than a single customer attribute—for example, customers' age and gender—to identify more nuanced patterns that may exist in the test results.

Tradeoffs

Positives The results of A/B tests are simple to interpret to create a clear picture of real user preferences, as they directly test one option over another. A/B tests can also provide answers to highly specific design questions. One example of this is Google's A/B testing with hyperlink colors. In order to optimize revenue, Google tested dozens of hyperlink hues to determine which colors attract the most clicks.

… excerpt ends here. Continue reading the full article.

Illustrations

A/B testing: Example of A/B testing on a website. Some users (chosen at random) are served a version of the website with a blue button, while others see a version with a green button. From this, the relative efficacy of the two designs can be measured.
Example of A/B testing on a website. Some users (chosen at random) are served a version of the website with a blue button, while others see a version with a green button. From this, the relative efficacy of the two designs can be measured.
A/B testing: HTTP router with A/B testing
HTTP router with A/B testing

Worked examples

Example 1 — a first encounter with A/B testing

Start with the simplest possible case. Write down what A/B testing claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to A/B testing before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about A/B testing ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of A/B testing

In research
A/B testing appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses A/B testing in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
A/B testing is common in secondary-school and first-year university syllabi. It links to neighbouring topics Experiments, Market research, Software testing, so understanding it makes those chapters shorter.
In everyday life
Look for A/B testing outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “A/B testing” →

How to study A/B testing in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what A/B testing means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain A/B testing out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is A/B testing in simple terms?

A/B testing (also known as bucket testing, split-run testing or split testing) is a user-experience research method. A/B tests consist of a randomized experiment that usually involves two variants (A and B), although the concept can be also extended to multiple variants of the same variable.

Why does A/B testing matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study A/B testing?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on A/B testing.

Tags

  • Experiments
  • Market research
  • Software testing

Keep exploring