Bypassing inference bottlenecks: Accelerating complex AI search with Retrieve-for-Train
Retrieve-for-Train replaces expensive inference-time LLM reasoning for query fan-out with a one-time offline RL stage. A 4B fan-out language model (Gemma3-4B or Qwen3-4B) is trained with Soft-GRPO on a composite set-level reward that combines groundedness to the database manifold, Vendi Score diversity and query alignment. The trained model then synthesizes query-to-target-set pairs, which are distilled into a 53.9M-parameter diffusion retriever that produces a whole slate of target embeddings in one non-autoregressive pass. On fashion (CLIP) and music playlist (MuLan) retrieval it beats zero-shot expansion and Best-of-N, with a 12–20x speedup, staying at sub-second to a few seconds where autoregressive fan-out reaches nearly 50 seconds. Ablations show that without the diversity term the policy reward-hacks into degenerate strings.
Related posts
- Training 100x Cheaper Retrieval models Neon and Castform
Neon easyNovice
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. The post claims the model matches GPT-5.6 Sol's accuracy at about 100x lower cost; a frontier multi-turn search request takes over 10s and costs around $0.03. The pipeline generates synthetic question/answer tasks from the existing corpus. Training uses a hybrid search tool with RRF merging and a reward function that scores retrieval, citation and answer correctness. Neon's autoscaling absorbs the bursty search load from parallel rollouts, and branching is positioned as a way to give stateful agents isolated environments.
- PipelineRL
Hugging Face hardMasterPipelineRL resolves the tradeoff between inference throughput and on-policy data in LLM reinforcement learning by doing inflight weight updates: after each optimizer step, trainers broadcast new weights via NCCL to inference servers, which pause only long enough to receive them and then keep generating with existing KV caches. Trained on the Open-Reasoner-Zero dataset at 7B and 32B, it matches or beats Open-Reasoner-Zero on AIME 2024 and MATH 500 using a simplified GRPO with no value function, importance-weight clamping, KL penalty or entropy bonus. The modular design defines HTTP contracts for inference servers (init_process_group, request_weight_update, chat completion) and Python contracts for trainers, so engines like vLLM, SGLang, DeepSpeed or FSDP can be swapped in.
- Our Early Journey to Transform Instacart’s Discovery Recommendations with LLMs
Instacart Tech mediumAdeptInstacart rebuilt its Shopping Hub discovery recommendations around a top-down, cascaded LLM pipeline. It first generates personalized page themes, then taxonomy-grounded retrieval keywords, then applies quality and diversity filtering, and finally hands off to existing product and pagewise ranking services. Keyword generation uses a teacher-student fine-tuned open-weight model (Llama/Qwen with LoRA ablations). It also uses RAG that prunes a 300,000-term keyword corpus to about 100 nearest neighbors per theme, which cut generation costs 15–20%. Quality is enforced through embedding-based deduplication, LLM-as-a-judge evaluators calibrated with human-in-the-loop data, and a fine-tuned cross encoder for theme-product relevance at scale.
- Meta’s Generative Ads Model (GEM): The Central Brain Accelerating Ads Recommendation AI Innovation
Meta Engineering hardMasterGEM is Meta's LLM-scale foundation model for ads recommendation, trained on thousands of GPUs and used as a teacher to improve hundreds of downstream vertical ranking models; it lifted ad conversions 5% on Instagram and 3% on Facebook Feed. The architecture handles non-sequence features with an extended Wukong design (stackable factorization machines), long user-behavior sequences with a pyramid-parallel structure, and cross-feature learning with InterFormer, plus multi-domain learning across surfaces, for 4x the efficiency of earlier ranking models. Knowledge reaches downstream models through direct and hierarchical transfer that combines distillation with a Student Adapter for stale supervision, representation learning and parameter sharing, which Meta reports as 2x as effective as standard distillation. A rebuilt training stack (HSDP for dense layers, 2D sharding of embedding tables, jagged-sequence kernels, FP8 activations, SM-free NCCLX collectives, compile caching) delivered 23x effective FLOPs with 1.43x MFU on 16x more GPUs.
- From Scoring to Spelling: Rebuilding Ads Retrieval at Instacart
Instacart Tech hardMasterInstacart 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.