Skip to content

Diogo TravassosData leadership · Analytics · Decision-making

Real public data

The ranking model on 1 million to 128 million shopping events, on one machine

On one public shopping log, the model that picks candidates ranked 9% better at 10 million events than at 1 million, then flat.

Main limitation One machine and one public shopping log, one month long: four weeks, so the holdout is a single later week and the 100M and full sizes are fitted once. The re-ranker that orders the candidates, worse than the factor model at 1 million, led it by 7% at 100 million, each size trained once; the step to all 128 million, with the re-ranker trained on the same 200,000 shoppers, was too small to tell. A user here is one anonymous shopper on one shop. The monitors' planted faults are a self-test. It shows the method and what changes at scale; it is not a production system.

The quarterly study trained its recommender on 32 million movie ratings. This part trains the same two models on one machine, on a public shopping log. The first, a factor model, picks 100 candidate articles for each shopper. The second, a re-ranker, puts them in order and shows the top 20. Both are trained at four sizes, 1 million, 10 million, 100 million and all 128 million events before a held-out week, and each size is scored on the same shoppers' new buys in that week. At the full size, about 3 in 100 of a shopper's new buys were in the re-ranker's top 20, against under 1 in 100 in a list of best sellers. The factor model's settings were picked at 10 million and not tried again at the larger sizes. What the larger sizes kept buying was reach: the share of buys on articles the model knew well enough to rank rose from 39% to 96%. One step, the full size's factor fit, broke twice on memory, and a fix that leaves the model unchanged let it finish under the 10 GB memory cap.

Key figures
Against a best-seller list 4.6 times the re-ranker's ranking score on all 128M events as a multiple of a popularity list's, on 36,361 held-out shoppers' new buys in the week after training; 4.2 to 4.7 times from 10M up. At 1M the factor model alone was already 3.7 times, and the re-ranker 2.5Buys the candidates could reach 39% to 96% of the held-out buys were on an article the size had seen at least 5 times, the only ones any candidate list can holdHighest peak memory 10.05 GB the full size's factor fit, over the 10 GB per-step cap in two runs, the second of which finished; with a fix that leaves the model unchanged it finished at 8.8 GB, and no step that finished under the cap passed 9.1 GBRows in the week's batch 594.6 million candidates for 5,946,293 shoppers in 24 chunks, re-ranked to 118.9 million served rows

In plain words

A model that works on a sample can fail on the whole log in ways that have nothing to do with ranking: it runs out of memory, a join multiplies rows, the disk fills, or the sample its training rows come from stops looking like the users it serves. And more data is supposed to buy quality. This part asks how much, and at what cost, on one machine with a memory cap, using the two models the earlier parts used.

The short answer, on this log: the gain in ranking came in two steps, from different models. The factor model ranked 9% better at 10 million than at 1 million and, with its settings picked at 10 million, gained nothing measurable over the next tenfold step. The re-ranker needed data before it helped: at 1 million it ranked below the factor model whose list it re-orders, so there the factor model's own list was the one to serve. It drew level at 10 million and was 7% above the factor model at 100 million and 8% above it on all 128 million, each size trained once. The last step, to all 128 million, adds 28% more events, and the re-ranker learns from the same 200,000 shoppers at both sizes, the cap the design set, so that step is too small to tell a plateau from a slow gain; a larger step or a lifted cap would tell. What the larger sizes kept buying was reach: the share of the next week's buys on articles the model had seen enough to rank grew from 39% to 96%. What they cost was memory, and the one step that broke, twice, did so at the full size, from a temporary copy inside the fit, not from the 216.7 million events the database engine read.

The log stands in for any shop with a recommender: products, listings, courses. It is a public dataset, so no data from any employer is used.

Terms used on this page
Event
One click, cart or order of one article by one shopper. A buy is a cart or an order.
Shopper
One anonymous id in the log. The publisher counts all of one user's activity in the month as one session, so a session here is a shopper.
Size
A sample of shoppers, by a fixed hash of their id, holding about 1 million, 10 million or 100 million events before the holdout week, or all of them. Each smaller size sits inside the larger ones.
Holdout week
Seven days near the end of the log, days 17.5 to 24.5 of 28 (why not the last seven: under What more data bought). Models see only earlier events; they are scored on what 36,361 shoppers outside every size bought that week among articles they had not touched before.
Factor model
Matrix factorization of who touched which article: a short vector per shopper and per article, and a score for how well they line up. It proposes each shopper's top 100.
Re-ranker
A gradient-boosted model that re-orders the top 100 using ten facts about the article, the shopper and the factor score, and serves the top 20. It learns from the previous week's buys.
Popularity
Articles ordered by buys in the week before, among the size's shoppers.
Coverage
The share of the holdout buys on articles the size had seen at least 5 times. No candidate list can hold the rest.
NDCG@10
Ranking quality of the top 10, from 0 to 1, against the articles the shopper went on to buy.
Capped recall@20
Of a shopper's new buys that week, the share that made the top 20, with the buys counted up to 20: a shopper with more than 20 new buys scores 1 if every place in the list holds one of them. For a shopper with 20 or fewer it is the plain share.
Out of core
The full log never sits in memory: a database engine reads it from disk in pieces and writes two smaller tables that every size reads with a filter.
Peak memory
The most memory a step's process held at once, as the operating system counts it.
Spill
Data the database engine wrote to disk because it ran out of the memory it was given.
Approximate index
A search structure that groups article vectors into clusters and searches only the nearest clusters, trading a little accuracy for far less work than scoring every article.
Drift index
The population stability index: how far a distribution moved from a reference; above 0.2 counts as a flag here.
Self-test
A test whose faults were planted by the same author who wrote the checks.

What more data bought

Each row is one training size, scored on the same 36,361 held-out shoppers' new buys in the holdout week (106,530 shopper and article pairs), with 95% paired intervals. The scores are small because the task is hard: each next buy is one of about 1.5 million articles in the full catalogue, among articles the shopper had never touched.

The weeks as run. Week numbers are rounded, not truncated, so every boundary sits half a week earlier than the design's first-hour start: the holdout week runs from day 17.5 to day 24.5 of the 28-day log, the models' history before it is 17.5 days, the first week is 3.5 days long, and the last 3.5 days (29.5 million events, 14% of the log) are used by no model. The split is still in time order, and no model or feature reads an event of the week it is scored on or of a later one, so the results stand as run; this page describes the windows the code used. Method and checks, at the end, lists this and every other change made after the results.

PopularityFactor modelRe-rankerNDCG@10 on the holdout week, by events before it00.0040.0080.0120.0161M events: popularity 0.0026 (0.0023 to 0.0029), factor model 0.0096 (0.0089 to 0.0103), re-ranker 0.0064 (0.0058 to 0.0069)1M10M events: popularity 0.0024 (0.0021 to 0.0027), factor model 0.0105 (0.0098 to 0.0113), re-ranker 0.0102 (0.0094 to 0.0109)10M100M events: popularity 0.0024 (0.0021 to 0.0027), factor model 0.0105 (0.0098 to 0.0113), re-ranker 0.0112 (0.0105 to 0.0120)100MAll 128M events: popularity 0.0024 (0.0021 to 0.0028), factor model 0.0104 (0.0097 to 0.0112), re-ranker 0.0113 (0.0105 to 0.0121)All 128M
NDCG@10 on the holdout week, per training size (95% intervals)
SizeEvents before the holdout weekPopularityFactor modelRe-rankerRe-ranker minus factor modelRe-ranker change from the size before
1M1.0 million0.0026 (0.0023 to 0.0029)0.0096 (0.0089 to 0.0103)0.0064 (0.0058 to 0.0069)-0.0033 (-0.0039 to -0.0026)first size
10M10.0 million0.0024 (0.0021 to 0.0027)0.0105 (0.0098 to 0.0113)0.0102 (0.0094 to 0.0109)-0.0003 (-0.0009 to 0.0003)0.0038 (0.0031 to 0.0045)
100M100.0 million0.0024 (0.0021 to 0.0027)0.0105 (0.0098 to 0.0113)0.0112 (0.0105 to 0.0120)0.0007 (0.0001 to 0.0013)0.0010 (0.0005 to 0.0016)
All 128M127.7 million0.0024 (0.0021 to 0.0028)0.0104 (0.0097 to 0.0112)0.0113 (0.0105 to 0.0121)0.0009 (0.0003 to 0.0014)0.0001 (-0.0004 to 0.0005)
Capped recall@20 on the holdout week, per training size (95% intervals)
SizeEvents before the holdout weekPopularityFactor modelRe-rankerRe-ranker minus factor modelRe-ranker change from the size before
1M1.0 million0.0076 (0.0068 to 0.0084)0.0228 (0.0215 to 0.0242)0.0198 (0.0186 to 0.0210)-0.0030 (-0.0040 to -0.0020)first size
10M10.0 million0.0069 (0.0062 to 0.0077)0.0247 (0.0232 to 0.0261)0.0260 (0.0246 to 0.0274)0.0014 (0.0003 to 0.0023)0.0062 (0.0050 to 0.0075)
100M100.0 million0.0072 (0.0065 to 0.0080)0.0250 (0.0237 to 0.0265)0.0273 (0.0259 to 0.0287)0.0023 (0.0012 to 0.0034)0.0013 (0.0003 to 0.0022)
All 128M127.7 million0.0071 (0.0064 to 0.0079)0.0243 (0.0230 to 0.0257)0.0273 (0.0258 to 0.0286)0.0029 (0.0019 to 0.0039)-0.0001 (-0.0008 to 0.0008)

The factor model levelled off after 10M, with its two settings picked at 10M and used at every size. Its NDCG@10 was 0.0096 at 1M, 0.0105 at 10M, 0.0105 at 100M and 0.0104 on all 128M events; the paired changes from 10M to 100M (0.0001) and from 100M to all 128M (-0.0001) both have intervals including zero. On capped recall@20 it fell slightly at the last step, by 0.0007 (interval below zero). Over the same sizes the share of held-out buys on articles the size had seen at least 5 times rose from 76% to 96%: the larger sizes could reach more of the buys, but ranked them no higher. Other settings might have used the larger sizes better; they were not tried.

The re-ranker needed data before it helped. At 1M it learned from 484,600 rows with 518 buys among them and scored below the factor model it re-orders (-0.0033, interval below zero). At 10M the two were level (interval including zero). So most of the re-ranker's own rise from 1M to 10M, 0.0038 (60%), was catching up with the list under it, which itself rose 0.0009 (9%, interval above zero). From 100M, trained on 20.0 million rows from the 200,000 shoppers the design caps it at (the same shoppers at both sizes: the cap takes the lowest by the hash, and the full size holds every shopper of 100M), it scored 7% above the factor model at 100M and 8% above it on all 128M, both intervals above zero, each from one fit. Those intervals are over held-out shoppers for that one fit, not over refits: at 10M, two more seeds moved the re-ranker by up to 0.0004 and two more samples of shoppers by up to 0.0009, about the size of these gaps. Its own change from 10M to 100M was 0.0010 (10%, interval above zero, one fit at each size). Each extra sample sits inside the next size's main sample, so the steps can also be read from them, as ratios of the scores alone, without intervals: from each of the three 10M samples to 100M the re-ranker rose 10% to 21%, and from each of the three 1M samples to 10M 58% to 71%. From 100M to the full size it changed 0.0001, interval including zero: a step of 28% more events with the same training shoppers, too small to tell a plateau from a slow gain.

Popularity stayed flat, between 0.0024 and 0.0026: the week's best sellers are much the same whichever sample counts them. At the full size the re-ranker scored 4.6 times popularity.

One reading, added after the results and not tested here: past 10M the added shoppers mostly bring articles that few shoppers touch. They raise coverage, but a vector learned from a handful of shoppers ranks its article poorly, so the score does not move.

Spread of NDCG@10 across samples and seeds at the two smaller sizes
SpreadPopularityFactor modelRe-ranker
1M, range over three samples of shoppers0.00040.00040.0005
1M, width of the main sample's 95% interval0.00060.00140.0011
10M, range over three samples of shoppers0.00050.00020.0009
10M, range over three seeds of the main sample0.00000.00020.0004
10M, width of the main sample's 95% interval0.00060.00150.0014

At 1M and 10M two more disjoint samples of shoppers went through the whole pipeline, and at 10M the main sample was refit with two more seeds; the table compares their spread with the width of one interval.

What each size cost on one machine

Each step ran as its own process. For each one the operating system's count of its peak memory, the database engine's spill to disk and the bytes in the size's work folder were recorded. The first table is per size, for the release scored on the holdout; the second lists every step the full size ran, from the prep to the daily monitors, the week 2 release, the serving batch and the index check included. The grid at 10M with its choice, and two small steps that count the log and pick the held-out shoppers, belong to no size and are listed in the download. Both tables give each step's run that finished; the two runs that went over the cap are under What broke.

What each size cost on one machine
SizePairs read for the week 3 fitShoppers by articles in that fitPeak memory of that fit as it finished, GBHighest peak of a finished step, GBSpill, GBWork folder at its largest over those steps, GBRe-ranker training rowsCoverage
1M627,96961,549 by 49,4170.51.2 (holdout scoring)0.00.2484,600 (0.11% positive)39%
10M6,272,879710,148 by 331,6291.31.8 (holdout scoring)0.00.64,814,400 (0.13% positive)76%
100M62,691,9987,335,827 by 1,310,2449.19.1 (factor fit, week 3)0.02.020,000,000 (0.13% positive)95%
All 128M80,072,9549,382,817 by 1,461,7648.88.8 (factor fit, week 3)0.02.220,000,000 (0.13% positive)96%
Every step the full size ran, from the prep to the monitors: peak memory, spill and rows
StepPeak memory, GBSpill, GBRows
Prep: two tables from the whole log5.50.1216,716,096 read; 133,683,868 and 23,256,446 written
Factor fit, week 38.80.080,072,954 read
Factor fit, week 27.80.046,392,099 read
Re-ranker shoppers, week 2 labels0.70.0200,000 kept of 614,899
Re-ranker rows, week 2 labels (8 chunks)2.60.020,000,000 written
Re-ranker fit, week 2 labels2.10.020,000,000 read
Holdout scoring, exact3.40.03,636,100 candidate rows
Factor fit, week 13.90.015,734,525 read
Re-ranker shoppers, week 1 labels0.80.0200,000 kept of 397,678
Re-ranker rows, week 1 labels (8 chunks)2.00.020,000,000 written
Re-ranker fit, week 1 labels2.10.020,000,000 read
Approximate index, week 21.50.0the week 2 fit's 1,104,324 articles
Approximate index, week 31.90.01,461,764 articles
Shoppers for the batch0.50.05,946,293 shoppers
Batch, per chunk (24 chunks)5.10.0594,625,338 and 118,925,860 written
Week 2 batch, for the monitors4.90.0260,228 shoppers
Index check on the held-out shoppers4.30.036,361 shoppers
Daily input counts3.70.0216,716,096 read
Daily input counts, day 20 loaded twice3.80.0216,716,096 read, day 20 counted twice

Memory followed the shoppers held at once, not the events read. The database pass read all 216,716,096 events and wrote the two prep tables with a peak of 5.5 GB and 0.1 GB spilled to disk; no other step spilled at all. The week 3 factor fit, which holds a vector for every shopper in the fit at once, went from 0.5 GB at 1M (61,549 shoppers) to 8.8 GB at the full size (9,382,817) in the run that finished, against 10.04 and 10.05 GB in the two runs before it, and it was the highest peak of any step at 100M and at the full size. The re-ranker, capped by shoppers, peaked at 2.1 GB at 100M and 2.1 GB at the full size on about the same number of rows.

Disk. The download is 1.5 GB. The two prep tables take 1.5 GB, and the table of each shopper's hash 0.1 GB beside them. Measured after each step, the full size's work folder held at most 2.2 GB over the steps of the release scored on the holdout, and 2.7 GB once the week 2 release and the index were in it.

What broke, and the fix

One step broke twice, at the full size: the factor fit on everything before the holdout week, the largest matrix of the round (9,382,817 shoppers by 1,461,764 articles, 79,290,550 pairs). The design had named this failure and the first fix to try before any model ran, and the fit was run three times.

  1. As designed. The watchdog stopped the fit at 10.04 GB, over the 10 GB cap.
  2. With the declared first fix: the 1,449,199 shoppers with a single catalogue article left out of the fit (they would still get vectors at scoring). It finished, but the operating system's count of its peak was 10.05 GB, over the cap; the watchdog samples memory at intervals and its highest sample was 9.91 GB. By the design's own scoring, which reads the operating system's count, that is a second break, and it was recorded as one.
  3. The cause. Reading memory after each phase of the same fit at 100M showed that reading the pairs and building the matrix stayed far below the peak. The peak is at the start of the fit: the library draws every shopper's random starting vector and scales it into a second array of the same size, so for a moment it holds two copies of shoppers x 128 numbers x 4 bytes, 3.8 GB each with the first fix. The first fix only shrank that array; the next declared fix, half the factors, would have changed the model.
  4. With a fix written down before it ran: the same starting vectors, built in place, from the same generator and seed, then handed to the library. The fitted numbers are identical bit for bit (checked at 1M, and by a test), so the fix costs no quality, and every shopper is back in the fit, as at the other sizes. Peak: 8.8 GB, with one 4.5 GB array where there had been two.

The run with the first fix is the lesson a team can use: the watchdog let a finished step through that the operating system had recorded over the cap. Every later step was held to the operating system's count as the cap, and none went over it.

The other failures the design listed did not happen. The database engine never ran out of memory, no step after the prep spilled to disk, and no step stopped on a table over its declared bound of 100 rows per shopper. The re-ranker's training rows are each shopper's whole top 100, not a sample of negatives, from shoppers taken by the same random hash, and the share of positive rows among them stayed at 0.13% from 10M up, against 0.11% at 1M.

One chunk of the batch, traced

The week 3 batch ranks articles for every shopper active in week 2: 5,946,293 shoppers, in 24 chunks of up to 250,000. Each chunk is its own process with its own done marker, so a stopped batch resumes at the next chunk. The first chunk, step by step:

  1. Read. Its 250,000 shoppers' earlier articles, 7,476,247 shopper and article pairs, from the prep table.
  2. Fold in. Each shopper gets a vector from those articles, with the week 3 factor model's 1,461,764 article vectors held fixed.
  3. Search. The approximate index compares each vector with 4,096 cluster centres, searches the 32 nearest clusters and keeps the 150 best articles; the shopper's earlier articles are dropped and the first 100 kept: 24,999,792 candidate rows, 147 MB as parquet; 42 of its shoppers got fewer than 100.
  4. Re-rank. The ten features are computed for every candidate, the re-ranker scores them, and each shopper's top 20 are written: 5,000,000 rows, 30 MB.
  5. Cost. Peak memory 5.1 GB, spill 0.0 GB.

Serving the largest model from one machine

The whole batch wrote 594.6 million candidate rows (3.4 GB as parquet) and 118.9 million served rows (0.7 GB) for 5,946,293 shoppers; 418 shoppers got fewer than 100 candidates. No chunk went over the cap; the highest peaked at 5.1 GB.

Why an index. Scoring every shopper against all 1,461,764 catalogue articles would take 1.1 x 10^15 multiply-adds; the index takes 1.2 x 10^13, 94 times fewer. The choice was made from these counts and a benchmark on random vectors before any model ran.

What the index costs in quality. On the 36,361 held-out shoppers, the index returned 71% of the exact top 100, and the re-ranker on index candidates scored 0.0108 NDCG@10 against 0.0113 on exact candidates, a paired difference of -0.0005 (interval below zero).

What is not here: a store that hands the lists out by shopper id, a schedule, alerting, and anything live. The batch is written to files on the same machine.

Monitoring one week against the last

Two releases at the full size: the week 2 release, built one week earlier in the same way, and the week 3 release. Each scores its own week's batch through the index. The batch-time monitors compare the week 3 batch with the week 2 batch on a fixed 1-in-20 sample of shoppers (296,177 and 260,228): the shoppers, the articles served and the re-ranker's output, each by its drift index over 10 bins, flagged above 0.2. The daily monitors compare each day of the log with the 7 before it: volume, flagged outside 0.5 to 2.0 times the trailing mean; the mix of clicks, carts and orders; the mix of article ages. Any batch-time flag holds the new batch while the previous lists keep serving; any daily flag raises an alarm on the input. Two planted faults test that they can fire: the quarterly study's feature-join bug in the week 3 batch and day 20 loaded twice.

Drift index of the week 3 batch against the week 2 batch
MonitorAs runWith the planted feature bug
shopper events0.060.06
shopper days since the last event0.030.03
article events0.62 (flag)5.56 (flag)
article events in the last week0.016.16 (flag)
article buy rate0.000.70 (flag)
article age7.94 (flag)6.93 (flag)
predicted chance of the top 200.72 (flag)0.94 (flag)
Daily input monitors, days 7 to 27, each day against the 7 before it
Copy and monitorDays flaggedWhich days
The log as published, volume0none
The log as published, event-type mix0none
The log as published, article-age mix27, 8
Day 20 loaded twice, volume0none
Day 20 loaded twice, event-type mix0none
Day 20 loaded twice, article-age mix27, 8

The week 3 batch against the week 2 batch: 3 monitors flagged (article age; article events; predicted chance of the top 20), so under the alarm rule the batch would have been held for review while the week 2 lists kept serving. With the planted feature bug, 5 flagged: article age; article buy rate; article events; article events in the last week; predicted chance of the top 20.

Daily inputs, the log as published: volume flagged no day, the event-type mix no day, and the article-age mix days 7 and 8. With day 20 loaded twice: volume flagged no day, the event-type mix no day and the article-age mix days 7 and 8.

The quality rule, once week 3's buys were in: on 36,361 held-out shoppers the week 3 release scored 0.0108 NDCG@10 against 0.0081 for the week 2 release run beside it, 1.33 times, so it was kept (the line is 0.95 times, on at least 300 shoppers).

So the batch-time flags were a false alarm on this log (a reading added after the results). The release they would have held scored 1.33 times the one that kept serving. The two article features that moved most are counted from the log's first day: an article's age and its events before the cut-off. The week 3 batch has 17.5 days of history behind it and the week 2 batch 10.5, so both move every week by construction (drift index 7.94 and 0.62). Last week's events, a count over one week, and the buy rate, a lifetime rate that does not grow with the history as a count does, stayed at 0.01 and 0.00, and with the planted bug moved to 6.16 and 0.70: they separated the fault from a clean week, and the counts since the log began did not. The output monitor compares two different releases, trained on different weeks' labels, so it moves with them. When the history starts on a fixed day, a monitor on counts since that day cannot tell a new week from a fault.

What was predicted, and what held

16 predictions were written in the design before any model ran. The code that scores them was committed after the three 1M samples were read and before any other result. Where a prediction left a choice open it takes the stricter reading, and a prediction with several parts holds only if every part does. On the lenient reading of the peak-memory prediction, 7 of 16 held.

One prediction is scored on the stricter reading, set after the results. Read on the run of the full size's week 3 fit that finished, the lenient reading, it held; counting the two runs that went over the cap, as the stricter reading does, the fit peaked at 10.05 GB and the prediction missed. So 6 of 16 held, and one of those, the size of the batch, holds largely by construction (below). The table shows both readings of the peak-memory prediction.

The predictions written before the runs, scored
TopicPredictionVerdictParts held
Re-ranker against popularityThe re-ranker beats popularity at every size, interval above zeroHeld4 of 4
Factor model against popularityThe factor model is below popularity at 1M and above it from 10M upMissed3 of 4
Re-ranker stepsThe re-ranker improves at each size step, interval above zero, with a smaller gain at the last stepMissed3 of 4
CoverageCoverage under 60% at 1M and over 90% at the full sizeHeld2 of 2
Spread of the three samplesAt 1M three samples spread wider than one interval; at 10M they spread less than at 1MMissed1 of 6
Peak memory of the week 3 fitThe week 3 factor fit is the peak step at 100M and the full size, 5 to 9 GB there, under the capMissed, on the stricter reading set after the results (held on the lenient reading)2 of 4 (4 of 4 on the lenient reading)
Peak against the estimateThat peak is within 25% of a back-of-envelope estimateMissed0 of 2
Spill to diskNo step after the prep spills to diskHeld1 of 1
Memory of the re-ranker fitThe re-ranker fit on 20 million rows peaks under 4 GBHeld3 of 3
Declared fixesNo size needs a declared fixMissed0 of 1
Index recallThe index returns 80% of the exact top 100 and costs the re-ranker under 5% of NDCG@10Missed1 of 2
Size of the batchThe batch writes about 594.6 million candidate and 118.9 million top-20 rows, no chunk over the capHeld3 of 3
Batch-time monitorsNo batch-time monitor flags between the week 2 and week 3 batchesMissed0 of 1
Volume and mix monitorsThe volume monitor flags in week 1 only; the mix monitors flag, if at all, only in week 1Missed2 of 3
Quality ruleThe quality rule does not roll the week 3 release backHeld1 of 1
Planted faultsThe planted feature bug flags the article and output monitors; the doubled day flags volumeMissed2 of 3

The size of the batch holds largely by construction. Its row counts follow from the design: the batch is 5,946,293 shoppers, each given 20 served rows and 100 candidates, less 3,962 candidates for the 418 shoppers with fewer than 100. Only its last part, no chunk over the cap, tested anything.

Why each missed prediction missed
  • Factor model against popularity missed: at 1M the factor model already scored 0.0096 against popularity's 0.0026, above it where the prediction had it below.
  • Re-ranker steps missed: the re-ranker's change from 100M to all 128M (0.0001) has an interval including zero.
  • Spread of the three samples missed: at 1M the three samples of every model spread less than the width of the main sample's interval; at 10M the three samples of popularity and the re-ranker spread wider than at 1M (the spread table above). That interval is over held-out shoppers for one fitted model, so it does not measure what a new training sample does; the two only compare in width.
  • Peak memory of the week 3 fit missed: counting every run, the full size's week 3 fit peaked at 10.05 GB, outside 5 to 9 GB and over the cap. On the lenient reading, the run that finished (8.81 GB), it held.
  • Peak against the estimate missed: the week 3 fit peaked at 1.64 times the estimate at 100M and 1.29 times it at the full size. The estimate counted the factors, the matrix and its transpose and the libraries; at 100M the library's second copy of the starting vectors, described above, is one thing it left out, and the full size, fitted without that copy, still peaked above it.
  • Declared fixes missed: the full size's week 3 fit needed a fix, as told in What broke.
  • Index recall missed: the index returned 71% of the exact top 100, and the re-ranker on its candidates scored 0.95 times its NDCG@10 on exact candidates.
  • Batch-time monitors missed: article age; article events; predicted chance of the top 20 flagged between the week 2 and week 3 batches (see the monitoring section for why).
  • Volume and mix monitors missed: volume did not flag in week 1. The prediction came from the week counts, and week 0 holds about half the events of week 1 only because, as run, it is 3.5 days long; per day the log is flat, with days 1 to 6 between 7.1 and 8.1 million events each. Day 7 was 1.19 times the 7 days before it because one of them, day 0, is the log's first half day, and no day of the published log passed 1.32.
  • Planted faults missed: the doubled day did not flag volume: it was 1.96 times the 7 days before it, under the 2.0 line. Of the parts that held, the planted bug flagging the output monitor shows nothing, since it flagged on the clean week too; it flagged both article monitors that were quiet on the clean week.

What a team should do with this

Limits

Use this at your company

To run the same check on your own ranking model, paste this prompt into an AI assistant along with a description of your log.

This method comes from Diogo Travassos's study "The ranking model on 1 million to 128 million shopping events, on one machine" (https://diogotravassos.dev/ranking-lifecycle/scale.html). If you can open links, read it first: it works the method through end to end, with its checks. The steps below stand on their own if you can't.

Help me find out what our ranking model gains from more training data, and what it costs to train, serve and monitor it at full size on the hardware we have.

Data: our interaction log (user id, item id, timestamp, event type) for a period that ends before a week we hold out.

Steps:
1. Hash user ids to a fixed number between 0 and 1. Keep a small bucket out of every training set for scoring, and take nested samples of the rest at about 1%, 10%, 100% of the volume, so each smaller sample sits inside the larger.
2. Reduce the log once, out of core, to one row per user and item and one row per user and period; read every sample from those with a filter.
3. At each size, train the same candidate model and re-ranker, score the held-out week against a popularity list with paired intervals on the same users, and report coverage: the share of held-out outcomes on items the size has seen.
4. Run each step in its own process under a memory cap and record its peak memory, disk spill, bytes left on disk and rows read and written. Write down before the run what you expect to break and the first fix.
5. At the largest size, score the whole week's batch from an approximate index in chunks, and check the index against exact search on the held-out users.
6. Compare each batch with the last on its inputs and outputs, and each day's input volume and mix with the days before; plant one fault of each kind to see that the monitors can fire.

Checks: the same held-out users at every size; no event after a model's cut-off in its training or features; every table checked against its declared row bound.

Report: per size, ranking quality against popularity with intervals, coverage, peak memory, disk and rows, and what broke with the fix; then how the largest model is served and monitored. Planted faults are a self-test.

In your report, say which study you followed and link it: https://diogotravassos.dev/ranking-lifecycle/scale.html

Method and checks

Set in advance

The data, the split, the four sizes and the hash that nests them, the model and its settings, the grid at 10M, the measures, the failures to record with the first fix for each, the serving batch, the monitors with their lines, the alarm and quality rules, the two planted faults and 16 predictions were written down in DESIGN-scale.md and protocol-scale.json and committed before any model was trained on this log. Before that, only the counts listed in the design's section 1 had been read, and search speed on random vectors.

Changed after that, each written down before any result it could affect, as an amendment at the end of the design: after the three 1M samples were scored and before any result at 10M or above, a size's disk footprint is the largest its work folder reached, the records of failed steps are kept, and where a prediction left a choice open the stricter reading is scored, in code; after the full size's week 3 fit first went over the cap, a measurement of the first fix's cost at 100M; and after the fit with the first fix also went over the cap, the in-place start, the rule that a finished step over the cap by the operating system's count is a break, and dropping that measurement before it ran, since no published model leaves shoppers out. Added after the results and labelled where they appear: the reasons given for the results.

Set after the results, with the design, protocol, scoring code and results file left as committed: the weeks are described as the code ran them; the peak-memory prediction is scored on the stricter reading (6 of 16 held, 7 on the lenient reading); the size of the batch and two parts of the planted-fault prediction are labelled as showing less than they look.

Data and the split

The OTTO session dataset's training split, 216,716,096 events, downloaded from a public parquet copy pinned by revision and checksum and checked against the publisher's six counts (events, sessions, articles, clicks, carts and orders), which all matched. The design set weeks to start at the log's first hour; as run, each event's week is its offset from that hour in weeks, rounded to the nearest whole number, and each day likewise. So week 0 is the first 3.5 days, weeks 1 to 3 are 7 days each, week 3 (days 17.5 to 24.5) is held out, and the last 3.5 days are read by no model. No model, feature or tuning step sees an event from the week it is scored on or a later one. Two features, an article's days since its first event and a shopper's days since the last event, count from the week's start as the design wrote it, 3.5 days after the last event a model reads, at every cut-off alike. The re-ranker learns from week 2's new buys, with candidates from a factor model fitted on the weeks before. The factor model's two settings were chosen from four at 10M, on week 2 (regularization 0.1 and alpha 20), and used at every size.

Sizes and what was measured

Each shopper gets a fixed number between 0 and 1 from a seeded hash of the id. The 36,361 held-out shoppers come from the lowest 5% and are in no size; a size is a range above that, so each size holds the smaller ones. Each step runs as its own process under a 10 GB cap (a GB here is 2^30 bytes). Peak memory is the operating system's high-water mark for that process, spill is the most the database engine had in its temporary folder at once, and a size's work folder is measured after each step; the per-size table gives its largest over the release scored on the holdout, reached before any of that size's files were deleted. The intervals are 95% paired bootstrap intervals over held-out shoppers, the same shoppers at every size.

What is in the download

The code, the design with its three amendments, the changes made after the results, the protocol, the aggregates and one manifest per release with file fingerprints. No event row and no model file is in it. fetch_scale.py downloads the public file and checks it; run_scale.py reruns the round from it on a machine with about 15 GB of free disk.