What If Your Page Layout Could Learn? Optimizing with Bandits

8 May 2026

Problem

Product pages at a large retailer are built from modules: recommendation carousels, banners, purchase blocks and item details. Layouts are designed by hand and stay static after launch, and improvements come from slow A/B tests that split traffic for days or weeks. Even reordering a few modules gives many possible layouts, and the best one differs by product category (Electronics versus Beauty, Grocery or Home) because intent, seasonality and business goals differ. Testing layouts one experiment at a time stops being practical, and every A/B winner assumes preferences stay stable.

Example from the article: Target tested carousel placement on product detail pages reached through external traffic such as search engines or social media.

Solution in brief

Layout becomes a continuous decision. A contextual bandit (LinUCB) picks, for each page view, which recommendation carousel to place in each position given item, guest and context features. It learns from clicks and add-to-cart events and keeps exploring, so no long A/B cycle is needed.

Questions this case answers
  • How to choose per user which content blocks to show and in what order when the number of possible arrangements is too large to test one at a time
  • How to keep a learned content-selection policy adapting to drifting preferences while still exploring
  • How to choose which modules to show, and in what order, on a product page for each visitor instead of testing layouts one A/B test at a time?
  • How to let a page layout keep adapting to changing shopper behavior without manual re-tuning?

Tools and methods

  • LinUCB contextual bandit — chooses a carousel per position from context features.
  • Ridge regression per arm — estimates expected reward as a linear function of context features.
  • Upper confidence bound (UCB) — balances exploration and exploitation.
  • Python microservice with gRPC on Kubernetes — serves the policy with autoscaling.
Continue reading — it's free

Google or a one-time email code. No password.