Small Language Models for Real-Time Ad Relevance Prediction

doordash · E-commerce · 2026 · source Agentic: no · promotional bias: low · summary-only (no fetched source) · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Sponsored search ad relevance prediction

DoorDash needed to filter irrelevant sponsored search results in real time, where keyword retrieval and personalization could promote semantically wrong ads despite overlapping tokens.

Constraints:

Architecture

DoorDash uses a teacher-student relevance architecture: roughly 700,000 human-labeled query-item pairs define a 0-1-2 relevance task, a fine-tuned closed-source LLM teacher generates offline labels for production traffic pairs, a DistilBERT bi-encoder student with shared weights and 64-dimensional cached embeddings learns the teacher's judgments, and online serving fetches precomputed query/item embeddings, scores them with a bilinear layer, and applies the relevance filter before the ad auction while quality scoring runs in parallel.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  A["Human relevance labels"] --> B["LLM teacher"]
  C["Production traffic pairs"] --> B
  B --> D["Teacher-generated labels"]
  D --> E["DistilBERT bi-encoder"]
  E --> F["Offline embedding job"]
  F --> G["Embedding key-value store"]
  G --> H["Online relevance scorer"]
  I["Quality scorer"] --> J["Ad auction"]
  H --> J
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Human relevance labels Approximately 700,000 query-item labels defining the relevance task and guidelines. LLM teacher
LLM teacher Fine-tuned large model that generates scalable offline relevance labels. Human relevance labels, Production traffic pairs, Teacher-generated labels
Production traffic pairs Query-item pairs extracted from six months of real traffic for offline labeling. LLM teacher
Teacher-generated labels Millions of consistent labels used to train the serving model. LLM teacher, DistilBERT bi-encoder
DistilBERT bi-encoder Small language model with shared query/item towers and CLS pooling. Teacher-generated labels, Offline embedding job
Offline embedding job Cron process that precomputes query and item embeddings. DistilBERT bi-encoder, Embedding key-value store
Embedding key-value store Cache of precomputed 64-dimensional embeddings for online serving. Offline embedding job, Online relevance scorer
Online relevance scorer Lightweight bilinear scoring layer used at serving time. Embedding key-value store, Ad auction
Quality scorer Parallel click/conversion quality model. Ad auction
Ad auction Auction over candidates that have already passed relevance filtering. Online relevance scorer, Quality scorer

Data flow

Human labels train a relevance teacher. The LLM teacher labels query-item pairs from six months of production traffic offline. A DistilBERT bi-encoder student trains on those labels, embeddings are computed offline and cached in a key-value store, and online serving performs lightweight bilinear relevance scoring before auction ranking.

3 supporting quotes
“The process began with human annotators labeling approximately 700,000 query-item pairs to create detailed guidelines and ground truth data.”summary, stated
“Once trained, this fine-tuned LLM was used to generate relevance labels offline for query-item pairs extracted from six months of real production traffic.”summary, stated
“During online serving, the system simply fetches these pre-computed embeddings and uses a bilinear layer to compute the relevance score.”summary, stated

Why this architecture

The architecture separates expensive semantic judgment from online inference: an LLM teacher can label at offline scale, while a cached-embedding DistilBERT student gives the ad serving path low latency and keeps irrelevant ads from entering the auction.

3 supporting quotes
“The core LLMOps innovation in this case study is the teacher-student pattern that separates offline label generation from online inference.”summary, stated
“The teacher model's role is purely to create scalable supervision; it never runs in the production serving path.”summary, stated
“This parallel execution keeps the latency impact of adding the relevance layer close to zero”summary, stated

Models used: closed-source LLM teacher · DistilBERT · fine-tuned GPT evaluation models · gradient boosted decision tree baseline

Scale

Alternatives considered (roads not taken)

Keyword-based ad retrieval alone

Rejected because: Keyword overlap can return semantically irrelevant sponsored items.

“their keyword-based retrieval system, optimized for recall, would surface irrelevant sponsored items simply because of overlapping keywords.”summary, stated

Use personalization to fix relevance

Rejected because: Personalization can reinforce irrelevant matches when user history favors the wrong category.

“if a user has historically bought many chips, personalization would actually amplify the poor relevance match.”summary, stated

Run the LLM teacher online

Rejected because: The teacher is for offline supervision; online serving requires a compact low-latency model.

“it never runs in the production serving path.”summary, stated

Matryoshka dimensionality reduction

Rejected because: DoorDash chose direct linear projection as simpler, efficient, and production-ready.

“Ultimately, they selected the direct linear projection approach because it provided the best balance of simplicity, efficiency, and production readiness”summary, stated

Patterns

model-distillation (model-adaptation)

DoorDash transfers offline LLM teacher judgments into a compact DistilBERT student for serving.

“The SLM is trained on the relevance labels generated offline by the fine-tuned LLM teacher, learning to reproduce those judgments in a form suitable for latency-constrained production serving.”summary, stated

batch-offline-processing (infrastructure)

The LLM teacher labels production traffic pairs offline and embeddings are precomputed by cron before serving.

“This batch process runs offline without serving latency constraints, allowing the system to generate high-quality labels consistently at scale across millions of pairs—mirroring the judgment a human rater would make but at volumes that would be impractical to produce manually.”summary, stated
“Critically, these embeddings are computed through an offline cron job and cached in a key-value store. During online serving, the system simply fetches these pre-computed embeddings and uses a bilinear layer to compute the relevance score.”summary, stated

latency-optimization (performance)

DoorDash moves neural encoding offline and runs only lightweight cached-embedding scoring online.

“the heavy neural network computation happens offline, while online serving only performs lightweight operations.”summary, stated

llm-as-judge (evaluation)

DoorDash uses fine-tuned GPT models for scalable and consistent relevance-quality measurement.

“Interestingly, they leverage fine-tuned GPT models to provide scalable and consistent measurement of result quality—using language models for evaluation is itself an emerging LLMOps pattern.”summary, stated

Tradeoffs

Separate teacher and student roles.

Chose offline LLM teacher plus online SLM student over one model for both label quality and low-latency serving.

Rationale: This preserves high-quality supervision while meeting production latency constraints.

“benefit from stronger relevance judgments during training while maintaining strict latency requirements at inference time.”summary, stated

Use a bi-encoder with cached embeddings.

Chose offline query/item embeddings and online bilinear scoring over online neural encoding for every request.

Rationale: Cached embeddings move expensive computation out of the serving path.

“This separation of embedding generation from scoring is a common LLMOps pattern for reducing online latency—the heavy neural network computation happens offline, while online serving only performs lightweight operations.”summary, stated

Filter before auction.

Chose relevance as a pre-auction gate over letting bids compensate for irrelevance.

Rationale: Relevance is treated as non-negotiable business logic before auction pricing.

“This prevents well-funded campaigns targeting irrelevant inventory from winning simply by bidding aggressively”summary, stated

Gotchas (what bit them)

Recall-oriented keyword retrieval can produce obviously irrelevant ads.

Root cause: Overlapping tokens do not guarantee semantic match to search intent.

Resolution: Add a user-agnostic relevance model that filters label-0 items before the auction.

“a search for "salt" would return "Pringles Salt & Vinegar Potato Crisps Chips" as a result.”summary, stated

Teacher labels can scale errors as well as knowledge.

Root cause: The student learns from millions of teacher-generated labels, not only human ground truth.

Resolution: Validate with online A/B tests and maintain awareness that the student may reproduce teacher errors.

“This also highlights a potential concern—the student model could be learning to reproduce the teacher's errors at scale, though the strong online A/B test results suggest this isn't a major issue in practice.”summary, stated

Closed-source teacher dependency creates control and reproducibility concerns.

Root cause: The LLM teacher relies on an external or closed model.

Resolution: Explore migration to fine-tuned open-source alternatives.

“The reliance on a closed-source LLM for the teacher model creates a dependency on external providers and potential reproducibility concerns.”summary, stated

Filtering affects future behavioral data.

Root cause: Items removed by relevance filters are not shown, changing what engagement data is collected.

Resolution: The summary flags feedback loops as an open operational consideration, not a fully solved area.

“The relevance model filters what ads get shown, which affects what user behavior data gets collected, which could eventually influence future model training.”summary, stated

Evaluation

DoorDash evaluates relevance with validation accuracy, three-class and binary teacher accuracy, architecture comparisons, Precision@2, NDCG@10, fine-tuned GPT evaluators, and online A/B testing against a GBDT baseline.

Metrics: three-class accuracy · binary accuracy · validation accuracy · Precision@2 · NDCG@10 · online A/B lift · serving latency

3 supporting quotes
“The fine-tuned LLM teacher achieved 86% accuracy on the three-class 0-1-2 classification task, with strongest agreement on clear positives and negatives.”summary, stated
“When combining moderately relevant and highly relevant items into a single positive class, the two-class accuracy reached approximately 91%”summary, stated
“DoorDash assesses relevance using metrics such as Precision@2 and NDCG@10 (Normalized Discounted Cumulative Gain at position 10).”summary, stated

Outcomes

The case includes 700,000 human-labeled examples, six months of production traffic for offline labels, millions of teacher labels, 64-dimensional embeddings, and distributed multi-GPU training.

3 supporting quotes
“DoorDash trained these models using a distributed data parallel framework across multiple GPUs, which allowed them to scale training efficiently over their large relevance dataset.”summary, stated
“The new SLM-based relevance model achieved a 5.2% relative gain in Precision@2 over the incumbent gradient boosted decision tree production model during online A/B testing.”summary, stated
“The placement of the relevance filter before the auction shows thoughtful integration with business logic.”summary, stated