GuideAdvanced
LLM Search and Recommendation
A store's search box and its "you may also like" section are product: they decide what each shopper sees and, therefore, what sells. This guide teaches you to build them and improve them with LLMs without losing sight of what actually matters: measuring. You walk the whole funnel, from candidate retrieval (lexical, vector and hybrid) to understanding the query, ranking with a trained ranker, reranking with an LLM and applying business rules; and on the recommendation side, from popularity and collaborative filtering to semantic IDs, generative retrieval and hybrids where an LLM interprets and a classical recommender ranks. You learn it at **Kestrova**, a fictional outdoor gear store with 560 products, 1,500 shoppers and 92 queries with relevance judgments. You see why a lexical search returns gaiters when someone asks for waterproof boots, how much you gain by understanding the query with an LLM versus reranking with one (and what each costs per thousand searches), how a reranker's position bias changes the result depending on the order you hand it the candidates, why an LLM judge can flip the comparison between systems when the pool is built wrong, how a semantic ID lets you recommend a product nobody has bought yet, and why interleaving detects with far less traffic a difference that an A/B test cannot see. Everything runs on your laptop without an API key: a deterministic synthetic catalog, BM25 written from scratch, vectors computed with numpy (no model downloads), a simulated model with the same response shape as the Claude Messages API, and real metrics (recall@k, MRR, NDCG, bootstrap intervals) computed on that data. You see exactly the same numbers as the guide. An optional `--live` mode uses the real API with structured outputs.
- 64
- lessons
- 8
- modules
- English · Spanish
- available in
- Free
- access
Outcomes
What you'll be able to do
- Explain search and recommendation as one staged funnel, with a quality, cost and latency budget for each stage
- Build a set of relevance judgments and evaluate offline with recall@k, MRR and NDCG, confidence intervals and paired comparisons, without being fooled by a small sample or a misused LLM judge
- Implement lexical (BM25), vector and hybrid retrieval (reciprocal rank fusion), with facet filters, knowing what recall you ask of each stage
- Understand the query with an LLM: correction, constraint extraction with structured outputs, expansion, recovery when there are no results, and caching for the head of the distribution
- Train a feature ranker and add LLM reranking (pointwise, listwise and sliding windows), measure its position bias, choose the depth and justify its cost
- Recommend with popularity, item-to-item, matrix factorization, semantic IDs and generative retrieval, and build hybrids where the LLM interprets and a classical recommender ranks, with verified explanations
- Solve cold start for new products and new shoppers, enrich the catalog with an LLM in batch, and explore with a bandit without falling into the popularity loop
- Evaluate online with a click model, A/B tests, sample size and interleaving, and make a launch decision with quality, cost per thousand queries and per-stage latency on the table
Before you start
What you need to bring
It's for you if...
- Software or ML engineers who will build or improve a product's search or recommendations and want to know where an LLM actually pays off
- AI engineers who have built RAG and need to go from "retrieve context for a model" to "rank products for a person"
- Technical and product leads who have to decide, with numbers, whether an LLM reranker is worth what it costs
Requirements and materials
- Intermediate Python: functions, classes, dictionaries, JSON, running a module with `python3 -m`
- Basic linear algebra (vector, dot product) and probability (proportion, mean). The guide explains every metric from scratch
- Python 3.10 or newer and `pip install numpy`. No API key needed; for the optional `--live` mode, an Anthropic key and `pip install anthropic`
Content
The syllabus, module by module
Open any of them to see its lessons.
- 1. Introduction: the search box is product
- 2. Search and recommendation, one problem
- 3. The multi-stage funnel and its budgets
- 4. Lab, part 1: data, text, retrievers and metrics
- 5. Lab, part 2: the mock model and the pipeline
- 6. Lab, part 3: recommenders, online simulation and CLI
- 7. Your first ranked list
- 8. Project: a baseline you can defend
- 1. Introduction: measure before you build
- 2. Relevance judgments and the golden set
- 3. Recall@k for the candidate stage
- 4. MRR and NDCG for the ranked list
- 5. Confidence intervals and paired comparisons
- 6. Beyond accuracy: coverage, diversity, novelty
- 7. LLM judges, pooling and agreement
- 8. Project: an evaluation report
- 1. Introduction: bring a hundred books, fast
- 2. BM25 from scratch
- 3. Dense vectors without a big model
- 4. Hybrid retrieval with reciprocal rank fusion
- 5. Filters, facets and thin listings
- 6. The accessory problem and category intent
- 7. Approximate search and the recall budget
- 8. Project: tune the candidate stage
- 1. Introduction: the bookseller who translates
- 2. What shoppers type: a query log tour
- 3. Normalization and spelling correction
- 4. Extracting constraints with structured outputs
- 5. Query rewriting and expansion
- 6. Zero results, relaxation and out of catalog
- 7. Caching understanding for the head
- 8. Project: a query understanding layer
- 1. Introduction: the expert bookseller charges per query
- 2. A feature ranker trained on pairs
- 3. LLM reranking: pointwise, listwise and sliding windows
- 4. The rerank prompt and structured output
- 5. Position bias: measure and mitigate
- 6. How deep to rerank
- 7. Business rules after ranking
- 8. Project: does the reranker earn its cost?
- 1. Introduction: recommending without a query
- 2. Popularity and item-to-item
- 3. Implicit matrix factorization in numpy
- 4. Semantic IDs with residual quantization
- 5. Generative retrieval over semantic IDs
- 6. Hybrids: an LLM profile plus a classical ranker
- 7. Grounded explanations
- 8. Project: a home page recommender
Where it fits
This guide is part of something bigger
It's studied inside these programs, with support and dates.
Common questions
What people usually ask
No limit. It's a free guide: come in whenever you like, as often as you like.
No. Modules run from easier to harder, but you can jump to the one you need. Progress is saved per lesson.
Whatever is needed is listed under “What you need to bring”, above. If nothing is listed there, you can start from zero.
In the WhatsApp group, and every two weeks there's a live with an instructor where questions get worked through.
No. This guide is self-paced with no dates. The bootcamp is live, by cohort, with work someone reviews.
Start whenever you like
What students say
These reviews are from enrolled students who completed at least 50% of the course. We moderate reviews only on content grounds (spam, offensive language, personal data), never for being critical or negative.
No approved reviews yet.
Be the first to share your experience!