← All mindmapsMAIN TOPIC · 09 / 14Generative AI
LLMs, adaptation, generative models and responsible outputs
Explore full topic ↗ Readable revision notes (19 concepts)
The same content as the visual sheet, optimized for mobile and assistive technology.
01 · Model families
- Autoregressive: p(x)=Π p(xₜ|x₍<ₜ₎)
- Diffusion: learn reverse noising process
- VAE: latent distribution; GAN: generator vs discriminator
02 · LLM training
- Pretrain on token prediction; learn broad patterns
- Supervised fine-tuning learns instruction responses
- RLHF/DPO align preferences; evaluate behavior separately
03 · Adaptation & efficiency
- Full fine-tune updates all parameters
- LoRA learns low-rank weight updates; QLoRA uses quantized base
- Quantization reduces memory; benchmark quality
04 · Prompt engineering
- Clear task, context, constraints, output format
- Zero-shot vs few-shot examples; structured schemas
- Separate instructions from untrusted retrieved data
05 · Generation controls
- Temperature scales logits; top-k/top-p filter tokens
- Max tokens and stop conditions cap output
- KV caching improves decode efficiency
06 · Grounding & tools
- RAG adds external evidence; citations must be checked
- Tool calls use schemas; validate args and permissions
- Hallucinations can remain even with retrieval
07 · Multimodal generation
- Text/image/audio inputs use modality-specific encoders
- Diffusion learns denoising for image synthesis
- Evaluate modality-specific fidelity and task success
08 · Evaluation
- Golden sets, rubrics, human review, regression tests
- LLM judges can be biased; calibrate against humans
- Measure factuality, usefulness, latency and cost
09 · Safety & deployment
- Prompt injection defenses; least-privilege tools
- PII redaction, consent, output validation
- Abstain when evidence is weak; monitor failures
10 · Autoregressive language modeling
- p(x)=Πp(xₜ|x<t); training minimizes token CE.
- Inference sequential: prefill + decode; KV cache avoids prior K/V recomputation.
- Perplexity is exp(mean NLL); not a direct measure of helpfulness.
11 · Fine-tuning ladder
- Pretraining learns broad representations; SFT adapts instruction behavior.
- RLHF learns reward from preferences then optimizes policy; DPO uses preference pairs directly.
- Use held-out eval; avoid benchmark contamination and catastrophic forgetting.
12 · LoRA vs QLoRA
- LoRA ΔW=BA; train small low-rank matrices (often with α/r scaling).
- QLoRA trains adapters on quantized frozen base, saving weight memory.
- Full fine-tuning updates all weights; compare data/compute/quality requirements.
13 · Diffusion models
- Forward adds noise over steps; model learns reverse denoising.
- Latent diffusion runs in learned latent space; decoder produces image.
- Classifier-free guidance balances conditioning strength/diversity; scheduler affects steps.
14 · VAE and GAN
- VAE optimizes reconstruction + KL regularization via ELBO.
- GAN generator produces samples, discriminator distinguishes real/generated.
- GAN can mode-collapse; VAE may blur; diffusion often higher inference cost.
15 · Sampling controls
- Temperature divides logits before softmax; lower often sharper.
- Top-k retains k candidates; top-p retains smallest set reaching cumulative mass.
- Greedy picks argmax; sampling can be nondeterministic even with seed across systems.
16 · Prompting & structured outputs
- Few-shot examples show desired patterns; delimit untrusted context.
- JSON/schema output validation; retry or repair malformed responses with limits.
- Prompt chaining decomposes tasks; avoid unnecessary calls.
17 · RAG vs fine-tuning vs tools
- RAG supplies current/private evidence; citations and retrieval evaluation.
- Fine-tuning changes behavior/format; not reliable fact database.
- Tools execute or fetch deterministic facts; enforce authorization and validation.
18 · Evaluation & safety
- Measure factuality, instruction following, robustness, hallucination, cost/latency.
- Human labels and calibrated judges; pairwise order bias and leakage checks.
- Red-team prompt injection, privacy, unsafe outputs; monitor false refusals.
19 · Production economics
- Cost includes input/output tokens, tools and infrastructure; cap budget.
- Cache exact compatible prefix; batch requests where latency allows.
- Track TTFT, tokens/sec, p95, quality, fallbacks and version regressions.
References & further study
Original schematics illustrate concepts, not measured data. Review these references for full derivations and implementation details.