RAG, knowledge bases and vector stores: AIF-C01 study notes and practice questions
What to know about RAG, knowledge bases and vector stores for the AIF-C01 exam, from the Applications of Foundation Models domain (28% of the exam guide), then 4 free questions to test it. Part of the AIF-C01 study guide.
RAG is one of the most tested ideas on the exam. Use it when answers must come from company documents that change, without retraining a model.
How RAG works
Preparing the data (once, then on updates):
Split documents into chunks.
Turn each chunk into an embedding with an embeddings model.
Store the vectors in a vector store.
At question time:
Embed the user’s question.
Search the vector store for the most similar chunks.
Add those chunks to the prompt.
The foundation model generates an answer grounded in them, ideally with citations.
Amazon Bedrock Knowledge Bases
A managed RAG service: point it at your data (such as an S3 bucket), choose an embeddings model and a vector store, and it handles chunking, embedding, syncing and retrieval. Answers can include source citations.
Vector stores on AWS
Amazon OpenSearch Service (and OpenSearch Serverless)
Amazon Aurora PostgreSQL and Amazon RDS for PostgreSQL with the pgvector extension
A city council's resident help assistant uses Amazon Bedrock Knowledge Bases over policy documents that were already chunked, embedded and stored in a vector index.
Put these steps in the order they happen when a resident asks a question, first step first.
Put these 5 steps in order.
AA. The resident's question is converted into a vector by an embedding model
BB. The foundation model generates an answer from the augmented prompt
CC. The most similar chunks are returned as context for the prompt
DD. The vector index is searched for chunks similar to the question's vector
EE. The retrieved chunk text is added to the prompt before generation
Show the answer and explanation
Correct order: A, D, C, E, B
A. The resident's question is converted into a vector by an embedding model First: the question must become a vector before it can be compared with the stored chunk vectors. The embedding model has to produce vectors that can be compared with the index.
D. The vector index is searched for chunks similar to the question's vector Second: similarity search compares the question's vector with the document vectors in the index. It returns the chunks whose meaning is closest to the question.
C. The most similar chunks are returned as context for the prompt Third: the chunks that matched the search are returned as the context that will ground the answer. Only the closest matches are passed on, not the whole document set.
E. The retrieved chunk text is added to the prompt before generation Fourth: the user's prompt is augmented with the retrieved text, so the model answers from the council's documents. The model sees the question together with this supporting text.
B. The foundation model generates an answer from the augmented prompt Fifth: generation happens last, once the prompt contains the retrieved context. The model then writes an answer grounded in the council's policy text.
Explanation
At query time a knowledge base embeds the question, searches the vector index for similar chunks, adds the retrieved text to the user's prompt, and has the foundation model generate the answer. Chunking and embedding happened earlier, when the documents were loaded.
An airline's customer assistant must answer questions about baggage and refund rules.
The rules change most weeks, answers must cite the current policy text, and the airline does not want to retrain a model each time a rule changes.
Which approach fits BEST?
Choose one answer.
AA. Pre-train a new foundation model on the policy documents every week
BB. Use RAG over the policy documents to retrieve current text
CC. Raise the temperature so the model explores more possible policy answers
DD. Fine-tune the model once on last year's policy documents
Show the answer and explanation
Answer: B
A. Wrong: Pre-training builds a model from large datasets at high cost, and repeating it every week is impractical. It also does not give answers that cite the current policy text.
B. Right: Correct. Retrieval Augmented Generation fetches the current policy passages at query time, adds them to the prompt and can cite the source. Updating the documents updates the answers without retraining the model. Learn more: Amazon Bedrock Knowledge Bases (opens in a new tab)
C. Wrong: Temperature changes how random the output is. It cannot give the model knowledge of policy text it has never seen.
D. Wrong: A one-off fine-tune fixes last year's rules into the model, so it goes out of date as policies change. It also cannot cite the current text.
Explanation
Retrieval Augmented Generation grounds a model's answer in documents retrieved at query time. Amazon Bedrock Knowledge Bases indexes the policy documents, adds retrieved passages to the prompt, and can include citations in the response. Fine-tuning and pre-training store knowledge in the model's weights, which goes stale.
RAG retrieves the current policy text at question time, so answers follow the rules without retraining the model.
A software company already runs Amazon Aurora PostgreSQL-Compatible Edition for its product catalog, and its database team knows it well.
A new RAG application needs embeddings stored and searched by similarity, and the company wants to avoid adopting a new database service.
Which option BEST meets these needs?
Choose one answer.
AA. Aurora PostgreSQL-Compatible Edition with the pgvector extension to store embeddings
BB. Amazon DynamoDB, with each embedding stored as a number list and retrieved by its partition key
CC. Aurora MySQL-Compatible Edition, with a full-text index built over the embedding text column
DD. Amazon S3, with each embedding saved as a separate JSON object in a bucket with versioning on
Show the answer and explanation
Answer: A
A. Right: Correct. Aurora PostgreSQL supports the pgvector extension, which stores vector embeddings and runs similarity search in the database the team already operates. This meets both the search need and the no-new-service constraint. Learn more: Amazon Aurora PostgreSQL now supports pgvector (opens in a new tab)
B. Wrong: Queries by partition key return exact key matches, not the nearest vectors. Similarity search would need extra design, and DynamoDB would be a new service for the team to learn.
C. Wrong: A full-text index finds documents that contain the query's words, not ones with similar meaning. It is not a vector search, so it would miss documents that express the same idea in different words.
D. Wrong: S3 stores objects durably but cannot search them by vector similarity. The application would have to load and compare the files itself.
Explanation
A vector store holds embeddings and finds the nearest ones to a query vector. Aurora PostgreSQL-Compatible Edition can do this with pgvector, so the team can keep its existing database and skills. Options that only store data or match keywords do not perform similarity search.
A university loads 2,000 long research reports into a knowledge base. Each report is split into smaller chunks, and each chunk is converted to an embedding before it is stored in a vector index.
What is the main purpose of this chunking step?
Choose one answer.
AA. So each report can be stored in a different AWS Region for resilience
BB. So the foundation model is fine-tuned separately on each chunk of text
CC. So only the passages relevant to a question are retrieved and fit in the prompt
DD. So each chunk is encrypted separately before it is embedded
Show the answer and explanation
Answer: C
A. Wrong: Regional placement is set by where the data and index are deployed. Chunking is about how text is retrieved, so it does not decide where reports are stored.
B. Wrong: A knowledge base retrieves chunks and adds them to the prompt. It does not fine-tune the model, which is a separate customization method.
C. Right: Correct. Each chunk gets its own embedding, so a search can return the few passages that answer a question, and they fit in the model's context. The mapping back to the source document is kept for citations. Learn more: How Amazon Bedrock knowledge bases work (opens in a new tab)
D. Wrong: Encryption protects stored and transmitted data and is configured separately from chunking. Chunking does not change how the data is protected.
Explanation
Chunking splits documents into manageable pieces before they are embedded and written to a vector index. Each chunk gets its own vector, so a search returns specific passages rather than whole long reports. Each chunk keeps a mapping back to its source document.
Want more on RAG, knowledge bases and vector stores? The 5 full-length practice sets have 20 more RAG, knowledge bases and vector stores questions, 325 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets →