ML System Design
How would you use векторный поиск, user clustering and domain-specific text/image embeddings to improve a social-feed recommender?
Ответить самому
Сначала сформулируйте ответ как на собеседовании, затем откройте разбор и оцените себя.
Короткий ответ
Use ANN over normalized post embeddings for scalable retrieval, cluster users only when personalization cost is too high, and introduce domain-specific encoders after a baseline proves where generic embeddings fail.
Полный разбор
Vector search is useful when the item tower produces embeddings and the catalog is too large for brute-force scoring. Store text/image post embeddings in an ANN index such as HNSW, FAISS or a vector database, then measure recall@K, p95 latency, memory, update cost and downstream ranker quality. The similarity metric must match training: cosine for normalized embeddings, dot product if trained that way.
User clustering can reduce serving cost, but it trades personalization for efficiency. If you recommend at cluster level, define how the cluster vector or prototype user is built, how often clusters update, and how much quality drops for heterogeneous clusters. Often it is safer to use clusters for fallback pools or cache warmup, not as the only personalization mechanism.
Domain-specific text/image encoders should be introduced after observing errors: travel photos, restaurant posts and finance/investment posts may need different features. Start with pretrained embeddings plus lightweight adaptation, then consider separate encoders or expert routing by topic. Keep diversity and exploration metrics because stronger embeddings can still create narrow feedback loops.
Теория
Retrieval improvements must be evaluated as serving tradeoffs: quality, latency, freshness, personalization and feedback-loop risk.
Типичные ошибки
- Choose a vector database without measuring ANN recall and latency.
- Use cluster-level recommendations while assuming they are fully personalized.
- Train domain-specific embedders before proving generic embeddings fail.
- Ignore diversity and exploration after improving semantic similarity.
Как отвечать на собеседовании
- Explain when user clustering is acceptable and when it hurts quality.
- Tie vector-search metrics to downstream ranking metrics.