CLOUD CONCEPT

Text Embeddings

Text embeddings are numerical vector representations of text that allow software to compare meaning and retrieve semantically related information.

Cloud Concepts Hub →

What is Text Embeddings

An embedding model maps text into a vector space where related passages tend to have similar representations. These vectors support semantic search and retrieval augmented generation (RAG), helping applications find relevant external information even when a question and its answer use different wording.

Text embeddings represent words, sentences, or passages as arrays of numbers generated by a machine learning model. Their usefulness comes from the relationships between vectors: text with related meaning tends to appear close together under an appropriate similarity measure. For example, a question about “recovering access to an account” may match a document titled “Password reset procedure” without sharing the same keywords. Embeddings capture learned patterns, not guaranteed understanding or factual correctness.

In cloud applications, an ingestion pipeline typically extracts text from documents, divides it into manageable chunks, and sends those chunks to an embedding model. It stores the resulting vectors in a searchable index alongside the source text or references to it, plus metadata such as document version, department, and access permissions. At query time, the application embeds the user's question and searches for similar document vectors. Cosine similarity, dot product, and Euclidean distance are common comparison methods; the correct choice depends on the model and index configuration.

Retrieval augmented generation is an application pattern that retrieves relevant information from an external source and supplies it as context to a generative model. Embeddings commonly power the retrieval step, although RAG can also use keyword search, structured queries, or hybrid retrieval. The retrieved passages, rather than the vectors themselves, usually enter the generation prompt. A service such as Amazon Bedrock Knowledge Bases can orchestrate document ingestion, embedding generation, retrieval, and integration with answer generation.

Typical business applications include employee policy assistants, customer support systems, technical documentation search, and research tools. An employee might ask whether a particular travel expense is reimbursable. A RAG application retrieves passages from the current expense policy and asks a foundation model to answer using that evidence, ideally with source citations. Updating the indexed policy can change the available evidence without retraining the generative model. RAG does not modify the model's weights and is not the same as fine-tuning.

Chunking is an important design decision. Very small chunks may lose qualifications or surrounding context, while very large chunks can mix unrelated subjects and consume more prompt tokens. Overlap can preserve context across boundaries but increases storage and processing. Document structure, language, domain terminology, and embedding model input limits also affect retrieval quality. Evaluate representative questions against expected source passages rather than selecting a model solely by vector size.

Document and query vectors must use a compatible embedding space, normally provided by the same model and version with the appropriate document and query settings. Equal vector dimensions do not make vectors from different models comparable. Changing the embedding model generally requires re-embedding the corpus and rebuilding or migrating the index. Higher-dimensional vectors can increase storage and search costs without necessarily improving results for a particular workload.

Vector similarity is not a probability that a passage is correct or sufficient. Approximate nearest-neighbor indexes trade some retrieval recall for speed, and semantic matching can miss exact identifiers, dates, or product codes. Hybrid keyword and vector search, metadata filters, and reranking can improve relevance. RAG can reduce unsupported answers but does not eliminate hallucinations or malicious instructions embedded in retrieved documents. Apply authorization during retrieval, treat embeddings as potentially sensitive data rather than anonymized text, propagate document updates and deletions, and measure both retrieval quality and answer grounding.

Key aspects of Text Embeddings

Effective text embedding systems combine compatible models, deliberate chunking, relevant retrieval, lifecycle management, and access-controlled grounding.

Semantic representation

Embeddings encode learned relationships in numerical vectors, allowing retrieval across different wording. They are useful for meaning-based matches but do not establish that retrieved content is true.

Compatible embedding spaces

Query and document vectors must come from compatible encoders and configurations. Track model versions and vector dimensions, and plan a corpus re-embedding process when changing models.

Chunking and metadata

Split documents so each chunk contains enough context to answer realistic questions. Preserve source references, document versions, and access-control metadata with each indexed chunk.

Retrieval before generation

In embedding-based RAG, vector search identifies passages that become context for a generative model. This supplies external knowledge at inference time without updating the model's weights.

Quality and cost trade-offs

Embedding inference, index storage, search latency, and retrieved prompt tokens all contribute to application cost. Tune chunk size, retrieval count, and index settings against measured relevance and latency.

Security and grounding

Protect vectors and source text with appropriate access controls, and enforce user permissions before retrieved content reaches the model. Evaluate source support and citations because relevant retrieval alone does not guarantee a grounded answer.

Cloud services for Text Embeddings

A typical AWS implementation stores source documents in Amazon S3 and uses Amazon Bedrock Knowledge Bases to process them with an embedding model. The resulting vectors and associated metadata are indexed in a supported store, such as Amazon OpenSearch Service or an appropriate Aurora PostgreSQL configuration. At query time, the application embeds the question, retrieves relevant passages, and supplies those passages to a generative model through Amazon Bedrock. These components have separate responsibilities: document storage preserves source material, embedding models create representations, vector stores perform similarity search, and generative models compose answers.

Amazon Bedrock

Provides access to embedding models and generative models. Amazon Bedrock Knowledge Bases manages supported RAG workflows, including chunking, embedding generation, vector-store integration, retrieval, and retrieval-augmented answer generation.

Open Amazon Bedrock →
Amazon OpenSearch Service image Amazon OpenSearch Service

Stores and searches embedding vectors using vector search capabilities. Applications can combine semantic retrieval with keyword search and metadata filtering, or use supported configurations as a vector store for Amazon Bedrock Knowledge Bases.

Open Amazon OpenSearch Service →
Amazon Aurora image Amazon Aurora

Aurora PostgreSQL supports the pgvector extension for storing and querying embedding vectors alongside relational data. Supported configurations can serve as a vector store for Amazon Bedrock Knowledge Bases.

Open Amazon Aurora →
Amazon Simple Storage Service image Amazon S3

Stores source documents that an embedding pipeline ingests, including documents used by Amazon Bedrock Knowledge Bases. Applications must synchronize relevant source changes and deletions with their retrieval index.

Open Amazon S3 →