Production retrieval-augmented generation systems depend heavily on the retrieval pipeline that precedes generation. While frontier language models receive the bulk of engineering attention, the accuracy, latency, and operational cost of a RAG application are often determined by the interplay between embedding models and rerankers.
Deploying search infrastructure requires navigating three distinct architectural paradigms: dense bi-encoders, multi-vector late interaction engines, and cross-encoder rerankers. Each approach presents different trade-offs across indexing throughput, storage footprint, query latency, and ranking precision.

The Three Retrieval Paradigms
Information retrieval over dense text collections relies on three foundational architectures:
1. Dense Bi-Encoders
Bi-encoder architectures encode queries and passages independently through a transformer encoder, producing a single fixed-dimensional dense vector per text chunk:
- Mathematical formulation: Query vector and document vector . The relevance score is calculated via dot product or cosine similarity: .
- Computational characteristics: Because document representations are decoupled from queries, passage embeddings can be precomputed offline and indexed in approximate nearest neighbor (ANN) vector structures such as HNSW or IVF-PQ. Query encoding requires a single forward pass, and candidate retrieval executes in under 2 milliseconds across millions of vectors.
- Limitation: Compressing an entire text passage into a single vector (typically 768 to 3072 dimensions) creates an information bottleneck. Fine-grained lexical matches, negation, and complex relational constraints are frequently lost during pooling.
2. Multi-Vector Late Interaction (ColBERT)
Introduced in the ColBERT paper (Khattab & Zaharia) and refined in ColBERTv2 (Santhanam et al.), late interaction preserves token-level representations rather than pooling them into a single vector.
- Mathematical formulation: The query produces a matrix and the document produces . The relevance score uses the MaxSim operator, which computes the maximum inner product between each query token and all document tokens, then sums across query tokens:
- Computational characteristics: Token embeddings are still precomputed offline. At query time, the search engine computes lightweight token-to-token similarity matrices. Using optimized search engines like PLAID (Santhanam et al.), late interaction achieves query latencies of 5 to 30 milliseconds while maintaining alignment fidelity close to cross-encoders.
- Limitation: Storing 128-dimensional vectors for every token in every document significantly expands index sizes compared to single-vector bi-encoders, requiring residual centroid compression (as in ColBERTv2) to remain viable at scale.
3. Cross-Encoder Rerankers
Cross-encoders discard decoupled representations and feed the concatenated query and candidate passage directly into a single transformer encoder.
- Mathematical formulation: Full cross-attention is computed across all query and passage tokens simultaneously: . Every token can attend to every other token across both texts across all self-attention layers.
- Computational characteristics: Cross-encoders provide the highest ranking precision on benchmarks, routinely adding 5 to 15 NDCG@10 points over standalone bi-encoder retrieval. However, because no passage representations can be precomputed, scoring requires compute at query time, where is the number of candidate documents and is sequence length.
- Limitation: High latency (50 to 250 milliseconds for 50-100 candidates) makes cross-encoders unsuitable for first-stage candidate generation across entire corpora.
Modern Embedding Models Compared
Production deployments evaluate embedding models across dimensionality, context window, multilingual coverage, and cost.
OpenAI text-embedding-3 Series
Released in 2024 by OpenAI, text-embedding-3-small (1,536 dimensions) and text-embedding-3-large (3,072 dimensions) implement Matryoshka Representation Learning (Kusupati et al.).
- Matryoshka Dimension Truncation: Allows engineers to truncate vector dimensions (for example, reducing
text-embedding-3-largefrom 3,072 to 1,024 or 512 dimensions) while retaining up to 98% of full retrieval performance, cutting downstream vector database RAM requirements by 3x to 6x. - Context Length: 8,191 tokens.
- Pricing: $0.02 per 1M tokens for small, $0.13 per 1M tokens for large.
- Trade-off: Strong general baseline and managed reliability, but outranked on specialized retrieval benchmarks by dedicated retrieval models.
Voyage AI (voyage-3 and voyage-3-large)
Developed by Voyage AI, the Voyage series leads multiple domain categories on the MTEB Leaderboard.
- Architecture and Context: 1,024 dimensions with a 32,000 token context window, supporting long-document and repository-level retrieval without premature chunking.
- Performance: Outperforms general-purpose bi-encoders across financial, legal, and code retrieval benchmarks.
- Pricing: $0.06 per 1M tokens for standard voyage-3, $0.18 per 1M tokens for voyage-3-large.
Cohere Embed v3 and v4
Described in Cohere's technical release, Cohere models are designed specifically for enterprise multi-stage pipelines.
- Input Type Optimization: Requires explicit
input_typeflags (search_queryvssearch_document), applying asymmetric projection heads to distinguish queries from indexed passages. - Compression Native: Supports native quantization to
int8andubinaryembeddings directly from the API, reducing storage and RAM costs by up to 96% with minimal loss in NDCG@10. - Multilingual Support: Supports over 100 languages with cross-lingual alignment.
BAAI BGE-M3
Documented in the BGE-M3 paper (Chen et al.), BAAI's open-weight model provides a unified tri-representation system:
- Tri-representation in One Pass: Generates dense representations (1,024 dimensions), sparse lexical weights (similar to learned BM25/SPLADE), and multi-vector ColBERT embeddings in a single forward pass over an 8,192 token window.
- Self-Hosting and Economics: 568M parameters, licensed under Apache 2.0, deployable locally on an NVIDIA L4 or A10G GPU via Hugging Face Text Embeddings Inference (TEI) or vLLM.
Reranker Landscape and Benchmarks
When vector search retrieves the top 50 to 100 candidate passages, second-stage rerankers reorder them before the LLM prompt is assembled.
Cohere Rerank (Rerank 3.5)
- Deployment: Managed REST API.
- Capabilities: Handles 4,096-token candidate passages, multilingual across 100+ languages, and structured JSON fields.
- Cost Structure: Billed per search request (typically $1.00 to $2.00 per 1,000 search queries with up to 100 passages).
BAAI BGE-Reranker-v2-m3
- Deployment: Open-weight model (0.6B parameters).
- Architecture: Lightweight cross-encoder built for multilingual and cross-lingual reranking.
- Throughput: On a single NVIDIA A10G or L4 using TensorRT-LLM or ONNX Runtime with FP16/BF16, scores 100 candidates in 30 to 60 milliseconds.
ModernBERT-based Cross-Encoders (GTE and Jina)
- Architecture: Built on ModernBERT with native 8,192 sequence lengths, rotary positional embeddings, and unpadding/FlashAttention optimizations.
- Efficiency: Reduces cross-encoder sequence padding overhead by packing multiple query-document pairs into a single attention buffer, improving GPU utilization by 2x to 4x over older BERT/RoBERTa cross-encoders.
Two-Stage Retrieval Pipeline Design
The standard production design pairs a high-recall first stage with a high-precision second stage:
[User Query]
│
├───► [Stage 1: Candidate Generation] (Latency: 2-15 ms)
│ ├─ Dense Vector Search (HNSW / IVF-PQ) -> Top 50 candidates
│ └─ Lexical / BM25 Sparse Search -> Top 50 candidates
│ └─ Reciprocal Rank Fusion (RRF) -> Merged Top 100 candidates
│
└───► [Stage 2: Neural Reranking] (Latency: 30-100 ms)
├─ Cross-Encoder / Late-Interaction Scorer
└─ Top 5 - 10 Highly Relevant Chunks
│
▼
[Augmented LLM Prompt Generation]Key Engineering Trade-offs
- Candidate Depth ():
- Retrieving minimizes reranker compute but risks truncating relevant passages if first-stage recall is low.
- Retrieving captures the long tail of relevant documents. Benchmarks show NDCG@10 plateaus between and ; pushing beyond 100 adds cross-encoder latency with negligible recall gains.
- Chunk Size vs Document Fragmentation:
- Shorter chunks (256-512 tokens) allow dense bi-encoders to generate focused representations, but risk splitting critical context.
- Longer chunks (1,024-2,048 tokens) preserve context but dilute single-vector dense representations. For corpora requiring long chunks, ColBERT late interaction or cross-encoders with long context windows (such as ModernBERT or Voyage) are necessary.
- Hybrid Search Integration:
- Pure dense retrieval frequently misses exact keyword queries, part numbers, and code identifiers. Combining dense vector search with sparse lexical search (BM25 or SPLADE) via Reciprocal Rank Fusion (RRF) provides robust recall prior to reranking.
Production Serving Economics
The choice between API providers and self-hosted models depends on query volume and data residency requirements:
- Low to Medium Traffic (< 50 queries/sec): Hosted APIs (OpenAI
text-embedding-3-small, Voyage AI, or Cohere Rerank) provide zero infrastructure overhead and predictable per-token pricing. - High Traffic (> 200 queries/sec): Self-hosting open-weight models (BGE-M3 for embeddings, BGE-Reranker-v2 for reranking) using Hugging Face Text Embeddings Inference (TEI) on dedicated cloud GPUs (such as AWS
g6.xlargewith NVIDIA L4) achieves significantly lower cost per million queries with sub-50ms p95 latency. - Vector Storage Optimization: Using Matryoshka dimension reduction (reducing 3,072-dim embeddings to 1,024-dim) combined with scalar quantization (FP32 to INT8) reduces RAM usage from 12 KB per vector to 1 KB per vector, cutting vector database infrastructure costs by over 80%.
Sources
- ColBERT: Efficient and Effective Passage Search via Contextualized Late Interaction over BERT (arXiv:2004.12832)
- ColBERTv2: Effective and Efficient Retrieval via Lightweight Late Interaction (arXiv:2112.01488)
- PLAID: An Efficient Engine for Late Interaction Retrieval (arXiv:2205.09707)
- BGE M3-Embedding: Multi-Lingual, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillation (arXiv:2402.03216)
- Matryoshka Representation Learning (arXiv:2205.13147)
- OpenAI: New Embedding Models and API Updates
- Voyage AI Embeddings Documentation
- Cohere: Introducing Embed v3
- Hugging Face Massive Text Embedding Benchmark (MTEB) Leaderboard



