Exam Room · AI Practitioner

Cheat Sheet: Generative AI Foundations

· 23 min read

AI Fundamentals · part of The Exam Room

A fast pass over what a generative model actually is before any AWS service wraps it: the architectures, the vocabulary, the limitations, and the prompting techniques the rest of the track assumes you already have.

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

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 semantic vector representation of text, image, or audio
Vector The array of numbers an embedding produces, compared by distance so that semantically similar things sit close together
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
Context window The maximum tokens a model can hold 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 an unchanging block of context across calls, cutting input-token cost and time to first token
Agentic AI A model that decides which tools to call and in what order, rather than only returning text
Multimodal A multi-modal model takes in or produces more than one type of content: text, image, audio, video
Hallucination A fluent, confident answer that is not supported by fact or by the given context
Knowledge cutoff The point past which a model has no training data and so no knowledge of events
Nondeterminism The same prompt can produce a different answer on different runs
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 beyond the window is simply unavailable to the model, not summarised for free
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

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 well understood by the model
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 to trust
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 model is steered by what sits in the prompt 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 costs
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 learns to copy a larger teacher’s outputs 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 response a model favours rather than teaching it new facts. 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.
  • If a description mentions encoding into a probabilistic latent space and decoding samples from it, that is a VAE; none of the other three works that way.
  • If two networks are described as trained against each other, generator versus discriminator, that 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 binding constraint is the context window, and content past it is not seen at all.
  • If a long document has to be searched or grounded, chunk it into passages first, embed each one, and compare the vectors by distance; retrieval works on passages, not whole documents.
  • If a description has the model choosing which tools to call and in what order, that is agentic AI; if it only returns text for a person to act on, it is not.
  • If an answer is fluent but unsupported by the given source, that is hallucination; if it is stale rather than wrong, that is the knowledge cutoff; the two are different failures with different fixes.
  • If the same prompt gives different answers on repeated runs, that is nondeterminism, and lowering temperature reduces but does not eliminate it.
  • If the task is common and the model already handles it, use zero-shot and do not spend tokens on examples.
  • If a single chain-of-thought pass is not trustworthy enough, sample several and take the majority answer with self-consistency, at the cost of more tokens.
  • If an image keeps including something unwanted, state it in a negative prompt rather than trying to word 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 model reads it there.
  • If the requirement is tone, format, or a house style the model 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, buying cheaper inference with a training run up front.
  • If the exposure is a third-party claim over the output itself, that is an intellectual property question answered by model selection, licence terms, provider indemnity, and human review, not by a guardrail.

Traps

  • Describing a transformer as “the architecture behind image generation.” Diffusion is the image architecture; transformers are the language one, though the two are sometimes combined in practice.
  • Missing the VAE’s fingerprint phrase. If a description mentions a probabilistic latent space and decoding samples from it, that is a VAE, not a GAN or 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. Retrieval still costs less and answers more precisely when it pulls the three relevant passages than when it pushes a whole handbook through the model on every call.
  • Treating single-shot and one-shot as two techniques. They are the same thing under two names: instruction plus exactly one worked example.
  • Reaching for fine-tuning to add facts the model does not have. 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, and 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 that is right there in the context.
  • Confusing hallucination with a knowledge-cutoff gap. Hallucination is a confident, wrong answer; a cutoff gap is the model correctly having no idea, though it can still hallucinate rather than admit that.
  • Treating temperature zero as a guarantee of identical output every time. It reduces variance sharply but is not an absolute determinism guarantee across all settings and infrastructure.
  • Piling on more few-shot examples to fix a reasoning failure. Examples fix format and edge cases, not multi-step logic; that is what chain-of-thought and self-consistency are for.
  • Using a negative prompt on a text task and expecting the image-generation effect. Diffusion pipelines take a negative prompt as a real parameter; in a text prompt it is just another instruction the model may or may not follow.

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 is unavailable, not summarised for free.
  5. Hallucination is a confident wrong answer; a knowledge cutoff is a correct gap in what the model has ever seen.
  6. Nondeterminism means the same prompt can answer differently on different runs; low temperature reduces it but does not remove it.
  7. Bias and toxicity are two of the named generative-AI limitations, alongside hallucination, knowledge cutoff, nondeterminism, and context-window limits.
  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, trading tokens for reliability.
  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.