Архитектуры моделей
Contrastive & dual encoders
Encode two inputs independently (such as a query and document or image and caption) and train matching pairs to land near each other.
Ментальная модель
Two readers meet in a shared coordinate system; they are fast because candidates do not interact until their vectors are compared.
Поток данных
- Paired inputs A and B
- Separate or shared encoders
- Projected normalized vectors
- Similarity matrix
- Contrastive matching loss
Как проходит обучение
Batch contrastive objectives reward paired examples and treat other examples as negatives. Negative quality, duplicate semantics, and temperature materially affect the learned space.
Как выполняется инференс
Encode each side independently and compare vectors with dot product or cosine similarity. Precompute the large candidate side; optionally rerank top results with a cross-encoder.
Сильные стороны
- Scales retrieval to large corpora
- Aligns modalities without a joint decoder
- Enables zero-shot classification through label text in some settings
Компромиссы
- Independent encoding misses fine-grained cross-input interactions
- False negatives can distort training
- Global similarity may ignore spatial, temporal, or compositional details
Использовать, когда
- Fast retrieval or matching is the first stage
- One side can be indexed offline
- Recall is followed by task-appropriate reranking when needed
Избегать или пересмотреть, когда
- Every candidate needs deep token-to-token comparison
- The task depends on precise spatial relationships
- Raw similarity scores are assumed to be probabilities
Примеры опубликованных семейств
- • CLIP image–text dual encoder
- • Dense passage retrieval
- • Bi-encoder semantic search
Часто сочетается с
Embedding modelsVision encodersRAGCross-encoder rerankers