- Choose zero-shot, few-shot, or chain-of-thought prompting for a concrete task
- Explain how RAG grounds generation and when retrieval is preferable to changing weights
- Compare full fine-tuning with LoRA/QLoRA in trainable parameters and memory use
- Distinguish instruction tuning, preference learning, and policy optimization as alignment objectives
- Use the course decision framework to choose prompting, RAG, PEFT, or quantization
Slide preview
Suggested reading
Course book · primary reading
Gemma model card: ai.google.dev/gemma/docs/core/model_card_3
Try each question before revealing the answer — these mirror the ideas the module quiz checks.
Q1.What is the central idea of In-Context Learning (ICL) in large language models?- Updating model weights during inference
- Learning tasks from examples provided in the prompt without parameter updates
- Distilling a smaller model from a larger one
- Retrieving documents from an external database
Show answer ▾
Answer: Learning tasks from examples provided in the prompt without parameter updates
ICL is learning by conditioning on demonstrations in the prompt with frozen parameters. The model leverages attention to infer the task from exemplars, allowing the same model to perform new tasks without modifying weights.
Q2.The defining feature of Retrieval-Augmented Generation (RAG) is:- Fine-tuning on retrieved passages
- Plugging an external retriever to ground generation on found documents
- Using a smaller tokenizer
- Quantizing the model to 4-bit
Show answer ▾
Answer: Plugging an external retriever to ground generation on found documents
RAG separates knowledge storage from parametric memory by dynamically injecting retrieved documents into the context during generation, improving freshness and reducing hallucinations without changing model weights.
Q3.In LoRA, a weight matrix is adapted using which parameterization?- with , where and
Show answer ▾
Answer: with , where and
LoRA trains low-rank factors and while keeping the base weight frozen. At inference, the adapted output is , where rank controls adapter capacity and reduces trainable parameters to approximately .
Q4.QLoRA fine-tunes large language models by:- Training all weights in FP32
- Storing the base weights in 4-bit and training LoRA adapters in 16-bit
- Using only prompt engineering
- Distilling to a tiny student model
Show answer ▾
Answer: Storing the base weights in 4-bit and training LoRA adapters in 16-bit
QLoRA combines quantization of base weights (e.g., to NF4 4-bit) with LoRA adapters trained in higher precision. This achieves near full fine-tuning quality on consumer GPUs by dramatically reducing memory requirements while maintaining task-specific expressivity.
Q5.In a decision framework, choose RAG over PEFT when:- The model must remember static domain style forever
- You need strict data governance and freshness without changing weights
- You cannot build an index
- You have abundant fine-tuning labels
Show answer ▾
Answer: You need strict data governance and freshness without changing weights
RAG is ideal when knowledge changes frequently or is sensitive/private, since it retrieves up-to-date information at inference without modifying weights. PEFT is better for persistent behavior, style, or domain shifts that must remain constant across calls.