Applications of Foundation Models
RAG Architecture
RAG connects retrieved source content with a foundation model response. The end-to-end flow ingests documents, chunks them, embeds chunks, stores vectors, embeds the user query at runtime, retrieves similar chunks, injects them into the prompt, and generates a grounded answer.
Concepts
- RAG commonly ingests documents, chunks text, creates embeddings, stores vectors, retrieves relevant chunks, and sends context to a model.
- RAG is usually preferred when knowledge changes frequently or must stay external to model weights.
- Retrieval quality depends on chunking, metadata, embedding model choice, ranking, and source document quality.
- At ingestion time, RAG loads documents, chunks them into passages, creates embeddings such as Amazon Titan Embeddings, and stores vectors in a vector database.
- At query time, RAG embeds the user question, runs similarity search such as cosine similarity, retrieves the top matching chunks, injects them into the model prompt, and generates a grounded response.
- Amazon OpenSearch Serverless is the default vector store for Amazon Bedrock Knowledge Bases, with other supported stores including Aurora PostgreSQL with pgvector, Pinecone, and Redis Enterprise Cloud.
- Amazon OpenSearch Service is a managed provisioned search and analytics engine for log analytics, full-text search, monitoring, and vector search; Amazon OpenSearch Serverless auto-scales with pay-per-use capacity and native Bedrock Knowledge Bases integration.
Exam tips
- RAG is preferred when private knowledge changes or should not be baked into model weights.
- Chunking, metadata, embedding model choice, and ranking affect retrieval quality.
- Bedrock Knowledge Bases provide managed RAG over supported data sources and vector stores.
- For query-time RAG, embed the user question before similarity search, then pass retrieved chunks into the FM prompt.
- OpenSearch Serverless is the default Bedrock Knowledge Bases vector store; do not confuse it with provisioned Amazon OpenSearch Service clusters.
- Choose Amazon OpenSearch Service when you need managed cluster capacity control; choose OpenSearch Serverless for auto-scaling, no capacity planning, and Bedrock Knowledge Bases RAG integration.