Narrow millions of listings to one page, in stages
With the label settled, turn to the numbers that shape the system.
Scoring every listing takes seconds, so narrow in stages
Do the numbers before you draw boxes. Assume 7 million active listings, a figure for this exercise: Airbnb's retrieval post says only that search covers millions of homes. A search for a city might cover 50,000 listings. 10,000 of them are free on the dates and fit the party. The guest sees a first page of about 20.
Can the best model score all 10,000? Assume the main ranker costs 200 µs a listing. A µs is a microsecond, a millionth of a second, and 200 µs is the time per listing after batching on the serving machines. 10,000 × 200 µs is 2 s, against a budget of a few hundred milliseconds. On all 7 million listings it's 1,400 s.
So the system narrows in stages. Each stage costs more per listing than the one before it, so the expensive model sees only a few hundred listings. The filter isn't a model at all: it's lookups in the search index. The retrieval stage runs on two-tower vectors and an ANN index, a nearest neighbor index.
The time budget, stage by stage
Here's that funnel against a 250 ms p99 budget. p99 is the time that 99 of every 100 requests finish within. Push the main ranker's items toward 10,000 and watch it blow past the line. Then see how much of the first-pass ranker you can afford.
First-pass ranker: 10 µs per item. Main ranker: 200 µs per item.
As set, the request takes 185 ms: 20 ms for 2,000 first-pass scores, 60 ms for 300 main-ranker scores, and 105 ms for everything else. With the main ranker on all 10,000 eligible listings, it's 2,125 ms, 1,875 over budget.
In the editor, write request_ms(fixed_ms, scored), the widget's total for one request, and room_for(budget_ms, used_ms, us_per_item), how many listings one stage can still score in the time left. Model stages cost microseconds per item, so divide by 1,000 to get milliseconds.