Embedding Models Comparison
| Model | Dimensions | Cost/1M tokens | Max Input | Best For |
| OpenAI text-embedding-3-small | 512-1536 | $0.02 | 8191 tokens | General purpose, great value |
| OpenAI text-embedding-3-large | 256-3072 | $0.13 | 8191 tokens | Highest quality, flexible dimensions |
| OpenAI ada-002 | 1536 | $0.10 | 8191 tokens | Legacy, being phased out |
| Cohere Embed v3 | 1024 | $0.10 | 512 tokens | Multilingual, classification |
| Voyage AI voyage-2 | 1024 | $0.10 | 4096 tokens | Domain-specific (legal, finance) |
| BGE-large-en (open source) | 1024 | Free | 512 tokens | Self-hosted, MTEB #1 open-source |
| E5-mistral-7b | 4096 | Free (self-host) | 32K tokens | Long context, open-source top performer |
Dimension Tradeoffs
| Item | Description |
1536d (Small) | Good enough for most use cases. Faster search, less storage. ~95% of full quality. |
3072d (Large) | Best quality, highest cost. Use when recall is critical (legal, medical search). |
256d (Ultra-compact) | OpenAI supports dimension reduction via API parameter. ~90% quality, 6x faster. |
Matryoshka Embeddings | text-embedding-3 supports shortening without quality loss — store at 1536, search at 256. |
Binary Quantization | Convert float32 → binary — 32x compression, ~90% recall. Cohere binary embeddings. |
Distance Metrics
| Item | Description |
Cosine Similarity | Default for text embeddings. Measures angle between vectors. Range: -1 to 1. |
Euclidean Distance | Straight-line distance. For L2-normalized vectors, equivalent to cosine ordering. |
Dot Product | Faster than cosine for normalized vectors. Range depends on vector norms. |
Jaccard Similarity | For binary/multi-hot embeddings. Set overlap measure. |
Use Cases & Best Practices
| Item | Description |
Semantic Search | Embed query → find nearest vectors. Primary use case. |
Clustering | Group similar documents — k-means over embeddings. Topic discovery. |
Classification | Train classifier on embeddings — often beats fine-tuning for small datasets. |
Recommendation | Item-item or user-item similarity via embeddings. |
Anomaly Detection | Flag vectors far from cluster centroids. |
Normalization | Always L2-normalize before comparing — most APIs do this automatically. |
Pro Tip: OpenAI text-embedding-3-small (1536d, $0.02/1M tokens) is the default choice. For cost-sensitive at scale, use text-embedding-3-large with dimension reduction or open-source alternatives.