Chapter 2

Generative AI and Foundation Models

AWS Certified AI Practitioner (AIF-C01) Study GuideBased on the AWS AIF-C01 exam objectives

Generative AI is the reason you're here. It's the technology behind the chatbots that write your emails, the image generators that create art from a sentence, and the copilots that autocomplete your code. But before you use it — and especially before you take an exam on it — you need to understand what it actually is, how it works under the hood, and why Amazon built an entire service around it.

This chapter is the heart of the AIF-C01 exam's generative AI domain. We'll take everything apart slowly: what makes AI "generative," what foundation models are, how transformers power them, what tokens and context windows mean in practice, how prompting controls behavior, why RAG makes models smarter without retraining them, what Amazon Bedrock is and why it matters, and how anyone evaluates whether a model is actually good. No math. No code. Just the concepts the exam tests, explained the way a good teacher would.

2.1 What Generative AI Actually Is

From predicting to creating

Traditional AI — the kind from Chapter 1 — is mostly discriminative. That's a technical word with a simple meaning: it draws boundaries between categories. Is this email spam or not? Is this tumor malignant or benign? Is this transaction fraud or legitimate? Discriminative AI looks at data and sorts it into buckets.

Generative AI does the opposite. Instead of sorting existing things into buckets, it creates new things that look like they could have come from the real world. It writes text that was never written before. It generates images that were never photographed. It composes music that was never played. The output is new, but it follows the patterns the model learned from training data.

a person looking at a large screen showing AI-generated artwork and text side by side
a person looking at a large screen showing AI-generated artwork and text side by side

This is why the word "generative" matters on the exam. If a question asks you to identify which scenario describes generative AI, look for creation: generating a product description, drafting a customer email, creating a summary of a long document, writing code from a comment, producing an image from a text prompt. If the scenario is about classifying, predicting, or detecting — that's traditional (discriminative) AI, not generative.

Exam tip

The exam loves this distinction. "A company wants to automatically write product descriptions for its catalog" = generative AI. "A company wants to flag fraudulent transactions" = traditional/predictive AI. When in doubt, ask: is the AI creating something new or deciding something about existing data?

The three big flavors of generative AI

Generative AI comes in several modalities — a fancy word for "types of input and output." The exam expects you to recognize the main ones:

Text generation is the most famous. Large language models (LLMs) take text in and produce text out. Chatbots, summarizers, translators, email writers, code generators — all text generation. When the exam says "generative AI," it usually means this unless it specifies otherwise.

Image generation takes text in and produces images out. You type "a lighthouse at sunset in the style of an oil painting" and get a picture. Amazon's image generation model on Bedrock is called Titan Image Generator.

Code generation takes natural language or partial code in and produces working code. Amazon CodeWhisperer (now part of Amazon Q Developer) is the AWS example here.

There are also audio and video generators, but the AIF-C01 stays focused on text, image, and code. If a question mentions a modality you don't recognize, eliminate it — the answer will be one of these three.

Exam tip

Know which AWS service maps to which modality. Bedrock hosts models for text (Claude, Llama, Titan Text, Mistral) and image (Titan Image Generator). Amazon Q Developer handles code. The exam likes "which service for which use case" questions.

Why generative AI exploded when it did

People sometimes ask: if the ideas behind neural networks are decades old, why did generative AI suddenly take over the world around 2022–2023? Three things converged:

  1. The transformer architecture (2017) made it possible to train models on enormous amounts of text efficiently. We'll cover this in Section 2.3.
  2. Compute scale — cloud providers (especially AWS) made it feasible to train models with hundreds of billions of parameters. Training a frontier model costs tens of millions of dollars in compute alone.
  3. Data scale — the internet provided trillions of words of training text, freely available.

The exam won't ask you for dates, but it may test the concept that generative AI's rise was driven by scale: bigger models, more data, more compute. That "scale" story is also why foundation models (next section) behave the way they do.

2.2 Foundation Models: The Engine Underneath

What "foundation" means

A foundation model is a large AI model trained on a vast, broad dataset that can then be adapted to many different tasks. The word "foundation" is doing real work here: just as a building's foundation supports everything built on top of it, a foundation model supports many different applications built on top of it.

Here's the key insight the exam wants you to have: before foundation models, you trained a separate model for each task. A spam filter model. A sentiment analysis model. A translation model. Each one needed its own labeled dataset and its own training run. Foundation models flipped this. You train one giant model on general data, and then that single model can do translation, summarization, question-answering, code writing, and dozens of other tasks — often with no additional training at all.

a wide concrete building foundation with multiple different structures built on top of it
a wide concrete building foundation with multiple different structures built on top of it

Examples of foundation models you should recognize for the exam: Anthropic's Claude, Meta's Llama, Amazon's Titan, Mistral AI's Mistral models, and Stability AI's Stable Diffusion (for images). On AWS, these are all available through Amazon Bedrock — which is exactly why Bedrock exists, as we'll see in Section 2.7.

Exam tip

The exam may describe a foundation model without naming it: "a large model trained on broad data that can be adapted to many downstream tasks." If you see "trained once, used for many tasks" or "adaptable to various applications," the answer is foundation model.

Pre-training: learning the world

Foundation models are built in two phases. The first is called pre-training, and it's the expensive one.

During pre-training, the model reads an enormous corpus of text — trillions of words from books, websites, articles, and code — and learns to predict what comes next. That's it. The entire objective, repeated trillions of times, is: given these words, what word most likely comes next?

This sounds almost too simple to produce intelligence, but it works because predicting the next word correctly requires understanding grammar, facts, reasoning patterns, writing styles, and even some common sense. A model that can reliably predict the next word in "The capital of France is ___" has learned a fact. A model that predicts the next word in a legal contract has learned legal language patterns.

Pre-training is:

Exam tip

Pre-training vs. fine-tuning is one of the most-tested distinctions in this domain. Pre-training = broad, expensive, self-supervised, learns general patterns from massive unlabeled data. If a question mentions "trillions of tokens" or "next-word prediction on internet-scale data," it's describing pre-training.

Fine-tuning: learning the job

After pre-training, you have a model that knows a lot about language in general but isn't particularly good at any specific task — and may not follow instructions well. Fine-tuning fixes that.

Fine-tuning takes the pre-trained model and continues training it on a smaller, curated, task-specific dataset. A hospital might fine-tune a foundation model on medical Q&A pairs so it answers like a medical assistant. A law firm might fine-tune on contracts so it drafts in legal language. A customer support team might fine-tune on their help-desk history so it answers in their company's voice.

Fine-tuning is:

The exam also expects you to know about instruction fine-tuning and RLHF (Reinforcement Learning from Human Feedback) at a conceptual level. Instruction fine-tuning trains the model on instruction/response pairs ("Summarize this article:" → summary) so it learns to follow instructions. RLHF goes further: humans rank the model's responses, and the model is trained to prefer responses humans rate highly — which is what makes modern chatbots helpful, harmless, and honest-ish rather than just autocomplete machines.

Exam tip

Classic exam trap: "A company wants a model that responds in its brand voice for customer support." The answer is fine-tuning (or customization), NOT pre-training from scratch. Pre-training from scratch is almost never the right answer on this exam — it's enormously expensive and only done by the big model providers.

The practical takeaway

Think of it like education. Pre-training is like sending someone through all of school — they learn language, facts, and reasoning generally. Fine-tuning is like job training — they learn to do your specific job. You wouldn't re-teach someone to read just to train them as a support agent; similarly, you don't pre-train a model from scratch when you can fine-tune an existing foundation model.

On AWS, this maps directly to Bedrock's customization options (Section 2.7): you can fine-tune certain models, or use techniques like RAG (Section 2.6) that avoid training altogether.

2.3 Transformers: The Architecture That Changed Everything

Attention is all you need

In 2017, researchers at Google published a paper titled "Attention Is All You Need." It introduced the transformer architecture — and every major language model since, from GPT to Claude to Llama to Titan, is built on it.

You don't need to understand the math. Here's the conceptual picture the exam expects:

Older models read text sequentially — word by word, left to right, like a person reading. This was slow and made it hard to connect words far apart in a sentence. Transformers read the whole input at once and use a mechanism called self-attention to decide which words matter most to each other.

a close-up of a large mural where many small painted details connect to form one image, illustrating attention across parts
a close-up of a large mural where many small painted details connect to form one image, illustrating attention across parts

Self-attention is the key idea. Consider the sentence: "The animal didn't cross the street because it was too tired." What does "it" refer to? The animal. Now: "The animal didn't cross the street because it was too wide." Now "it" refers to the street. Humans resolve this instantly using context. Self-attention is the mechanism that lets the model do the same thing — for every word, it weighs every other word in the input and decides how much attention to pay to each one when understanding it.

Exam tip

The exam tests transformers conceptually, not mathematically. Know: (1) transformers are the architecture behind modern LLMs, (2) self-attention lets the model weigh the relevance of different words to each other, (3) this enables understanding context and long-range relationships in text. If a question asks "which architecture powers modern large language models," the answer is transformer.

Why transformers scaled

Two properties made transformers take over:

  1. Parallelization. Because transformers process the whole input at once rather than word-by-word, training can be massively parallelized across thousands of GPUs. This is what made trillion-token training runs feasible.
  1. Long-range context. Self-attention doesn't degrade with distance the way older sequential models did. A transformer can connect a pronoun to a noun fifty words earlier. This is what enables long documents, extended conversations, and the large context windows we'll discuss next.

The exam won't ask you to compare transformers against RNNs or LSTMs in detail, but knowing that transformers replaced older sequential architectures because of parallelization and context handling is useful background.

Encoders, decoders, and what LLMs use

You may encounter the terms encoder and decoder. Conceptually: an encoder reads input and builds a rich representation of its meaning; a decoder takes a representation and generates output from it. Modern large language models (like the ones on Bedrock) are primarily decoder-based — they generate text one token at a time, each new token informed by all previous ones.

For the AIF-C01, you just need the vocabulary: if a question mentions "decoder-only architecture" in the context of text generation, that's describing models like GPT, Claude, and Llama. Don't overthink it — the exam stays at the "recognize the term" level here.

2.4 Tokens and Context Windows

The model doesn't see words — it sees tokens

Here's something that surprises beginners: large language models don't process text as words or characters. They process it as tokens.

A token is a chunk of text — sometimes a whole word ("cat"), sometimes part of a word ("un" + "believ" + "able"), sometimes a single character or punctuation mark. The model's vocabulary is a fixed list of tens of thousands of these tokens, and everything the model reads or writes is converted into token IDs first.

a close-up of printed text with colored highlighter marks breaking words into chunks
a close-up of printed text with colored highlighter marks breaking words into chunks

Why does this matter for the exam and for real life?

  1. Cost. Bedrock and other providers charge per token, not per word. Input tokens (your prompt) and output tokens (the response) are metered separately, usually with output costing more.
  2. Limits. Every model has a maximum number of tokens it can handle — the context window (next subsection).
  3. Rough conversion. A common rule of thumb: ~1,000 tokens ≈ 750 English words. The exam probably won't make you do token math, but understanding that tokens are the unit of measurement is essential.
Exam tip

If a question asks what unit is used to measure LLM input/output for pricing or limits, the answer is tokens. If it asks what a model "processes" text as, the answer is tokens, not words. This is one of those small facts the exam loves.

The context window: the model's working memory

The context window is the maximum number of tokens a model can consider at one time — your prompt plus the conversation history plus the response it's generating. Think of it as the model's working memory or the size of its desk: everything it needs to "keep in mind" must fit on the desk.

Typical context windows (and these grow constantly, so learn the concept, not specific numbers):

Why it matters:

  1. Long documents. If you need to summarize a 50-page report, you need a model whose context window fits it — or you need RAG (Section 2.6) to feed it relevant chunks.
  2. Long conversations. In a chatbot, the conversation history consumes context. Very long chats eventually "forget" the beginning as old tokens fall out of the window.
  3. Cost and latency. Bigger context windows cost more and respond slower. Using a 200K-token window for a 50-word question is wasteful.
Exam tip

Watch for scenario questions: "A company needs to analyze 300-page legal contracts in a single prompt." The correct consideration is context window size — they need a model with a large enough context window. "A chatbot forgets earlier parts of long conversations" = context window limitation.

Putting tokens and context together

Here's the mental model: tokens are the currency (what gets counted, priced, and limited), and the context window is the budget (how many you can spend at once). Every prompt you write spends tokens from the budget. Every token the model generates also comes from the same budget. When the budget runs out, the oldest tokens drop off.

This is the fundamental constraint that makes techniques like RAG (retrieval-augmented generation) so valuable — instead of stuffing everything into the context window, you retrieve only the relevant pieces. More on that in Section 2.6.

2.5 Prompting: Steering the Model with Words

What prompting is

A prompt is the input you give a generative AI model to get it to do something. Prompt engineering is the practice of designing effective prompts. On the AIF-C01, you need to know the concept and the main techniques — not become a prompt wizard.

The core insight: foundation models are incredibly capable but also incredibly literal and impressionable. The same model gives wildly different results depending on how you ask. Prompting is how you steer it.

a person typing on a laptop with a large speech bubble showing a detailed instruction above a simple one
a person typing on a laptop with a large speech bubble showing a detailed instruction above a simple one

Zero-shot prompting

Zero-shot prompting means asking the model to do a task with no examples — just the instruction.

> "Classify this review as positive or negative: 'The battery died after two hours.'"

The model has never seen a labeled example of this specific task in your prompt, yet it usually gets it right — because its pre-training exposed it to enough language patterns to generalize. "Zero-shot" = zero examples.

This works surprisingly well for straightforward tasks. It's the default way most people interact with chatbots.

Few-shot prompting

Few-shot prompting means including a few examples in the prompt before asking the model to perform the task.

> "Classify these reviews as positive or negative: > 'Amazing battery life!' → Positive > 'Screen cracked in a week.' → Negative > 'The battery died after two hours.' → "

By showing the model the pattern (review → label), you anchor its behavior. Few-shot prompting improves accuracy on tasks with specific formats, unusual labels, or edge cases where the model's default guess might be wrong.

The trade-off: examples consume tokens from your context window and add cost. More examples = more tokens = more money and slower responses.

Exam tip

Zero-shot vs. few-shot is a favorite exam topic. Zero-shot = no examples, just the instruction. Few-shot = a few examples included in the prompt to demonstrate the pattern. If a question says "the prompt includes three labeled examples," that's few-shot. If it says "without providing any examples," that's zero-shot.

Chain-of-thought prompting

Chain-of-thought (CoT) prompting asks the model to reason step by step before giving its final answer. The magic phrase is often literally "Let's think step by step."

> "A store sells 3 apples for $2. How much do 12 apples cost? Let's think step by step."

Instead of jumping to an answer (and possibly getting it wrong), the model writes out its reasoning: 12 ÷ 3 = 4 groups, 4 × $2 = $8. The step-by-step trace dramatically improves accuracy on math, logic puzzles, and multi-step reasoning problems.

Why does this work? Remember that these models generate one token at a time, and each token becomes part of the context for the next. By forcing the model to "show its work," you give it intermediate tokens to build on — like letting a student use scratch paper instead of doing everything mentally.

Exam tip

Chain-of-thought = asking the model to show step-by-step reasoning before answering. Look for phrases like "think step by step" or "show your reasoning." The exam may ask which technique improves performance on complex reasoning tasks — that's CoT.

Prompt engineering best practices (exam-level)

The exam may test general prompting principles:

None of this requires hands-on practice for the exam — just recognize the techniques and their purposes.

2.6 RAG: Giving the Model a Library Card

The problem RAG solves

Foundation models have two big limitations:

  1. Knowledge cutoff. A model only knows what was in its training data. If it was trained in 2024, it doesn't know about 2025 events, your company's new product, or your internal wiki.
  2. Hallucination. When a model doesn't know something, it doesn't say "I don't know" — it confidently makes something up. (More on hallucinations in the responsible AI chapters.)

You could fix this with fine-tuning (Section 2.2) — retrain the model on your documents. But fine-tuning is expensive, slow, and the knowledge goes stale the moment your documents change.

Retrieval-Augmented Generation (RAG) is the alternative the exam wants you to know cold.

a person at a library desk handing a specific book to someone writing at a table
a person at a library desk handing a specific book to someone writing at a table

How RAG works (conceptually)

RAG has two phases, and the name tells you both: retrieval, then augmented generation.

  1. Retrieval. You store your documents (manuals, wikis, policies, product catalogs) in a searchable knowledge base — technically a vector database, which lets the system find documents by meaning, not just keywords. When a user asks a question, the system searches the knowledge base and retrieves the most relevant chunks.
  1. Augmented generation. Those retrieved chunks are stuffed into the model's prompt alongside the user's question. The model now generates its answer grounded in your actual documents rather than relying on its training memory.

Think of it this way: instead of asking a student to memorize the entire textbook (fine-tuning), you let them bring the textbook into the exam and look up the relevant pages (RAG). The answers are more accurate, cite real sources, and stay current — just update the documents, no retraining needed.

Exam tip

RAG is one of the highest-yield topics in this domain. Memorize this: RAG = retrieve relevant documents from a knowledge base, then feed them to the model with the question so it generates grounded answers. On AWS, this is Amazon Bedrock Knowledge Bases. If a question describes "answering questions using company documents without retraining the model," the answer is RAG.

RAG vs. fine-tuning: when to use which

The exam loves "which approach" scenario questions. Here's the decision framework:

RAGFine-tuning
Best forFactual Q&A over changing documentsBehavior, style, tone, specialized tasks
Knowledge updatesInstant (update the documents)Requires retraining
CostLow (no training)Higher (training run)
Example"Answer questions from our product manuals""Write support replies in our brand voice"

A useful rule of thumb: RAG for knowledge, fine-tuning for behavior. If the company needs the model to know things (facts from documents), use RAG. If they need it to act a certain way (tone, format, specialized skill), use fine-tuning. Many real systems use both.

Exam tip

Classic trap: "A company wants its chatbot to answer based on internal documents that change weekly." RAG — because retraining weekly via fine-tuning would be wasteful. "A company wants the model to always respond in a specific format for legal disclaimers." Fine-tuning (or careful prompting) — that's about behavior, not knowledge.

Key RAG vocabulary

2.7 Amazon Bedrock: Generative AI on AWS

What Bedrock is

Amazon Bedrock is AWS's fully managed service for building generative AI applications using foundation models. That's the one-sentence definition to memorize.

Unpack it:

a modern office building lobby with multiple different company logos displayed on a directory board
a modern office building lobby with multiple different company logos displayed on a directory board

The analogy the exam wants you to internalize: Bedrock is like a model marketplace with a unified front door. Instead of integrating separately with Anthropic, Meta, Mistral, and Amazon's own models — each with different APIs, billing, and access controls — you integrate once with Bedrock and switch models with a configuration change.

Exam tip

If a question asks "which AWS service provides access to multiple foundation models through a single API," the answer is always Amazon Bedrock. This is probably the single most-tested Bedrock fact on the exam. Also know: it's serverless/fully managed — no infrastructure to manage.

Why Bedrock instead of calling model providers directly

The exam may probe why a company would choose Bedrock. The reasons:

  1. Model choice and switching. Try Claude today, Llama tomorrow — same API. No vendor lock-in to a single model provider.
  2. Privacy and security. Your prompts and data stay within AWS. They are not used to train the underlying models. This is a huge deal for enterprises and a favorite exam point.
  3. AWS integration. Bedrock connects natively to S3 (your data), IAM (your access controls), CloudWatch (your monitoring), and VPC (your network isolation).
  4. Customization. Fine-tune select models, use RAG via Knowledge Bases, and configure guardrails — all inside Bedrock.
  5. No infrastructure. Serverless — you pay per use, no GPUs to manage.
Exam tip

"A company wants to use foundation models but requires that its data not be used for model training and must stay within its AWS environment." That's a textbook Bedrock scenario — data privacy plus AWS-native integration.

Bedrock's key features (what the exam tests)

Model access and playgrounds. Bedrock provides a console where you can test models interactively (text and image playgrounds) before writing code. You may need to request access to certain models first.

Knowledge Bases (RAG). Bedrock's built-in RAG capability: point it at your S3 documents, and it handles chunking, embeddings, retrieval, and prompt augmentation automatically. When the exam says "RAG on AWS," think Bedrock Knowledge Bases.

Agents. Bedrock Agents extend models so they can take actions, not just generate text — calling APIs, querying databases, running multi-step workflows. Conceptually: a model that can do things, orchestrated through Bedrock. The exam expects you to recognize the term and its purpose.

Guardrails. Bedrock Guardrails let you set content filters and guardrails on model inputs and outputs — blocking harmful content, PII, or off-topic responses. This maps to the responsible AI domain (covered in a later chapter), but know that guardrails are a Bedrock feature.

Customization: fine-tuning and continued pre-training. For select models, Bedrock supports fine-tuning on your labeled data and continued pre-training on your unlabeled data — the two adaptation techniques from Section 2.2, delivered as a managed service.

Model evaluation. Bedrock offers tools to evaluate models — automatic metrics and human review workflows — so you can compare models before committing. This connects to the next section.

Exam tip

Map features to names: RAG → Knowledge Bases. Actions/workflows → Agents. Content safety → Guardrails. Adapting models → fine-tuning / continued pre-training. Comparing models → model evaluation. The exam loves "which Bedrock feature for which need" questions.

Bedrock vs. SageMaker: don't confuse them

This is a classic exam trap. Both are AWS ML services, but they serve different purposes:

Simple rule: generative AI apps on pre-built foundation models → Bedrock. Training your own models → SageMaker. If the scenario mentions foundation models, LLMs, or generative AI, it's Bedrock — even if SageMaker is listed as a distractor.

Exam tip

The Bedrock-vs-SageMaker distinction appears repeatedly. "A developer wants to build a chatbot using a pre-trained large language model without managing infrastructure" = Bedrock. "A data science team wants to train a custom classification model on proprietary data" = SageMaker. When you see "foundation model" or "generative AI," choose Bedrock.

2.8 Model Evaluation Basics

Why evaluation matters

How do you know if a generative AI model is any good — or which of two models is better for your use case? You evaluate it. This sounds obvious, but generative AI broke the old evaluation playbook: there's no single "correct" summary of an article or "correct" marketing email to compare against. Evaluation for generative AI is its own discipline, and the exam expects basic literacy.

a judge's scorecard with multiple criteria listed beside a row of trophies
a judge's scorecard with multiple criteria listed beside a row of trophies

What gets measured

At the AIF-C01 level, know the categories of evaluation:

Accuracy and correctness. Does the model produce factually correct outputs? For Q&A and summarization, this is paramount. Techniques include comparing against reference answers (where they exist) and using a second model as a judge ("LLM-as-judge" — one model evaluating another's outputs).

Relevance and helpfulness. Does the answer actually address what was asked? A fluent, confident, off-topic answer is a failure.

Coherence and fluency. Is the output well-formed and readable? Modern models rarely fail here, but it's still a dimension.

Safety and bias. Does the output contain harmful content, or reflect unfair bias? This bridges into the responsible AI domain.

Latency and cost. How fast is the response, and how many tokens (dollars) did it cost? A slightly worse model that's 10x cheaper may be the right business choice.

Exam tip

The exam is unlikely to ask for specific metric formulas (no BLEU/ROUGE calculations — this is a practitioner exam, not a data science exam). Know that models are evaluated, what dimensions matter (accuracy, relevance, safety, cost/latency), and that Bedrock provides model evaluation tools.

Human evaluation vs. automatic evaluation

Two broad approaches:

In practice, teams use both: automatic metrics for rapid iteration, human review for final validation. Bedrock's model evaluation feature supports both paths.

The evaluation mindset for the exam

If a scenario asks how a company should choose between models or validate a generative AI application before launch, the answer involves evaluation — testing with representative prompts, measuring accuracy/relevance/safety, possibly with human reviewers. Don't pick "deploy the biggest model" or "choose based on marketing claims." The practitioner mindset is: measure, then decide.

Chapter 2 Summary

End-of-Chapter Test

1. A company wants to automatically generate product descriptions for thousands of items in its catalog. Which type of AI is the best fit? A. Discriminative AI for classifying products into categories B. Generative AI for creating new text content C. Reinforcement learning for optimizing warehouse layout D. Computer vision for detecting defective products

2. What is the defining characteristic of a foundation model? A. It is trained from scratch separately for each downstream task B. It is a small model optimized for edge devices C. It is trained once on broad data and can be adapted to many tasks D. It can only process structured numerical data

3. During pre-training of a large language model, what is the model primarily learning to do? A. Classify images into predefined categories B. Predict the next token given the preceding context C. Follow human instructions from labeled examples D. Rank responses based on human preferences

4. A company wants its customer-support chatbot to respond in the company's specific brand voice. Which approach is most appropriate? A. Pre-train a new foundation model from scratch on internet data B. Fine-tune an existing foundation model on the company's support conversations C. Increase the model's context window to the maximum setting D. Switch from zero-shot to chain-of-thought prompting only

5. What does the self-attention mechanism in a transformer architecture allow the model to do? A. Process images pixel by pixel in strict sequential order B. Weigh the relevance of different words to each other when understanding text C. Store training data verbatim for later retrieval D. Eliminate the need for any training data

6. A developer's prompt uses 2,000 tokens and the model's response uses 500 tokens. The model's context window is 8,000 tokens. Which statement is true? A. The interaction exceeds the context window B. Tokens are only counted for the model's output, not the prompt C. Both input and output tokens count against the 8,000-token context window D. Context windows are measured in words, not tokens

7. Which prompting technique involves including labeled examples in the prompt to demonstrate a pattern? A. Zero-shot prompting B. Few-shot prompting C. Chain-of-thought prompting D. Negative prompting

8. A company has internal policy documents that change every week and wants a chatbot that answers employee questions based on the current documents, without retraining a model weekly. What should it use? A. Fine-tuning the model every week on the updated documents B. Pre-training a new model from scratch each month C. Retrieval-Augmented Generation (RAG) with a knowledge base of the documents D. Increasing the number of few-shot examples to cover all policies

9. Which AWS service provides access to multiple foundation models (such as Claude, Llama, and Titan) through a single API for building generative AI applications? A. Amazon SageMaker B. Amazon Bedrock C. Amazon Comprehend D. AWS Lambda

10. A team is comparing two foundation models for a summarization application and wants to assess factual correctness, relevance, and safety before choosing. What should they do? A. Deploy the model with the most parameters without testing B. Perform model evaluation using automatic metrics and human review C. Fine-tune both models and pick the one that trains fastest D. Select based solely on the lowest per-token price

---

Answer Key

1. B — Generating new product descriptions is content creation, which is the definition of generative AI. Classifying products (A) would be discriminative AI.

2. C — A foundation model is trained once on broad, general data and can then be adapted (via prompting, RAG, or fine-tuning) to many downstream tasks. That's what makes it a "foundation."

3. B — Pre-training is self-supervised next-token prediction on massive unlabeled text. Instruction-following (C) comes from instruction fine-tuning, and preference ranking (D) describes RLHF — both happen after pre-training.

4. B — Adapting a model to a specific brand voice is a behavior/style adaptation, which calls for fine-tuning on the company's own conversations. Pre-training from scratch (A) is enormously expensive and unnecessary.

5. B — Self-attention lets the model weigh how relevant each word is to every other word, enabling it to resolve references (like pronouns) and capture context across the input.

6. C — The context window counts all tokens the model must hold at once: the prompt (input) tokens plus the generated (output) tokens. 2,000 + 500 = 2,500, well within 8,000.

7. B — Few-shot prompting includes a few labeled examples demonstrating the desired pattern. Zero-shot (A) uses no examples; chain-of-thought (C) asks for step-by-step reasoning.

8. C — RAG retrieves current documents at query time, so weekly document changes require no retraining — just update the knowledge base. Weekly fine-tuning (A) would be costly and wasteful.

9. B — Amazon Bedrock is the fully managed service offering multiple foundation models through a single API. SageMaker (A) is for training and deploying your own ML models; Comprehend (C) is for NLP analysis, not generative AI.

10. B — The practitioner approach is to evaluate models before choosing: measure accuracy, relevance, and safety with automatic metrics and human review, then decide based on evidence.

Answer key