Library/ML system design/Ranking and retrieval

Search ranking with no text query

115 min5 partsCoreFundamentalsChecked Nov 2026
Start the lessonShort steps, each with something to do
What you'll learn
  • What a stays search carries when it has no words, and why a booking, not a click, is the label
  • Why the system narrows millions of listings to one page in stages, and the time budget that forces it
  • How candidates are found, with hard filters, listing vectors learned from browsing, and two-tower retrieval from a nearest neighbor index
  • How HNSW, IVF and product quantization trade memory, recall and update cost, and why Airbnb picked IVF
  • How Airbnb's ranker went from boosted trees to a neural network, and what each step taught
  • Features grouped by how fresh they must be, and how position bias gets into training and evaluation and how to take it out
  • How to evaluate with NDCG on the booked listing, interleaving and A/B tests, and the ways it fails with cold start, sameness and feedback loops
Part 1 of 5about 13 min
The prompt and the labels

Design search ranking for a stays marketplace

Design the search ranking system for a marketplace of short-term stays. A guest picks a destination or drags a map, sets dates and a guest count, and we show a page of homes. There's no keyword, so we can't match text. How would you decide what goes at the top?

Candidates report this question at Airbnb and OpenAI. Each line here is one report, not a rule:

  • One senior onsite at Airbnb covered search ranking without text queries (1 report). A prep bank lists that question as "Design a home-search ranker without query text" (1 source).
  • Another Airbnb loop asked for user embeddings with two-stage retrieval and ranking (1 report). Its interviewer "really dug into position bias" (1 report).
  • One OpenAI candidate got the general version in a phone screen, a recommendation and search design question (1 report).

You start with what the query holds and with the label, the thing the model learns to predict, because the label shapes everything after it. Then come the numbers, retrieval, ranking, position bias, evaluation and cold start, in the order you present them in the round. NDCG and propensity weighting come from the ranking metrics lesson, and the back-of-envelope numbers from the design method lesson.

It ends on a mock interview that runs in the order of a 45-minute round.

A stays search has no words

It sounds like web search until you look at the query.

The query is a place, dates and a party size

Web searchStays search
quiet hotel near the louvre with a balcony: words to matchwhere: a city or a map area
when: check-in and check-out
who: the number of guests
filters: price, room type
device: phone or laptop
no words to match

Airbnb's 2020 ranking paper says a guest's query typically holds a location, a number of guests, and check-in and check-out dates. The page adds a map area, filters for price or room type, and the device. None of that is text you can match against a listing. So the order has to come from three other places:

  1. Hard constraints. In the area, free on those dates, big enough for the party. They decide whether a listing is in at all.
  2. The listing. Its price for those dates, location, quality and reviews.
  3. The guest. What they've booked before, what they clicked ten minutes ago, and what guests like them book.

The marketplace adds its own twist. Airbnb's KDD 2018 paper names it. The ranking has to serve hosts and guests both. A guest rarely books the same place twice. And a listing can take only one guest for a set of dates.

Hosts get a say too. The main ranker sits among other models, and one of them predicts whether a host will accept the guest's booking request.

The design, in the order you present it

One search, and the loop it feedsInteractive
filter = place, dates, party size.

Present the design in this order in the round. The filter comes first: a listing that fails a hard constraint is out at any score.

In the editor, write overlaps(a_in, a_out, b_in, b_out), whether two stays share a night, and eligible(listing, query), the three hard constraints. A listing holds its city, how many it sleeps and its booked stays as (check-in, check-out) pairs, and a query holds a city, check_in, check_out and guests.

Before any model, decide what it learns from.

Every label trades how often it happens against how close it is to the goal

LabelHow often it happensHow close to the objectiveThe catch
ClickOftenLoosePosition-biased, and rewards eye-catching photos
Long view of the listing pageOftenCorrelated with bookingMoving it may not move bookings
WishlistSometimesInterestNot a decision
Booking requestRarelyCloseThe host can decline
Uncancelled bookingRarelyThe objectiveArrives days or weeks after the search
5-star stayRarestPast the objectiveArrives after checkout

The objective is bookings that hold. A click is cheap, a booking pays, and a cancelled booking costs both sides. Airbnb's 2022 paper on diversity lists the targets: more bookings, fewer bad outcomes like cancellations, and better trip ratings.

Airbnb learned what a cheap stand-in costs, and its 2019 search paper tells it. Long views of a listing's page are far more common than bookings, and listings with more of them tend to get more bookings. So the team built a model that predicted both.

Online, long views went up by a large margin. Bookings stayed neutral.

In the editor, write top(listings, label, k) and overlap(a, b), then rank four listings by each label. Each listing in listings holds two made-up rates: long_view, the cheap stand-in, and booking, the goal.

A booking means something only next to the listings the guest passed over.

Predict

The guest booked L3, at rank 2 on a page of 4. How many training pairs does that search give?

Pick an answer above to see the rest
Part 1 done
Part 2 of 5about 42 min
Stages and retrieval

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

The main ranker on all 10,000 eligible listings, at 200 µs each
budget
250 ms
needed
2,000 ms

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.

Listings left after each stage
all listings
7,000,000
filter
10,000
retrieve
2,000
first pass
300
main ranker
300, in order
re-rank
a page of 20

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.

Stays search, p99Interactive
Parse query and geocode10 ms
Location and availability filter30 ms
Embedding retrieval20 ms
Feature fetch30 ms
First-pass ranker20 ms
Main ranker60 ms
Diversity and rules15 ms
Total185 ms of 250 ms
budget 250 ms
Fits, with 65 ms to spare

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.

Two tricks that make the towers cheap

The first stage has to cut thousands of listings fast, so most of its work must happen before the search arrives.

Predict

Which tower runs on every search?

Pick an answer above to see the rest

Filter in the index first, then let a model pick a few thousand

Location, dates, party size and the guest's own filters are rules, not preferences. A listing that's booked on those dates isn't a candidate at any score. So filter it in the index before any model runs. This is where most of the 7 million drop out.

Filters alone aren't enough. Airbnb's retrieval post names the hard cases: large areas like California or France, and busy places like Paris or London. A search for a whole region can leave tens of thousands of eligible homes, far more than a ranker can score. Retrieval has to pick the best few thousand, and that takes a model.

Learn a vector for each listing from browsing sessions

That retrieval model starts from how guests browse.

Predict

One guest clicked L4, L9, L2, L7 and L5, in that order. Which listings pull L2's vector toward them?

Pick an answer above to see the rest

A vector for a brand-new listing

Learned vectors need history, and a brand-new listing has none.

Predict

A new home priced $$ has no clicks yet. Where does its first vector come from?

Pick an answer above to see the rest

Compare each candidate with what this guest clicked and skipped

Vectors can also describe the guest, from what they did in this session.

Predict

The guest skipped L3 and L8, then clicked L1 at rank 3. Does L6, at rank 4, count as skipped?

Pick an answer above to see the rest

Two towers learn from whole trips

Airbnb's embedding-based retrieval learns two models: one for the query and one for the listing.

Query towerListing tower
inputlocation, guests, length of staypast engagement, amenities, guest capacity
outputa query vector, every searcha listing vector, once a day, stored

The score is how close the two vectors are.

Airbnb's 2025 retrieval model is a standard two-tower network (1 source). The listing tower reads features of the home, such as past engagement, amenities and guest capacity. The query tower reads the location, the number of guests and the length of stay.

The training pairs come from user trips (1 source). A trip groups the searches of a guest who booked, by location, number of guests and length of stay. The booked home is the positive. Each pair puts it against another home the guest saw on that trip and didn't book.

The negatives matter more than the architecture. Random homes made the task too easy and the model worse (1 source). A random home is usually in the wrong city at the wrong price, and the location filter already handles that. The homes this guest considered for this trip and passed on teach the model what set the booked one apart.

The system led to a statistically significant gain in overall bookings in an A/B test (1 source).

In the editor, write trip_pairs(trip, booked): the booked home paired with every other home the guest saw on the trip. A trip is a list of pages, one per search, so a home can show up on more than one page, and it still pairs only once.

HNSW, one approximate index, walks a graph in layers

Finding the nearest vectors among millions needs an approximate index. HNSW is one widely used kind, and IVF, in the next step, is another.

HNSW layerPoints
2A, F
1A, C, F, H
0A, B, C, D, E, F, G, H, I

A search starts at the top, hops toward the query, and drops a layer when it can't get any closer.

Retrieval asks for the 2,000 listing vectors closest to the query vector, among the eligible ones, in a few milliseconds. Comparing the query with every vector takes too long. An approximate nearest neighbor (ANN) index finds most of the closest vectors, not always all of them, in far less time. Three designs are worth knowing.

HNSW (hierarchical navigable small world) builds a graph over the vectors, in layers. The top layer has few points and long links. Each layer below has more points and shorter links. Its authors report that starting at the top, where links are longest, lets search time grow only with the logarithm of the number of points.

The graph costs memory: HNSW keeps the full vectors plus the links. And Faiss, a widely used library for vector search, notes that HNSW can't remove a vector, because that would break the graph.

IVF scans only the clusters nearest the query

The second design skips the graph and sorts the vectors into clusters instead.

IVF groups the vectors into clusters, and scans only the nearest
clusters
cluster 1cluster 2cluster 3cluster 4

The query lands between clusters 2 and 3, so only those two are scanned. 1 and 4 are skipped.

IVF (inverted file) groups the vectors into clusters with k-means. At query time it scans only the vectors in the few clusters whose centers sit nearest the query.

How many clusters it probes is the dial between speed and recall. The Faiss paper says most indexes have settings like this, chosen at search time, that trade speed against accuracy. IVF misses a true neighbor when that neighbor's cluster isn't one of the ones probed.

In the editor, write probe(query, nprobe), the clusters a search scans, and ivf_nearest(query, nprobe), the nearest vector inside them. The stub holds a tiny index: 4 cluster centers, 7 vectors in vecs, and assign, each vector's cluster. The query (5.2, 0) sits nearest cluster 1, but its true neighbor, vector 4 at (4.9, 0.2), is in cluster 0.

Product quantization shrinks each vector to a few bytes

Product quantization cuts one vector of 8 numbers, [0.12 0.80 | 0.33 0.05 | 0.91 0.40 | 0.27 0.66], into 4 pieces. Each piece becomes 1 byte, here 17, 203, 4 and 88, which names the nearest of 256 centers learned for that piece. 4 bytes in all.

Product quantization (PQ) cuts each vector into pieces and replaces each piece with the number of its nearest center, from a small list learned for that piece. With 256 centers, a piece fits in one byte. PQ usually sits inside an IVF index.

At a billion 256-dimensional vectors, it takes the index from 1 TB to 40 GB: 32 bytes of codes plus an 8-byte id for each vector. The design method lesson works that math.

In the editor, write encode(vec), which turns an 8-number vector into 4 codes, and index_gb(n, code_bytes), the size of an index of n encoded vectors. codebooks holds the learned centers, 3 for each of the 4 pieces here instead of 256, so you can check the codes by eye.

Watch · 4 min

James Briggs explains product quantization step by step, the compression behind IVF-PQ indexes, with diagrams before any code.

Product Quantization for Vector Similarity Search (+ Python) · James Briggs · Aug 2021YouTube

Airbnb picked IVF for its updates and filters

Now run the numbers for this catalog. Assume 64 float32 dimensions per listing, 4 bytes each. 7,000,000 × 64 × 4 bytes is 1.8 GB.

That fits in memory on any serving machine. So compression isn't the question here. The choice turns on updates and filters, and that's how Airbnb decided.

idlocationfreesleepscluster
L42ParisMar 3 to Mar 7417

With IVF, retrieval is one more filter: the cluster is among the top few for the query.

Airbnb compared IVF and HNSW. HNSW scored slightly better on recall, its main evaluation metric. Airbnb still found that IVF offered the best trade-off between speed and performance (1 source). It gave two reasons:

  • Prices and availability change all the time, so the index takes a high volume of updates every second. That made the memory of the HNSW index grow too large.
  • Most searches carry filters, especially on location, and HNSW retrieval alongside filters had poor latency.

With IVF, the clusters are built ahead of time, and each listing's cluster becomes one more field in the existing search index. At serving time, retrieval is a normal filter: listings from the top clusters.

HNSWIVFIVF with PQ
Memory per vectorFull vector plus graph linksFull vector plus an idA few bytes of codes plus an id
Speed and recall dialSearch depthClusters probedClusters probed, plus rescoring
Updates and deletesHard; deletes break the graphReassign a cluster idReassign and re-encode
Works with index filtersPoorly at AirbnbAs a filter fieldAs a filter field
Pick it whenStatic, memory to spareFrequent updates, heavy filteringToo big for memory uncompressed

IVF is only as good as its clusters are even. If one cluster holds a big share of the homes, picking it narrows almost nothing. Airbnb tried dot product and Euclidean distance as the measure of closeness. Both did about as well as a model, but Euclidean distance gave much more balanced clusters.

In the editor, write vectors_gb(n, dims), the memory for the whole catalog's vectors, and scan_share(assign, probed), the share of listings a query scans. In the example, 3 of 4 listings sit in cluster 0, so probing it scans 75% of them.

Measure retrieval with recall at the cut

Retrieval has one job, to keep the right listings in the pool, so it needs its own measure.

Predict

Retrieval keeps the top 3. In three searches the booked listing sat at 1, 4 and 2. What's recall at 3?

Pick an answer above to see the rest
Part 2 done
Part 3 of 5about 24 min
Ranking and features

Rank: trees first, then a neural network

With a few thousand candidates in hand, the ranker puts them in order.

Boosted trees are the right first version

A hand-written scoring function came first. Replacing it with a gradient boosted decision tree (GBDT) model gave one of the largest booking gains in Airbnb's history. A GBDT is a chain of small decision trees, each one fixing the errors of the ones before it. Many good iterations followed. Then the gains stalled, with long runs of neutral experiments.

So a GBDT on a few hundred features, trained with a ranking objective like LambdaMART, is the right first version of your design. It's strong, fast and easy to debug. LambdaMART is boosted trees trained on pairs of results, with each pair weighted by how much swapping the two would change NDCG.

Which pairs should weigh more

Predict

Which training pair should weigh more?

Pick an answer above to see the rest

Four steps took the neural ranker past the trees

The 2019 paper describes how the team got past the stall. Each step makes a good talking point.

  1. A simple neural network, with one hidden layer of 32 units. It came out booking-neutral against the trees. Its value was proving the whole pipeline could serve live traffic.
  2. Pairwise loss weighted by NDCG. Booked against not-booked pairs, each weighted by how much swapping the two would change NDCG, as in the last step.
  3. Trees and a factorization machine as inputs. The leaf each tree landed in, and a factorization machine's booking prediction, fed the network as features. A factorization machine is a linear model that also scores every pair of features, by the dot product of a small learned vector for each feature.
  4. More data, a simpler model. The team dropped all that complexity, scaled the training data 10 times, and moved to a network with 2 hidden layers. It took 195 input features, had hidden layers of 127 and 83 units, and trained on 1.7 billion pairs.

One Airbnb candidate in 2026 reported a discussion of factorization machines against embeddings plus a deep network (1 report).

A vector for each listing id

Predict

Most listings are booked only a few times a year. What does a learned vector for each listing id do?

Pick an answer above to see the rest

Two towers score the distance to an ideal listing

Airbnb's next ranker came from looking hard at its own mistakes, not from a bigger network.

The 2020 paper adds a lesson about architecture. More layers, residual connections and attention all came back neutral. What worked was a change aimed at a problem they could see in the data. The model had learned that cheaper is better, but it was missing the right price for a trip, which depends on the query.

One tower took the query and the guest and built a vector for the ideal listing for them. The other tower built a vector for each listing. The score was the distance between the two.

Online, against the 2019 network, bookings rose 0.6% and the average price of results fell 2.3%. And p99 scoring latency fell by a third, since the query tower runs once per search.

In the editor, write rank_by_ideal(ideal, listings): the listing ids sorted by straight-line distance to ideal, the query tower's vector, closest first.

Personalize with the guest's history, and keep it fresh

Two kinds of personal signal feed the ranker, and they differ in how fresh they must be. Airbnb's 2026 sequence model reads a guest's history with a Transformer, a network that reads a sequence and weighs each event against the others.

  • Long-term. Rare but telling events from the past seven years: bookings, reviews, cancellations and other past actions, capped at 80 events.
  • Short-term. Listing views from the past 21 days, capped at 200 events.

The model's encoder first ran as a daily batch job (1 source). At search time the ranker fetched the guest's stored vector and combined it with the live query. Adding the short-term sequence lifted uncancelled bookers 0.55% (1 source).

Then Airbnb moved these vectors to near real time, cutting staleness from roughly two days to less than a minute (1 source). Updates often land 10 to 30 seconds after the activity. Offline NDCG rose 1.67% from freshness alone.

That's the design argument for a streaming path. In Airbnb's words, "freshness itself is a meaningful source of ranking quality."

In the editor, write history(events, today): the guest's long-term and short-term lists, cut by the windows and caps above. Each event is (day, kind, listing), and LONG names the kinds that go in the long-term list.

Group features by how fresh they must be

The ranker's features don't all change at the same speed, and that decides where each one is computed.

Freshness decides where a feature is computed

SourceHoldsReaches the ranker
daily batch job, into a feature storelisting, guest, engagementper request
stream of clicks, into a session storeclicked, skipped, seconds oldper request
the request itselfquery, price for these dates, cross featuresper request

Group features by family and by how fresh they need to be. The freshness column decides where each one is computed and stored.

FamilyExamplesFreshnessWatch out for
ListingPrice for these dates, location, capacity, amenities, rating, photo qualityDaily, price per requestPrice depends on the dates searched
Listing engagementPast bookings, views, conversion rate, host acceptanceDailyMissing for new listings
GuestPast bookings, typical price, party size, deviceDailyMissing for logged-out guests
QueryLocation, check-in, nights, lead time, guests, filters, map zoomPer requestNo text, so this is all the intent you get
SessionListings clicked and skipped, similarity to themSecondsThe freshest signal you have
CrossPrice against this guest's usual price, distance to the map centerPer requestComputed at scoring time

In the editor, write cross_features(listing, guest, query): the two features in the table's Cross row, price_ratio and km_to_center. A listing holds its price per night by date and its map position in km, a guest holds a usual price or is None when logged out, and a query holds its nights and the map's center.

Location: the query's city paired with the listing's map cell

One cross feature in the 2019 paper earned its own learned vector: where the listing sits, read against where the guest is searching.

The paper built it from two things: the city in the query, and the map cell that holds the listing. S2 is a library that cuts the globe into cells, and level 12 is the cell size it used. The pair is hashed to one integer, and that integer gets its own learned vector.

The paper's own example: the query city San Francisco, plus a listing near the Embarcadero in S2 cell 539058204, hash to 71829521. That integer has one learned vector for that pair.

The model learned which neighborhoods guests prefer in each city. That replaced a heavily engineered pipeline.

Which date a training feature comes from

Training rows need features from the moment of the search, not from today.

Predict

A search on March 1 is used as training data in April. Listing L had 4 bookings then and 9 now. Which count goes in the example?

Pick an answer above to see the rest
Part 3 done
Part 4 of 5about 19 min
Position bias and evaluation

Position bias, in training and in evaluation

Labels come from what the old ranker showed

This is where that Airbnb interviewer "really dug into" position bias (1 report), and it's the push to prepare for. Your labels come from what the previous ranker showed, and guests mostly book what they see near the top. A listing that sat on page three for a year has few bookings because few people looked, not because it's bad. Train on those labels as they are, and the new model learns the old model's order.

Airbnb's 2020 paper says the same thing. A model trained to predict bookings learns a chance that depends on the position. The position was a decision of the previous model, so the current model ends up depending on the previous ones.

Fix one: weight each example by one over its propensity

PositionChance a guest looksWeight, 1 / chance
11.01
30.52
100.110

A propensity is the chance that a guest looks at a position at all. Estimate it from randomized swaps, or harvest it from past A/B tests. Then weight each training example by one over its position's propensity. A booking at a slot few guests see counts for more, because it happened against the odds.

Big weights also make the estimate noisy. The ranking metrics lesson works through this method and that cost.

In the editor, write weighted_rates(log, propensity): each listing's booking rate, with every booking weighted by one over its slot's propensity. Each log row is (listing, slot, impressions, bookings), and L2 has two rows because it was shown at two slots.

Fix two: feed position in to train, set it to 0 to score

Weighting is one fix for position bias. Airbnb used another.

ListingSlot
trainingL11booked: part of this booking is the slot
trainingL27not booked: part of this miss is the slot
scoringL10
scoringL20the slot is the same, so only the listing differs

Airbnb's own fix needs no propensity model. During training, position is an input to the network, so the network can explain part of each booking by where the listing sat. During scoring, position is set to 0 for every listing. Then position can't separate the listings, and only relevance does.

The network leans on position if it can. Added plainly and set to 0 at scoring, position cost about 1.3% NDCG against a model without it. So position goes through dropout at a rate of 0.15 during training: the input is hidden at random 15% of the time, which keeps the relevance part from depending on it.

Dates1234
Mar 3 to 7L2L5L8L1
Mar 10 to 14L5L1L8L2 booked, gone
Mar 17 to 21L8L2L5L1

The fix also needs listings to show up at different positions for reasons unrelated to quality. Airbnb gets that without shuffling any results.

  • Listings get booked and drop out of search, which moves the ones that remain.
  • Each listing has its own calendar, so the same listing lands at different positions for similar searches on different dates.

Removing position bias raised revenue

The online test lifted bookings 0.7% and revenue 1.8%. The paper explains the revenue surprise. Early models learned that cheap listings get booked, since price is a clean feature and quality is hard to learn. Each later model trained on rankings shaped by that, and inherited it.

The paper calls it stickiness: successive models overestimated how much guests prefer lower prices. Taking out position bias let the model weigh price against quality again.

In the editor, write position_input(positions, training, rng): the position column the network reads, in training and when scoring. rng is a numpy random generator, and rng.random(n) gives n numbers between 0 and 1.

Offline NDCG on logs carries the same bias

Position bias doesn't stop at training. Offline NDCG on logged searches has the same problem. You re-rank only what the old ranker showed, and the labels favor its top slots. Airbnb hit this. A model that matched the old one's offline NDCG lost bookings online, and the paper's diagnosis was that the offline analysis only re-ranked the top results in the logs.

Use offline metrics corrected for position where you can, and confirm online.

Maps

Predict

On a map, which pin gets the most looks?

Pick an answer above to see the rest

Evaluate offline, then online

A new ranker passes several checks before it reaches every guest.

CheckRuns onAnswers
offline NDCGlogged searcheswhich models to test
recall at 2,000logged bookingsdoes retrieval keep them
interleavinglive traffic, fastwhich of two rankers wins
A/B testlive traffic, 3 weeksship it or not

Offline, score where the booked listing landed

Each logged search becomes a test case with one relevant listing, the booked one. Airbnb's 2020 paper calls NDCG on the booked listing's position the most reliable gauge of model performance they have. For retrieval, check recall at the cut: the share of booked listings that survive into the 2,000 the ranker sees.

The differences that matter are small. The 2020 paper saw statistically significant booking differences online between models only 0.7% apart in NDCG. In 2026 the team wrote that a 0.3% improvement counts as significant.

Split train and test by time. Then break the metric out by segment: new listings, boutique hotels, first-time bookers, logged-out guests. An average hides the segments where ranking goes wrong.

In the editor, write by_segment(results), the mean NDCG of each segment, and worst(results). results holds 100 logged searches, and their overall mean, about 0.59, hides the new listings at 0.31.

Interleaving puts two rankers on one page

An A/B test on bookings needs a lot of traffic. Interleaving compares two rankers on the same page.

Predict

Two rankers take turns filling one page, A first, and both rank L4 at the top. The guest books L4. Which ranker gets the credit?

Pick an answer above to see the rest
Part 4 done
Part 5 of 5about 17 min
Cold start and feedback loops

Cold start, sameness and feedback loops

New listings: estimate what they're missing

A new listing has no bookings, views or reviews, and the ranker leans hard on exactly those. Airbnb measured it. NDCG for booked new listings ran 6% below established ones. Removing the engagement features cost the model 4.5% NDCG overall.

The first fix was a boost: rank new listings higher than the model would. Tuned to keep bookings neutral, it gave new listings 8.5% more first-page impressions. But the right boost depends on supply and demand in each market, and the team found no principled way to set it.

So they reframed it. Cold start stopped being a trade between showing unproven listings to learn about them and showing proven ones. It became a problem of estimating a new listing's missing engagement. The estimator averaged the engagement of nearby listings with the same guest capacity, over a sliding time window. The results:

  • Offline, estimation error fell 42%.
  • Online, bookings of new listings rose 14%.
  • Overall bookings rose 0.38%.

New guests borrow from the crowd nearby

The 2020 paper says that for all practical purposes users are in continuous cold start: at any moment, many are new or back after a long gap. Many arrive with nothing. A significant share of Airbnb users arrive without a login, a recent search history or any past booking (1 source).

Airbnb's answer was to borrow from the crowd nearby. It groups behavior by a key for a local cluster of about 1,000 users. The serving design is worth copying: the lookup is a soft dependency. If it times out, the model goes on without it, so personalization never blocks the request.

In the editor, write estimate(new, listings, radius, window, today): Airbnb's estimate of a new listing's recent bookings. Each listing holds its map position xy in km, how many it sleeps, and booked_days, the days it was booked.

A page is more than its best listings

A page of individually best listings can still be a bad page.

Predict

Each listing is scored alone, and most guests like budget studios. What does the page look like?

Pick an answer above to see the rest

Feedback loops

A ranker that learns from its own bookings has one more trap.

Predict

The next model trains on logs of what the last one ranked high. What happens to those listings?

Pick an answer above to see the rest

What interviewers ask next

Your labels come from the old ranker. How do you keep position bias out?

Give the four-sentence chain from Part 4: the labels mix relevance with position, so weight by one over the propensity or feed position in with dropout, evaluate with metrics corrected for position, and confirm online. Be ready for pushes on the variance of propensity weights, on what you set position to at serving, and on how you'd evaluate.

How do you trade off precision, recall, latency and infra cost?

One Airbnb round put it in these words: "How do you trade off precision / recall / latency / infra cost?" (1 report). Answer with the funnel. Retrieval recall rises with the number of candidates you pass on. In Part 2's latency budget, the first pass costs 10 µs a candidate, so every 1,000 extra candidates cost 10 ms. Pick the cut where recall of booked listings flattens.

Offline NDCG is up 1%, and the A/B test is flat

Check four things:

  • Does the offline set re-rank only logged results?
  • Do the labels carry position bias?
  • Does the gain sit in a segment that books rarely?
  • Did the test have the power to see a 0.3% change?

A new listing shows up. Where does it rank?

Give it engagement features estimated from similar nearby listings, a vector from its nearest neighbors, and a capped exploration budget. Watch the share of first-page impressions that goes to new listings.

Price changes every hour. Is your index stale?

Keep price and availability out of the vector. Apply them as filters and ranking features at request time. The vector should describe what doesn't change by the hour.

Half your traffic is on the map

Position curves don't apply there. Model attention for each layout, starting from Airbnb's finding that the map has no decay by rank (1 source).

In the editor, write pick_cut(recall, min_gain), the cut where recall flattens, and first_pass_ms(cut), what that cut costs at the first pass. recall maps each cut to the share of booked listings that retrieval keeps.

The practice round, start to finish

That's every piece the practice round needs. Here it is in order, from the first question to the last minute.

Check yourself
5 questions
  1. 1.Your stays ranker can train on clicks, which are plentiful, or bookings, which are rare. Which label, and why?

  2. 2.The main ranker costs 200 µs per listing. A city search has 10,000 eligible listings and the p99 budget is 250 ms. What does the design need?

  3. 3.Airbnb adds the listing's position as a feature during training. What does it set that feature to when scoring live searches, and why?

  4. 4.Seven million listings at 64 float32 dimensions take about 1.8 GB. Why did Airbnb choose IVF over HNSW for retrieval?

  5. 5.New listings have no bookings or views, and the ranker leans on those features. What did Airbnb find works better than a fixed ranking boost?

Where this shows up

The reports behind this lesson, each with its source.

Same report: the virtual onsite covered document redaction, project decisions, search ranking without a text query, and retrieval-assisted guidance for support staff.

Candidate report·PracHub (first-person report, curated and edited by the site)·2026-09-21Source

MLE onsite design question (posted 2026-09-04, linked to the Sep 2026 report): rank home search results with no query text.

Prep site·PracHub (prep site question bank)·2026-09-04Source

ML system design in the same loop: user embeddings plus two-stage semantic retrieval and ranking.

Candidate report·PracHub (first-person report, curated and edited by the site)·2026-08-25Source

The interviewer pushed hard on position bias.

Candidate report·PracHub (first-person report, curated and edited by the site)·2026-08-25Source

Same MLE report: the phone screen ML design question was about recommendation and search.

Candidate report·PracHub (first-person report, curated and edited by the site)·2026-08-25Source

Embedding-based retrieval (Mar 2025) produces a candidate pool that more compute-intensive ranking models score later.

“which can then be scored by more compute-intensive machine learning models later in the search ranking process.”
Company source·Airbnb Tech Blog (airbnb.tech), post 'Embedding-Based Retrieval for Airbnb Search'·2025-03-19Source

The retrieval model is a standard two-tower network.

“The model architecture followed a traditional two-tower network design.”
Company source·Airbnb Tech Blog (airbnb.tech), post 'Embedding-Based Retrieval for Airbnb Search'·2025-03-19Source

Training pairs are sampled from real user trips.

“we devised a sampling method based on user trips”
Company source·Airbnb Tech Blog (airbnb.tech), post 'Embedding-Based Retrieval for Airbnb Search'·2025-03-19Source

Random negatives made the task too easy and the model worse.

“Randomly sampling homes made the problem too easy and resulted in poor model performance.”
Company source·Airbnb Tech Blog (airbnb.tech), post 'Embedding-Based Retrieval for Airbnb Search'·2025-03-19Source

For serving, IVF beat HNSW on the speed versus quality tradeoff.

“we ultimately found that IVF offered the best trade-off between speed and performance.”
Company source·Airbnb Tech Blog (airbnb.tech), post 'Embedding-Based Retrieval for Airbnb Search'·2025-03-19Source

The system produced a statistically significant booking gain in an A/B test.

“led to a statistically-significant gain in overall bookings when A/B tested”
Company source·Airbnb Tech Blog (airbnb.tech), post 'Embedding-Based Retrieval for Airbnb Search'·2025-03-19Source

Same round: factorization machines versus embeddings plus a DNN.

Candidate report·PracHub (first-person report, curated and edited by the site)·2026-08-25Source

The sequence encoder runs as a daily batch job that stores the resulting embeddings.

“The sequence encoder runs as a daily batch job, processing event history and storing the resulting embeddings”
Company source·Airbnb Tech Blog (airbnb.tech), post 'Personalizing Airbnb search by learning from the guest journey'·2026-07-21Source

Adding the short-term sequence lifted uncanceled bookers, nights and views, all statistically significant.

“Adding the short-term sequence: +0.55% uncanceled bookers, +0.82% uncanceled nights, +0.90% views ... all statistically significant.”
Company source·Airbnb Tech Blog (airbnb.tech), post 'Personalizing Airbnb search by learning from the guest journey'·2026-07-21Source

Chronon real-time update (Sep 2026): streaming feature updates cut staleness from about two days to under a minute.

“cutting effective staleness from roughly two days to less than a minute”
Company source·Airbnb Tech Blog (airbnb.tech), post 'The guest journey, updated in real time: extending Airbnb's sequence recommender with Chronon'·2026-09-17Source

The Chronon project site promises point-in-time correctness, so training data does not leak future values.

“Eliminate data leakage with guaranteed point-in-time correctness.”
Company source·Chronon project site (chronon.ai)Source

Personalization without identity (Sep 2026): many users arrive logged out with no history or bookings.

“A significant share of Airbnb users arrive without a login, without a recent search history, or without any prior booking.”
Company source·Airbnb Tech Blog (airbnb.tech), post 'Personalization without user identity'·2026-09-29Source

Map ranking differs from list ranking: attention does not decay with rank position.

“There is no ranked list, and there is no decay of user attention by ranking position.”
Company source·Airbnb Tech Blog (airbnb.tech), post 'Improving Search Ranking for Maps'Source

Interleaving for search ranking (Oct 2022, older): a 50x speedup over an A/B test at equal traffic.

“We achieve a 50x speedup over an A/B test given the same amount of traffic.”
Company source·Airbnb Tech Blog, post 'Beyond A/B test : Speeding up Airbnb Search Ranking Experimentation through Interleaving' (full text read from the blog's Medium RSS feed; the post page returns 403)·2022-10-06Source

Interleaving credit is assigned by bookings, a downstream action.

“we assign credits by bookings, which is a downstream activity”
Company source·Airbnb Tech Blog, post 'Beyond A/B test : Speeding up Airbnb Search Ranking Experimentation through Interleaving' (full text read from the blog's Medium RSS feed; the post page returns 403)·2022-10-06Source

Interleaving is the main evaluation step before an A/B test.

“Interleaving is currently part of our experimentation procedure, and is the main evaluation technique before the A/B test.”
Company source·Airbnb Tech Blog, post 'Beyond A/B test : Speeding up Airbnb Search Ranking Experimentation through Interleaving' (full text read from the blog's Medium RSS feed; the post page returns 403)·2022-10-06Source

ML experience round: what to do when offline and online metrics disagree.

Candidate report·PracHub (first-person report, curated and edited by the site)·2026-08-25Source

Same round: trading off precision, recall, latency and infrastructure cost.

Candidate report·PracHub (first-person report, curated and edited by the site)·2026-08-25Source

Practice

Sources (14)
  1. Real-time Personalization using Embeddings for Search Ranking at Airbnb · KDD 2018 · Jul 19, 2018
    “being a two-sided marketplace in which one needs to optimize for host and guest preferences, in a world where a user rarely consumes the same item twice and one listing can accept only one guest for a certain set of dates”
  2. Listing Embeddings in Search Ranking · The Airbnb Tech Blog on Medium, read through a Wayback Machine snapshot · Mar 13, 2018
    “we predict not only the neighboring clicked listings but also the eventually booked listing as well”
  3. Applying Deep Learning To Airbnb Search · arXiv 1810.09591 (KDD 2019) · Oct 24, 2018
    “Even the most popular listing can be booked at most 365 times in an entire year.”
  4. Improving Deep Learning For Airbnb Search · arXiv 2002.05515 (KDD 2020) · Feb 10, 2020
    “Instead, we introduce position as a feature in the DNN, regularized by dropout. During scoring we set the position feature to 0.”
  5. Learning To Rank Diversely At Airbnb · arXiv 2210.07774 · Sep 19, 2022
    “Diversifying search results shifts the balance away from the majority preference of affordability towards the minority preference of quality.”
  6. Embedding-Based Retrieval for Airbnb Search · The Airbnb Tech Blog · Mar 19, 2025
    “A key design decision here was choosing features such that the listing tower could be computed offline on a daily basis.”
  7. Efficient and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphs · arXiv 1603.09320 · Mar 30, 2016
    “Starting search from the upper layer together with utilizing the scale separation boosts the performance compared to NSW and allows a logarithmic complexity scaling.”
  8. Faiss indexes · Faiss wiki (GitHub) · Jul 28, 2025
    “HNSW does not support removing vectors from the index. This would destroy the graph structure.”
  9. The Faiss library · arXiv 2401.08281v4 · Oct 23, 2025
    “For a fixed index, there are often one or several search-time hyperparameters that trade off speed with accuracy.”
  10. Personalizing Airbnb search by learning from the guest journey · The Airbnb Tech Blog · Jul 21, 2026
    “The short-term sequence captures listing views from the past 21 days. We cap the short-term sequence at 200 events.”
  11. The guest journey, updated in real time: extending Airbnb's sequence recommender with Chronon · The Airbnb Tech Blog · Sep 17, 2026
    “In practice, updates often land within 10 to 30 seconds of the underlying activity.”
  12. Personalization without user identity · The Airbnb Tech Blog · Sep 29, 2026
    “The lookup is a soft dependency. If it times out, the model proceeds without it, so personalization never blocks the core request path.”
  13. Learning to Rank for Maps at Airbnb · arXiv 2407.00091 (KDD 2024) · Jun 25, 2024
    “But some of the basic assumptions underlying ranking, built for a world where search results are presented as lists, simply break down for maps.”
  14. Rules of Machine Learning: Best Practices for ML Engineering · Google for Developers · Aug 25, 2025
    “The best way to make sure that you train like you serve is to save the set of features used at serving time, and then pipe those features to a log to use them at training time.”