Exam Room · AI Practitioner

Cheat Sheet: Generative AI Foundations

· 25 min read

AI Fundamentals · part of The Exam Room

A fast pass over what a generative model is before any AWS service wraps it. The architectures, the vocabulary, the limitations, and the prompting techniques everything else builds on.

Architectures at a glance

Architecture How it works What it is for
Transformer Self-attention across the whole input at once Large language models: text generation, reasoning, chat
Diffusion Iterative denoising from random noise toward a target Image generation
VAE Encode into a probabilistic latent space, then decode samples Generating new examples that resemble the training data
GAN A generator and a discriminator trained against each other Realistic images and synthetic data

Three of those are named in the generative-AI groundwork: transformer-based LLMs, multi-modal models, and diffusion models. VAEs and GANs are the earlier generative families. Recognise them by their description rather than by their name.

Vocabulary and limitations at a glance

Term What it means
Foundation model (FM) A large model pre-trained on broad data and adapted to many tasks; an LLM is the text-and-language case of one
Transformer-based LLM An LLM built on self-attention over the whole input at once, the architecture behind text generation
Embedding A vector representation of text, image, audio, or video, placed so that similar meanings sit close together
Vector The array of numbers an embedding produces, compared by distance
Chunking Splitting a long document into passages small enough to embed and to fit the context window. Smaller chunks retrieve more precisely; larger ones keep more surrounding meaning
Token The unit a model reads and generates in; cost and limits are counted in tokens, not words
Token-based pricing Input and output tokens are metered separately, and the whole prompt is charged again on every call unless a cached prefix is reused
Context window The maximum tokens a model can process in one call; the binding constraint on long documents
Context engineering Deciding what goes into the context window on each call: system prompt, examples, retrieved passages, conversation history, tool results
Prompt engineering Shaping the wording, structure, and examples of a prompt to get a better answer without changing the model
Prompt caching Reusing a static prompt prefix across calls to cut response latency and input-token cost. Cached tokens bill at the model’s cache-read rate, and a cache hit is never guaranteed
Agentic AI The model’s output selects which tools to run and in what order. Tool use, memory management, workflow orchestration, multi-agent patterns, and the Model Context Protocol are the concepts underneath
Multimodal A multi-modal model takes in or produces more than one type of content: text, image, audio, video
Hallucination A fluent, plausible-looking answer that the facts or the supplied context do not support
Knowledge cutoff The date the training data stops at, so later events are absent from the model
Nondeterminism The same prompt can produce a different answer on different runs
Interpretability How far the reasons behind a given output can be traced and explained
Inaccuracy Output that is wrong on the merits, however confident the wording
Bias Systematic favouritism or disadvantage reflected in training data or output
Toxicity Harmful, offensive, or abusive content in a model’s output
Context-window limit Content past the window never reaches the model, and nothing summarises it on the way in
Intellectual property infringement claim Generated output reproduces protected work; answered by model choice, provider indemnity, licence terms, and grounding in content you own
End user risk Someone acts on a generated claim in a regulated or safety-relevant area: medical, legal, financial
Loss of customer trust AI-generated content that was never disclosed, discovered after the fact

Four disadvantages are named for generative AI itself: hallucinations, interpretability, inaccuracy, and nondeterminism. Bias and toxicity belong to the responsible-AI vocabulary instead, alongside fairness, inclusivity, robustness, safety, and veracity. Amazon Bedrock Guardrails is the control aimed there, with content filters, denied topics, word filters, sensitive information filters, contextual grounding checks, and Automated Reasoning checks.

Prompting techniques at a glance

Prompt constructs. Three named building blocks sit under every technique below: the instruction (what to do), the context (the material to do it with), and the negative prompt (what to avoid).

Technique What it does Use when
Zero-shot Instruction only, no examples The task is common and the model already handles it
Single-shot Instruction plus exactly one worked example One example is enough to fix the shape of the answer
Few-shot Instruction plus a handful of examples Output format or edge cases need pinning down
Chain-of-thought Asks the model to reason step by step Multi-step logic, maths, or layered decisions
Self-consistency Samples multiple reasoning paths and takes the majority answer A single chain-of-thought pass is not reliable enough
Negative prompt States what to avoid rather than what to produce Mostly image generation: no text, no watermark, no extra limbs
Prompt chaining The output of one prompt becomes the input to the next A task naturally breaks into smaller stages
Prompt template A parameterised prompt with input variables, reused across many inputs The same task runs repeatedly and only the inputs change

Zero-shot, single-shot, and few-shot go by one collective name, in-context learning. The prompt steers the model and no weights change. Picking a technique for the task walks that choice at length.

Customisation and training at a glance

Approach What changes What it takes
In-context learning Nothing in the model; only what you put in the prompt Tokens on every call, and prompt length
RAG Nothing in the model; retrieved passages join the prompt A vector store, an ingestion pipeline, retrieval latency, extra input tokens
Fine-tuning Model weights, trained on labelled prompt-and-response pairs A training job, a curated dataset, and a custom model to host and re-tune later
Continuous pre-training Model weights, trained on unlabelled domain text More data and compute than fine-tuning, without needing labels
Model distillation A smaller student model is fine-tuned on a larger teacher model’s responses A training run up front, cheaper and faster inference afterwards
Pre-training A model built from scratch The most expensive option by a wide margin, and rarely the answer here

Transfer learning is the umbrella idea fine-tuning sits under: what a model learned on one task carries into another. RLHF tunes against human preference rankings rather than reference answers, so it shapes which responses come back rather than adding facts. Amazon Bedrock’s user guide names three customisation methods: supervised fine-tuning, reinforcement fine-tuning, and distillation. Continued pre-training remains a valid customisation type on the model-customisation API, spelled continued rather than continuous. How far to customise weighs these against each other.

Decision rules

  • If the task is generating or reasoning over text, that is a transformer. If it is generating an image from noise, that is diffusion.
  • A description that mentions encoding into a probabilistic latent space and decoding samples from it is a VAE. None of the other three works that way.
  • Two networks trained against each other, generator versus discriminator, is a GAN.
  • If cost or a length limit is being discussed, think in tokens, not words or characters.
  • If a document will not fit in one call, the context window is the binding constraint. Content past it is not seen at all.
  • To search or ground a long document, chunk it into passages, embed each one, and compare the vectors by distance. Retrieval works on passages, not whole documents.
  • If the model’s output selects which tools to run and in what order, that is agentic AI. If it only returns text for a person to act on, it is not.
  • A fluent answer unsupported by the given source is hallucination. An answer that is stale rather than wrong is the knowledge cutoff. The two failures take different fixes.
  • If the same prompt gives different answers on repeated runs, that is nondeterminism. Lowering temperature reduces it without removing it.
  • If the task is common and the model already handles it, use zero-shot and skip the examples.
  • If one chain-of-thought pass is not reliable enough, sample several and take the majority answer with self-consistency. That costs more tokens.
  • If an image keeps including something unwanted, name it in a negative prompt rather than wording the positive prompt around it.
  • If a task naturally has stages, chain prompts rather than asking for everything in one pass.
  • If the requirement is fresh or private facts, that is RAG. Retrieval puts the fact in the prompt, and the answer is generated from it.
  • If the requirement is tone, format, or a house style the output keeps missing, that is fine-tuning. If it is unfamiliar domain language rather than task behaviour, continuous pre-training on unlabelled domain text.
  • If the requirement is similar quality at lower cost and latency, that is model distillation: a training run up front, then cheaper and faster inference.
  • If the exposure is a third-party claim over the output itself, that is an intellectual property question. Model selection, licence terms, provider indemnity, and human review answer it. A guardrail does not.

Traps

  • Describing a transformer as “the architecture behind image generation.” Diffusion is the image architecture. Transformers are the language one, and the two are sometimes combined in practice.
  • Missing the VAE’s fingerprint phrase. A probabilistic latent space with samples decoded from it is a VAE, not a GAN and not a diffusion model.
  • Treating embeddings as a model output you read directly. They are a vector representation for comparison and search, not a human-readable answer.
  • Assuming a bigger context window removes the need for chunking. Pulling the three relevant passages still costs less and answers more precisely than pushing a whole handbook through the model on every call.
  • Treating single-shot and one-shot as two techniques. They are one thing under two names: instruction plus exactly one worked example.
  • Reaching for fine-tuning to add facts that are absent from the training data. It teaches behaviour, tone, and format reliably. Facts that change belong in retrieval.
  • Treating Bedrock Guardrails as a legal control. It filters harmful and off-topic content, flags ungrounded responses, and masks PII. It says nothing about who owns the words that come back.
  • Assuming a longer context window fixes hallucination. It only changes what fits in the prompt. A model can still hallucinate about content sitting right there in the context.
  • Confusing hallucination with a knowledge-cutoff gap. Hallucination is a confident, wrong answer. A cutoff gap is missing data, and the output is often a fluent guess rather than a statement that the answer is unknown.
  • Treating temperature zero as a guarantee of identical output. A lower temperature steepens the token probability distribution and leads to more deterministic responses. AWS stops short of calling them identical.
  • Piling on more few-shot examples to fix a reasoning failure. Examples fix format and edge cases, not multi-step logic. Chain-of-thought and self-consistency are for that.
  • Using a negative prompt on a text task and expecting the image-generation effect. Amazon Nova Canvas takes negativeText as a real parameter, and its documentation says to put the unwanted subject there rather than negate it in the main prompt. In a text prompt it is one more instruction, and the excluded thing can still turn up in the output.

Say it in one line

  1. Transformers generate language through self-attention; diffusion generates images through iterative denoising.
  2. A VAE encodes into a probabilistic latent space and decodes samples from it; a GAN pits a generator against a discriminator.
  3. Tokens, not words, are what cost and context-window limits are measured in.
  4. The context window is the binding constraint on long documents. Content past it never reaches the model.
  5. Hallucination is a confident wrong answer; a knowledge cutoff is a correct gap in the training data.
  6. Nondeterminism means the same prompt can answer differently on different runs. Low temperature reduces it but does not remove it.
  7. The four named disadvantages of generative AI are hallucinations, interpretability, inaccuracy, and nondeterminism.
  8. Zero-shot needs no examples; few-shot fixes format and edge cases, not reasoning.
  9. Self-consistency samples multiple reasoning paths and takes the majority vote, at the cost of more tokens.
  10. Negative prompts state what to avoid, mainly for image generation. Prompt chaining breaks a task into stages, feeding one prompt’s output into the next.
  11. In-context learning changes nothing in the model, RAG changes what the prompt contains, and fine-tuning changes the weights.
  12. The named legal risks of generative AI are intellectual property infringement claims, biased model outputs, loss of customer trust, end user risk, and hallucinations.

These posts are LLM-aided. Backbone, original writing, and structure by Craig. Research and editing by Craig + LLM. Proof-reading by Craig.