- Model selection — choose the best prebuilt model for your data and task.
- Model optimization — adapt and tune that model to meet production SLOs.
1. Model selection
Model selection starts when you decide to use embeddings for a task: semantic search, recommendations, RAG (retrieval-augmented generation), clustering, etc. The aim is to filter candidate models based on characteristics that matter for your data and task. Key factors to evaluate
Task-to-model mapping (high level)
- Semantic search: prioritize high recall and good separation of near-duplicates.
- Clustering: prefer compact, well-separated clusters in vector space.
- RAG: embeddings must capture passage-level context and be robust across longer texts.
- Recommendations: may require multimodal or hybrid embeddings that blend behavior and content signals.
- Use metrics suited to the task: recall@K, precision@K, MRR, NDCG for retrieval; silhouette score or adjusted Rand index for clustering.
- Create a holdout dataset that closely resembles production inputs and user queries.
- Add human validation for semantic judgments (e.g., similarity labeling of pairs).

2. Model optimization
After selecting a base model, optimization focuses on adapting it to production constraints. Optimization is iterative: fine-tune or transform, re-evaluate, and deploy with monitoring. Common optimization techniques
Optimization workflow
- Benchmark baseline (selected model + default indexing).
- Apply one optimization at a time (e.g., quantize, then reduce dimension).
- Re-run benchmarks and human validation after each change.
- Tune ANN index parameters to achieve target recall/latency trade-offs.
- Deploy with monitoring and drift detection.
Remember: higher-dimensional or more complex embeddings can improve accuracy but increase storage, memory bandwidth, and search latency. Optimize for the smallest representation that meets your quality SLOs.
Warning: using a model trained on a different domain or modality without adaptation often produces misleading similarity scores. Always validate embeddings on representative samples before productionizing them.
Practical checklist — from selection to production
- Define the task and SLOs (latency, recall, cost).
- Characterize your data modality and domain.
- Shortlist candidate models by modality, dimension, and complexity.
- Benchmark candidates on a holdout dataset and include human validation where needed.
- Select the best base model.
- Optimize: fine-tune, compress, reduce dimensionality if possible, and tune the vector index.
- Deploy, monitor, and iterate; add drift detection and alerting for representation degradation.
- Query latency and p95/p99.
- Recall@K or NDCG on a production-like query stream.
- Index size, memory pressure, and throughput.
- Concept drift indicators (e.g., distributional changes in query embeddings).
- RAG (retrieval-augmented generation) overview
- Kubernetes Documentation — for scaling and serving vector services
- Vector indexing and ANN resources (HNSW, IVF, PQ) — check vendor/OSS docs for tuning guidance