---
name: llms-and-generative-ai
description: "LLMs and Generative AI: 83 concepts, no maths assumed."
version: 1.0.0
author: Learn AI
license: CC-BY-4.0
metadata:
  hermes:
    tags: [Llms, And, Generative, Ai]
    related_skills: [deep-learning, machine-learning, mathematical-foundations]
    source: https://basavapurushottam.com/learn-ai
---
# LLMs and Generative AI

83 concepts, written for an adult with no computer science and no mathematics past school arithmetic. Each concept is a file under `references/`; load one when it is the thing being asked about rather than reading the whole domain.


## When to Use

- The reader asks about llms and generative ai and wants it explained from the ground up rather than summarised.

- A term below comes up and you want the plain-language account of it, with a worked example.

- You need to know what a concept rests on before teaching it — every reference lists its prerequisites.


## When NOT to Use

- The reader wants current events, papers or library documentation. This is a curriculum, not a news source, and it does not update itself.

- The reader wants code they can ship. Examples here are written to be understood, not deployed.


## How to Run

Open the file listed beside a concept in Quick Reference below. The files live in the `references` directory, are plain Markdown with no front matter and no dependencies — read the one you want and ignore the rest.


## Quick Reference


### Fine-Tuning

- `references/catastrophic-forgetting.md` — **Catastrophic Forgetting**: Losing previously acquired general capability while training on new narrow data — the c…
- `references/chat-format-templates.md` — **Chat Format Templates**: The role-tagged structure — system, user, assistant — that conversational models were t…
- `references/classification-fine-tuning.md` — **Classification Fine-Tuning**: Adapting a language model for label prediction by attaching a classification head and t…
- `references/continued-pre-training.md` — **Continued Pre-Training**: Extending pretraining on domain-specific corpora before any task tuning, to inject voca…
- `references/cross-lingual-transfer.md` — **Cross-Lingual Transfer**: Capability learned in one language carrying over to another, exploiting shared multilin…
- `references/instruction-tuning.md` — **Instruction Tuning**: Fine-tuning on instruction-response pairs so a model follows directions rather than mer…
- `references/lora-and-qlora.md` — **LoRA and QLoRA**: Training small low-rank matrices alongside frozen base weights, with QLoRA additionally…
- `references/multi-tenant-adapter-serving.md` — **Multi-Tenant Adapter Serving**: Serving many customers from one base model by loading their individual adapters on demand.
- `references/peft.md` — **PEFT**: Parameter-efficient fine-tuning: the family of methods that adapt a model by training a…
- `references/pre-trained-model-adaptation.md` — **Pre-Trained Model Adaptation**: The general practice of taking an existing trained model and adjusting it for a new tas…
- `references/qlora-for-finance.md` — **QLoRA for Finance**: Applying quantised low-rank adaptation to financial models, where domain vocabulary mat…
- `references/the-steering-test.md` — **The Steering Test**: A decision heuristic: if you can get the behaviour you need by steering with prompts, c…

### Hallucination Mitigation

- `references/content-moderation-guardrails.md` — **Content Moderation Guardrails**: Layered checks on inputs and outputs that block, filter or redirect unsafe content befo…
- `references/cross-modal-drift.md` — **Cross-Modal Drift**: Producing output plausible for the training distribution generally, but not for this pa…
- `references/multimodal-grounding-failures.md` — **Multimodal Grounding Failures**: The general class of outputs making claims the supplied non-text evidence does not supp…
- `references/object-hallucination.md` — **Object Hallucination**: Describing entities that are not present in a provided image — the most studied multimo…

### Inference Optimization

- `references/edge-and-air-gapped-inference.md` — **Edge and Air-Gapped Inference**: Serving models on devices or in isolated networks with no external connectivity, under…
- `references/knowledge-distillation.md` — **Knowledge Distillation**: Training a small student model to reproduce a large teacher's outputs, transferring cap…
- `references/latency-and-speedups.md` — **Latency and Speedups**: Reducing perceived and actual response time through caching, batching, streaming and de…
- `references/local-model-deployment.md` — **Local Model Deployment**: Running models on your own hardware rather than calling an API, for privacy, cost predi…
- `references/quantization.md` — **Quantization**: Representing weights and activations at lower numerical precision to cut memory and oft…
- `references/test-time-compute.md` — **Test-Time Compute**: Spending more computation during inference — sampling multiple answers, searching, or e…

### Large Language Models

- `references/byte-pair-encoding.md` — **Byte-Pair Encoding**: Building a vocabulary by repeatedly merging the most frequent adjacent pair, yielding s…
- `references/context-window.md` — **Context Window**: The maximum number of tokens a model can attend to at once — its entire working memory…
- `references/foundation-models.md` — **Foundation Models**: Large models pretrained broadly enough to adapt to many downstream tasks, serving as a…
- `references/llm-nondeterminism.md` — **LLM Nondeterminism**: The same prompt can yield different outputs, because sampling is stochastic and even gr…
- `references/multi-token-decoding.md` — **Multi-Token Decoding**: Generating more than one token per forward pass — speculative decoding and related meth…
- `references/quality-cost-latency-tradeoff.md` — **Quality-Cost-Latency Tradeoff**: The three-way tension in model selection, where improving one dimension typically costs…
- `references/reasoning-models.md` — **Reasoning Models**: Models trained to produce extended intermediate reasoning before answering, trading lat…
- `references/sliding-window-sampling.md` — **Sliding Window Sampling**: Generating training examples by moving a fixed-size window across a corpus, with stride…
- `references/temperature-and-sampling.md` — **Temperature and Sampling**: Decoding controls that shape how the next token is drawn from the predicted distributio…
- `references/token-ids-and-special-tokens.md` — **Token IDs and Special Tokens**: Tokens map to integer IDs, alongside reserved markers for padding, sequence boundaries,…
- `references/tokenization.md` — **Tokenization**: Splitting text into the discrete units a model actually processes.

### LLM Evaluation

- `references/answer-relevancy-and-correctness.md` — **Answer Relevancy and Correctness**: Distinguishing whether an answer addresses the question from whether what it says is tr…
- `references/bleu-and-reference-metrics.md` — **BLEU and Reference Metrics**: Automatic metrics comparing generated text to reference answers by n-gram overlap.
- `references/benchmarking.md` — **Benchmarking**: Comparing models on standardised task suites to get a common frame of reference.
- `references/deterministic-validators.md` — **Deterministic Validators**: Programmatic checks — schema validity, format, forbidden content, numerical bounds — th…
- `references/evals-gap.md` — **Evals Gap**: The widespread pattern of shipping LLM applications with no real measurement discipline…
- `references/evaluation-datasets.md` — **Evaluation Datasets**: Curated sets of inputs with expected properties or outputs, forming the fixed reference…
- `references/evaluator-drift.md` — **Evaluator Drift**: The evaluation apparatus itself changing over time — judge model updates, rubric edits,…
- `references/four-axis-quality-safety-cost-and-reliability.md` — **Four-Axis Quality, Safety, Cost and Reliability**: Defining what working means in production across four dimensions rather than a single q…
- `references/gold-and-adversarial-sets.md` — **Gold and Adversarial Sets**: Gold sets capture correct expected behaviour; adversarial sets deliberately probe for f…
- `references/llm-safety-benchmarks.md` — **LLM Safety Benchmarks**: Standardised suites probing harmful, unsafe or policy-violating behaviour, often paired…
- `references/llm-as-judge.md` — **LLM as Judge**: Using a model to score another model's output against a rubric, making open-ended evalu…
- `references/minimum-evaluable-product.md` — **Minimum Evaluable Product**: Building the smallest version that can be measured, rather than the smallest that can b…
- `references/offline-vs-online-evaluation.md` — **Offline vs Online Evaluation**: Offline evaluation runs against fixed datasets before release; online evaluation measur…
- `references/promptfoo-and-lighteval.md` — **Promptfoo and LightEval**: Open-source harnesses for running structured evaluations over prompts and models with r…
- `references/rouge-and-human-eval.md` — **ROUGE and Human Eval**: Recall-oriented overlap metrics for summarisation, paired with human review as the grou…
- `references/regression-gates.md` — **Regression Gates**: Automated thresholds in the release pipeline that block a deployment when evaluation me…
- `references/repeatability-under-stochasticity.md` — **Repeatability Under Stochasticity**: Getting stable measurements from a system that returns different outputs each run, thro…
- `references/skill-testing-and-evals.md` — **Skill Testing and Evals**: Applying evaluation discipline to reusable agent skills, checking they behave correctly…
- `references/slice-based-coverage.md` — **Slice-Based Coverage**: Evaluating on meaningful subsets — language, customer type, query category — rather tha…
- `references/synthetic-eval-data.md` — **Synthetic Eval Data**: Generating test cases with models to reach coverage that manual authoring cannot, with…
- `references/training-time-vs-inference-time-evaluation.md` — **Training-Time vs Inference-Time Evaluation**: Evaluating during training to guide model development, versus evaluating live behaviour…

### Post-Training Alignment

- `references/alignment-case-study.md` — **Alignment Case Study**: A worked end-to-end alignment example — collect preferences, train a reward model, opti…
- `references/bradley-terry-model.md` — **Bradley-Terry Model**: A statistical model turning pairwise comparisons into latent scalar scores, the standar…
- `references/direct-preference-optimization.md` — **Direct Preference Optimization**: Optimising directly on preference pairs without training a separate reward model, using…
- `references/grpo.md` — **GRPO**: Group relative policy optimisation, which scores a group of sampled responses against e…
- `references/orpo-and-preference-optimization.md` — **ORPO and Preference Optimization**: The family of methods aligning models directly from preferences, with ORPO folding pref…
- `references/on-policy-vs-off-policy.md` — **On-Policy vs Off-Policy**: Whether training data comes from the current policy's own outputs or from a different,…
- `references/preference-data-collection.md` — **Preference Data Collection**: Gathering human comparisons between model outputs — the annotation process that determi…
- `references/reward-hacking.md` — **Reward Hacking**: A policy maximising the reward signal in ways that do not reflect genuine quality — exp…
- `references/reward-modeling.md` — **Reward Modeling**: Training a model to predict human preference, producing a scalar signal that stands in…
- `references/supervised-fine-tuning.md` — **Supervised Fine-Tuning**: Training on curated demonstrations of desired behaviour — the first and most important…
- `references/synthetic-data-generation.md` — **Synthetic Data Generation**: Using models to produce training data — instructions, preferences, self-play trajectori…

### Prompt Engineering

- `references/context-packs.md` — **Context Packs**: Curated bundles of the context an agent or prompt needs for a task — specifications, ex…
- `references/prompt-iteration.md` — **Prompt Iteration**: Refining a prompt through cycles of change and measurement rather than intuition.
- `references/prompt-optimization.md` — **Prompt Optimization**: Automatically improving a prompt against measurable criteria, using data rather than ma…
- `references/prompt-registry-and-versioning.md` — **Prompt Registry and Versioning**: Storing prompts as versioned artifacts with aliases, history and controlled promotion,…
- `references/structured-output-constraints.md` — **Structured Output Constraints**: Forcing generation to conform to a schema through grammar-constrained decoding or valid…

### Retrieval-Augmented Generation

- `references/admissible-evidence-spans.md` — **Admissible Evidence Spans**: Restricting answers to specific verified passages that may legitimately be cited, commo…
- `references/agentic-retrieval.md` — **Agentic Retrieval**: Letting the model decide what to retrieve, evaluate whether it sufficed, and search aga…
- `references/chunking.md` — **Chunking**: Splitting documents into retrievable units.
- `references/citations-and-evidence.md` — **Citations and Evidence**: Requiring generated claims to point at the retrieved passages supporting them, making a…
- `references/context-precision-and-recall.md` — **Context Precision and Recall**: Retrieval metrics for RAG: precision measures how much retrieved context was relevant,…
- `references/enterprise-knowledge-assistants.md` — **Enterprise Knowledge Assistants**: Assistants grounded in an organisation's own documents, requiring permission-aware retr…
- `references/graphrag.md` — **GraphRAG**: Retrieval over a knowledge graph of entities and relationships, so answers can follow c…
- `references/hybrid-and-semantic-search.md` — **Hybrid and Semantic Search**: Combining lexical keyword matching with dense vector similarity so exact terms and sema…
- `references/multi-document-retrieval.md` — **Multi-Document Retrieval**: Assembling evidence from several sources for a single answer, including deduplication a…
- `references/reranking.md` — **Reranking**: Re-scoring an initial candidate set with a more expensive, more accurate model before p…
- `references/retrieval-quality.md` — **Retrieval Quality**: Measuring the retrieval stage independently of generation, so you know which half of a…
- `references/vector-native-storage.md` — **Vector Native Storage**: Storage designed around embeddings as a first-class type, with indexes, filters and hyb…
- `references/vector-search.md` — **Vector Search**: Finding the nearest embeddings to a query vector, using approximate algorithms to keep…


## Pitfalls

- The concepts are ordered by what rests on what, not by difficulty. A later concept is not always harder; it is later because something else has to come first.

- Explanations avoid notation the reader has not met. If you reintroduce standard symbols, say what they mean, or you undo the thing this curriculum is for.


## Verification

`ls references/ | wc -l` should print 83.


---

From [Learn AI](https://basavapurushottam.com/learn-ai). Prose is licensed CC BY 4.0.
