AIAI study materials
AIAI study resources

AIAI: Generative AI and Large Language Models

AIAI · Work through your exam, one topic at a time.

All guide sections

Generative AI and Large Language Models

How LLMs work

Large language models are transformer-based networks trained with self-supervision to predict the next token. Understand tokens (subword units), embeddings, attention, context windows, and autoregressive generation. Parameters encode learned patterns; temperature and top-p control sampling randomness. Lower temperature yields more deterministic output; higher temperature increases diversity and risk.

Training pipeline

Pre-training builds general capability from large corpora. Fine-tuning adapts a model to a task or style. Instruction tuning and preference alignment (for example, RLHF) shape behavior. Retrieval-augmented generation (RAG) supplies external context at inference without changing weights. Know the distinction: RAG changes what the model sees; fine-tuning changes the model's weights.

Known limitations

Hallucination (confident fabrication), stale knowledge, context-window limits, sensitivity to prompt phrasing, and non-determinism. Grounding, citations, and human review mitigate these. Prompt engineering techniques include few-shot examples, chain-of-thought prompting, and system instructions.

Evaluation

Generative outputs need task-specific evaluation: exact match, similarity metrics, human ratings, and rubric-based scoring. Automated metrics are imperfect proxies.

Worked example

A support assistant must answer from an internal policy manual that changes weekly. Fine-tuning would go stale quickly; RAG retrieves current passages and grounds answers, enabling citations. Fine-tuning is better reserved for consistent style or format behavior.

Rule of thumb

If the knowledge changes often, retrieve it; if the behavior must change, fine-tune.