Skip to content

Text Embeddings & Semantic Search

Turn sentences into vectors and fetch nearest by meaning

Language & knowledgeIntermediate#09
inTextTable

What this capability means

Encodes a piece of text into a fixed-length vector so that semantically similar texts sit close together, then retrieves related items by nearest-neighbour lookup. Output is a ranked result list (item ids and scores), not prose. Unlike question answering it only finds possibly relevant material; it does not compose the answer.

How it is done

The mainstream design is a two-tower model: queries and documents are compressed by encoders, and training pushes true pairs above random negatives, typically with contrastive learning and large batches. At query time all document vectors are pre-computed into an index and an approximate nearest-neighbour search returns the top-k in milliseconds. Sparse and dense representations are often mixed to combine keyword hits with semantic recall.

Representative products

6

Pinecone

Pinecone

A managed vector database for similarity search

2Caps
Infrastructure Closed
2019

Hugging Face

Transformers

One API to load and train pretrained models

2Linked
Tool Open source
2018

Replicate

Replicate

Run community-uploaded models through an API

1Linked
Platform Closed
2019

Perplexity AI

Perplexity

Answers built as it searches, each one backed by sources

3Caps
App Freemium
TextText
2022

Organizations involved

Typical uses

  • Search over enterprise documents and code
  • The recall stage of RAG pipelines
  • Deduplication, clustering and topic discovery
  • Recommendation and similar-content entry points

How it is evaluated

Recall@k
Whether the top-k contain all relevant documents
nDCG
Discounted cumulative gain that accounts for rank position
MRR
Mean reciprocal rank of the first relevant result

Limits and hard parts

  • Semantic similarity is not relevance: near neighbours may merely share wording
  • Cross-domain or cross-lingual use degrades noticeably without adaptation
  • Chunking long documents severs context, and answers at chunk boundaries are easily missed

Concepts behind it

NLP & Large Language Models

Word EmbeddingsBeginner

Turning words into coordinates — synonyms land near each other, and meaning becomes something you can add and subtract

4Linked
Figures 1 · Data 2

Math & Statistics Foundations

Vectors & Vector SpacesBeginner

AI turns everything — words, images, sounds, users — into one thing: a list of numbers

3Linked
Figures 1 · Data 1

AI Engineering, Safety & Ethics

Retrieval-Augmented GenerationBeginner

Rather than cramming knowledge into parameters, leave it outside and look it up on demand — an open-book exam instead of a closed-book one

4Linked
Figures 2 · Data 1