LLM-Powered Recommendation System
A personalized activity and event recommendation system combining user preferences, semantic representations, retrieval, and language models.
The problem
Activity and event recommendation is cold-start heavy and context-rich: catalogs churn, user intent is expressed in natural language, and pure collaborative signals are sparse. The system needs to reason over semantics and preferences, not just co-occurrence.
My role
AI engineer. I designed and built the end-to-end recommendation pipeline, from preference encoding through retrieval, LLM enrichment, and ranking.
System architecture
- 01User Profile — structured preferences plus interaction history.
- 02Preference Encoder — turns profile and context into a query representation.
- 03Candidate Retrieval — semantic vector search over the activity/event catalog.
- 04LLM Enrichment — language model reasons over candidates, explanations, and fit against stated intent.
- 05Ranking — final ordering combining relevance, diversity, and preference signals.
- 06Results — personalized, explainable recommendations.
Technical decisions
Retrieve-then-rank over end-to-end LLM scoring
Scoring the whole catalog with an LLM is too slow and expensive. Cheap semantic retrieval narrows to a candidate set; the LLM only reasons over a shortlist.
Embeddings for recall, LLM for precision
Vector search maximizes recall over a churning catalog; the LLM adds precision and natural-language justification where it changes the decision.
Explainability as a first-class output
For discretionary activities, a short 'why this' rationale materially improves trust and click-through, so the enrichment step emits explanations, not just scores.
Evaluation
Offline evaluation on held-out interactions using retrieval recall@k and ranking quality (NDCG-style), plus qualitative review of LLM rationales for faithfulness. Latency and cost per request are tracked because they gate what LLM stages are affordable in production.
- TODO: recall@k for the retrieval stage
- TODO: ranking NDCG@k vs. non-LLM baseline
- TODO: p95 latency and cost per recommendation request
Failure cases & lessons
- LLM enrichment can hallucinate attributes not present in catalog metadata; constraining it to provided fields and validating outputs mitigates this.
- Semantic retrieval can over-cluster popular categories, hurting diversity; explicit diversification in ranking counteracts it.
- End-to-end latency is dominated by the LLM stage, forcing careful shortlist sizing and caching.
Technologies
- LLMs
- Embeddings
- Vector Search
- Ranking
- Python