AIF-C01
Deep Dive
The most important technique for connecting a foundation model to private or up-to-date information without having to retrain it. Master this and you'll solve most "the model doesn't know X" scenarios on the exam.
Contents
A foundation model is trained once, at a specific point in time, on a corpus of public data. After that training, the model knows nothing new: it has no knowledge of events after its cutoff date, no access to your company's internal documents, and no access to your private databases.
Retraining the model every time your data changes is slow and expensive. RAG solves this without touching the model's weights: at response time, the relevant information is "injected" as additional context in the prompt.
Without RAG
The model responds only with what it "remembers" from its training. If you ask about your company's vacation policy or a product launched last week, it either invents a plausible answer (hallucination) or admits it doesn't know.
With RAG
Before responding, the system searches your documents for the fragments most relevant to the question and adds them to the prompt. The model responds based on that concrete, up-to-date, and verifiable information.
Four steps, two phases: a preparation phase (offline) and a query-time phase (online).
Ingest and chunk documents
Preparation (offline)Your documents (PDFs, web pages, support tickets, internal wikis) are split into smaller fragments ("chunks") — manageable paragraphs or sections.
Generate embeddings and store them
Preparation (offline)Each fragment is converted into a numeric vector (embedding) that captures its semantic meaning, and saved into a vector database.
Semantic similarity search
Query (online)When the user asks a question, it is also converted into an embedding, and the vector database is searched for the fragments "closest" (most similar in meaning) to the question.
Context injection into the prompt
Query (online)The retrieved fragments are inserted into the prompt together with the original question, and that "enriched" prompt is sent to the foundation model to generate the final response.
Compare small chunks against large chunks and observe the precision vs. context tradeoff in a RAG query.
+1 more...
Embeddings
Numeric representations (vectors of hundreds or thousands of dimensions) of a text's meaning. Texts with similar meanings produce vectors that are "close" to each other in that mathematical space, even if they use completely different words. This is what enables searching by meaning instead of just word matching.
Vector database
Stores embeddings and enables very fast similarity searches even over millions of fragments, by comparing vectors instead of comparing literal text.
AWS services you can use as a vector store
The exam expects you to recognize which AWS services can store embeddings and run similarity searches — they're the "vector storage" piece of the RAG pipeline.
Amazon OpenSearch Service
Search and analytics engine with native vector support (k-NN). The most widely used vector store for RAG, including the one Bedrock Knowledge Bases provisions by default.
Amazon Aurora (with pgvector)
PostgreSQL-compatible relational database with the pgvector extension added to store embeddings alongside your transactional data.
Amazon Neptune
Graph database that also supports vector storage and search, useful when you additionally need to model relationships between entities.
Amazon RDS for PostgreSQL (with pgvector)
Same as Aurora, but on standard RDS for PostgreSQL: add the pgvector extension to enable similarity search.
Key idea for the exam
Vector search ≠ keyword search. Traditional search looks for exact text matches; a vector search looks for closeness in meaning, so "how do I cancel my subscription" can find a fragment titled "cancel your plan" even though they don't share a single word.
AWS's fully managed implementation of RAG: it automates the entire pipeline you just saw.
What it automates
Why it matters for the exam
When the scenario says "we want our chatbot to answer based on our internal manuals, without managing vector search infrastructure", the answer is almost always Bedrock Knowledge Bases — not building your own vector store from scratch.
Create a Knowledge Base in Bedrock to implement RAG over company documents.
+1 more...
| Situation | RAG | Fine-tuning |
|---|---|---|
| Data changes frequently (prices, inventory, policies) | ✓ | — |
| You need the model to cite or ground its answers in verifiable source documents | ✓ | — |
| You want to reduce hallucinations by providing concrete factual context | ✓ | — |
| You need to consistently change the tone, style, or response format | — | ✓ |
| You need the model to learn a highly specialized language or domain (legal, medical jargon) | — | ✓ |
| You want to avoid the cost and complexity of retraining | ✓ | — |
Quality depends on the source documents
"Garbage in, garbage out": if your documents are outdated, poorly organized, or contradictory, the model will retrieve and use that incorrect information with total confidence. RAG doesn't fix the quality of your data.
Doesn't change the model's behavior
RAG gives the model new information, but it doesn't teach it new reasoning patterns, tone, or format on a permanent basis — for that you'd need fine-tuning. The base model stays the same between queries.
Imperfect retrieval
If the semantic search doesn't find the right fragments (poorly chunked documents, ambiguous questions), the model will respond with irrelevant or insufficient context.
Context window limit
Only a limited amount of context can be injected per query (depending on the model's context window), so you have to carefully choose how many fragments to retrieve.
A RAG chatbot keeps citing old prices even though the PDF in S3 was already updated. Find and fix the cause — no guided steps.
+1 more...
RAG and fine-tuning aren't the only ways to adapt a foundation model. The exam also expects you to recognize these two related techniques:
In-context learning
Teaching the model to solve a task by including examples directly in the prompt (few-shot prompting), without modifying its weights or adding retrieval infrastructure. It's the lightest of the four techniques.
Model distillation
Training a smaller ("student") model to imitate the behavior of a large, already-trained ("teacher") model, using the large model's responses as training data. The result is a cheaper model with lower latency, that retains much of the original model's quality for the specific task it was distilled for.
Key idea for the exam
If the scenario says "we want to reduce cost and latency while keeping performance similar to a large model", think of model distillation — it's different from fine-tuning (which adjusts the same model with new data) and from RAG (which doesn't change the model at all).
Did you get this topic?
Test what you just learned
An e-commerce company wants its generative AI assistant to answer employee questions using the internal policy manual, which is updated weekly. The company does not want to manage vector search infrastructure. Which AWS solution is the best fit?
Put what you learned to the test with original AIF-C01 exam questions.
Start AIF-C01 mock examUnlimited mock exams with the Pro plan
Log in to track your progress.