code/+/trust primary logo full color svg

Embeddings

Definition

Embeddings are dense numerical vectors -- typically 768 to 3,072 floating-point numbers -- that represent the semantic meaning of a piece of text, image, or other data. Documents with similar meaning produce embeddings that are close together in vector space, enabling AI systems to find relevant content by meaning rather than keyword matching.

An embedding model converts raw text into a fixed-size vector. "Contract renewal reminder" and "subscription expiry notice" are different strings but produce similar vectors -- so a search for one finds the other. This is the mathematical foundation under every RAG system and semantic search feature.

How embeddings are used in production

  • Index all documents in a knowledge base at ingestion time
  • At query time, embed the user question and find the nearest document vectors
  • Pass retrieved document text as context to the LLM
  • Cache embeddings -- re-embedding unchanged documents wastes compute

Choosing an embedding model

OpenAI text-embedding-3-large and Cohere embed-v3 are strong general-purpose choices. For on-premises GovCon deployments, open-source models like BGE-large can run air-gapped. Embedding dimensions, cost per token, and retrieval accuracy vary significantly across providers.

Related terms

Need help implementing this in your business?

Code and Trust translates AI concepts like embeddings into working implementations — starting with a workflow audit that shows exactly where it creates ROI.

Schedule AI Audit →