Home Knowledge Base Dense Retrieval and Embedding Models

Dense Retrieval and Embedding Models are the neural information retrieval systems that encode queries and documents into dense vector representations in a shared semantic space — enabling semantic search where relevance is measured by vector similarity rather than keyword overlap, finding conceptually related documents even with no shared vocabulary, powering applications from question answering systems to RAG pipelines and enterprise search.

Sparse vs Dense Retrieval

AspectSparse (BM25/TF-IDF)Dense (Bi-Encoder)
RepresentationBag of wordsDense vector
SimilarityTerm overlapDot product / cosine
Vocabulary mismatchFails (lexical gap)Handles (semantic)
SpeedVery fast (inverted index)Fast (ANN index)
InterpretabilityHighLow
Out-of-domainRobustMay degrade

DPR (Dense Passage Retrieval)

In-Batch Negatives Training

def contrastive_loss(q_embeds, p_embeds, temperature=0.07):
    # q_embeds: [B, D] query embeddings
    # p_embeds: [B, D] positive passage embeddings
    # Other passages in batch serve as hard negatives
    
    scores = torch.matmul(q_embeds, p_embeds.T) / temperature  # [B, B]
    labels = torch.arange(B)  # diagonal is positive pair
    return F.cross_entropy(scores, labels)

Sentence Transformers (SBERT)

Modern Embedding Models

ModelSizeNotes
E5-large335MStrong general embedding
BGE-M3570MMultilingual, multi-granularity
GTE-Qwen27BLLM-based, very strong
text-embedding-3 (OpenAI)Proprietary1536-d, MTEB SOTA
Voyage-3 (Anthropic)ProprietaryStrong code + retrieval

MTEB (Massive Text Embedding Benchmark)

ANN (Approximate Nearest Neighbor) Search

Retrieval in RAG Pipelines

Dense retrieval and embedding models are the semantic backbone of modern AI-powered search and knowledge retrieval — by learning that "cardiac arrest" and "heart attack" are semantically equivalent without sharing a single word, dense retrievers close the vocabulary gap that made keyword search frustrating for decades, enabling the retrieval-augmented generation pipelines that allow LLMs to access specialized knowledge bases, corporate documents, and up-to-date information far beyond what can fit in a context window.

dense retrievalbi encoderdprembedding modelsemantic searchsentence embedding retrieval

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.