Prompt engineering, alignment, and summary
Getting the most out of pre-trained LLMs, how and why models are aligned, and a synthesis of the course
Open slidesOverview
The last content lecture closes three loops. Prompting is lecture 9’s zero-cost adaptation route done well: specificity, pasted context, few-shot examples, chain-of-thought — and the pitfalls that survive good prompting, prompt injection above all. Alignment explains the gap between a raw text-completer and the assistant you actually use: instruction tuning plus preference alignment — and what that recipe does not fix (hallucination is reduced, not removed; lecture 7’s verify-everything rule stands). The constructive answer is retrieval-augmented generation: give the model sources by retrieving relevant text and putting it in the prompt — a pattern this course has already taught in pieces, since RAG is lecture 2’s cosine similarity plus lecture 6’s embeddings plus an LLM. Finally, the course in one pass: the workflow map from lecture 1 makes its last appearance, the arc runs count → predict → pre-trained, and one claim ties it together — a single loss function, −log P(next token), ran the whole course from the 27×27 bigram table to GPT. Concrete exam pointers included.
Topics
- Prompting: specificity, context, format, iteration; shot prompting and chain-of-thought; pitfalls and prompt injection
- Alignment: instruction tuning, preference alignment, refusals — and limits
- RAG: grounding answers in your own documents with embeddings + retrieval
- Course synthesis: the arc, the recurring coincidence of counting and learning, and what to revise for the exam
Readings
- J&M chapters 7, 8, and 9
Materials
- Slides: use the Open slides button above — the backup slides include a one-screen prompting checklist worth keeping at hand during assignment work
- No notebook — prompting is exercised directly in any chat interface, and programmatic use was covered on practical day 2
Before lecture 12
- Prepare your presentation: 6 minutes per group, allocation on Itslearning — see lecture 12 for the format
- Feedback on Thursday is a free review round for the final submission