ai-ml

Embedding: What It Is and Why It Matters for AI Products

A dense numerical vector representation of text, images, or other data that captures semantic meaning for similarity search.

An embedding is a dense numerical vector representation of text, images, or other data that captures semantic meaning for similarity search. When you convert a sentence into an embedding, you get a list of hundreds or thousands of floating-point numbers that encodes what the sentence means, not just which words it contains. Sentences with similar meanings cluster together in this high-dimensional space, while unrelated sentences sit far apart. This mathematical property is the foundation for semantic search, retrieval-augmented generation, recommendation systems, and many other AI capabilities. Embeddings are not typically visible to end users, but they are the hidden infrastructure behind some of the most valuable AI product features. Understanding how they work, which models generate them, and how to store and query them efficiently is essential knowledge for any team building a modern AI application. Embeddings also carry compliance implications that UK product teams need to plan for from the start. When personal data is embedded and stored in a vector database, that data remains subject to UK GDPR obligations including the right to erasure. Deleting a user's personal data from a vector store requires tracking which vectors were generated from their content and removing them explicitly, which adds engineering complexity if not designed in early. SpeedMVPs builds embedding-powered retrieval and semantic search products from GBP 8,000, delivered in 2-3 weeks from our Hemel Hempstead base, with GDPR-aware vector store design and full code ownership transferred at handover.

What Is an Embedding: A Plain-English Definition

Think of an embedding as a location in a very large map. Each word, sentence, or document gets assigned a specific position in this map based on its meaning. Items with similar meanings end up near each other. 'Dog' and 'puppy' are close together. 'Interest rate' and 'mortgage' are close together. 'Banana' and 'quantum physics' are far apart. The technical mechanism is a neural network trained to produce these vector representations. Text embedding models like OpenAI's text-embedding-3-large or Cohere's embed-v3 take text as input and output a fixed-length array of numbers, typically 768 to 3,072 dimensions depending on the model. These dimensions have no human-interpretable meaning individually, but together they encode rich semantic information that allows mathematical operations to capture meaning. The most important mathematical operation on embeddings is cosine similarity, which measures the angle between two vectors. A cosine similarity of 1.0 means two texts have identical meaning in the embedding space. A cosine similarity close to 0 means they are unrelated. This allows you to find the top-N most semantically similar chunks from a large corpus for any given query, without needing exact keyword matches. Embeddings are not limited to text. Image embedding models can represent photos as vectors, enabling similarity search over image libraries. Multimodal models like OpenAI's CLIP can embed both text and images into the same vector space, so a text query can retrieve visually relevant images.

How Embeddings Work

To use embeddings in a product, the workflow has two phases: indexing and querying. During indexing, you take your source documents, whether they are product descriptions, support articles, legal contracts, or internal knowledge base entries, and split them into chunks. Each chunk is then sent through an embedding model to produce a vector. These vectors are stored in a vector database alongside metadata and the original text. During querying, when a user types a search query or when an LLM needs to retrieve relevant context, the query is also embedded using the same model. The system then performs a nearest-neighbour search in the vector database to find the stored chunks whose vectors are closest to the query vector. Those chunks are the semantically relevant results. Consider a concrete example. A UK HR software startup wants to build an employee handbook search tool. They take their 200-page handbook, split it into 400 chunks of roughly 500 words each, and embed each chunk using text-embedding-3-small. These 400 vectors are stored in Pinecone. When an employee asks 'Can I carry over unused holiday to next year?', the query is embedded and matched against the stored vectors. The three most similar chunks, which contain the firm's holiday carryover policy, are retrieved and passed to an LLM to generate a clear, grounded answer. The quality of the embedding model significantly affects retrieval quality. Newer models like text-embedding-3-large outperform older models like ada-002 on most benchmarks. For non-English content or multilingual products, models like Cohere's embed-multilingual-v3 or OpenAI's multilingual embeddings are required.

Why Embeddings Matter for AI Product Development

Embeddings are what make modern AI products search through meaning rather than keywords. The difference in user experience is significant. Keyword search fails when users phrase things differently from how your documents are written. Semantic search with embeddings finds the right content even when the exact words do not match. For product teams building RAG applications, which is the dominant pattern for knowledge-grounded AI products, embeddings are not optional. They are the core retrieval mechanism. How well your embeddings capture semantic meaning in your specific domain directly affects the quality of your AI product's responses. Embeddings also enable recommendation systems. By representing users and content as vectors, you can find content that is similar to what a user has engaged with. This underlies personalisation features in content platforms, e-commerce sites, and learning applications. Compliance considerations apply in certain scenarios. Embedding personal data, such as customer messages, medical notes, or financial correspondence, and storing the resulting vectors in a vector database constitutes processing of personal data under UK GDPR. The vectors themselves, while not human-readable, can potentially be used to reconstruct approximate versions of the original text. Data minimisation principles apply, and you need appropriate access controls and retention policies on your vector store.

Common Use Cases for Embeddings

Document retrieval is the most common embedding use case. Enterprise knowledge bases, legal document libraries, and customer support article stores all benefit from embedding-powered semantic search. A query like 'what is our refund policy for enterprise customers' correctly retrieves the relevant contract clause even if the exact phrase 'refund policy' never appears in the document. Duplicate detection uses embedding similarity to identify near-identical content. Content moderation systems, fraud detection for repeated support ticket abuse, and deduplication of product catalogs all use this pattern. Classification with few examples is another strong use case. Rather than training a custom classifier, you can embed examples of each class and classify new items by finding which class centroid they are closest to. This is effective for support ticket routing, content categorisation, and lead scoring. Personalisation and recommendation engines use embeddings to represent user preferences as vectors derived from their behaviour. When a user reads three articles about containerisation and one about Kubernetes, their combined embedding profile points toward cloud infrastructure content, enabling accurate recommendations. For UK healthtech teams, embedding clinical notes for retrieval requires careful governance. NHS Digital provides guidance on processing clinical data, and any system embedding patient records needs to address right to erasure requirements under UK GDPR, since deletion from a vector database requires removing both the stored vector and rebuilding any affected index structures.

Related Concepts You Need to Know

Vector databases are the storage layer for embeddings. Once you generate embedding vectors, you need a system that can store them and perform fast nearest-neighbour searches at scale. Options include Pinecone (hosted, production-ready), Weaviate (open-source with a managed option), Qdrant (fast, open-source), and pgvector (a PostgreSQL extension suitable for lower-scale use cases). Choosing the right vector store depends on your scale, latency requirements, and whether you want managed infrastructure or self-hosted control. Semantic search is the application that embeddings most directly enable. Understanding the difference between keyword search, which operates on exact term matching, and semantic search, which operates on meaning, helps you design better search experiences and know when to use each. Retrieval-augmented generation builds on embeddings to give LLMs access to external knowledge. The retrieval step uses embeddings to find relevant chunks; the generation step uses an LLM to synthesise those chunks into a coherent answer. Together, they form the most widely deployed architecture for knowledge-grounded AI products. Transformer architecture is the foundation that makes high-quality embedding models possible. The same attention mechanisms that power LLMs also power embedding models, which is why text embedding models have followed a similar scaling trend toward larger, more capable models. Chunking strategy, the way you split documents before embedding, has a significant effect on retrieval quality. Chunks that are too long lose specificity; chunks that are too short lose context. Typical production systems use chunks of 256-512 tokens with some overlap between adjacent chunks to avoid cutting off relevant context at chunk boundaries.

Frequently Asked Questions

What is the difference between an embedding and a vector?+

An embedding is a vector, but not all vectors are embeddings. A vector is simply an ordered list of numbers. An embedding is specifically a vector produced by a trained neural network to represent the semantic content of some input. When people say 'embedding' in the context of AI, they almost always mean a dense vector produced by a model like OpenAI's text-embedding-3 or Cohere's embed model, where the position in the vector space encodes meaning. The term 'embedding' emphasises the semantic encoding property, while 'vector' is the mathematical object used to represent it.

Which embedding model should I use?+

For English-only applications, OpenAI's text-embedding-3-small offers the best cost-to-quality ratio for most use cases, while text-embedding-3-large provides higher quality at higher cost. For multilingual applications, Cohere's embed-multilingual-v3 is a strong choice. For self-hosted deployments, sentence-transformers models like all-MiniLM-L6-v2 are widely used and free to run on your own infrastructure. The key decision factor beyond language support is the embedding dimension: higher dimensions capture more nuance but cost more to store and search. Test multiple models on your actual data before committing.

Can I delete embeddings of personal data to comply with GDPR right to erasure?+

Yes, but it requires careful implementation. You need to store a mapping between each user's personal data and the specific vectors generated from it, so you can identify and delete the correct vectors when a deletion request arrives. Some vector databases support metadata filtering that makes this straightforward. The complication is that if embeddings have been used to train downstream components, such as a fine-tuned reranker, those components may also need to be retrained or replaced. Design your vector store and retrieval pipeline with deletion in mind from the start rather than retrofitting it later.

How many vectors can a typical vector database handle?+

Production-scale vector databases like Pinecone and Weaviate handle hundreds of millions to billions of vectors. For most startup-stage AI products, this is not the constraint. A typical RAG application embedding a company's knowledge base might have tens of thousands of vectors. A consumer product embedding millions of user interactions might reach the tens of millions range. At these scales, pgvector on a well-resourced PostgreSQL instance can handle the load without requiring a dedicated vector database. A dedicated vector store becomes important when you need sub-10ms query latency at high concurrency or are indexing more than a few million vectors.

Do I need a vector database, or can I use a regular database?+

For small scale (under 100,000 vectors) and moderate latency requirements (under 100ms), pgvector in PostgreSQL is entirely adequate and reduces infrastructure complexity significantly. For larger scales or very low latency requirements, a dedicated vector database like Pinecone or Qdrant provides better performance. The tradeoff is operational: adding a separate vector store means another managed service to configure, monitor, and pay for. SpeedMVPs typically defaults to pgvector for MVPs to reduce infrastructure surface area, and advises migrating to a dedicated vector store only when latency or scale demands it.

SpeedMVPs builds RAG and semantic search applications powered by embeddings from GBP 8,000 with 2-3 week delivery. We design the right retrieval architecture for your use case, whether that is pgvector, Pinecone, or Weaviate, with full code ownership transferred on delivery. Get a free consultation at speedmvps.co.uk

Get a Free Quote