Tune Smarter, Not Harder: A Deep-Dive into Hyperparameter Tuning in Payment Fraud at Booking.com

Nicholas Allen3 Feb 2025

Problem

Booking.com retrains its payment fraud model regularly, because fraudsters keep changing tactics and the model must follow. Hyperparameter tuning was the slow step: the team ran random search one configuration at a time on very large transaction data, so a tuning cycle took many hours or even days. A slow cycle leaves the model stale, which weakens fraud detection and costs money and customer trust.

Example from the article: the primary payment fraud model needed tens to hundreds of random-search trials per retraining, and the sequential run grew with the data.

Solution in brief

Run the independent random-search trials in parallel on Spark, then replace random search with the Bayesian Tree-structured Parzen Estimator (TPE) from hyperopt, which picks each new trial from the results of earlier ones. Parallelism cut training time by 95%, and TPE improved the model in an online A/B test.

Questions this case answers
  • How to cut the wall-clock time of hyperparameter search for a model retrained often on a growing dataset, so that the model stays fresh
  • How to choose between random search and sequential model-based tuning when parallel workers weaken the sequential feedback and the number of trials is limited
  • How to shorten hyperparameter tuning of a fraud model that trains on huge transaction data without losing quality?
  • How to keep a fraud model fresh when sequential random search takes hours or days?

Tools and methods

  • Apache Spark — runs hundreds of tuning trials at once on the existing cluster
  • Joblib with joblib-spark — a Spark backend for Python's Parallel, the simplest way to parallelize a loop of trials
  • hyperopt (SparkTrials) — generates hyperparameters itself and distributes trials over Spark, with random search or TPE
  • Tree-structured Parzen Estimator (TPE) — Bayesian search that samples where earlier trials scored well
Continue reading — it's free

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