AWS AI Practitioner · 8 of 12

Designing applications on foundation models: model choice, RAG, vector stores and agents

How to pick a foundation model, what the inference parameters do, how Retrieval Augmented Generation works end to end and where it fails, which AWS databases hold the vectors, the cost ladder from prompting to pre-training, and how agents turn a model into something that acts.

Updated 2026-09-10AIF-C01 · Domain 3
On this page

A foundation model on its own is a very well-read stranger: it knows a great deal about the world up to the day its training stopped, nothing about your company, and it cannot look anything up or press a button. Building an application on one is the work of fixing those three gaps. You pick a model whose size, price and modality fit the job, tune the knobs that shape its answers, hand it your own documents at question time through Retrieval Augmented Generation, and, when the task needs more than one step, wrap it in an agent that can call tools. This article walks that path in the order a team actually takes it, and names the AWS service at every step, because Domain 3 of the exam is the largest and most of its questions are "which approach, which service".

The map

Read this first when short on time. Every branch is a section below.

Figure 1. The whole article on one page. Every branch is a section below; fold what you know, open what you do not.

Choosing a model: the criteria that decide before any prompt is written

Model selection is the act of matching a task's requirements (what goes in, what comes out, how fast, how often, in which language, at what price) against the published properties of the pre-trained models on offer, and it is done before a single prompt is written because every later decision inherits it.

Amazon Bedrock puts dozens of models from several providers behind one API, and SageMaker JumpStart adds hundreds of open-weight ones, so "which model" is a real decision with real consequences. The exam lists a specific set of criteria, and a question usually makes one of them the deciding factor while the rest are noise. Learn to spot which one is doing the work.

CriterionWhat it meansHow it shows up in a question
CostPrice per 1,000 input tokens and per 1,000 output tokens on demand, or an hourly price for provisioned throughput. Output tokens usually cost more than input tokens. A smaller model is cheaper per token."Minimise cost", "high volume of simple requests": pick the smaller or cheaper model, or batch inference.
ModalityThe kinds of data the model accepts and produces: text, image, audio, video, embeddings, or several at once (multimodal)."Describe images", "generate product photos": the answer must be a multimodal or image model, not a text-only one.
LatencyTime to first token and tokens per second. Larger models are slower; some providers offer latency-optimised inference."Real-time chat", "interactive": prefer the smaller or faster model.
Multilingual supportWhich languages the model was trained on well enough to read and write them. Not every model covers every language equally."Customers in twelve countries": check language coverage before anything else.
Model sizeParameter count, roughly billions of weights. Size raises capability and cost together."Run on edge devices", "fastest and cheapest": small model. "Complex reasoning": large model.
Model complexityHow much reasoning the model can do: instruction following, multi-step problems, coding, tool use."Multi-step analysis of legal text": the frontier model, not the lightweight one.
Customisation optionsWhether the provider allows fine-tuning or continued pre-training of the model, and whether Bedrock supports it for that model."Must be fine-tuned on company data": only models that support customisation qualify.
Input and output length, context windowThe maximum number of tokens the model can take in plus give out in one call. Long-context models take whole books; short ones need RAG or chunking."Summarise a 300-page report in one call": long context window. Otherwise chunk or retrieve.
LicensingProprietary models are used through an API under the provider's terms; open-weight models (Llama, Mistral) carry licences that may restrict commercial use or require attribution."Must run in the company's own account and be modifiable": open weights on SageMaker.
Availability in regionEach model is offered in specific AWS Regions and must be enabled there; data residency rules may force a Region."Data must stay in eu-central-1": the model has to be offered there, or use cross-Region inference only if the rules allow it.

Two shortcuts help. First, the task decides the modality and the floor on complexity; everything else is a trade against cost. Second, the context window decides the architecture: if the knowledge the model needs does not fit in the window, or changes often, the answer is RAG rather than a bigger model. A model card, or the Bedrock model catalogue, states the window, the modalities, the languages, the customisation support and the Regions, so these are facts to look up, not to guess.

In the wild
  • Amazon Bedrock lists Amazon Nova and Titan, Anthropic Claude, Meta Llama, Mistral, Cohere, AI21 and Stability AI models in one catalogue; the console shows, per model, the modalities, the Regions and whether fine-tuning is supported.
  • Amazon Nova comes in tiers (Micro, Lite, Pro, Premier) precisely so that a team can trade capability for price and latency within one family; Nova Canvas and Nova Reel add image and video generation.
  • SageMaker JumpStart is where open-weight models such as Llama and Mistral are deployed into the customer's own account when the licence and the control matter more than convenience.
  • Amazon Bedrock model evaluation runs the same prompts through several candidate models and scores them, which is how the choice is made with data rather than reputation.
Exam angle

Most selection questions hinge on one word. "Cost-effective" and "high volume" point at the smaller model or batch inference; "images" or "audio" force a multimodal model; "latency" and "real time" pick the smaller or faster model; "entire book in one request" is the context window; "must remain in Region X" is availability; "modify the weights and host ourselves" is an open-weight model on SageMaker. When two answers look right, prefer the one that satisfies the stated constraint with the least operational overhead, which on this exam is almost always Amazon Bedrock over a self-managed endpoint.

token
The unit a model reads and writes, roughly three quarters of an English word. Pricing, context windows and length limits are all counted in tokens.
context window
The maximum number of tokens a model can attend to in a single call: system prompt, conversation history, retrieved documents and the answer all share it.
open weights
A model whose trained parameters are published for download, so it can be hosted, inspected and fine-tuned by anyone the licence allows. Contrast with a proprietary model reachable only through its provider's API.
provisioned throughput
Bedrock's mode of buying dedicated model capacity by the hour instead of paying per token; required for running customised models. The Bedrock article covers the pricing modes.

Inference parameters: shaping the answer without touching the model

Inference parameters are the settings sent with each request that control how the model turns its probability distribution over the next token into an actual token, and how long it keeps going; they change the character of the output without changing a single weight.

At every step a language model produces a score for every token in its vocabulary. Something has to turn tens of thousands of scores into one chosen token, and the sampling parameters are the rules for that choice. The length parameters then say when to stop. The Bedrock article shows where they live in the InvokeModel and Converse requests; here the point is what each one does to the answer.

flowchart TD
  A["Model scores every token in the vocabulary"] --> B["Temperature reshapes the scores<br/>low sharpens, high flattens"]
  B --> C["Top-k keeps only the k most likely tokens"]
  C --> D["Top-p keeps the smallest set whose<br/>probabilities add up to p"]
  D --> E["Sample one token from what is left"]
  E --> F{Stop?}
  F -- "stop sequence or max tokens" --> G["Return the response"]
  F -- "no" --> A
Figure 2. One token per lap. Temperature changes the shape of the distribution, top-k and top-p cut its tail, sampling picks, and the loop runs until a stop sequence appears or the token budget runs out.
ParameterWhat it controlsLow valueHigh valueTypical use
TemperatureHow much the probability curve is flattened before sampling. 0 always takes the most likely token.Deterministic, repeatable, focused. Same prompt gives the same answer.Varied, surprising, sometimes off the rails.Low (0 to 0.3) for extraction, classification, code, factual Q&A. Higher (0.7 to 1) for brainstorming, marketing copy, fiction.
Top-p (nucleus sampling)Keeps the smallest set of tokens whose cumulative probability reaches p, then samples within it.Only the few most likely tokens are eligible.The long tail of unlikely tokens stays eligible.Alternative to temperature; adjust one, not both, or the effects become hard to reason about.
Top-kKeeps only the k highest-scoring tokens regardless of their probabilities.k = 1 is greedy decoding.Large k barely filters at all.Supported by some model families (Anthropic, Cohere, Titan) and absent from others.
Max tokens (response length)Hard ceiling on output tokens. Generation stops mid-sentence if reached.Short, cheap, possibly truncated.Room to finish, higher cost ceiling.Set from the expected answer size; it is a cap, not a target.
Input lengthHow many tokens of prompt and context are sent. Bounded by the context window minus the output budget.Cheap, but the model may lack the facts.Complete, but slower and costlier per request.Retrieved chunks and conversation history are the usual consumers.
Stop sequencesStrings that end generation the moment they appear.Used to stop after one turn ("Human:"), one list item, or a closing tag such as </answer>.Keeps the model from writing the next speaker's lines or trailing commentary.

The combination matters. A temperature of 0 makes the other sampling parameters irrelevant, because the top token is always taken. A high temperature with a tight top-p still produces varied but sensible text, because the tail of nonsense tokens has been cut off before sampling. Length settings interact with cost directly: output tokens are the expensive ones, and a generous max tokens on a chatty model is where a bill grows.

In the wild
  • Amazon Bedrock playground exposes temperature, top-p, top-k (where supported), response length and stop sequences as sliders and fields, so the effect of each can be seen before code is written.
  • Amazon Q Developer and other code assistants run at low temperature because a variable name that changes between runs is a bug, not creativity.
  • Marketing copy generators built on Bedrock typically raise temperature and ask for several variants, then let a person choose; the randomness is the feature.
Exam angle

"Deterministic", "consistent", "repeatable" and "factual" mean lower temperature. "Creative", "diverse", "varied" mean higher temperature or higher top-p. "The response is cut off" is max tokens too low. "The model keeps writing past the answer" is a missing stop sequence. None of these require retraining, and a distractor that suggests fine-tuning to fix randomness is wrong.

greedy decoding
Always taking the single most probable next token; equivalent to temperature 0 or top-k of 1. Repeatable, but can loop or sound flat.
nucleus sampling
Another name for top-p: sample only from the smallest "nucleus" of tokens whose probabilities sum to p.

Retrieval Augmented Generation: give the model the facts at question time

Retrieval Augmented Generation, RAG, is the pattern of looking up the passages relevant to a question in your own documents and pasting them into the prompt, so the model answers from evidence it was just shown instead of from memory it may not have.

A foundation model's knowledge is frozen at its training cut-off and never included your intranet, your contracts or last week's price list. Asked about them it will either decline or, worse, invent a plausible answer, which is the hallucination problem described in the capabilities article. RAG fixes this without retraining: the knowledge lives in a searchable index outside the model, and the model's job shrinks to reading the retrieved passages and composing an answer from them, ideally with citations to the passages it used.

RAG has two phases that run at different times. Ingestion happens whenever documents change: load them, split them into chunks, turn each chunk into an embedding vector, and store vector plus text plus metadata in a vector store. Query happens at every request: embed the question with the same model, find the nearest chunks, put them into the prompt with the question, and generate. The next two sections take each phase in turn; this one covers ingestion and the reasons the pattern wins.

flowchart TD
  S["Documents in Amazon S3<br/>PDF, HTML, Word, wiki exports"] --> L["Load and parse<br/>extract text, keep title and URL as metadata"]
  L --> C["Chunk<br/>fixed size with overlap, hierarchical or semantic"]
  C --> E["Embed each chunk<br/>Titan Text Embeddings V2 or Cohere Embed"]
  E --> V["Store vector, text and metadata<br/>OpenSearch Serverless, Aurora pgvector, others"]
  V --> I["Vector index ready for search"]
  I -. "documents change: sync again" .-> S
Figure 3. The ingestion pipeline. Amazon Bedrock Knowledge Bases runs every step of it as a managed job when the S3 data source is synchronised; the same four steps exist in every hand-built pipeline.

The four ingestion steps

  1. Load. Pull documents from wherever they live (an S3 bucket, a SharePoint site, Confluence, Salesforce, a web crawl) and extract plain text plus whatever metadata will be useful later: title, URL, author, date, access group. Amazon Bedrock Knowledge Bases connects to S3 and to several such sources directly.
  2. Chunk. Split each document into pieces small enough to embed well and to fit several into a prompt. Fixed-size chunking cuts every few hundred tokens with some overlap so that a sentence straddling a boundary appears in both chunks. Hierarchical chunking keeps small child chunks for precise matching and larger parent chunks for context. Semantic chunking splits where the meaning changes. Bedrock offers all three plus "no chunking" for documents that are already the right size.
  3. Embed. Run each chunk through an embedding model to get a vector of a few hundred to a few thousand numbers that encodes its meaning. Amazon Titan Text Embeddings V2 and Cohere Embed are the Bedrock options; the same model must be used at query time.
  4. Store. Write vector, chunk text and metadata into a vector store that can answer "which stored vectors are nearest to this one" quickly. The store also keeps the metadata so results can be filtered by, say, product line or access group before ranking.

Why RAG rather than fine-tuning for knowledge

In the wild
  • Amazon Q Business is RAG as a product: it indexes an organisation's content through dozens of connectors and answers employees' questions with citations, filtering results by what each user is allowed to see.
  • Customer support assistants at large companies (telecoms, banks, airlines) answer from product manuals and policy documents through exactly this pipeline, because a wrong answer about a fee or a warranty is a complaint, and a citation lets the agent check.
  • Perplexity and similar answer engines are RAG over the live web: search first, then have the model write an answer with numbered references.
  • Amazon Q Developer and GitHub Copilot retrieve relevant files from the open repository and put them in the prompt, which is RAG over code rather than prose.
Exam angle

Any question with "company documents", "up-to-date information", "proprietary knowledge", "reduce hallucinations" or "cite sources" and the phrase "without retraining" or "least effort" is asking for RAG, and on AWS the managed answer is Amazon Bedrock Knowledge Bases. The exam sometimes writes the phrase out in full, "Retrieval Augmented Generation", and sometimes just says "knowledge base"; both mean the same thing.

chunk
A piece of a document small enough to embed as one vector and to include in a prompt alongside others; typically a few hundred tokens with a little overlap to its neighbours.
embedding model
A model that maps text (or images) to a fixed-length vector such that similar meanings land close together. It does not generate text; it only measures.
data source sync
The Bedrock Knowledge Bases job that re-reads a data source, re-chunks and re-embeds what changed, and updates the vector index.

The query path: from a question to a cited answer

At request time RAG embeds the user's question, asks the vector store for the chunks nearest to it, builds a prompt that contains the question and those chunks with an instruction to answer only from them, and sends that prompt to the generating model, which replies with an answer and the citations that support it.

sequenceDiagram
  autonumber
  participant U as User
  participant A as Application
  participant V as Vector store
  participant M as Foundation model
  U->>A: "What is the refund window?"
  A->>A: embed the question with the same model
  A->>V: k nearest chunks, filter by region and product
  V-->>A: top 5 chunks with text and source metadata
  A->>A: build prompt: instruction, chunks, question
  A->>M: augmented prompt
  M-->>A: answer grounded in the chunks
  A-->>U: answer plus citations to the sources
Figure 4. One RAG request. The question is embedded (2), the store returns the nearest chunks (3 and 4), the application stitches them into the prompt (5) and the model answers from that evidence (6 and 7). In Bedrock Knowledge Bases the whole sequence is the RetrieveAndGenerate API; Retrieve alone stops after step 4.
  1. Embed the question. The user's text goes through the same embedding model that indexed the documents. Mixing models here is a silent failure: the vectors live in different spaces and nothing matches.
  2. Similarity search. The store returns the k chunks whose vectors are closest to the question's vector, typically k between 3 and 10. Metadata filters narrow the candidates first: only this customer's region, only documents this user may read, only the current version.
  3. Augment the prompt. The application assembles a prompt: a system instruction ("answer using only the passages below, say so if they do not contain the answer, cite the passage number"), the retrieved chunks each labelled with its source, the conversation history if any, and the question.
  4. Generate with citations. The model writes the answer. Because each chunk was labelled, it can name the ones it used, and the application turns those labels back into links or page references for the user.

Two design points decide quality. The retriever's recall puts a ceiling on the answer: a fact that was not retrieved cannot be used, however good the model. And the instruction to stay grounded is what stops the model from filling gaps with memory; without it RAG degrades into "a prompt with some extra text". Bedrock Knowledge Bases writes both of these for you, including a default prompt template for the generation step that can be edited.

In the wild
  • Amazon Bedrock Knowledge Bases exposes RetrieveAndGenerate for the full path and Retrieve for teams that want the chunks and will build their own prompt; the response carries citations with the source S3 URI and the exact text span.
  • LangChain and LlamaIndex are open-source frameworks whose "retriever" and "chain" abstractions implement exactly this sequence, with Bedrock as one of the pluggable models and OpenSearch, pgvector and others as pluggable stores.
  • Amazon Kendra can be the retriever: its Retrieve API returns semantically ranked passages that a Bedrock model then answers from.
Watch out
  • Different embedding models at ingest and query produce vectors that cannot be compared. Changing the embedding model means re-embedding the whole corpus.
  • Conversation history plus retrieved chunks plus a long system prompt can exceed the context window; something has to be summarised or dropped, and it should be the oldest history, not the evidence.
  • A follow-up question ("and for business customers?") embeds badly on its own. Rewrite it with the previous turn's context before embedding; Bedrock Knowledge Bases keeps the session context for RetrieveAndGenerate and can reformulate a query before searching.
retriever
The component that takes a question and returns the most relevant chunks. It may be a vector store query, a keyword search, a managed service such as Kendra, or a combination.
grounding
Constraining the model to answer from supplied evidence. A "grounded" answer is one whose claims can be traced to the retrieved passages.
citation
A pointer from a statement in the answer back to the chunk it came from, carried in Bedrock responses as the source URI and the matching text span.

Embeddings and similarity: how "nearest" is measured

An embedding is a list of numbers, typically several hundred to a few thousand long, that an embedding model produces for a piece of text so that pieces with similar meaning get lists that point in similar directions; similarity search is the arithmetic of finding the stored lists that point most nearly the same way as the query's.

The fundamentals article introduced embeddings as the way a transformer represents tokens. For RAG the useful picture is geometric: every chunk becomes a point in a space with, say, 1,024 dimensions, and "the refund window is 30 days" lands near "returns are accepted within a month" even though they share no words. The question "how long do I have to return something?" lands in the same neighbourhood, and the search is simply "which stored points are closest to this one".

dimension 1 of 1,024 (sketched) dimension 2 returns and refunds "refund window is 30 days" "returns accepted within a month" "exchange policy" shipping and delivery "ships in 2 to 3 days" "tracking number" "free delivery over 50" query "how long do I have to return it?" nearest two
Figure 5. Embedding space squashed to two dimensions. The query shares no words with "returns accepted within a month" yet lands beside it, because the embedding model was trained to place meanings, not spellings, near each other. Top-k search returns the two nearest refund chunks and ignores the shipping cluster.

Distance measures

Exact versus approximate search

Comparing the query against every stored vector (exact k-nearest-neighbours, k-NN) is perfectly accurate and gets slow past a few hundred thousand vectors. Every vector store therefore offers approximate nearest neighbour (ANN) indexes that trade a little recall for a lot of speed. The common one is HNSW, a graph where each vector links to its neighbours so a search can hop towards the target in logarithmic time; the other is IVF, which clusters vectors and searches only the nearest clusters. OpenSearch's k-NN plugin, pgvector, DocumentDB and MemoryDB all implement HNSW.

In the wild
  • Amazon Titan Text Embeddings V2 outputs 256, 512 or 1,024 dimensions, letting a team shrink the index at a small cost in accuracy; it is the default embedding model in Bedrock Knowledge Bases.
  • Amazon Titan Multimodal Embeddings puts images and text in one space, so a product photo can be searched with a sentence and vice versa, which is how visual product search is built.
  • Cohere Embed on Bedrock is the multilingual alternative, with over a hundred languages in one embedding space.
Exam angle

The exam tests the concept, not the maths: embeddings are numerical representations of meaning, similar meaning means nearby vectors, and a vector database is what stores and searches them. If a question mentions "semantic search", "similar items" or "find related documents by meaning rather than keywords", the answer involves an embedding model and a vector store, not a fine-tuned text generator.

k-NN
k-nearest-neighbours: return the k stored vectors closest to the query. "Exact" k-NN checks every vector; approximate variants use an index.
HNSW
Hierarchical Navigable Small World, the graph-based approximate index most vector stores use; fast queries, more memory, slower to build.
recall
In retrieval, the fraction of the truly relevant items that were returned. Approximate indexes trade a little recall for speed; the same word means something different in classification metrics.

Where RAG goes wrong, and the fixes: chunking, hybrid search, re-ranking

RAG fails in four recognisable ways (the wrong chunk boundaries, a retrieval that misses the passage that matters, a prompt that overflows the context window, and an index that no longer matches the documents) and each has a standard remedy that the exam expects you to know by name.

FailureSymptomCauseFix
Bad chunkingAnswers are half right; a table or a step list is cut in two; the model sees "see above" with no above.Chunks too small lose context; too large dilute the embedding with unrelated text and waste prompt space.Tune chunk size and overlap; use hierarchical chunking (small children matched, larger parent returned) or semantic chunking; keep tables and headings intact.
Retrieval missThe answer exists in the corpus but the model says it does not, or answers from the wrong document.The question's wording is far from the passage's in embedding space; exact identifiers (part numbers, error codes) embed poorly.Hybrid search: combine vector similarity with keyword (BM25) matching. Re-ranking: retrieve a wider set, then score each against the query with a cross-encoder model and keep the best. Metadata filters. Query rewriting.
Context overflowRequests fail, or the model ignores the evidence, or history gets truncated.Too many or too large chunks plus history plus system prompt exceed the window.Lower k, re-rank so only the best chunks go in, summarise history, pick a longer-context model.
Stale indexConfident answers with last quarter's prices and a citation to prove it.Documents changed but the sync did not run; deleted documents still in the index.Sync on a schedule or on S3 events; include a date in metadata and filter or warn on age.

Hybrid search

Vector search finds meaning; keyword search finds exact strings. A question that contains "error E-4471" or a product SKU needs the second, and a question phrased differently from the document needs the first. Hybrid search runs both, normalises the scores and merges the lists, so neither kind of question falls through. OpenSearch supports this natively, and Bedrock Knowledge Bases offers a hybrid search option on stores that can do it.

Re-ranking

Embedding similarity is a cheap first pass, computed once per chunk in advance. A re-ranker is a second, slower model that reads the query and each candidate chunk together and produces a relevance score. Retrieving 25 candidates by vector and keeping the 5 best after re-ranking gives much better evidence than retrieving 5 by vector alone. Bedrock offers rerank models (from Amazon and Cohere) and a Rerank API that Knowledge Bases can call automatically.

In the wild
  • Amazon OpenSearch Service runs hybrid queries with its neural search and normalisation processors, so the same index answers both "what is our travel policy" and "policy HR-207".
  • Amazon Bedrock Knowledge Bases exposes chunking strategy, hybrid search, metadata filtering and re-ranking as configuration rather than code, which is what "managed RAG" means in practice.
  • Amazon Kendra ships its own relevance ranking tuned on enterprise documents, which is why teams with heavy SharePoint and Confluence estates often use it as the retriever in front of Bedrock.
Watch out
  • More chunks is not more accuracy. Models pay less attention to evidence buried in the middle of a long prompt; five relevant chunks beat twenty mixed ones.
  • Evaluate the retriever separately from the generator. Measure whether the right chunk is in the top k before blaming the model. Bedrock's RAG evaluation scores retrieval and generation apart.
  • Access control is enforced at retrieval. If a chunk the user may not see reaches the prompt, the model will happily quote it. Filter by permission metadata before the search, as Amazon Q Business does.
hybrid search
Combining vector (semantic) similarity with keyword (lexical, BM25) matching and merging the two ranked lists.
re-ranking
A second scoring pass in which a model reads query and candidate together and reorders the candidates by relevance before the best are placed in the prompt.
BM25
The classic keyword relevance formula behind most full-text search engines: term frequency weighted by how rare the term is across the corpus.

Vector stores on AWS: which database holds the embeddings

A vector store is any database that can save embedding vectors alongside their text and metadata and answer nearest-neighbour queries over them with an index, and on AWS that capability is offered inside several existing databases rather than as one dedicated product, so the choice usually follows the database a team already runs.

The exam names a specific list of AWS services "for storing embeddings within vector databases", and expects you to know the keyword that distinguishes each. Here they are, with the partner stores that Bedrock Knowledge Bases also supports.

ServiceVector capabilityPick it whenExam keyword
Amazon OpenSearch Servicek-NN plugin with HNSW and IVF indexes (Lucene and Faiss engines), hybrid search, filtering, neural search pipelines.Search is the primary workload; you want keyword and vector in one engine at large scale."k-NN", "search and analytics", "hybrid search"
Amazon OpenSearch ServerlessA "vector search collection" type with the same k-NN engine and no cluster to size.Least operational overhead; the default and quick-create store for Bedrock Knowledge Bases."serverless", "vector engine", "quick create"
Amazon Aurora PostgreSQLpgvector extension: a vector column type, distance operators, HNSW and IVFFlat indexes; Aurora Optimized Reads speeds large indexes.Vectors must sit next to relational data (orders, users) and join with it; a Bedrock Knowledge Bases option."pgvector", "relational data alongside embeddings"
Amazon RDS for PostgreSQLThe same pgvector extension on a standard RDS instance.Already on RDS PostgreSQL and the scale is modest; Aurora not needed."pgvector", "existing PostgreSQL"
Amazon Neptune (Neptune Analytics)Graph database plus vector similarity search over node embeddings; the engine behind GraphRAG in Bedrock Knowledge Bases.Answers depend on relationships between entities (who reports to whom, which part fits which product), not just similar passages."graph", "relationships", "GraphRAG", "knowledge graph"
Amazon DocumentDB (with MongoDB compatibility)Vector search on JSON documents with HNSW and IVFFlat indexes.The application data is already JSON documents in DocumentDB and the vectors should live with them."JSON documents", "MongoDB-compatible"
Amazon MemoryDBIn-memory vector search with single-digit millisecond latency and high recall; durable across failures.The lowest possible latency at high throughput: real-time recommendation, fraud checks, semantic caching."lowest latency", "in-memory", "real time"
Amazon KendraNot a vector database you administer: a managed retriever with connectors, ranking and access-control awareness; its Retrieve API and GenAI Index feed RAG.Many enterprise sources, document-level permissions, no wish to run an index; pairs with Bedrock Knowledge Bases."intelligent search", "connectors", "managed retriever"
Partner stores (Pinecone, Redis Enterprise Cloud, MongoDB Atlas)Third-party vector databases selectable in Bedrock Knowledge Bases.The team already uses one of them.Rarely the answer on an AWS exam; recognise the names.
flowchart TD
  Q1{Graph relationships?} -- yes --> N["Amazon Neptune Analytics, GraphRAG"]
  Q1 -- no --> Q2{Lowest latency?}
  Q2 -- yes --> M["Amazon MemoryDB vector search"]
  Q2 -- no --> Q3{Already PostgreSQL?}
  Q3 -- yes --> P["Aurora PostgreSQL or RDS with pgvector"]
  Q3 -- no --> Q4{JSON documents?}
  Q4 -- yes --> D["Amazon DocumentDB vector search"]
  Q4 -- no --> Q5{Many sources?}
  Q5 -- "yes, with permissions" --> K["Amazon Kendra as retriever"]
  Q5 -- no --> O["Amazon OpenSearch Serverless, the default"]
Figure 6. A decision path through the AWS vector stores. The exam's questions follow the same shape: one distinguishing requirement, one service. When nothing distinguishes, OpenSearch Serverless is the managed default that Bedrock Knowledge Bases creates for you.

Bedrock Knowledge Bases also introduced Amazon S3 Vectors, a vector storage type inside S3 itself aimed at very large, cost-sensitive indexes where sub-second rather than millisecond latency is acceptable. It is newer than the exam guide, so recognise it as the low-cost option rather than expecting it as an answer.

In the wild
  • Amazon Bedrock Knowledge Bases creates an OpenSearch Serverless vector collection in one click when no store is specified, which is why most RAG proofs of concept on AWS end up on it.
  • Aurora PostgreSQL with pgvector is the choice of teams whose product catalogue already lives in Postgres: one SQL query joins "similar to this description" with "in stock and under 50".
  • Amazon MemoryDB is used for semantic caching in front of a model: if a new question embeds close to a recent one, the cached answer is returned in milliseconds and the model call is skipped.
  • Amazon Q Business and Amazon Kendra share connector technology; both pull from SharePoint, Confluence, Salesforce, ServiceNow, Jira, S3 and dozens more, and both filter results by the user's permissions.
Exam angle

Match the keyword: "k-NN" or "search" is OpenSearch; "serverless" or "least overhead" is OpenSearch Serverless; "pgvector" or "existing relational data" is Aurora or RDS PostgreSQL; "graph" or "relationships" is Neptune; "JSON" or "MongoDB" is DocumentDB; "lowest latency" or "in-memory" is MemoryDB; "connectors", "enterprise search" or "document permissions" is Kendra. A distractor will offer DynamoDB or Redshift; neither is a vector store in the exam's list.

pgvector
An open-source PostgreSQL extension that adds a vector column type, distance operators and HNSW and IVFFlat indexes; available on both Aurora PostgreSQL and RDS for PostgreSQL.
GraphRAG
RAG that also builds a knowledge graph of entities and relationships from the documents and retrieves along the graph as well as by similarity; in Bedrock it is backed by Neptune Analytics.
vector search collection
The OpenSearch Serverless collection type dedicated to k-NN workloads, created automatically by Bedrock Knowledge Bases.

The customisation ladder: prompting, RAG, fine-tuning, pre-training and what each costs

There are four ways to make a foundation model do your task better, and they form a ladder of rising cost, effort and data requirements: in-context learning through prompts, Retrieval Augmented Generation, fine-tuning, and training a model from scratch; the rule is to climb only as high as the problem forces you.

The training and evaluation article covers how fine-tuning and pre-training actually work. This section is about the choice between them, which is the way the exam asks.

ApproachWhat changesData neededCost and effortFreshnessBest for
In-context learning (prompt engineering, few-shot)Nothing in the model; instructions and examples travel in every prompt.A handful of examples, written by hand.Lowest. Minutes to iterate. Cost is extra input tokens on every call.Instant: edit the prompt.Formatting, tone, simple classification, anything a good instruction can express.
RAGNothing in the model; relevant documents are retrieved into the prompt.Your documents, unlabelled. An embedding pass and a vector store.Low to medium. Days to build, ongoing storage and retrieval cost, longer prompts.Minutes: re-sync the index.Questions over private, large or changing knowledge, with citations.
Fine-tuningThe weights, a little: a copy of the model is trained further on labelled examples.Hundreds to tens of thousands of labelled prompt and completion pairs, cleaned and formatted.Medium to high. Hours of GPU training per run, then provisioned throughput to host the custom model on Bedrock.Slow: retrain and redeploy to change.Consistent style, format or domain vocabulary; behaviour that prompts cannot pin down; shorter prompts at scale.
Continued pre-trainingThe weights, more: unlabelled domain text teaches new vocabulary and knowledge.Large volumes of unlabelled domain text.High. Long training runs, provisioned throughput.Slow.A specialised domain (medicine, law, a rare language) the base model handles poorly.
Pre-training from scratchEverything: a new model.Trillions of tokens of curated text.Highest by orders of magnitude: thousands of accelerators for weeks or months, a research team.Frozen at cut-off.Model providers. Almost never the answer for a business application.
flowchart TD
  S["A task the base model does imperfectly"] --> Q1{Prompt enough?}
  Q1 -- yes --> P["Prompt engineering, few-shot examples<br/>cheapest, change any time"]
  Q1 -- no --> Q2{Missing knowledge?}
  Q2 -- "yes, and it changes or is private" --> R["RAG with a knowledge base<br/>fresh, cited, no training"]
  Q2 -- no --> Q3{Style or format?}
  Q3 -- "yes, prompts cannot pin it down" --> F["Fine-tuning on labelled pairs<br/>custom model, provisioned throughput"]
  Q3 -- no --> Q4{New domain?}
  Q4 -- "yes, vocabulary the model lacks" --> C["Continued pre-training on domain text"]
  Q4 -- no --> T["Pre-train a new model<br/>model providers only"]
Figure 7. Climb the ladder only when the rung below fails. Each step down the diagram costs roughly an order of magnitude more than the one above it and takes longer to change.

Two of these are often combined. A model fine-tuned to speak in the company's voice and follow its output schema, used inside a RAG pipeline that supplies the facts, is a common production shape: fine-tuning for how, RAG for what. And in-context learning never goes away; even a fine-tuned model gets a system prompt.

In the wild
  • Amazon Bedrock supports fine-tuning and continued pre-training for selected models (Titan, Nova, some Meta and Cohere models); the resulting custom model is private to the account and served through provisioned throughput.
  • Bloomberg trained a finance-specific model on decades of financial text, the well-known example of domain pre-training being worth the cost because the vocabulary and the data were unlike the public web.
  • Most enterprises stop at the first two rungs: the pattern in AWS customer case studies is prompt engineering plus a knowledge base, with fine-tuning reserved for format-heavy tasks such as structured extraction.
Exam angle

The ordering by cost is a direct question: pre-training is the most expensive, then fine-tuning, then RAG, then in-context learning (prompt engineering) as the cheapest. "Without retraining" or "least cost" rules out fine-tuning. "Frequently updated information" is RAG, never fine-tuning. "Consistent tone and format across thousands of outputs" or "domain-specific terminology the model misuses" is fine-tuning. "Custom model on Bedrock" implies provisioned throughput.

in-context learning
A model's ability to pick up a task from instructions and examples inside the prompt, with no weight updates. Zero-shot, one-shot and few-shot prompting are its forms; the prompt engineering article goes into them.
fine-tuning
Further supervised training of a pre-trained model on labelled examples so that it adopts a behaviour, style or domain; produces a new custom model.
continued pre-training
Further self-supervised training on unlabelled domain text, so the model learns the vocabulary and facts of a field. Bedrock calls it "continued pre-training"; it is also written "continuous pre-training".

Agents: a model that plans, calls tools and checks its work

An agent is an application loop in which a foundation model is asked not for a final answer but for the next action, the application performs that action (a search, an API call, a database query), feeds the result back, and repeats until the model decides the task is done; it is how a model that can only produce text gets to do things.

A single prompt answers a single question. "Book me the cheapest flight to Bengaluru next Friday and add it to my calendar" needs several steps, each depending on the last: look up flights, compare prices, book one, read the confirmation, create the event. No amount of prompting lets one model call do that, because the model cannot see the flight prices until something fetches them. Agents solve this with three ingredients.

flowchart TD
  G["User goal<br/>book the cheapest flight and add it to my calendar"] --> T["Think: what is the next step?<br/>the model plans"]
  T --> Q{Need a tool?}
  Q -- yes --> A["Act: call a tool with arguments<br/>searchFlights, bookFlight, createEvent"]
  A --> O["Observe: the tool result comes back as text"]
  O --> T
  Q -- "no, the task is complete" --> R["Respond to the user with the outcome"]
Figure 8. The agent loop, ReAct style. The model is called once per lap and only ever produces text: either a tool call for the application to run or a final answer. Memory is the transcript that accumulates around the loop.

The loop is what makes agents both useful and risky. Useful, because the model can recover from a failed call, ask a clarifying question, or try another route. Risky, because a model that is wrong about the next step will act on it, so tools must be scoped to what the task needs, destructive actions should require confirmation, and the number of laps should be bounded.

In the wild
  • Amazon Q Developer in the IDE is an agent: asked to implement a feature it reads files, plans changes, edits code, runs tests and iterates, each of those a tool call around a model.
  • LangChain and LangGraph are the most-used open-source frameworks for writing agent loops, with Bedrock models as one backend; the exam may name LangChain as a framework for building applications on foundation models.
  • Customer-service agents at airlines and retailers combine a knowledge base (policy) with tools (look up booking, issue refund), which is exactly the Bedrock Agents shape below.
Watch out
  • Every tool is an attack surface. A retrieved document or a user message can try to talk the model into calling a tool it should not; the next article covers prompt injection. Give agents least-privilege IAM roles and read-only tools wherever possible.
  • Loops can run away. Bound the number of steps and the spend per session; an agent that retries a failing API forever is an expensive way to do nothing.
  • Latency multiplies. Five laps means five model calls plus five tool calls in series; agents are not for sub-second interactions.
ReAct
A prompting pattern in which the model alternates reasoning ("thought") with actions ("call tool X") and reads the observation before the next thought. The name is "Reason and Act".
tool (function) calling
A model's ability to output a structured request to invoke a named function with arguments, which the application executes. The Bedrock Converse API exposes this as "tool use".
orchestration
The application code (or managed service) that runs the loop: sends prompts, parses tool calls, executes them, appends results, and stops when the model finishes.

Amazon Bedrock Agents: the managed agent loop, with knowledge bases and guardrails attached

Amazon Bedrock Agents (launched as Agents for Amazon Bedrock) is the managed implementation of the loop above: you describe the agent's job in plain language, attach action groups that define the tools and the Lambda functions behind them, optionally attach knowledge bases and guardrails, and Bedrock runs the planning, tool calling and memory for you.

The Bedrock article describes the console and API mechanics; this section is about the parts and how they fit an application design.

flowchart TD
  U["User request"] --> GI["Guardrail on input<br/>denied topics, PII, prompt attacks"]
  GI --> AG["Agent: FM plus orchestration prompt<br/>plans, picks actions, keeps session memory"]
  AG <--> KB["Knowledge base<br/>RAG over company documents"]
  AG <--> AC["Action group<br/>OpenAPI schema or function details"]
  AC <--> LF["AWS Lambda<br/>calls the booking API, the database, another service"]
  AG --> GO["Guardrail on output<br/>grounding check, word filters"]
  GO --> RSP["Response to the user"]
Figure 9. The parts of a Bedrock agent. Guardrails wrap both ends, the knowledge base supplies facts, action groups supply the tools, and Lambda does the actual work. The loop between agent, knowledge base and action group repeats until the agent has what it needs.
In the wild
  • Amazon Q Business sits above this stack as a finished product: RAG over enterprise sources with permission filtering, plugins that perform actions in Jira, ServiceNow or Salesforce, and no model or prompt to manage.
  • Insurance and banking claims assistants built on Bedrock Agents typically pair a knowledge base of policy documents with action groups that fetch the customer's record and open a case, a pattern AWS shows in most of its reference architectures.
  • LangChain remains the choice when the loop must be customised beyond what Bedrock Agents exposes; it runs anywhere, including Lambda, and can still call Bedrock models and Knowledge Bases.
Exam angle

"Multi-step tasks", "call APIs", "perform actions on behalf of the user", "orchestrate" and "automate a workflow using a foundation model" point at Amazon Bedrock Agents. The pieces have fixed names: action groups define what the agent can do, Lambda functions execute it, OpenAPI schemas describe the API, knowledge bases give it facts, guardrails police it. A question asking for a ready-made enterprise assistant "without building an application" is Amazon Q Business instead.

action group
A named set of operations an agent may call, described by an OpenAPI schema or function details and backed by a Lambda function or return of control.
return of control
An action group mode in which Bedrock returns the agent's chosen action and parameters to the calling application instead of invoking Lambda, so the application executes it.
contextual grounding check
A Bedrock Guardrails filter that scores whether the model's answer is supported by the retrieved sources and blocks answers that are not.

Business applications: where RAG and agents earn their keep

The exam expects you to recognise the four or five business shapes that RAG and agents fit, map each to its architecture, and pick the AWS service with the least operational overhead that meets it.

ApplicationWhat the user getsPatternAWS servicesWhat matters most
Customer support over manuals and policiesAnswers to "how do I", "am I covered", "what does error X mean", with the page cited.RAG; an agent if it must also look up the customer's account or open a ticket.Bedrock Knowledge Bases on OpenSearch Serverless, Bedrock Agents, Amazon Connect for the contact centre, Amazon Lex for the voice or chat front end.Grounding and citations; a guardrail that refuses topics outside support; escalation to a human.
Internal knowledge assistant"What is our parental leave policy?", "who owns the billing service?", answered from wikis, tickets and documents.RAG with permission-aware retrieval.Amazon Q Business (finished product) or Kendra plus Bedrock (custom).Connectors to every source; results filtered by the user's identity from IAM Identity Center.
Contract and document analysisExtract clauses, compare versions, flag missing terms, summarise obligations across thousands of contracts.Extraction with Amazon Textract, then RAG or long-context prompting; fine-tuning for a fixed output schema.Textract, Bedrock (long-context model), Knowledge Bases, Step Functions for the batch flow.Low temperature, structured output, human review of anything that drives a decision (Amazon A2I).
Product and content search"A blue jacket like this one but warmer", search by photo, recommendations by meaning.Embeddings and vector search, often multimodal; no generation needed for search itself.Titan Multimodal Embeddings, OpenSearch Service, Amazon Personalize for behaviour-based recommendations.Embedding quality, hybrid search for SKUs, latency (MemoryDB if it must be instant).
Task automation"Reschedule my delivery", "reconcile these invoices", "triage this ticket".Agent with tools.Bedrock Agents with Lambda action groups, Step Functions around it, EventBridge to trigger.Least-privilege tools, confirmation before irreversible actions, tracing.
In the wild
  • Amazon Q Business is the internal knowledge assistant shape shipped as a service; Amazon Q Developer is the same idea over code, with repository context retrieved into the prompt.
  • Retailers use multimodal embeddings for "shop the look" search, matching a customer's photo against the catalogue in one embedding space.
  • Banks and insurers run contract and claims analysis through Textract and Bedrock with a human sign-off step, because a model's reading of a clause is evidence, not a decision.
Exam angle

These scenarios are where "least operational overhead" does its work. An enterprise assistant "without developing an application" is Amazon Q Business. Search across many enterprise sources with permissions is Kendra. Questions over documents in S3 with citations is Bedrock Knowledge Bases. Acting on systems is Bedrock Agents. A conversational front end is Lex; a contact centre is Connect. If an option involves training a model when a knowledge base would do, it is a distractor.

Recap

  • Pick a model by cost, modality, latency, multilingual support, size, complexity, customisation options, context window, licensing and Region availability; the task fixes the modality and the floor on complexity, the rest trades against cost.
  • Temperature, top-p and top-k control randomness (low for deterministic tasks, high for creative ones); max tokens caps length; stop sequences end generation early. None of them changes the model.
  • RAG retrieves relevant passages from your own documents and puts them in the prompt so the model answers from evidence, with citations, without retraining.
  • Ingestion is load, chunk, embed, store; the query path is embed the question, similarity search, augment the prompt, generate. The same embedding model must be used for both.
  • Embeddings turn meaning into vectors; cosine similarity measures nearness; HNSW and IVF indexes make approximate nearest-neighbour search fast.
  • RAG fails through bad chunking, retrieval misses, context overflow and stale indexes; the fixes are chunking strategy, hybrid search, re-ranking, metadata filters, lower k and scheduled syncs.
  • Vector stores on AWS: OpenSearch Service and Serverless (k-NN, the default), Aurora and RDS PostgreSQL (pgvector), Neptune (graphs, GraphRAG), DocumentDB (JSON), MemoryDB (lowest latency), Kendra (managed retriever with connectors).
  • The customisation ladder by cost: in-context learning, RAG, fine-tuning, continued pre-training, pre-training from scratch. RAG for knowledge, fine-tuning for style and format, prompts always.
  • Custom models on Bedrock need provisioned throughput; knowledge bases and prompts do not.
  • Agents run a loop: the model plans, calls a tool, observes the result and repeats. ReAct is the reasoning-and-acting prompt pattern; tools, planning and memory are the three ingredients.
  • Amazon Bedrock Agents: instructions, action groups (OpenAPI schema or function details) backed by Lambda or return of control, attached knowledge bases, guardrails on input and output, session and long-term memory, traces for debugging.
  • Amazon Q Business is the finished enterprise assistant; LangChain is the open-source framework the exam may name; Amazon Q Developer is RAG and agents over code.
  • Business shapes: support over manuals (RAG plus guardrails), internal knowledge (Q Business or Kendra), contract analysis (Textract plus Bedrock plus human review), product search (multimodal embeddings), task automation (agents with least-privilege tools).

Questions

Try answering each one out loud before opening it. Lead with the one-line answer, then the reasoning, then one detail that shows you have used it.

A company needs to caption thousands of product images and wants the cheapest model that can do it. Which selection criteria decide, and in what order?

Modality first, because only a multimodal (image-plus-text) model can read the images at all, then cost and latency among the multimodal candidates, so the smallest multimodal model that captions well enough wins.

  • Modality is a hard filter: a text-only model, however cheap, is disqualified.
  • Among the candidates, a smaller model is cheaper per token and faster; batch inference cuts the price further for a large offline job.
  • Region availability and licensing are checked last but can still veto a choice.

On Bedrock the natural shortlist is Amazon Nova Lite or Claude with vision, evaluated side by side with Bedrock model evaluation before committing.

What does temperature do, and when would you set it to zero?

Temperature scales the model's probability distribution before a token is sampled; near zero the most likely token is always chosen, so output is deterministic and repeatable, while higher values flatten the distribution and let less likely tokens through for variety.

  • Zero for extraction, classification, code and factual answers where the same input should give the same output.
  • Higher values (0.7 to 1) for brainstorming, marketing variants and fiction.
  • Top-p and top-k achieve similar control by trimming the candidate set; adjust one of them, not all three.

At temperature zero the other sampling parameters have no effect, because there is nothing left to sample from.

A generated response stops in the middle of a sentence. What is the likely cause and the fix?

The max tokens (response length) parameter was reached; raise it, or ask for a shorter answer, rather than changing the model.

  • Max tokens is a hard cap, not a target; the model does not plan to finish inside it.
  • Check that a stop sequence is not matching something inside the intended answer.
  • If the input plus output would exceed the context window, shorten the prompt or move to a longer-context model.

Output tokens are the expensive ones, so the cap should be set from the expected answer size rather than the maximum the model allows.

Explain Retrieval Augmented Generation and why it is preferred over fine-tuning for company knowledge.

RAG retrieves the passages relevant to a question from an index of your documents and places them in the prompt, so the model answers from evidence it was just given; it beats fine-tuning for knowledge because the index can be refreshed in minutes, the documents stay under access control, the answer can cite its sources, and there is no training run to pay for.

  • Fine-tuning changes weights and is good at style and format, but poor at reliably injecting facts, and the facts cannot be updated or deleted.
  • RAG reduces hallucination by instructing the model to answer only from the retrieved passages.
  • On AWS the managed implementation is Amazon Bedrock Knowledge Bases.

The two combine well: fine-tune for the company's voice and output schema, retrieve for the facts.

Walk through the two phases of a RAG system.

Ingestion loads documents, chunks them, embeds each chunk and stores vector, text and metadata in a vector store; query embeds the user's question with the same model, finds the nearest chunks, builds a prompt from them plus the question, and has the model generate an answer with citations.

  • Ingestion runs when documents change; in Bedrock it is the data source sync job.
  • Query runs per request; in Bedrock it is RetrieveAndGenerate, or Retrieve if you build the prompt yourself.
  • Metadata filters (region, permission group, version) narrow the search before ranking.

Using a different embedding model at query time than at ingestion produces vectors in a different space, and retrieval silently returns junk.

What is an embedding, and how does a vector store decide which chunks are "nearest"?

An embedding is a fixed-length vector of numbers that an embedding model produces so that texts with similar meaning point in similar directions; a vector store measures nearness with cosine similarity, dot product or Euclidean distance and returns the k closest stored vectors.

  • Cosine similarity compares direction and ignores length; it is the usual choice for text.
  • Exact k-NN compares against every vector; approximate indexes such as HNSW trade a little recall for much faster search.
  • Titan Text Embeddings V2 (256, 512 or 1,024 dimensions) and Cohere Embed are the Bedrock embedding models.

Titan Multimodal Embeddings puts images and text in one space, which is how a photo can be searched with a sentence.

Users report that the assistant says "I do not know" although the answer is in the manual. What are the likely causes and fixes?

The retriever is missing the passage: either the chunking split it badly, or the question's wording is far from the passage's in embedding space, or an exact identifier such as an error code is not being matched; fix with better chunking, hybrid search that adds keyword matching, re-ranking a wider candidate set, and metadata filters.

  • Evaluate retrieval separately: check whether the right chunk appears in the top k before blaming the model.
  • Hierarchical chunking matches small children and returns the larger parent for context.
  • Re-ranking retrieves 20 to 30 candidates by vector and keeps the best 5 after a cross-encoder scores them.

A stale index is the other classic cause: the manual was updated in S3 but the knowledge base was never re-synced.

A team runs its product catalogue in Aurora PostgreSQL and wants semantic search over descriptions with minimal new infrastructure. Which vector store?

Aurora PostgreSQL with the pgvector extension, so the embeddings sit in the same database as the catalogue and one SQL query can combine "similar to this" with "in stock and under 50".

  • pgvector adds a vector column type, distance operators and HNSW and IVFFlat indexes.
  • Amazon RDS for PostgreSQL offers the same extension for smaller estates.
  • Aurora PostgreSQL is a supported store for Bedrock Knowledge Bases.

Aurora Optimized Reads improves pgvector performance when the index no longer fits in memory.

Match each requirement to an AWS vector store: lowest latency, graph relationships, JSON documents, enterprise connectors with permissions, least overhead default.

Lowest latency is Amazon MemoryDB; graph relationships is Amazon Neptune (Neptune Analytics, GraphRAG); JSON documents is Amazon DocumentDB; enterprise connectors with document permissions is Amazon Kendra as a managed retriever; the least-overhead default is Amazon OpenSearch Serverless.

  • MemoryDB is in-memory with single-digit millisecond vector search, good for real-time recommendations and semantic caching.
  • Neptune Analytics backs GraphRAG in Bedrock Knowledge Bases when answers depend on relationships between entities.
  • OpenSearch Serverless vector search collections are what Bedrock Knowledge Bases creates when you choose quick create.

Amazon OpenSearch Service (the managed cluster) is the pick when keyword and vector search must share one engine at large scale with full control.

Rank the foundation model customisation approaches by cost and say what each is for.

From cheapest to most expensive: in-context learning (prompt engineering and few-shot examples) for behaviour a good instruction can express, RAG for private or changing knowledge with citations, fine-tuning for consistent style, format or domain vocabulary, continued pre-training for a whole new domain, and pre-training from scratch, which only model providers do.

  • Prompting and RAG change no weights and can be updated in minutes.
  • Fine-tuning needs labelled prompt and completion pairs, GPU hours, and provisioned throughput to host the custom model on Bedrock.
  • Pre-training needs trillions of tokens and thousands of accelerators for weeks.

"Frequently updated information" always means RAG, and a distractor that proposes fine-tuning to keep a model current is wrong.

When is fine-tuning the right choice rather than RAG or prompting?

When the goal is a consistent behaviour, style or output format that prompts cannot pin down reliably, or domain vocabulary the model misuses, and the knowledge involved is stable; fine-tuning bakes that in and also shortens prompts at scale.

  • Examples: always output a specific JSON schema, write in the company's voice, classify with domain labels the base model confuses.
  • It needs hundreds to thousands of clean labelled examples and a training run.
  • It is not the tool for facts that change; pair a fine-tuned model with RAG for those.

On Bedrock the custom model is private to the account and must be served through provisioned throughput, which is a fixed hourly cost.

What is an agent in the context of foundation models, and what are its three ingredients?

An agent is a loop in which the model is asked for the next action rather than a final answer, the application executes that action and returns the result, and the cycle repeats until the task is done; its ingredients are planning (deciding the steps, often in the ReAct thought-action-observation style), tool use (structured calls to APIs, functions or searches that the application runs) and memory (the transcript within a session plus anything persisted across sessions).

  • The model only ever produces text: a tool call or a final answer. It never executes anything itself.
  • Agents handle multi-step tasks such as "find the cheapest flight, book it, add it to my calendar".
  • Risks are runaway loops, latency that grows with each lap, and tools invoked on bad reasoning or injected instructions.

Tool descriptions are part of the prompt, so a vague tool description is a prompt engineering bug.

Name the parts of an Amazon Bedrock agent and what each does.

Instructions describe the job in plain language; action groups define the tools through an OpenAPI schema or function details and are backed by Lambda functions (or return control to the app); knowledge bases give the agent RAG over documents; guardrails filter input and output; session and long-term memory carry context; traces show every thought, action and observation.

  • Bedrock builds the orchestration prompt from the instructions and tool definitions and runs the ReAct-style loop.
  • The pre-processing, orchestration and post-processing prompt templates can be edited.
  • Multi-agent collaboration lets a supervisor delegate to specialist agents.

The service launched as Agents for Amazon Bedrock and is now called Amazon Bedrock Agents; both names appear in questions.

A company wants employees to ask questions across SharePoint, Confluence and Salesforce, with answers respecting each person's permissions, and does not want to build an application. Which service?

Amazon Q Business: a finished generative assistant that connects to enterprise sources through built-in connectors, indexes them, answers with citations and filters results by the user's identity and document permissions.

  • Identity comes from IAM Identity Center, so a user only sees what they could open in the source system.
  • Plugins let it perform actions in Jira, ServiceNow or Salesforce.
  • Building the same with Kendra or Bedrock Knowledge Bases plus a custom front end is the "we want control" alternative.

The phrase "without developing an application" is what separates Q Business from Bedrock in an exam question.

What is hybrid search and why does a RAG system need it?

Hybrid search runs a vector similarity query and a keyword (BM25) query together and merges the ranked lists, so questions phrased differently from the document are found by meaning while exact strings such as part numbers, error codes and names are found by keyword.

  • Embeddings represent identifiers poorly; "E-4471" and "E-4417" land close together in vector space.
  • OpenSearch supports it natively, and Bedrock Knowledge Bases exposes it as a search option.
  • Re-ranking is the complementary fix: retrieve a wider set, then let a cross-encoder reorder it.

Metadata filtering runs before either search and is where access control belongs.

What is LangChain, and where does it sit relative to Bedrock Agents?

LangChain is an open-source framework for building applications on language models, with abstractions for prompts, chains, retrievers, tools and agents; it runs in your own code and can call Bedrock models and Knowledge Bases, whereas Bedrock Agents is the managed equivalent where AWS runs the loop.

  • Choose LangChain (or LangGraph, LlamaIndex) when the loop needs customisation beyond what the managed service exposes, or must run outside AWS.
  • Choose Bedrock Agents for least operational overhead with built-in knowledge bases, guardrails and tracing.
  • Both implement the same plan-act-observe pattern.

The exam may name LangChain only as "a framework for developing applications powered by foundation models"; it is not an AWS service.