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
RAG (Retrieval-Augmented Generation)
Retrieval-augmented generation (RAG) is an AI architecture that supplements a large language model's static training knowledge with real-time retrieval from a private or external knowledge base. RAG reduces hallucinations by grounding LLM responses in verified source documents, making it the standard pattern for enterprise AI assistants built on proprietary data.
LLM (Large Language Model)
A large language model (LLM) is a deep-learning model trained on billions of text tokens to predict and generate human-readable language. LLMs such as GPT-4, Claude, and Gemini power chatbots, document summarization, code generation, and AI workflow automation -- and serve as the reasoning engine inside RAG systems and AI agents.
Fine-Tuning
Fine-tuning is the process of further training a pre-trained large language model on a curated dataset of domain-specific examples to adjust its tone, format, or reasoning patterns. A fine-tuned model can match a specialized style with 10-100x fewer tokens at inference time, reducing API cost and latency for high-volume production workloads.
Vector Database
A vector database is a specialized data store that indexes and retrieves high-dimensional numerical embeddings by similarity rather than by exact match. Vector databases power retrieval-augmented generation (RAG) systems by finding the documents most semantically relevant to a user query in milliseconds, even across millions of stored records.
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 →