---
title: "CASTLE: training natural language search before the first real query"
description: "CASTLE solves the cold-start problem for Airbnb's natural language search by generating synthetic queries and relevance labels together."
url: "https://swe.quest/articles/castle-training-natural-language-search-before-the-first-real-query-3fadbe49f51d97fd"
canonical: "https://medium.com/airbnb-engineering/castle-training-natural-language-search-before-the-first-real-query-3818ef8b4828"
source: "Airbnb Engineering"
published: "2026-10-13"
difficulty: "hard"
kind: "Research"
reading_minutes: 7
tags: ["search","llms","model-training","machine-learning"]
---

# CASTLE: training natural language search before the first real query

A post on [Airbnb Engineering](https://swe.quest/sources/airbnb.md), published 2026-10-13, 7 min read, Research. Original: [https://medium.com/airbnb-engineering/castle-training-natural-language-search-before-the-first-real-query-3818ef8b4828](https://medium.com/airbnb-engineering/castle-training-natural-language-search-before-the-first-real-query-3818ef8b4828)

## Summary

CASTLE solves the cold-start problem for Airbnb's natural language search by generating synthetic queries and relevance labels together. It uses contrastive listing pairs from de-identified booking sessions: a booked listing is the positive and a viewed-but-not-booked one the negative, so the label is correct by construction. Template, few-shot (about 500 user-research seed queries) and attribute-grounded prompts, plus a variety mechanism, prevent query collapse. Query-distribution KL divergence against real users is 1.01, versus 9.33 for the best baseline (Promptagator), and human raters agreed with the labels 91–93% of the time. An LLM Virtual Judge covers listings with no booking history, and a CASTLE-R variant seeds generation from real queries once traffic exists.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Search](https://swe.quest/tags/search.md) (Backend & APIs)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [Machine learning](https://swe.quest/tags/machine-learning.md) (AI & ML)

## Prerequisites

- information retrieval relevance labels ([easy posts on Search](https://swe.quest/tags/search.md?difficulty=easy))
- LLM prompting ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- KL divergence
- dense retrieval training ([easy posts on Model training](https://swe.quest/tags/model-training.md?difficulty=easy))

## Keywords

CASTLE, Airbnb, InPars, Promptagator, CIKM 2026, KL divergence, Virtual Judge

## Related posts

- [How Etsy Uses LLMs to Improve Search Relevance](https://swe.quest/articles/how-etsy-uses-llms-to-improve-search-relevance-3911d99788b5bd04.md): Etsy Code as Craft · 2026-01-16 · Medium · 10 min read · Search, LLMs, Evaluation, Model training, E-commerce
  Etsy built an LLM-powered semantic relevance framework that complements engagement signals, which favor popular listings, with judgments of how well listings match query intent across three classes: relevant, partially relevant and irrelevant.
- [Search Quality Assurance with AI as a Judge](https://swe.quest/articles/search-quality-assurance-with-ai-as-a-judge-64fdd8c596751052.md): Zalando Engineering · 2026-03-16 · Medium · 12 min read · Search, Evaluation, LLMs, Data pipelines, E-commerce
  Zalando validated search quality for new markets (Luxembourg, Portugal, Greece) before launch by using a multimodal LLM-as-a-judge instead of manual expert review.
- [Back to The Future: Evaluating AI Agents on Predicting Future Events](https://swe.quest/articles/back-to-the-future-evaluating-ai-agents-on-predicting-future-events-bb60d8a7df64d21c.md): Hugging Face · 2025-07-17 · Medium · 10 min read · Evaluation, AI agents, LLMs
  FutureBench evaluates AI agents on predicting real future events, which rules out training-data contamination by design and makes every answer verifiable once the outcome is known.
- [Training 100x Cheaper Retrieval models Neon and Castform](https://swe.quest/articles/training-100x-cheaper-retrieval-models-neon-and-castform-05a64846d2e32056.md): Neon · 2026-08-05 · Easy · 5 min read · Model training, RAG & retrieval, PostgreSQL, AI agents, Search
  Castform uses data stored in Neon Postgres, exposed through Lakebase Search's BM25 and vector functions, to RL post-train a 4B open-source model for agentic retrieval.
- [Teaching Sidekick to say no: automated data curation with LLM judge consensus](https://swe.quest/articles/teaching-sidekick-to-say-no-automated-data-curation-with-llm-judge-consensus-cbd8b5202d7ba316.md): Shopify Engineering · 2026-06-15 · Medium · 9 min read · Model training, LLMs, Evaluation, AI agents
  Production training data for Shopify's Sidekick segmentation skill contained only successful queries, so the fine-tuned model never learned to refuse impossible requests and instead generated queries returning zero results.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
