Week 2 Self-Paced Module: In-Context Learning and Instruction Tuning
CSIC30216 · Fall 2026
Overview
This module answers a question Week 2's lecture raised but left open: if the model is just predicting tokens, why does it follow instructions at all? And why do examples in the prompt work without retraining? Neither in-context learning nor instruction following is magic — both have specific mechanisms, and understanding those mechanisms changes how you design prompts and systems.
Why This Matters
Understanding why few-shot examples work tells you how to choose better examples. Understanding why instruction tuning is not a hard constraint tells you when and why your system prompt might fail — including to adversarial input from users. These are practical, not just theoretical, engineering concerns for the systems you'll build this semester.
Format and Timing
- Framing video (posted on E3) — walks through in-context learning, why raw pre-trained models don't follow instructions, and three approaches to instruction tuning (FLAN, RLHF, Constitutional AI).
- Required readings — Lilian Weng's “Prompt Engineering” and the Hugging Face RLHF post (~30 minutes combined). Linked below.
- Multiple choice questions (單一選擇題) — four questions on E3, about 10 minutes. Submit before Week 3 class to mark the module complete.
- Total estimated time: ~60 minutes
What You'll Learn
- In-context learning — giving a model examples doesn't change its weights; it shifts the probability distribution over what comes next. This is why example quality matters more than example quantity, and why output can be sensitive to example order and phrasing.
- Why raw models don't follow instructions — a model trained to predict internet text learns to produce internet text, not to answer questions. Instruction following has to be introduced deliberately through fine-tuning.
- Three approaches to instruction tuning — FLAN (fine-tuning on diverse tasks phrased as instructions), InstructGPT/RLHF (training on human preference rankings), and Constitutional AI (using the model's own self-critique against written principles instead of human rankers).
- Engineering implications — how to write more effective few-shot examples and system prompts, why RLHF training produces sycophancy (covered further in Week 6), and why instruction following being learned rather than hardcoded creates prompt injection risk for any system that processes user-supplied text.
Required Materials
- Framing video: Week 2 Self-Paced Intro — posted on E3 under Week 2 Self-paced Modules.
- Reading: Prompt Engineering, by Lilian Weng — read the “Basic Prompting” and “Instruction Tuning” sections (stop before “Automatic Prompt Design”).
- Reading: Illustrating Reinforcement Learning from Human Feedback, Hugging Face — read from the beginning through “RLHF: Let's take it step by step” (stop before “Open-source tools for RLHF”).
- Multiple choice questions: posted on E3 under Week 2 Self-paced Modules.
Optional Materials
If you want to go deeper on any of these topics (not required, but helpful if you're curious):
- Chip Huyen, “RLHF: Reinforcement Learning from Human Feedback,” 2023 — explains why raw pre-trained models don't follow instructions, and discusses InstructGPT in real depth.
- Anthropic, “Claude's Character,” 2024 — a readable explanation of how Constitutional AI shapes Claude's behaviour; connects instruction tuning to what you will observe in the API.
- Jason Wei et al., “Finetuned Language Models Are Zero-Shot Learners” (FLAN), 2021 — the original FLAN paper (read just the abstract and introduction); shows what instruction tuning looked like in practice at the research level.
- Riley Goodside, via Simon Willison, “prompt injection examples,” 2022 — short and practical; makes the security implication of instruction tuning immediately concrete.