1.2.2. Embeddings and Semantic Representations
💡 First Principle: Embeddings compress semantic meaning into dense numerical vectors — the geometric distance between two vectors corresponds to semantic similarity. This is the mechanism that makes "search by meaning" possible, and it underpins every RAG architecture.
Concretely: when you embed the sentence "How do I reset my password?" and the sentence "Steps to change account credentials," the resulting vectors will be geometrically close even though they share no common words. This is the property that makes knowledge base retrieval work. Closeness is usually scored with cosine similarity — the angle between two vectors, ignoring their length — so texts with the same meaning score high even when they share no words (Euclidean distance and dot product are the other common metrics).
How embeddings flow through a RAG system:
Critical rule: The same embedding model must be used at index time (when documents are stored) and at query time (when user queries are embedded). If you change embedding models, you must re-embed your entire corpus — the vector spaces are incompatible.
Amazon Titan Embeddings on Bedrock:
amazon.titan-embed-text-v2— configurable output of 1024 (default), 512 or 256 dimensions; optimized for English, with 100+ languages in preview. Use it for new builds; v1 (amazon.titan-embed-text-v1) outputs a fixed 1536 dimensions. Retrieval across languages (index in one language, query in another) is weaker than same-language retrievalamazon.titan-embed-image-v1— for multimodal embeddings (text + image). Text and images land in the same vector space, so a text query ("red running shoes") can retrieve matching images directly
⚠️ Exam Trap: Changing the embedding model after initial deployment requires re-indexing the entire vector store. This is not a zero-downtime operation without careful blue/green index management. Exam scenarios that ask about "upgrading the embedding model" are testing whether you understand this constraint.
Reflection Question: Your RAG system's retrieval quality suddenly degrades after a scheduled Bedrock service update. No code changed. What is the most likely cause, and what should you check first?