AWS AI Practitioner · 5 of 12

Generative AI fundamentals: tokens, embeddings, transformers and foundation models

What a token is and why it is not a word, how documents are chunked, what an embedding vector means, how a transformer predicts the next token, what makes a model a foundation model, how diffusion turns noise into pictures, which use cases fit, and the seven-stage lifecycle of a foundation model with the AWS service behind each stage.

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

The machine learning article ended with models that answer a narrow question: is this transaction fraud, what will demand be next Tuesday. Generative AI asks a model to produce the answer itself, a paragraph, a picture, a function, and to do so for tasks nobody trained it for by name. Underneath the apparent magic is a small set of ideas that repeat everywhere: text is cut into tokens, tokens are turned into vectors, a transformer looks at all of them at once and guesses the next one, and a model trained that way on a very large pile of data becomes a foundation model that can be pointed at almost anything. This article builds those ideas in order, then adds pictures, use cases and the lifecycle that takes a model from raw data to a monitored deployment. It is the vocabulary every other generative AI article in the series assumes.

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.

Generative versus discriminative: learning the distribution, not the boundary

A discriminative model learns the line that separates classes, and a generative model learns what the data itself looks like well enough to produce more of it.

Every model in the machine learning article was discriminative in spirit: given features, produce a label or a number. The model never needs to know what a fraudulent transaction looks like in full; it only needs to know which side of a boundary it falls on. A generative model has a harder job. Trained on text, it must learn the probability of every possible next word given the words so far; trained on images, it must learn what arrangements of pixels look like a photograph of a cat. Because it has learned the shape of the data, it can sample from that shape and produce something new that was not in the training set.

The word "generative" is older than the current wave. Naive Bayes is a generative classifier, and Markov chains have written nonsense poetry for decades. What changed around 2020 is scale: the transformer architecture, trained on hundreds of billions of tokens scraped from the web on thousands of GPUs, produced models whose outputs are fluent enough to be useful. The empirical finding behind that investment is the scaling law: loss falls predictably as parameters, data and compute grow together, so the same architecture keeps getting better without a new idea.

DiscriminativeGenerative
LearnsP(label | input): where the boundary between classes liesP(data): what the data looks like, so it can be sampled
OutputA class, a score, a numberNew content: text, image, audio, code, embeddings
Training dataLabelled examples for one taskMostly unlabelled data at very large scale, the data is its own label
Tasks per modelOneMany, chosen at run time by the prompt
EvaluationAccuracy, precision, recall, RMSEHuman preference, ROUGE, BLEU, BERTScore, benchmarks (see the evaluation article)
Failure modeWrong labelFluent but wrong content, a hallucination
AWS examplesAmazon Fraud Detector, Amazon Rekognition labels, SageMaker XGBoostClaude and Amazon Nova on Bedrock, Titan Image Generator, Nova Canvas
In the wild
  • Amazon Fraud Detector is the discriminative side of the house: it scores an event and returns a number; it never writes a sentence.
  • Anthropic Claude on Amazon Bedrock is the generative side: the same weights answer a support ticket, draft SQL and explain a contract, with nothing changed but the prompt.
  • Amazon Rekognition and Amazon Nova Canvas sit at the two ends of images: Rekognition tells you what is in a picture, Nova Canvas makes the picture.
Exam angle

When a scenario says "classify", "detect", "predict a value" or "score", the answer is a discriminative model or a pre-built AI service. When it says "generate", "draft", "summarise", "converse" or "create an image", the answer is a foundation model, and on AWS that almost always means Amazon Bedrock. The exam also expects you to know that generative models are trained mostly on unlabelled data.

discriminative model
A model that learns to tell inputs apart: it estimates the probability of a label given the input, and outputs that label or a number.
generative model
A model that learns the distribution of the training data well enough to sample new data from it: text, images, audio, code.
scaling law
The observed rule that a model's loss improves smoothly and predictably as parameters, training data and compute are increased together.

Tokens: the unit a model reads, counts and bills

A token is a piece of text from a fixed vocabulary, usually a whole common word or a fragment of a rare one, and it is the only thing a language model ever sees.

Neural networks work on numbers, not letters, so before any text reaches a model it passes through a tokeniser that cuts it into pieces and replaces each piece with an integer id from a vocabulary of, typically, 30,000 to 200,000 entries. The vocabulary is learned from the training corpus by an algorithm such as byte pair encoding (BPE), which starts with single characters and repeatedly merges the most frequent adjacent pair until the vocabulary is full. Frequent words such as "the" and "model" end up as one token each. Rare words, names, misspellings and numbers are split: "tokenisation" might become "token" and "isation", a 10-digit account number might become five tokens of two digits each. Punctuation and leading spaces are usually part of the token that follows them.

flowchart TD
  T["Text<br/>The model tokenises text."]
  K["Tokens<br/>The · model · token · ises · text · ."]
  I["Token ids<br/>791 · 1646 · 4037 · 5014 · 1495 · 13"]
  E["Embedding lookup<br/>one vector of 1,024 numbers per token id"]
  V["Vectors<br/>the sequence the transformer actually reads"]
  T --> K --> I --> E --> V
Figure 2. From text to the numbers a model reads. The tokeniser cuts text into vocabulary pieces and maps each to an id; an embedding table turns each id into a vector; the transformer works on the vectors. The ids shown are illustrative, every model has its own vocabulary.

Why a token is not a word

The rule of thumb for English is that one token is about four characters or three-quarters of a word, so 1,000 tokens is roughly 750 words, or about a page and a half of prose. The ratio worsens for anything the vocabulary saw less of during training: code with its brackets and underscores, languages written in scripts other than Latin, chemical names, base64 strings. A Japanese sentence can cost two to three times the tokens of its English translation, and a JSON document is far more expensive than the same information in plain sentences. This is why the same question costs different amounts in different languages and why "trim the whitespace and drop the boilerplate" is real cost engineering.

Tokens drive cost and limits

Two facts about tokens follow you through every later article. First, foundation models are billed per token: Bedrock on-demand pricing charges separately for the tokens you send (input) and the tokens the model produces (output), and output tokens cost more because generating them takes more compute than reading them. Second, a model's context window, the total amount of text it can consider at once, is measured in tokens, and it must hold the prompt, any retrieved documents, the conversation so far and the answer. A long system prompt spends the same budget on every call; a chatty history eventually pushes the earliest turns out of the window.

InputRoughly how it tokenisesWhy it matters
"the quick brown fox"4 tokens, one per wordCommon English is cheap
"antidisestablishmentarianism"5 to 7 sub-word tokensRare words are split into pieces the vocabulary knows
"4471 2039 5561 8820"8 or more tokensNumbers are chopped into short digit groups, so arithmetic is hard for the model
for (i = 0; i < n; i++)10 to 14 tokensSymbols each cost a token; code is dearer per character than prose
A Japanese sentence2 to 3 times its English tokensNon-Latin scripts tokenise into smaller pieces, so the same meaning costs more and fills the window faster
Watch out
  • Every model has its own tokeniser. A token count from one vendor's tool does not transfer to another model. Bedrock reports input and output token counts in each response; use those for cost estimates.
  • Prompt length is paid on every turn. In a chat application the whole history is re-sent each time, so the cost of a conversation grows with the square of its length unless old turns are summarised or dropped.
  • Models see tokens, not letters. "How many r's in strawberry" and "reverse this string" are hard precisely because the model never sees individual characters.
In the wild
  • Amazon Bedrock prices every text model by input and output tokens on the on-demand plan and returns the counts in the response metadata, which is what a FinOps dashboard aggregates.
  • Anthropic publishes a token counting endpoint so an application can measure a prompt before sending it, and Claude's tokeniser is what a Bedrock Claude call bills against.
  • Amazon Q Developer sends your open file and cursor context as tokens on every suggestion, which is why it trims to the relevant window rather than the whole repository.
Exam angle

Expect a question that hinges on "tokens are not words", another on "cost is per input and output token", and a third on "the context window limits how much the model can consider". If a scenario asks how to reduce the cost of a chat application, shorter prompts, fewer output tokens (a lower maximum length) and a smaller model are the levers.

token
The unit of text a model reads and produces: a whole common word, a word fragment, a punctuation mark or a group of digits, each mapped to an integer id in the model's vocabulary.
tokeniser
The program that cuts text into tokens using a vocabulary learned from the training data; byte pair encoding, WordPiece and SentencePiece are the common algorithms.
vocabulary
The fixed list of tokens a model knows, tens of thousands to a few hundred thousand entries. Anything not in it is represented as smaller pieces that are.

Chunking: cutting documents into pieces a model can hold

Chunking splits a long document into passages of a few hundred tokens each so that they can be embedded, stored and retrieved individually and fed to a model without overflowing its context window.

A foundation model cannot read a 400-page manual in one go, and even when a window is large enough, stuffing everything in costs money and buries the relevant sentence among thousands of irrelevant ones. The standard answer, and the first step of retrieval-augmented generation (RAG, covered properly in the applications article), is to chunk: split the text into passages, embed each passage as a vector, store the vectors, and at question time retrieve only the handful of chunks that match the question. Chunking therefore decides what the model will later be able to find.

flowchart TD
  D["Document<br/>an 80-page PDF, about 40,000 tokens"]
  P["Parse to text<br/>drop headers, footers, keep section titles"]
  C["Split into chunks<br/>300 tokens each, 20 percent overlap"]
  M["Attach metadata<br/>source file, page, section, date"]
  E["Embed each chunk<br/>Titan Text Embeddings V2"]
  S["Store vector plus text plus metadata<br/>OpenSearch, Aurora pgvector, Pinecone"]
  D --> P --> C --> M --> E --> S
Figure 3. The ingestion pipeline that turns a document into searchable chunks. Every choice on the way, chunk size, overlap and metadata, shapes what a later query can retrieve.

Size and overlap

Chunk size is a trade-off. Small chunks (a sentence or two) embed very precisely but lose the context around them: "it must be replaced every 500 hours" is useless without the sentence that says what "it" is. Large chunks (a whole page) keep context but their embedding becomes an average of many topics, so a specific question matches them weakly, and they eat context window when retrieved. Most systems land between about 200 and 500 tokens and tune from there by measuring retrieval quality.

Overlap repeats the last few dozen tokens of one chunk at the start of the next, so that a sentence or a definition that straddles a boundary survives whole in at least one chunk. Ten to twenty percent overlap is the usual range; more than that stores the same text several times for little gain.

Strategies

In the wild
  • Amazon Bedrock Knowledge Bases offers fixed-size, semantic, hierarchical and no chunking when it ingests from Amazon S3, and stores the chunk text alongside the vector so the retrieved passage can be shown as a citation.
  • Amazon Kendra has always chunked documents into passages behind the scenes; its answers point at the passage, not just the document.
  • LangChain and LlamaIndex, the open-source toolkits most RAG prototypes start with, expose recursive character splitters and token splitters with size and overlap as their two main dials.
Watch out
  • Chunking a table by characters destroys it. A row split across two chunks loses its column headers. Convert tables to sentences or keep rows with their header.
  • Metadata is not optional. Without source and page in each chunk, the model cannot cite where an answer came from, and you cannot filter retrieval to "only 2025 policies".
  • Re-chunking means re-embedding. Changing the strategy later means running every document through the embedding model again, at token cost.
Exam angle

Chunking questions come dressed as "answers are missing context" (chunks too small, add overlap or use hierarchical chunking) or "retrieval returns irrelevant passages" (chunks too large or not semantic). Know that Bedrock Knowledge Bases handles chunking for you and that overlap exists to protect sentences that straddle a boundary.

chunk
One passage of a document, typically a few hundred tokens, embedded and stored as a unit for retrieval.
overlap
Text repeated at the end of one chunk and the start of the next so that nothing meaningful is cut in half at a boundary.
hierarchical chunking
Storing small child chunks for matching and larger parent chunks for reading, so retrieval is precise but the model gets full context.

Embeddings: meaning as a point in space

An embedding is a list of numbers, a vector, produced by a model so that pieces of text (or images) with similar meaning end up close together, which turns "find something similar" into arithmetic.

The embedding table in Figure 2 gives each token a vector, but the word "embedding" in generative AI usually means something bigger: a vector for a whole sentence, paragraph, product description or image, produced by a dedicated embedding model. The model is trained so that texts that mean the same thing produce vectors pointing in the same direction, whatever words they use. "How do I reset my password" and "forgotten login credentials" share almost no words but land next to each other; "password" and "passport" share most of their letters and land far apart. The dimensions have no human names; meaning is spread across all of them.

dimension 1 of 1,024 dimension 2 θ, small angle: cosine near 1 "reset my password" "forgot my login" "account locked out" "quarterly revenue grew" "Q3 sales figures" "renew my passport" "visa application form"
Figure 4. An embedding space squashed to two dimensions. Phrases about the same thing cluster, whatever words they use; "password" and "passport" look alike as strings and sit far apart as meanings. Cosine similarity is the cosine of the angle between two vectors: near 1 for the two dashed arrows, near 0 for unrelated phrases.

Measuring similarity

Three measures appear in practice. Cosine similarity is the cosine of the angle between two vectors: 1 when they point the same way, 0 when they are unrelated, negative when opposed. It ignores length, which is what you want when one text is a long paragraph and the other a five-word query. Euclidean distance is the straight-line distance between the two points; smaller is more similar. The dot product is fast and equals cosine similarity when the vectors are normalised to unit length, which many embedding models do by default. Vector databases index millions of these vectors with approximate nearest-neighbour algorithms (HNSW is the common one) so that "the 10 closest vectors to this query" returns in milliseconds rather than scanning everything.

Embedding models on AWS

Embeddings are used far beyond RAG: semantic search that matches meaning rather than keywords, recommendation ("products whose descriptions are near what you bought"), clustering support tickets into themes, deduplication of near-identical documents, anomaly detection for a log line unlike any seen before, and classification by nearest labelled neighbour when there is too little data to train a classifier.

In the wild
  • Amazon OpenSearch Service stores vectors with its k-NN plugin and is the default vector store behind Bedrock Knowledge Bases (as OpenSearch Serverless), combining keyword and vector search in one query.
  • Amazon Aurora PostgreSQL with the pgvector extension keeps embeddings next to the relational data they describe, so one SQL query can filter by customer and rank by similarity.
  • Spotify and Netflix style recommenders embed users and items into the same space and recommend by proximity, the same idea years before language models made it famous.
Watch out
  • Vectors from different models do not mix. A query embedded with Cohere cannot be compared to documents embedded with Titan. Changing the embedding model means re-embedding the whole corpus.
  • Embeddings capture meaning, not truth. A confidently wrong document sits right next to a correct one on the same topic; retrieval finds relevance, and the model still has to judge.
  • Dimension count is a cost dial. 1,024 floats per chunk across ten million chunks is tens of gigabytes of index; the 256-dimension option exists for exactly that reason.
Exam angle

"Semantic search", "find similar", "meaning rather than keywords" and "vector database" all point at embeddings, and on Bedrock the named embedding model is Amazon Titan Text Embeddings (or Cohere Embed). Know that cosine similarity is the usual comparison and that OpenSearch Serverless, Aurora PostgreSQL with pgvector, Pinecone, Redis Enterprise Cloud and MongoDB Atlas are the vector stores Bedrock Knowledge Bases can use.

embedding
A vector of a few hundred to a few thousand numbers produced by a model so that inputs with similar meaning have vectors that point in similar directions.
cosine similarity
The cosine of the angle between two vectors, from 1 (same direction) through 0 (unrelated) to −1 (opposite). The standard measure for comparing embeddings because it ignores vector length.
vector database
A store that indexes embeddings for fast approximate nearest-neighbour search, returning the k vectors closest to a query.
k-NN
k nearest neighbours: the k stored vectors closest to a query vector. HNSW is the graph index most vector stores use to find them quickly.

Transformers: attention over every token at once

A transformer is a neural network that processes a whole sequence of tokens in parallel and lets every token gather information from every other token through a mechanism called self-attention.

The architecture comes from a 2017 Google paper, "Attention Is All You Need", written for machine translation. Before it, sequence models were recurrent neural networks (RNNs, and their LSTM and GRU variants) that read one token at a time and carried a running summary forward. That design had two problems: information from early in a long sentence faded by the end, and reading one token at a time cannot be parallelised across a GPU's thousands of cores. The transformer threw away recurrence. Every token is processed at the same time, and the connection between distant tokens is one attention step away, not a hundred recurrent steps. That made training on web-scale data feasible, and everything called a large language model since is a transformer.

Self-attention in plain words

For each token, the model computes three vectors from its embedding: a query ("what am I looking for"), a key ("what do I contain") and a value ("what I pass on if chosen"). The query of one token is compared with the keys of every token in the sequence; the scores are turned into weights that sum to one with a softmax; and the token's new representation is the weighted sum of all the values. In "the animal did not cross the street because it was too tired", the token "it" places heavy weight on "animal", and its representation absorbs that. The model runs several of these in parallel, multi-head attention, so one head can track grammatical agreement while another tracks coreference and another tracks position in a list.

Because attention on its own has no idea of order (a bag of tokens gives the same weights in any order), a positional encoding is added to each embedding before the first layer so that the model can tell the third token from the thirtieth.

flowchart TD
  I["Token embeddings plus positional encoding<br/>one vector per token, all tokens at once"]
  A["Multi-head self-attention<br/>each token weighs every other token: query, key, value"]
  N1["Add and normalise<br/>residual connection keeps the original signal"]
  F["Feed-forward network<br/>the same small network applied to each position"]
  N2["Add and normalise"]
  R["Repeat the block N times<br/>dozens of layers in a large model"]
  O["Linear layer and softmax<br/>a probability for every token in the vocabulary"]
  I --> A --> N1 --> F --> N2 --> R --> O
Figure 5. One transformer block and the output head. Attention mixes information between tokens; the feed-forward network processes each token on its own; the two are stacked dozens of times. In a decoder, attention is masked so each token can only look at tokens before it.

Encoder, decoder, or both

The original transformer had two stacks. The encoder reads the whole input and produces a rich representation of it; every token can attend to every other, forwards and backwards. The decoder produces output one token at a time, attending to what it has produced so far (masked, so it cannot peek ahead) and, through cross-attention, to the encoder's output. Three families grew from that:

Recurrent network (RNN, LSTM)Transformer
Reads the sequenceOne token at a time, in orderAll tokens at once
Long-range linksMust survive every step in between; fade over long inputsOne attention step between any two tokens
Training on GPUsSequential, poor use of parallel hardwareParallel over the whole sequence, which made web-scale training practical
Cost as input growsLinear in sequence lengthAttention is quadratic in sequence length, which is why context windows have limits
OrderBuilt inAdded through positional encodings
Where it lives nowSmall on-device models, some time-series workEvery foundation model, and the vision and audio models as well
In the wild
  • Anthropic Claude, Meta Llama, Mistral and Amazon Nova are all decoder-only transformers; the differences are in data, size, training recipe and alignment, not in the basic block.
  • Amazon Comprehend and most embedding models are encoder-style: they read text and produce a label or a vector, never a story.
  • Google Translate moved from LSTM sequence-to-sequence models to transformers soon after the 2017 paper, and the paper's own benchmark was English to German translation.
Watch out
  • Attention is quadratic. Doubling the input roughly quadruples the attention compute, which is one reason a long prompt is slow and expensive and why context windows are finite.
  • "Understands" is a metaphor. The model has learned statistical relations between tokens strong enough to be useful; it has no model of the world outside them, which is why it can be fluent and wrong at the same time.
Exam angle

The exam tests the vocabulary, not the maths: "transformer", "self-attention", "encoder and decoder", "parallel processing", and "why transformers replaced RNNs" (long-range dependencies and parallel training). If a question asks what architecture underlies large language models, the answer is the transformer.

self-attention
The operation in which each token computes weights over every other token in the sequence and takes a weighted sum of their values, so its representation reflects its context.
multi-head attention
Several attention operations run in parallel with different learned projections, so different heads can capture different kinds of relation.
positional encoding
A vector added to each token embedding that tells the model where in the sequence the token sits, because attention alone is order-blind.
encoder and decoder
The reading stack and the writing stack of a transformer. Encoder-only models understand, decoder-only models generate, encoder-decoder models map one sequence to another.
RNN
Recurrent neural network: the earlier sequence architecture that reads one token at a time and carries state forward. LSTM and GRU are its best-known variants.

Generation: next-token prediction, the context window and the autoregressive loop

A language model produces text by predicting a probability for every possible next token, picking one, appending it to the input and doing it again until it emits a stop token or hits the length limit.

The output of the transformer in Figure 5 is not a sentence. It is a list of numbers, one per vocabulary entry, saying how likely each token is to come next. The training objective was exactly that: shown billions of text fragments with the last token hidden, adjust the weights so the hidden token gets a higher probability. That single, simple objective, next-token prediction, is enough to force the model to learn grammar, facts, reasoning patterns and style, because predicting the next word of a physics textbook well requires knowing some physics. It needs no human labels, which is what makes web-scale training possible: the data is its own label, a setup called self-supervised learning.

flowchart TD
  P["Prompt tokens<br/>The capital of France is"]
  M["Transformer forward pass<br/>reads every token in the window"]
  D["Probability over the vocabulary<br/>Paris 0.91 · a 0.03 · the 0.02 · ..."]
  S["Pick one token<br/>greedy takes the top, sampling uses temperature and top-p"]
  A["Append it to the sequence<br/>The capital of France is Paris"]
  Q{"Stop token?"}
  O["Return or stream the text"]
  P --> M --> D --> S --> A --> Q
  Q -- "no, and room left in the window" --> M
  Q -- "yes, or max tokens reached" --> O
Figure 6. Autoregressive generation. Every output token costs one full pass over everything before it, which is why output tokens are priced higher than input tokens and why a long answer takes longer than a long question.

Autoregressive

"Autoregressive" means the model's own output becomes part of its next input. Each new token is chosen, appended and the whole sequence is read again. This is why generation is slow relative to reading (one forward pass per output token), why responses can be streamed token by token to the user, and why an early mistake compounds: once a wrong fact is in the sequence, the model conditions on it as though it were true.

Choosing the token: greedy or sampled

If the model always picked the most probable token (greedy decoding) it would be deterministic and often dull, repeating safe phrases. Instead it usually samples from the distribution, and three parameters shape that sampling. Temperature flattens or sharpens the distribution: near 0 behaves like greedy, higher values make unlikely tokens more likely and output more varied. Top-p (nucleus sampling) keeps only the smallest set of tokens whose probabilities add up to p, cutting off the long tail. Top-k keeps only the k most probable tokens. The Bedrock article has the table of what each does; here the point is that sampling is the source of the nondeterminism the next article lists as a limitation: the same prompt can give a different answer twice.

The context window

The context window is the maximum number of tokens the model can attend to in one pass: prompt, retrieved documents, conversation history and the answer so far, all together. Early models had windows of 2,000 to 4,000 tokens. Current Claude models on Bedrock accept 200,000 tokens, roughly a 500-page book; Amazon Nova Pro offers a 300,000-token window and Llama models 128,000. A larger window means fewer retrieval tricks but a higher per-call cost and slower responses, and models still attend less reliably to the middle of a very long context than to its start and end.

In the wild
  • Amazon Bedrock Converse API streams tokens as they are sampled, which is what makes a chat interface feel alive; a 500-token answer that takes ten seconds is shown word by word rather than as a ten-second pause.
  • Amazon Q Developer proposes code completions by predicting the next tokens of your file; the stop condition is the end of the statement or block.
  • Any chat assistant re-sends the whole conversation on every turn because the model has no memory between calls; "memory" is the application keeping the history inside the window.
Watch out
  • The model has no memory of its own. Each call is independent; what looks like memory is the application putting earlier turns back into the prompt.
  • Maximum tokens is a cut-off, not a target. Set it too low and answers stop mid-sentence; it does not make the model concise, the prompt does that.
  • Temperature 0 is not a guarantee. Even greedy decoding can vary slightly across hardware and batching, so do not build tests that require byte-identical output.
Exam angle

"Nondeterministic output" is explained by sampling and fixed by lowering temperature. "The model forgot the start of the conversation" is the context window. "Model stopped mid-answer" is the maximum token setting. And "why does the model produce output one word at a time" is autoregressive generation.

next-token prediction
The training objective of a language model: given the tokens so far, assign probabilities to what comes next.
autoregressive
Generating one token at a time, feeding each generated token back in as input for the next step.
context window
The maximum number of tokens a model can consider in one call, covering the prompt, any history and the answer together.
self-supervised learning
Training where the labels come from the data itself, such as hiding the next token and asking the model to predict it. It needs no human annotation.
stop token
A special token the model emits to signal that its answer is finished; applications can also define stop sequences of their own.

Foundation models: trained once on everything, adapted to anything

A foundation model is a very large model pre-trained on a broad, mostly unlabelled corpus so that it can be adapted, by prompting, retrieval or fine-tuning, to a wide range of tasks it was never specifically trained for.

The term was coined at Stanford in 2021 to name what GPT-3 and its peers had become: not a spam filter or a translator but a general substrate on which many applications are built. Three properties make a model "foundation". Scale: billions to hundreds of billions of parameters, trained on trillions of tokens. Breadth: the training data spans web pages, books, code, forums and, for multimodal models, images and audio, so the model has seen a little of almost everything. Adaptability: the same weights serve many tasks, and behaviour is changed by the input rather than by training a new model. A large language model (LLM) is a foundation model for text; image and multimodal foundation models exist too.

Pre-training and adaptation

Pre-training is the expensive step: months of next-token prediction on thousands of accelerators, costing tens of millions of dollars for the largest models. Only a handful of organisations do it, which is why the Bedrock catalogue lists providers rather than expecting you to train your own. After pre-training comes alignment: supervised fine-tuning on example conversations and reinforcement learning from human feedback (RLHF) so that the model follows instructions and declines harmful requests. The customising article covers those in detail.

Everything a business does with the model is adaptation, and it comes in increasing order of effort and cost: writing a good prompt (see the prompt engineering article), giving the model retrieved documents at run time (RAG), fine-tuning the weights on a few thousand labelled examples, and continued pre-training on a large body of domain text. One base model therefore stands behind many products: the same Claude model answers a bank's support chat, reviews a law firm's contracts and writes a retailer's product descriptions.

Provider on BedrockFamilyModalityTypical use
AmazonTitan (Text, Text Embeddings, Multimodal Embeddings, Image Generator), Nova (Micro, Lite, Pro, Premier, Canvas, Reel, Sonic)Text, embeddings, image, video, speechCost-efficient general text, embeddings, image and video generation, speech-to-speech
AnthropicClaude (Haiku, Sonnet, Opus generations)Text and image in, text outReasoning, long documents, coding, agents
MetaLlamaText, some vision variantsOpen-weights models, fine-tuning, cost control
Mistral AIMistral, Mixtral, PixtralText, some visionEfficient open-weights text models
CohereCommand, Embed, RerankText, embeddingsEnterprise RAG, retrieval, reranking
AI21 LabsJamba (earlier Jurassic)TextLong-context text generation
Stability AIStable Diffusion XL, Stable Image Core and Ultra, Stable Diffusion 3Text in, image outImage generation and editing
In the wild
  • Amazon Bedrock is a catalogue of foundation models from several providers behind one API; the Bedrock article is the full reference.
  • Amazon Nova is Amazon's own foundation model family, trained on AWS Trainium and offered only through Bedrock.
  • Amazon SageMaker JumpStart is the other door to foundation models on AWS: open-weights models (Llama, Mistral, Falcon, Stable Diffusion) that you deploy onto your own endpoints and can fine-tune, described in the next article.
Watch out
  • Knowledge cut-off. A foundation model knows nothing after the date its training data was collected. Anything newer has to arrive through the prompt (RAG), not through the weights.
  • Bigger is not always better. A smaller model with a good prompt or retrieval often beats a larger one on cost and latency, and the exam likes "choose the smaller model that meets the requirement".
  • Open weights is not open data. Llama and Mistral publish their weights and a licence; they do not publish the training corpus, so bias and provenance questions still apply.
Exam angle

The defining phrases are "pre-trained on broad data", "adaptable to many downstream tasks" and "large scale". A question that asks how a company can use a foundation model for its own domain without training one from scratch is pointing at fine-tuning or RAG on Bedrock; one that asks about the base model's own training is pointing at self-supervised pre-training.

foundation model (FM)
A large model pre-trained on broad data at scale that serves as the base for many downstream tasks through prompting, retrieval or fine-tuning.
large language model (LLM)
A foundation model for text: a decoder transformer with billions of parameters trained by next-token prediction.
pre-training
The initial self-supervised training of a foundation model on a huge corpus; the costly step that only the model provider performs.
parameters
The learned weights of the network. A model's size is quoted as its parameter count: 8 billion, 70 billion, several hundred billion.
knowledge cut-off
The date after which the training data contains nothing, so the model has no knowledge of later events unless the prompt supplies it.

Multimodal models: text, image, audio and video on either side

A multimodal model accepts or produces more than one kind of data, typically text together with images, audio or video, inside one network rather than by chaining separate models.

The trick is to make everything look like tokens. An image is cut into patches and each patch is encoded into a vector by a vision encoder; audio is cut into short frames and encoded the same way; those vectors are placed in the sequence alongside the text token vectors, and the transformer's attention treats them all alike. A question about a photograph therefore becomes "attend from the question tokens to the image patches". On the output side, a model may produce text about the image (Claude describing a chart), produce an image from text (Nova Canvas), or produce speech from speech (Nova Sonic). "Multimodal" is used loosely for any of these; the exam cares that you know the input and output modalities of the named models.

flowchart TD
  T["Text tokens"]
  I["Image patches<br/>through a vision encoder"]
  A["Audio frames<br/>through an audio encoder"]
  V["Video frames<br/>sampled and encoded"]
  M["One transformer<br/>attention across every modality in one sequence"]
  O1["Text out<br/>describe, answer, extract"]
  O2["Image or video out<br/>generate, edit, extend"]
  O3["Speech out<br/>spoken reply"]
  T --> M
  I --> M
  A --> M
  V --> M
  M --> O1
  M --> O2
  M --> O3
Figure 7. A multimodal model turns every input into vectors in one sequence and attends across them. Which inputs and outputs are supported depends on the model: Claude reads images and writes text; Nova Canvas reads text and writes images; Nova Sonic listens and speaks.

What it enables

In the wild
  • Amazon Nova Lite and Nova Pro accept text, images and video and produce text; Nova Micro is text-only and fastest; Nova Canvas generates images; Nova Reel generates short video; Nova Sonic handles speech in and out.
  • Anthropic Claude models on Bedrock read images, so a chart, a screenshot or a photographed form can be part of the prompt.
  • The new Alexa is built on foundation models running through Bedrock, combining speech, text and device context in one assistant rather than a chain of narrow models.
Watch out
  • Images cost tokens too. An image is billed as the number of patch tokens it becomes, often the equivalent of a thousand or more words; resize before sending.
  • Reading is not generating. Claude reads images but does not draw them; Stable Diffusion draws but does not chat. Match the model to the direction of the modality.
  • Chained single-modal services still make sense when you need each intermediate result: Amazon Transcribe gives you the transcript, Amazon Polly gives you the audio file, and both are auditable.
Exam angle

A scenario that mixes input types ("customers upload photos and describe the problem") calls for a multimodal model, and the named ones on Bedrock are Claude (image in) and Amazon Nova Lite and Pro (image and video in). "Generate an image from text" is Titan Image Generator, Nova Canvas or Stability AI; "generate video" is Nova Reel.

modality
A kind of data: text, image, audio, video, or a vector. Multimodal means more than one, on the input side, the output side or both.
vision encoder
The network that turns image patches into vectors a transformer can attend to alongside text tokens.
cross-modal search
Finding items of one modality with a query of another, such as images from a text description, using a shared embedding space.

Diffusion models: images from noise, and GANs and VAEs for contrast

A diffusion model generates an image by learning to remove noise: trained to undo the gradual corruption of real images into static, it can start from pure static and, step by step, denoise it into a new picture guided by a text description.

Training has two directions. The forward process takes a real image and adds a little Gaussian noise, then a little more, over hundreds of steps until nothing but noise remains; this needs no learning. The reverse process is what the network learns: at each step, given the noisy image and the step number, predict the noise that was added so it can be subtracted. Show it millions of images and it becomes very good at "what would this look like slightly less noisy". At generation time you feed it random noise and run the reverse process from the last step to the first. Conditioning on text is done by feeding an embedding of the prompt into the network at each step, and a technique called classifier-free guidance pushes the result towards the prompt and away from a generic image.

Denoising a full-resolution image hundreds of times is slow, so Stable Diffusion introduced latent diffusion: a variational autoencoder first compresses the image into a much smaller latent grid, diffusion runs in that compressed space, and the decoder expands the final latent back into pixels. It is why Stable Diffusion can run on a consumer graphics card. Video models such as Amazon Nova Reel extend the same idea across frames.

flowchart TD
  subgraph Training
    direction LR
    X0["Real image"] --> X1["Add noise<br/>hundreds of small steps"] --> XT["Pure noise"]
  end
  subgraph Generation
    direction LR
    Z0["Random noise"] --> Z1["Remove noise<br/>step by step, guided by<br/>the text prompt embedding"] --> ZI["New image"]
  end
  Training ~~~ Generation
Figure 8. Diffusion. Training learns to reverse the noising of real images one step at a time; generation runs that learned reversal from random noise, with the text prompt steering each step.

GANs and VAEs, for contrast

Two older generative architectures still appear in exam glossaries. A generative adversarial network (GAN) trains two networks against each other: a generator that makes fakes and a discriminator that tries to spot them, each improving until the fakes are convincing; GANs produce sharp images fast but are hard to train and prone to producing the same few outputs (mode collapse). A variational autoencoder (VAE) trains an encoder that compresses an input into a small probability distribution and a decoder that reconstructs it; sampling the distribution gives new outputs, typically blurrier than GANs but stable and useful, which is why a VAE is the compressor inside latent diffusion.

ArchitectureHow it generatesStrengthsWeaknessesProducts
DiffusionIteratively denoises random noise, guided by a text embeddingHighest quality and diversity, easy to steer with text, stable trainingMany steps per image, so slower and costlierStable Diffusion, Stable Image Core and Ultra, Titan Image Generator, Nova Canvas, Nova Reel
GANGenerator makes fakes, discriminator judges them, both improveFast single-pass generation, sharp resultsUnstable training, mode collapse, weak text controlStyleGAN faces, older super-resolution and face-swap tools
VAEEncodes to a latent distribution, decodes samples from itStable, smooth latent space, good compressorBlurry outputs on its ownThe latent compressor inside Stable Diffusion; anomaly detection
Autoregressive transformerPredicts the next token, including image tokensOne architecture for text and images, strong prompt followingSlow for high-resolution imagesMost LLMs; some image models tokenise pixels the same way
In the wild
  • Amazon Nova Canvas and Amazon Titan Image Generator generate and edit images from text on Bedrock, with inpainting (change a region), outpainting (extend the canvas), background removal and image variation; every image carries an invisible watermark to mark it as generated.
  • Stability AI models on Bedrock (Stable Diffusion XL, Stable Image Core and Ultra, Stable Diffusion 3 Large) are the same latent diffusion line that started the open image-generation wave.
  • Adobe Firefly powers Generative Fill in Photoshop and is trained on licensed Adobe Stock content, a deliberate answer to the copyright questions around web-scraped training sets.
Watch out
  • Text inside images is unreliable. Diffusion models draw the shape of writing rather than the writing; a logo with a slogan still needs a designer.
  • Watermarks and content credentials are the mitigation, not a guarantee. Titan and Nova images are watermarked so they can be detected as generated; that helps provenance, it does not stop misuse.
  • Every step costs. Image generation is priced per image, not per token, and higher resolution or quality settings cost more.
Exam angle

"Generate images from text on AWS" points at Amazon Titan Image Generator, Amazon Nova Canvas or Stability AI on Bedrock; "the underlying technique" is diffusion, noise added then removed. GANs are "generator versus discriminator" and VAEs are "encode to a latent space and decode". Know the vocabulary, not the equations.

diffusion model
A generative model trained to reverse the gradual addition of noise, so that running the reversal from random noise produces a new sample.
latent diffusion
Diffusion performed in the compressed latent space of an autoencoder rather than on pixels, making it far cheaper; the design behind Stable Diffusion.
GAN
Generative adversarial network: a generator and a discriminator trained against each other until the generator's fakes fool the discriminator.
VAE
Variational autoencoder: an encoder that maps inputs to a small probability distribution and a decoder that reconstructs them; sampling the distribution generates new outputs.
inpainting and outpainting
Editing operations of image models: regenerate a masked region inside the picture, or extend the picture beyond its original edges.

The model zoo: what each type takes in and gives out

Four model types cover almost every generative AI system, and choosing between them starts with one question: what goes in and what comes out.

The catalogue in Bedrock or SageMaker JumpStart can look like a hundred unrelated names. It collapses to four kinds. Large language models turn text into text and are the general workhorse. Diffusion models turn text or an image into an image or video. Multimodal models take several kinds of input, usually to produce text about them. Embedding models take text or images and return a vector, producing nothing a human reads but powering search and retrieval. Most real applications use at least two: an embedding model to retrieve and an LLM to answer, or an LLM to write a prompt and a diffusion model to draw it.

Model typeInputOutputArchitectureExamples on BedrockTypical jobs
Large language modelText (a prompt, documents, history)TextDecoder-only transformerAnthropic Claude, Amazon Nova Micro, Amazon Titan Text, Meta Llama, Mistral, Cohere Command, AI21 JambaChat, summarisation, translation, code, extraction, agents
Diffusion modelText, optionally a source image and maskImage or videoLatent diffusion with a text encoderAmazon Titan Image Generator, Amazon Nova Canvas, Amazon Nova Reel, Stability AI Stable Diffusion and Stable ImageMarketing visuals, product imagery, concept art, inpainting, short video
Multimodal modelText plus images, video or audioText, or speechTransformer with modality encodersAnthropic Claude (image in), Amazon Nova Lite and Pro (image and video in), Amazon Nova Sonic (speech in and out), Meta Llama vision variantsDocument and image understanding, video summaries, voice assistants
Embedding modelText, or text and imagesA vector of numbersEncoder-style transformerAmazon Titan Text Embeddings V2, Amazon Titan Multimodal Embeddings, Cohere EmbedSemantic search, RAG retrieval, recommendation, clustering, deduplication
In the wild
  • Amazon Bedrock Knowledge Bases is an embedding model (Titan Text Embeddings by default) plus an LLM of your choice wired together with a vector store, the two-model pattern in managed form.
  • Amazon Q Business combines retrieval over enterprise connectors with a language model to answer questions with citations, without the customer picking either model.
  • E-commerce catalogue tooling commonly chains an LLM (write the product description) with a diffusion model (render the lifestyle shot) and an embedding model (find duplicates), three types in one pipeline.
Exam angle

When a question names a task, first identify the modality in and out, then the model type, then the Bedrock model: vector out means Titan Embeddings; image out means Titan Image Generator, Nova Canvas or Stability AI; image in with text out means Claude or Nova Lite and Pro; text in and out means any LLM, with cost and context window deciding which.

Use cases: what fits generative AI and which modality does the job

Generative AI fits a task when there is no single right answer to check against, fluency and adaptability are worth more than perfect precision, and a human or a retrieval step can catch the mistakes that will happen.

The use-cases article asked when machine learning fits at all. Generative AI narrows that: it shines where the output is language-like (prose, code, structured text) or media (images, video, audio), where the input varies too much for rules, and where a draft that a person refines is more valuable than a system that must be right unattended. It is a poor fit where the answer must be exactly right every time with no review (a tax calculation), where the rules are already known and cheap to code, or where the cost per call outweighs the value of the output.

Use caseModality in → outModel typeWhat makes it a fitWhere it appears on AWS
Image generationText → imageDiffusionMany acceptable outputs, iteration is cheap, a designer choosesNova Canvas, Titan Image Generator, Stability AI on Bedrock
Video generationText or image → videoDiffusionShort clips for ads and product demos where variation is welcomeNova Reel on Bedrock
Audio and speechText → speech, speech → speechMultimodal or speech modelNatural voices, real-time conversationNova Sonic on Bedrock, Amazon Polly for plain text-to-speech
SummarisationLong text → short textLLMReading is the bottleneck; a summary with the source attached is easy to verifyAny Bedrock LLM, Amazon Q Business, Amazon Connect contact summaries
Chatbots and assistantsText (and voice) → textLLM, often with RAGOpen-ended questions, natural phrasing, escalation to a humanBedrock Agents and Knowledge Bases, Amazon Lex with Bedrock, Amazon Q
TranslationText → text in another languageLLM (or encoder-decoder)Tone and idiom matter; context across paragraphsBedrock LLMs; Amazon Translate for high-volume, deterministic translation
Code generationText and code → codeLLMTests and compilers verify the output; boilerplate dominatesAmazon Q Developer, Bedrock LLMs
Customer service agentsText → text plus actionsLLM with toolsMulti-step tasks over company systems, with humans for the hard casesBedrock Agents, Amazon Q in Connect
SearchQuery → ranked passages, then an answerEmbedding model plus LLMMeaning-based matching beats keywords; answers with citationsBedrock Knowledge Bases, Amazon Kendra, OpenSearch
Recommendation enginesBehaviour and content → ranked itemsEmbedding model (plus LLM for explanations)Embeddings of items and users make "similar" cheap; LLMs explain the pickAmazon Personalize, Titan Embeddings with a vector store
In the wild
  • Amazon.com review highlights summarise thousands of customer reviews into a short paragraph of common themes at the top of a product page: summarisation where reading everything is the bottleneck.
  • GitHub Copilot and Amazon Q Developer generate code from comments and context inside the editor; the compiler and the test suite are the verification step that makes the fit work.
  • ChatGPT-style assistants and Amazon Q are the chatbot case, Q adding enterprise data, permissions and citations on top of the model.
  • Adobe Firefly in Photoshop is image generation with a designer in the loop: the tool proposes, the person picks and edits.
Watch out
  • Do not use a generative model where a deterministic service exists. Amazon Translate, Amazon Transcribe and Amazon Textract are cheaper and more predictable for their narrow jobs; the exam will offer them as distractors and sometimes as the right answer.
  • A human in the loop is a design decision, not an afterthought. Where the cost of a wrong answer is high, the fit depends on someone reviewing before the output acts.
Exam angle

Use-case questions usually give away the modality in the wording: "marketing images" (diffusion), "summarise call transcripts" (LLM), "answer questions about internal documents" (RAG, Knowledge Bases), "help developers write code" (Amazon Q Developer). The trap is a task that only sounds generative: "extract text from scanned forms" is Amazon Textract, "detect faces" is Amazon Rekognition.

Prompt engineering: steering a model without retraining it

Prompt engineering is the craft of writing the input to a foundation model, instructions, context, examples and output format, so that the same fixed weights produce the behaviour you want.

Because a foundation model's behaviour is a function of its input, the cheapest way to change what it does is to change the prompt. A prompt is more than a question: it usually contains a system prompt setting the role and rules ("you are a support assistant for a bank, answer only from the provided policy"), context such as retrieved documents or the conversation so far, the user's actual request, and often examples of the desired output and a required format (JSON with these fields). Zero-shot prompting gives an instruction alone; few-shot adds a handful of worked examples; chain-of-thought asks the model to reason step by step before answering, which improves accuracy on multi-step problems. Every one of these is bounded by the context window and none adds knowledge the model does not have: for that you need retrieval or fine-tuning.

The prompt engineering article covers the techniques, the inference parameters and the attacks (prompt injection, jailbreaking, leaking) in full. Here the concept matters because it is the first rung of the adaptation ladder: try a better prompt before retrieval, retrieval before fine-tuning, fine-tuning before continued pre-training.

In the wild
  • Amazon Bedrock Prompt Management stores, versions and tests prompts as first-class resources, so a prompt change goes through review like a code change.
  • Amazon Q Developer and GitHub Copilot build their prompts for you: the open file, the cursor position and nearby files become the context around your comment.
  • PartyRock, the Bedrock playground, is essentially a prompt engineering sandbox where an app is a prompt with input widgets.
Exam angle

Prompt engineering is the answer when the requirement is "with the least effort and cost" or "without training or changing the model". When the requirement is "use the company's own data", the answer moves to RAG; when it is "change the model's style or format permanently across all prompts", to fine-tuning.

prompt
The full input to a foundation model: system instructions, context, examples and the user's request.
zero-shot, few-shot
Prompting with an instruction only, or with an instruction plus a few worked examples of the expected output.
chain of thought
Asking the model to write out its reasoning steps before the final answer, which improves results on multi-step tasks.

The foundation model lifecycle: from data selection to feedback

A foundation model passes through seven stages, data selection, model selection, pre-training, fine-tuning, evaluation, deployment and feedback, and AWS has a named service for each.

The exam guide lists these stages in this order and expects you to say what happens in each and where AWS helps. Two of them, pre-training and sometimes fine-tuning, are done by the model provider; most customers enter the lifecycle at model selection and spend their time from fine-tuning onwards. The loop closes at feedback: what users say about the deployed model becomes new evaluation data and, eventually, new fine-tuning data.

flowchart TD
  A["Stage 1 · Data selection<br/>Amazon S3, AWS Glue, SageMaker Data Wrangler, Ground Truth"]
  B["Stage 2 · Model selection<br/>Bedrock model catalogue, SageMaker JumpStart"]
  C["Stage 3 · Pre-training<br/>SageMaker HyperPod, Trainium, GPU instances"]
  D["Stage 4 · Fine-tuning<br/>Bedrock custom models, SageMaker training jobs"]
  E["Stage 5 · Evaluation<br/>Bedrock Model Evaluation, SageMaker Clarify"]
  F["Stage 6 · Deployment<br/>Bedrock on-demand or provisioned, SageMaker endpoints"]
  G["Stage 7 · Feedback<br/>invocation logs, CloudWatch, Amazon A2I, user ratings"]
  A --> B --> C --> D --> E --> F --> G
  G -. "new examples and failure cases" .-> D
  G -. "new data" .-> A
Figure 9. The foundation model lifecycle with the AWS service at each stage. Providers do stages 1 to 3 for their base models; most customers start at 2, skip 3, and loop between 4 and 7.
  1. Data selection. Choose what the model will learn from: broad and diverse for a base model, focused and high-quality for fine-tuning. The work is collecting, deduplicating, filtering for quality and toxicity, removing personal data, and checking licences, because whatever is in the data comes out in the model. On AWS the data lives in Amazon S3; AWS Glue and SageMaker Data Wrangler clean and transform it; SageMaker Ground Truth produces labels and human-written examples; Amazon Comprehend or Amazon Macie can flag personal information before it gets in.
  2. Model selection. Pick the base: which provider, which size, which modality, which context window, what licence, what price. For most teams this is browsing the Amazon Bedrock catalogue or SageMaker JumpStart and running the candidates against a small evaluation set. The next article lists the selection factors.
  3. Pre-training. The provider trains the base model by self-supervised next-token prediction on trillions of tokens. It needs thousands of accelerators working for weeks: SageMaker HyperPod manages resilient clusters for this, AWS Trainium chips and GPU instances (P5 with NVIDIA H100, for example) in EC2 UltraClusters supply the compute. Customers rarely do this; Amazon Nova was trained on Trainium, and Anthropic trains Claude on Trainium-based clusters as well as GPUs.
  4. Fine-tuning. Adapt the base model to a domain, a style or a task with a comparatively small labelled dataset of prompt-completion pairs, or continue pre-training on a body of unlabelled domain text. Amazon Bedrock offers both as custom models from JSONL files in S3; SageMaker fine-tunes JumpStart and custom models with full control over the training job. Parameter-efficient methods such as LoRA update a small slice of weights to keep cost down. Detail is in the customising article.
  5. Evaluation. Measure whether the model is good enough before it meets users: automatic metrics (accuracy, robustness, toxicity, ROUGE, BLEU, BERTScore), public benchmarks, and human evaluation for the qualities metrics miss. Amazon Bedrock Model Evaluation runs automatic and human evaluations against built-in or your own datasets; SageMaker Clarify evaluates foundation models for quality and bias and explains predictions.
  6. Deployment. Put the model behind an endpoint with the right throughput, latency and cost profile: Bedrock on-demand for variable traffic, provisioned throughput for steady high volume or custom models, batch inference for offline jobs; SageMaker real-time, serverless and asynchronous endpoints for models you host yourself. Wrap it with Bedrock Guardrails and IAM before exposing it.
  7. Feedback. Watch the model in production and feed what you learn back. Bedrock model invocation logging writes prompts and completions to CloudWatch Logs or S3; CloudWatch metrics track latency, token counts and errors; Amazon Augmented AI (A2I) routes low-confidence or sampled outputs to human reviewers; thumbs-up and thumbs-down from users become the next evaluation set and the next fine-tuning file.
StageWho usually does itKey questionAWS services
Data selectionProvider for base data, customer for tuning dataIs it broad, clean, licensed and free of personal data?Amazon S3, AWS Glue, SageMaker Data Wrangler, SageMaker Ground Truth, Amazon Macie
Model selectionCustomerWhich model meets the requirement at the lowest cost?Amazon Bedrock catalogue and playgrounds, SageMaker JumpStart, Bedrock Model Evaluation
Pre-trainingProviderHow much data and compute, on what hardware?SageMaker HyperPod, AWS Trainium, EC2 GPU instances, EC2 UltraClusters
Fine-tuningCustomer (optional)Do I have labelled examples, and is prompting or RAG not enough?Bedrock custom models (fine-tuning, continued pre-training), SageMaker training and JumpStart
EvaluationCustomerIs it accurate, safe and better than the alternative?Bedrock Model Evaluation, SageMaker Clarify, fmeval
DeploymentCustomerWhat throughput, latency, cost and controls?Bedrock on-demand, provisioned throughput, batch; SageMaker endpoints; Bedrock Guardrails
FeedbackCustomerWhat is going wrong in production and how do I learn from it?Bedrock invocation logging, Amazon CloudWatch, Amazon A2I, AWS CloudTrail
In the wild
  • Amazon Nova went through this whole lifecycle inside Amazon: trained on Trainium-based clusters, evaluated on public benchmarks and internal human review, deployed only through Bedrock, and iterated from customer feedback into newer versions.
  • Anthropic trains and serves Claude on AWS, using Trainium alongside GPUs, and ships Claude to customers through Bedrock; the same model then enters each customer's lifecycle at the model selection stage.
  • A typical enterprise team never touches stage 3: it picks a model in Bedrock, adds a Knowledge Base, evaluates with Model Evaluation, deploys behind Guardrails, logs invocations to S3 and reviews a sample every week.
Watch out
  • Fine-tuning is not the default. Most quality problems are solved earlier and cheaper with a better prompt or retrieval; fine-tune when the format or style must be baked in, or when latency rules out long prompts.
  • Evaluation is never finished. Models are updated, data drifts and users find new failure modes; feedback is a stage, not an event.
  • Logging prompts means logging customer data. Invocation logs need the same encryption, retention and access controls as the source data; see the governance article.
Exam angle

Expect the seven stages in order and a service match for each: data (S3, Glue, Data Wrangler, Ground Truth), selection (Bedrock, JumpStart), pre-training (HyperPod, Trainium), fine-tuning (Bedrock custom models, SageMaker), evaluation (Bedrock Model Evaluation, SageMaker Clarify), deployment (Bedrock, SageMaker endpoints), feedback (invocation logging, CloudWatch, A2I). "Human review of model outputs" is Amazon A2I.

fine-tuning
Further training of a pre-trained model on a small, task-specific labelled dataset so that its weights adapt to a domain, style or format.
continued pre-training
Further self-supervised training on a large body of unlabelled domain text, to teach the model vocabulary and facts of a field.
SageMaker HyperPod
A managed, resilient cluster service for large distributed training jobs that recovers automatically from hardware faults.
Amazon A2I
Amazon Augmented AI: a service that routes model outputs to human reviewers according to rules you set, and returns their verdicts.

Recap

  • Discriminative models learn the boundary between classes and output a label; generative models learn the distribution of the data and output new samples. Generative models train mostly on unlabelled data, and one model serves many tasks.
  • A token is a vocabulary piece, about three-quarters of an English word; code, numbers and non-Latin scripts cost more tokens. Models are billed per input and output token, and the context window is measured in tokens.
  • Chunking splits documents into passages of a few hundred tokens with 10 to 20 percent overlap so they can be embedded and retrieved; Bedrock Knowledge Bases offers fixed, semantic, hierarchical and no chunking.
  • An embedding is a vector that places meaning in space; cosine similarity compares direction. Amazon Titan Text Embeddings V2 (1,024 dimensions by default), Titan Multimodal Embeddings and Cohere Embed are the Bedrock embedding models; OpenSearch and Aurora pgvector store the vectors.
  • A transformer processes all tokens in parallel and lets each attend to every other through self-attention with queries, keys and values; positional encodings supply order. It replaced RNNs because long-range links are one step away and training parallelises.
  • Encoder-only models (BERT) understand, decoder-only models (Claude, Llama, Nova, GPT) generate, encoder-decoder models (T5) translate one sequence into another.
  • Generation is autoregressive next-token prediction: sample, append, repeat until a stop token or the maximum length. Sampling (temperature, top-p, top-k) is why output is nondeterministic. The context window bounds prompt plus answer; Claude on Bedrock offers 200,000 tokens.
  • A foundation model is pre-trained self-supervised on broad data at large scale and adapted to many tasks by prompting, RAG, fine-tuning or continued pre-training. Bedrock offers Amazon Titan and Nova, Anthropic Claude, Meta Llama, Mistral, Cohere, AI21 Labs and Stability AI.
  • Multimodal models encode images, audio and video into the same token sequence as text: Claude and Nova Lite and Pro read images, Nova Lite and Pro read video, Nova Canvas and Reel generate images and video, Nova Sonic speaks.
  • Diffusion models learn to remove noise and generate by denoising random noise under text guidance; Stable Diffusion, Titan Image Generator and Nova Canvas use it. GANs pit a generator against a discriminator; VAEs encode to a latent distribution and decode.
  • Four model types cover the catalogue: LLM (text to text), diffusion (text to image or video), multimodal (media in, text or speech out), embedding (text or image to vector). Identify modality in and out first.
  • Generative AI fits where there is no single right answer, fluency matters and a human or retrieval step catches errors: images, video, audio, summaries, chatbots, translation, code, service agents, search, recommendations. Narrow deterministic tasks belong to Translate, Transcribe, Textract and Rekognition.
  • Prompt engineering changes the input, not the weights, and is the first rung of adaptation: prompt, then RAG, then fine-tuning, then continued pre-training.
  • The FM lifecycle is data selection, model selection, pre-training, fine-tuning, evaluation, deployment, feedback, mapped to S3 and Glue and Ground Truth, Bedrock and JumpStart, HyperPod and Trainium, Bedrock custom models and SageMaker, Model Evaluation and Clarify, Bedrock and SageMaker endpoints, invocation logging and CloudWatch and A2I.

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.

What is the difference between a discriminative and a generative model?

A discriminative model learns the boundary between classes and outputs a label or a number; a generative model learns the distribution of the data itself and can produce new samples from it.

  • Discriminative: fraud score, spam filter, demand forecast, trained on labelled examples for one task.
  • Generative: text, images, audio or code, trained mostly on unlabelled data at scale, steered to many tasks by the prompt.
  • Their failure modes differ: a wrong label versus fluent but wrong content, a hallucination.

On AWS, Amazon Fraud Detector is discriminative and Claude on Bedrock is generative; Rekognition tells you what is in a picture while Nova Canvas makes the picture.

Why is a token not the same as a word, and why does it matter?

A token is a piece of text from the model's learned vocabulary, a whole common word or a fragment of a rare one, and it matters because models are billed per token and their context windows are measured in tokens.

  • Roughly one token per four English characters, so 1,000 tokens is about 750 words.
  • Rare words, numbers, code symbols and non-Latin scripts split into more tokens, so the same meaning costs more.
  • Output tokens are priced higher than input tokens because each one needs a full forward pass.

Every model has its own tokeniser, so token counts from one vendor's tool do not transfer; Bedrock returns the real counts in each response.

A company's RAG system returns answers that are missing the context around the matched sentence. What is likely wrong, and what would fix it?

The chunks are too small or have no overlap, so the retrieved passage is cut off from the sentences that give it meaning; increase chunk size, add overlap, or switch to hierarchical chunking.

  • Small chunks embed precisely but lose surrounding context; large chunks keep context but match weakly.
  • Overlap of 10 to 20 percent repeats the boundary text so a sentence survives whole in at least one chunk.
  • Hierarchical chunking matches on small child chunks and returns the larger parent to the model.

Amazon Bedrock Knowledge Bases offers fixed-size, semantic, hierarchical and no chunking at ingestion; changing strategy means re-embedding the corpus.

What is an embedding, and how are two embeddings compared?

An embedding is a vector of hundreds to thousands of numbers produced by a model so that inputs with similar meaning point in similar directions, and two are usually compared with cosine similarity, the cosine of the angle between them.

  • Cosine similarity ignores length, which suits comparing a short query with a long passage; Euclidean distance and dot product are the alternatives.
  • Vector databases use approximate nearest-neighbour indexes such as HNSW to find the k closest vectors quickly.
  • Vectors from different embedding models cannot be compared; switching models means re-embedding everything.

Amazon Titan Text Embeddings V2 returns 1,024 dimensions by default with 512 and 256 options to cut index storage.

A retailer wants customers to find products by describing them in words or by uploading a photo. Which model type and Bedrock model?

A multimodal embedding model that places text and images in the same vector space, Amazon Titan Multimodal Embeddings, with the vectors in a store such as Amazon OpenSearch Service.

  • Product images are embedded once at ingestion; a text query or an uploaded photo is embedded at query time and matched by cosine similarity.
  • This is cross-modal search: one modality finds another because they share a space.
  • An LLM is not needed for the search itself, only if you want a written explanation of the results.

Amazon Rekognition would identify what is in the photo, but it cannot rank a catalogue by similarity to a free-text description.

What does self-attention do, and why did transformers replace recurrent networks?

Self-attention lets every token compute weights over every other token and take a weighted sum of their values, so its representation reflects its whole context; transformers replaced RNNs because that connects distant tokens in one step and processes the whole sequence in parallel on GPUs.

  • Each token derives a query, key and value; queries against keys give the weights; multiple heads capture different relations.
  • RNNs read one token at a time, so long-range information fades and training cannot parallelise.
  • Positional encodings restore the notion of order that attention alone lacks.

The cost is quadratic attention: doubling the input roughly quadruples the compute, which is why context windows are finite.

What is the difference between encoder-only, decoder-only and encoder-decoder transformers?

Encoder-only models read and understand (classification, embeddings), decoder-only models generate text one token at a time, and encoder-decoder models read one sequence and write another.

  • BERT is encoder-only; GPT, Claude, Llama, Mistral and Amazon Nova are decoder-only; T5 and the original translation transformer are encoder-decoder.
  • Decoder attention is masked so a token can only see tokens before it, which is what makes next-token prediction well defined.
  • Almost every chat model is decoder-only; the prompt is simply read by the same stack.

Embedding models such as Titan Text Embeddings are encoder-style: they read text and emit a vector, never a sentence.

Why does the same prompt sometimes give different answers, and how would you make output more consistent?

Because generation samples the next token from a probability distribution rather than always taking the most likely one; lower the temperature towards zero (and tighten top-p or top-k) for more deterministic output.

  • The model outputs a probability for every vocabulary token; temperature flattens or sharpens that distribution before sampling.
  • Top-p keeps the smallest set of tokens whose probabilities sum to p; top-k keeps the k most likely.
  • Greedy decoding at temperature 0 is close to deterministic but not guaranteed byte-identical across runs.

Nondeterminism is one of the listed limitations of generative AI, and the exam expects temperature as the control.

What is a context window, and what happens when a conversation exceeds it?

The context window is the maximum number of tokens a model can consider in one call, prompt, history and answer together, and when a conversation exceeds it the application must drop or summarise earlier turns, or the model can no longer see them.

  • The model has no memory between calls; "memory" is the application re-sending the history inside the window.
  • Every turn re-sends everything, so cost grows with the length of the conversation.
  • Retrieval exists partly to put only the relevant chunks in the window instead of whole documents.

Claude models on Bedrock accept 200,000 tokens, roughly a 500-page book, but a long context is slower and costlier per call.

What makes a model a foundation model?

Scale, breadth and adaptability: it is pre-trained self-supervised on a very large and broad corpus, has billions of parameters, and can be adapted to many downstream tasks by prompting, retrieval or fine-tuning rather than trained for one.

  • Pre-training is done by the provider on thousands of accelerators; customers adapt rather than train.
  • A large language model is a foundation model for text; multimodal and image foundation models also exist.
  • It has a knowledge cut-off: nothing after the training data date is known unless the prompt supplies it.

Amazon Bedrock is a catalogue of foundation models from Amazon, Anthropic, Meta, Mistral, Cohere, AI21 Labs and Stability AI behind one API.

A support team receives photos of damaged goods with a written description and wants a model to assess claims against the policy. Which Bedrock models fit?

A multimodal model that accepts images and text and produces text: Anthropic Claude or Amazon Nova Lite or Pro, with the policy text supplied in the prompt or through a Knowledge Base.

  • The image becomes patch tokens in the same sequence as the description, so the model attends across both.
  • Nova Micro is text-only and Stability AI models generate images rather than read them, so neither fits.
  • Images are billed as tokens, so resize before sending.

Where the cost of a wrong decision is high, route low-confidence assessments to a human with Amazon A2I rather than acting automatically.

How does a diffusion model generate an image, and how do GANs and VAEs differ?

A diffusion model is trained to reverse the step-by-step addition of noise to real images, then generates by starting from random noise and denoising it repeatedly under the guidance of a text embedding; a GAN trains a generator against a discriminator, and a VAE encodes inputs to a latent distribution and decodes samples from it.

  • Latent diffusion (Stable Diffusion) runs the process in a compressed latent space produced by a VAE, which makes it affordable.
  • GANs are fast and sharp but unstable and prone to mode collapse; VAEs are stable but blurry alone.
  • Image generation is priced per image, not per token.

On Bedrock, Amazon Titan Image Generator, Amazon Nova Canvas and Stability AI models are diffusion models, and Titan and Nova images carry an invisible watermark.

A marketing team wants to create product images from text descriptions with the least operational effort. Which AWS service and model?

Amazon Bedrock with an image generation model: Amazon Nova Canvas, Amazon Titan Image Generator or a Stability AI model, called through the Bedrock API or the image playground.

  • Bedrock is serverless, so there is no endpoint to size or manage.
  • Titan and Nova Canvas also support inpainting, outpainting, background removal and variations for iterating on a picture.
  • Amazon Rekognition is a distractor: it analyses images and generates nothing.

SageMaker JumpStart could host Stable Diffusion on your own endpoint, but that is more operational effort, not less.

Name the four model types in the generative AI catalogue and their inputs and outputs.

Large language models (text to text), diffusion models (text or image to image or video), multimodal models (text plus image, audio or video to text or speech) and embedding models (text or image to a vector).

  • Examples: Claude and Nova Micro; Nova Canvas, Titan Image Generator and Stable Diffusion; Claude with images and Nova Lite and Pro; Titan Text Embeddings and Cohere Embed.
  • Most applications combine two: an embedding model to retrieve and an LLM to answer.
  • Start any question by fixing the modality in and out, then the type, then the named model.

Bedrock Knowledge Bases is exactly the embedding-plus-LLM pattern packaged as a managed service.

Which tasks fit generative AI well, and which should go to a narrow AI service instead?

Generative AI fits tasks with many acceptable answers where fluency matters and a human or retrieval step catches errors, such as summarisation, chatbots, code, images and search; narrow deterministic tasks such as OCR, face detection, transcription and bulk translation are cheaper and more predictable on Amazon Textract, Rekognition, Transcribe and Translate.

  • Code generation fits because the compiler and tests verify the output; summarisation fits because the source is attached for checking.
  • A tax calculation that must be exactly right with no review does not fit.
  • Recommendation and search lean on embedding models, with an LLM only to explain or answer.

Amazon.com's review highlights are summarisation at scale; Amazon Q Developer is the code case; both keep a human deciding what to do with the output.

List the stages of the foundation model lifecycle and one AWS service for each.

Data selection (Amazon S3, AWS Glue, SageMaker Data Wrangler, Ground Truth), model selection (Bedrock catalogue, SageMaker JumpStart), pre-training (SageMaker HyperPod, AWS Trainium), fine-tuning (Bedrock custom models, SageMaker training), evaluation (Bedrock Model Evaluation, SageMaker Clarify), deployment (Bedrock on-demand or provisioned throughput, SageMaker endpoints), feedback (Bedrock invocation logging, CloudWatch, Amazon A2I).

  • Providers do data selection through pre-training for their base models; customers usually start at model selection and skip pre-training.
  • Feedback loops back into fine-tuning data and evaluation sets.
  • Fine-tuning is optional; prompting and RAG are tried first because they are cheaper.

Amazon Nova was trained on AWS Trainium and Anthropic uses Trainium clusters for Claude; both reach customers through Bedrock, entering each customer's lifecycle at model selection.

What is prompt engineering, and when is it not enough?

Prompt engineering is writing the model's input, instructions, context, examples and format, to get the behaviour you want from fixed weights; it is not enough when the model lacks the knowledge (use RAG) or when style and format must be permanent across every call or the prompt is too long to afford (use fine-tuning).

  • Zero-shot gives an instruction only, few-shot adds worked examples, chain of thought asks for step-by-step reasoning.
  • Everything in the prompt spends context window and is re-sent on every call.
  • The adaptation ladder is prompt, then RAG, then fine-tuning, then continued pre-training, in rising cost.

Amazon Bedrock Prompt Management versions and tests prompts as resources, so prompt changes get reviewed like code.