Inferensys

Glossary

Passage Embedding

A dense vector representation of a text passage generated by an encoder, stored in a vector index for semantic retrieval.
Developer working on RAG retrieval system, document chunks visible on screen, technical workspace with code editor.
DENSE VECTOR REPRESENTATION

What is Passage Embedding?

A passage embedding is a dense vector representation of a text passage generated by an encoder, stored in a vector index for semantic retrieval.

A passage embedding is a fixed-length dense vector that encodes the semantic meaning of a text passage into a high-dimensional numerical space. Generated by a neural encoder—typically a transformer model like BERT—this representation maps semantically similar passages to proximate points, enabling similarity search via cosine similarity or maximum inner product search (MIPS).

Unlike sparse representations that rely on exact term matching, passage embeddings capture contextual relationships and paraphrases. They are stored in a vector index using approximate nearest neighbor (ANN) algorithms such as HNSW or FAISS, allowing retrieval systems to find relevant passages based on conceptual meaning rather than keyword overlap.

DENSE VECTOR REPRESENTATIONS

Key Characteristics of Passage Embeddings

Passage embeddings are the fundamental unit of modern semantic search, transforming variable-length text into fixed-size dense vectors that capture contextual meaning. These representations enable machines to compare passages based on semantic similarity rather than lexical overlap.

01

Fixed-Dimensional Dense Vectors

Regardless of the input passage length—whether a single sentence or a 512-token paragraph—the encoder compresses it into a fixed-size dense vector (e.g., 768 dimensions for BERT-base). This property is critical for efficient indexing and comparison:

  • Every passage maps to a point in the same high-dimensional embedding space
  • Enables constant-time similarity computation via dot product or cosine similarity
  • Typical dimensionalities range from 384 (MiniLM) to 4096 (large proprietary models)
  • Unlike sparse bag-of-words vectors, most dimensions carry non-zero values, hence "dense"
02

Contextualized Token Aggregation

Passage embeddings are not simple word averages. A transformer encoder processes the entire sequence with full self-attention, producing context-aware token representations. These are then aggregated into a single vector:

  • Mean pooling: Averages all output token vectors (common in Sentence-BERT)
  • [CLS] token pooling: Uses the special classification token's representation (standard BERT)
  • Max pooling: Takes the element-wise maximum across token dimensions
  • The aggregation strategy significantly impacts retrieval quality and must align with training objectives
03

Semantic Proximity Encoding

The defining property of a well-trained passage embedding is that semantically similar passages cluster together in the vector space. This is achieved through contrastive training:

  • "How do I reset my password?" and "Password recovery instructions" map to nearby points
  • "Apple releases new iPhone" and "Apple pie recipe" map to distant regions despite lexical overlap
  • The cosine similarity between two passage vectors quantifies their semantic relatedness
  • This property enables retrieval based on intent and meaning rather than keyword matching
04

Indexability for Billion-Scale Search

Passage embeddings are designed to be stored in vector indexes that support efficient similarity search at massive scale. Key indexability characteristics:

  • Vectors are stored in specialized data structures like HNSW graphs or IVF inverted files
  • Product Quantization (PQ) compresses embeddings to reduce memory footprint by 10-30x
  • FAISS and ScaNN libraries enable sub-millisecond retrieval over billions of passages
  • The fixed dimensionality ensures predictable memory requirements: 1 billion 768-dim float32 vectors = ~3 TB
05

Encoder-Specific Representation Space

Passage embeddings are not interchangeable across encoders. Each model produces vectors in its own unique representation space with distinct geometric properties:

  • Embeddings from all-MiniLM-L6-v2 cannot be directly compared to those from text-embedding-3-large
  • The same passage encoded by different models yields vectors with no meaningful similarity
  • Cross-encoder models produce passage representations optimized for pairwise scoring, not standalone indexing
  • Production systems must maintain encoder consistency across indexing and querying pipelines
06

Asymmetric Query-Passage Encoding

In Dense Passage Retrieval, queries and passages are processed by separate encoders with distinct parameterizations. This asymmetry is intentional:

  • The query encoder is optimized for short, often incomplete natural language questions
  • The passage encoder is optimized for longer, structured document chunks
  • Both map into the same shared embedding space for direct similarity comparison
  • This design enables the passage index to be pre-computed offline while queries are encoded in real-time at sub-millisecond latency
PASSAGE EMBEDDING FAQ

Frequently Asked Questions

Clear, technically precise answers to the most common questions about passage embeddings, their creation, and their role in modern semantic retrieval systems.

A passage embedding is a dense vector representation of a text passage generated by an encoder model, stored in a vector index for semantic retrieval. Unlike sparse bag-of-words representations, a passage embedding maps the semantic meaning of a sequence of text into a fixed-size, high-dimensional array of floating-point numbers. This process works by passing the passage through a transformer-based encoder—typically a fine-tuned Bi-Encoder or Sentence-BERT (SBERT) model—which applies mean pooling over the final hidden states to produce a single vector. The resulting embedding captures contextual relationships, synonyms, and paraphrases, allowing a system to find relevant documents by computing cosine similarity or performing Maximum Inner Product Search (MIPS) against a query embedding in the same vector space.

REPRESENTATION COMPARISON

Passage Embedding vs. Other Representations

Comparing dense passage embeddings against sparse lexical and late interaction representations across key retrieval dimensions.

FeaturePassage EmbeddingBM25 (Sparse)ColBERT (Late Interaction)

Representation Type

Single dense vector

Sparse bag-of-words

Multiple token-level vectors

Semantic Understanding

Exact Keyword Matching

Indexing Speed

Fast

Very Fast

Moderate

Query Latency

< 10 ms

< 5 ms

50-200 ms

Storage Footprint

768-4096 floats

Inverted index

24K+ floats per passage

Out-of-Vocabulary Robustness

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.