Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

OpenAI 14 min read Case study mediumAdept

How we built ChatGPT’s novel ad stack for user trust and relevance

ChatGPT's ad stack replaces the event-driven request/response ads pipeline with stateful ads sessions that track evolving intent across turns and conversations, orchestrated by a post-trained LLM that calls tools for query rewriting, ANN retrieval over multiple embedding indices, eligibility filtering (budget, pacing, targeting, policy, dedup), relevance and engagement scoring, and a separate auction tool that handles pricing and final selection. The ads service runs alongside, and fully separate from, answer generation, with separate models and code, so it cannot influence or delay ChatGPT responses. Returning no ad, or timing out before the response is ready, counts as a normal outcome. A model-generated neutral preamble is kept separate from the advertiser creative, and the system reportedly reached a $1B annualized run rate within 200 days.

Assumes: ad auctions basicssemantic embeddingsLLM tool calling

Related posts

  • Let AI Entertain You: Increasing User Engagement with Generative AI and Rejection Sampling

    Nextdoor Engineering mediumAdept

    Nextdoor improved notification email subject lines by having ChatGPT extract (not rewrite) the most interesting phrase from a post, then using a fine-tuned OpenAI ada reward model to accept the generated subject only when it predicts more clicks than the user-written one, a form of rejection sampling. The reward model was trained on ~50k A/B-labeled pairs collected by serving each variant to small random user buckets. It reaches about 65% accuracy, is monitored daily against control buckets, and is retrained when accuracy drops 10%+. Prompt engineering alone plateaued below control, while the full system lifted sessions 1%, WAU 0.4% and ads revenue 1%. Per-post caching cut cost 600x, and retries fall back to the user subject.

  • From Scoring to Spelling: Rebuilding Ads Retrieval at Instacart

    Instacart Tech hardMaster

    Instacart replaced its BERT-based ads retrieval model, which scored every atomic product ID in a fixed vocabulary, with a generative model that autoregressively decodes Semantic IDs (RQ-VAE codeword sequences) via beam search. The goal was to fix vocabulary bottlenecks, cold-start bias toward popular items, and incoherent candidate sets. Prompts combine a retailer-type token, user history SIDs and cart SIDs. SIDs shrink embedding parameters 125x and give new products coverage from day one, while beam width and temperature act as dials between precision and diversity. Serving moved from Python on CPU to a Go service on TensorRT-LLM and Triton. Mean latency dropped 10–17% despite roughly twice the candidates, and A/B tests showed +5% CTR and +34% add-to-carts.

  • Part 2: Generative bidders for ads at Grab

    Grab Engineering hardMaster

    Grab Ads replaces reactive PID budget pacing with a generative bidder that plans 30-minute sequences of per-minute pacing actions. A diffusion Generator, conditioned on campaign context and steered by classifier-free guidance, proposes candidate plans. A differentiable Aligner predicts fulfillment progress and ROAS for each plan, and the planner refines the plans by gradient descent at inference time and picks the lowest-error one. Training starts with behavioral cloning on production logs, then moves to simulator-driven learning, with Ray fanning out simulator replays across dates, markets and policy variants. Before any scoped live experiment, candidates must pass three validation gates: model metrics such as Wasserstein distance and MAE, simulator comparison against the PID baseline, and stress tests. Live results are then fed back to calibrate the simulator.

  • GenRecs Tokenization: Transforming Ads Recommendation at Meta with Stable Model Vocabulary

    Meta Engineering hardMaster

    Meta's ads recommender replaces per-item IDs with GenRecs Tokenization, a stable semantic vocabulary. Each ad, product or page is encoded with pre-trained multimodal models, decomposed into subspaces (e.g. residual decomposition) and quantized against learned codebooks into short token sequences, so similar items share tokens. This lets new and tail items inherit what the model learned about related items, enabling cold-start generalization and cross-campaign transfer. Paired with GEM and the Adaptive Ranking Model it delivered a +0.35% conversion lift. Across eight tokenizer versions, intrinsic metrics (cluster purity, distribution balance, codebook utilization) correlated with downstream CTR accuracy, so the tokenizer can be iterated without full model retraining.

  • Part 1: Simulation-first AI experimentation for ads at Grab

    Grab Engineering mediumAdept

    Grab built an offline ads simulator that sequentially replays historical ad opportunities, applies candidate bidding, ranking and pacing logic, and probabilistically generates user responses from calibrated engagement models. Shortlisted candidates that pass business and user guardrails across many traffic conditions then go to live A/B tests. Fidelity is checked continuously at the mechanism level (matching production logic) and the outcome level (comparing metric distributions against production). Two use cases illustrate the approach: narrowing the mix-ranking alpha parameter that blends ads with organic results, and comparing a Primal-Dual Adaptive Pacing controller against a harder-to-tune PID budget pacer. Lessons include treating the simulator as a product and recognizing that idealized spend-signal timing can hide live instability.

The quest for software engineering knowledge.

Look:
Layout: