# Airbnb CASTLE: training search before the first real query

How Airbnb solved having neither real queries nor relevance labels when it opened natural language search. An LLM writes a query from a booked and a viewed-only listing, so the label comes with the pair. KL divergence 1.01 \(best prior 9.33\), 91 to 93 percent expert agreement, limits and next steps.

- Language: en
- Published: 2026-11-18
- Tags: dev, airbnb, search, llm, synthetic-data
- URL: https://devs7ud.io/en/deep-dives/airbnb-castle-search-before-first-query-en
- Translation (ko): https://devs7ud.io/deep-dives/airbnb-castle-search-before-first-query.md

## Before the first query

Airbnb has published a method called CASTLE on its engineering blog. It tells how the team opened natural language search, where guests look for a stay in their own words such as "romantic cabin near skiing", with no real queries to train on and no labels saying which listings match.

- Early on, with no search history, both the queries and the relevance labels have to be built from scratch.
- CASTLE has an LLM write a query from a pair of listings in a booking session, and attaches the label at the moment the pair is built.
- The paper behind it was accepted as a full research paper at CIKM 2026.

![CASTLE architecture overview: contrastive listing pairs feeding seed-guided query generation](https://miro.medium.com/v2/resize:fit:1400/1*SnUKzKBbuTC2iWIJHS-6fg.png "zoom")

_Image: [Airbnb Tech Blog](https://airbnb.tech/ai-ml/castle-training-natural-language-search-before-the-first-real-query/)_

## No queries, no labels at the starting line

Search where people type what they mean, instead of tapping filters and categories, needs training data before it can start. But search has not opened yet, so there are no queries, and with no queries there are no labels saying which listings are the right results. The post calls this the cold-start problem for natural language search.

Earlier methods tackle the two needs separately. Passage-based approaches such as InPars have an LLM write a query from a single document and then rely on another LLM judgment for the label, which adds a second source of error. Promptagator widens query diversity with a few examples, but a gap remains between what it generates and how real guests behave.

What the post stresses most is the distribution. If synthetic queries differ from real guests in phrasing, length, or the attributes they mention, a model trained on them generalizes poorly. Airbnb measured that gap with KL divergence, a measure of how far one distribution sits from a reference, and reports that earlier approaches scored between 9.33 and 26.2, far from the real-user distribution.

**KL divergence of earlier approaches**

| 항목 | 값 |
| --- | --- |
| Lowest score | 9.33 |
| Highest score | 26.2 |

_Source: Airbnb Tech Blog. Lower means closer to real query distribution._

## The booked listing and the one only viewed

CASTLE starts from booking records. When a guest looks at several listings and books one, that act already carries a preference: the booked listing was chosen over the rest. Airbnb pairs the booked listing, as the positive, with one listing picked at random from the others the same guest viewed but did not book, as the negative.

**How one booking becomes a query and a label**

- Booking session → Listing pair
- Listing pair → Listing features
- Listing features → LLM writes a query
- LLM writes a query → Query and label

_Source: summarized from the Airbnb Tech Blog._

The features of the two listings are the LLM's input. They include amenities and property details plus a one-sentence summary of recent public guest reviews, with personally identifying information removed. The post says the whole process uses de-identified booking sessions, selected in accordance with user privacy permissions.

The label is the point. The query is written as something that fits the booked listing and not the one it is compared with, so the listing that matches that query is, by construction, the booked one. No extra LLM judgment or human labeling is needed, and the source of error shrinks to the query generation alone.

## A mix of three prompts

Even with a pair of listings, asking an LLM for a query tends to give the same short phrase again and again. The post calls this query collapse. CASTLE blends three prompt variants of different character to prevent it.

| Prompt | What it does |
| --- | --- |
| Template-based | Gives a frame for common search patterns so query structure stays varied |
| Few-shot | Shows about 500 seed queries from user research so the wording follows real guests |
| Attribute-grounded | Aims the query at what separates the two listings, such as a fireplace or distance to a ski resort |

_Source: Airbnb Tech Blog. A variety mechanism on query length and phrasing is used as well._

On top of this, a variety mechanism pushes the model to vary query length and phrasing. The resulting word-count distribution has a standard deviation of 2.48, close to the 2.49 of real guests, against 0.99 for the baselines (InPars and Promptagator) without the seed-guided mechanism. The post also notes that real Airbnb guests tend to use concise phrases of about four to eight words rather than long sentences, and that CASTLE is designed to match that distribution, not to write artificially long queries.

![Query length distribution comparison: CASTLE, baselines, and real users](https://miro.medium.com/v2/resize:fit:1400/1*k9_WSHcM1dv4bxXAgtMuqQ.png "zoom")

_Image: [Airbnb Tech Blog](https://airbnb.tech/ai-ml/castle-training-natural-language-search-before-the-first-real-query/)_

## KL 1.01, a distribution 9.2x closer

CASTLE is compared with InPars-style generation and Promptagator on two axes: how well the query distribution matches, and label quality. Against real guest queries, CASTLE reaches a KL divergence of 1.01, a 9.2 times improvement over the best baseline, Promptagator at 9.33. At the level of attribute types (property type, amenity, location and so on) its KL is 0.08, lower even than the 0.09 of the hand-curated survey seed queries. The post reads this as the generated queries capturing the diversity of real guest intent more faithfully than the seeds themselves.

**KL divergence from real guest queries**

| 항목 | 값 |
| --- | --- |
| CASTLE | 1.01 |
| Promptagator | 9.33 |

_Source: Airbnb Tech Blog. Lower means closer to the real distribution._

For label quality, three independent subject matter experts reviewed 200 sampled triplets of a query and two listings. All three agreed with CASTLE's relevance assignments at 91 to 93 percent, and the post concludes that the contrastive construction yields high-quality labels without any human annotation in the loop.

![KL divergence comparison across methods: CASTLE, baselines, and the real user distribution](https://miro.medium.com/v2/resize:fit:2000/1*z27vgN4i_HHtAB_tiY-_ng.png "zoom")

_Image: [Airbnb Tech Blog](https://airbnb.tech/ai-ml/castle-training-natural-language-search-before-the-first-real-query/)_

## The gap for new listings

A new listing with no booking history cannot form a contrastive pair. For those, a Virtual Judge, an LLM evaluator, assigns relevance labels to additional query and listing pairs and fills the gap. The post says this extends coverage to rare intents while keeping the quality guarantee of the contrastive construction for the core training set. For services where real traffic has begun to build up, it also describes CASTLE-R, a variant seeded with real queries.

The synthetic data stays useful once real traffic accumulates. Because it starts from listing characteristics, it naturally oversamples property types and amenity combinations that guests rarely search for but that matter when they do. The next challenge is multi-turn conversational search, where a guest begins with "cabin near skiing" and refines to "one that allows dogs". Cold-start data is even harder to generate there, and the team wants to see whether contrastive grounding carries over.

The post names neither the LLM that was used nor any search results after the method went into the product. Every figure in this article is an offline evaluation reported by Airbnb.

## View

There is something here for a small team opening search for the first time: behavior records make the labels, and the LLM adds the wording. Asking an LLM to judge the right answer adds one more layer of error, while reading the answer from a choice a person has already made removes that step. Behavior alone cannot tell how people actually phrase things, so filling that part with about 500 seed queries is also worth noticing.

What this article covers, though, is the distribution match and label agreement that Airbnb reported. Whether guests actually find stays better with this search is not in the post, so that answer has to come from later news.

## Original

- [CASTLE: training natural language search before the first real query](https://airbnb.tech/ai-ml/castle-training-natural-language-search-before-the-first-real-query/) — How Airbnb solved the cold start for natural language search
- [CASTLE: Contrastive and Seed-Guided Training for Cold-Start Natural Language Se…](https://arxiv.org/abs/2605.21812) — The CIKM 2026 paper \(DOI 10.1145/3799682.3841071\)

The post is written by Wendy Ran Wei and other Airbnb authors. All images are from the original post.
