Prompting and Alignment
Fine-tuning adapts a model by changing its weights. The second family of adaptation changes nothing: a large frozen model performs a task from an instruction and a few examples placed in its context.
╌╌╌╌
This builds on Fine-Tuning and Prompting, which covered the first family of adaptation — fine-tuning, which updates a pretrained model's weights with a small task head and a run of supervised training. Here we take up the second family, which changes no weights at all: the model is frozen and the task is written into its input. We then add the training stages that make a frozen model reliably promptable.
Prompting and in-context learning
Fine-tuning needs labelled data and a training run per task. The second family needs neither. A large pretrained generative language model performs a task from a description alone: the task is written into the input as a prompt , and the model returns the continuation under frozen weights . Specification is in-context, at inference, with no gradient step.1
This works because a next-token predictor with parameters has, during
pretraining, maximized over corpora containing
the requested pattern. Formatting a prompt as Review: … Sentiment:
makes a sentiment
word the high-probability continuation. The frozen model does not learn the task; it
recognizes a distribution it already absorbed and completes it.
Zero-shot prompting gives only an instruction, conditioning on . Few-shot prompting prepends solved demonstrations, conditioning on so the model infers the task from the pattern. Picking up a task from context with no gradient step is in-context learning.2
The demonstrations are not training data in the usual sense: they exist only in that one forward pass. The next prompt retains nothing from the previous one. In-context learning is adaptation carried entirely in the input.
Chain-of-thought prompting
Prompting directly for the answer to a multi-step problem often fails: the model must emit in one commitment, before any intermediate computation. Chain-of-thought prompting inserts a reasoning trace between question and answer, factoring the prediction as
and demonstrations of the form (question, worked steps, answer) steer the model onto a high-probability trace before it commits to .3
The generated intermediate tokens become context the answer tokens condition on, giving the model extra sequential computation that a one-shot answer lacks. Writing out reasoning raises multi-step accuracy sharply.
Instruction tuning and RLHF
A raw pretrained model predicts likely continuations, which is not the same as
following an instruction. Prompted with Summarize this article,
a base model may
continue with another article-like paragraph — the likely continuation — rather than
a summary. Two further training stages turn the base predictor into an
assistant.
Instruction tuning is supervised fine-tuning on a broad, diverse set of tasks, each phrased as a natural-language instruction paired with a correct response.4 Trained on thousands of (instruction, response) pairs, the model learns the general behaviour of following an instruction and generalizes it to unseen instructions. It makes the model promptable: after instruction tuning, a plain zero-shot instruction succeeds far more often.
The final stage aligns the model with preferences that are hard to specify as a loss — helpfulness, honesty, harmlessness. Reinforcement learning from human feedback (RLHF) proceeds in two steps.5 First, from human comparisons of two outputs for a prompt , a reward model is fit under the Bradley–Terry preference model, minimizing
so scores the preferred output higher. Second, the policy is optimized against that reward with RL, under a KL penalty to the supervised reference that prevents reward hacking and preserves fluency:
The result is the base model turned into an aligned assistant: fluent, instruction-following, and steered toward responses people rate as good. RLHF is treated in full in the reinforcement-learning course and the deep-learning treatment of learning from human feedback; here it is enough to place it as the last adaptation step in the stack — pretrain, instruction-tune, align.
The papers behind the pipeline
The instruction-tuning-then-RLHF stack and the prompting tricks above each trace to a specific public result. Naming them precisely keeps the claims honest.
BERT (Devlin et al., 2019). The masked-language-modeling encoder of this lesson is the
model of BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
(NAACL 2019).6 It paired MLM (masking of tokens) with next-sentence
prediction, pretrained on BooksCorpus plus English Wikipedia; a single pretrained model,
fine-tuned with one added output layer, set new state-of-the-art on eleven understanding
tasks. The pretrain-then-finetune scheme of the previous part is BERT's.
LoRA (Hu et al., 2021). The low-rank correction is LoRA: Low-Rank Adaptation of Large Language Models.
7 On GPT-3 175B, LoRA trained roughly
times fewer parameters than full fine-tuning while matching or beating its quality, and
because the correction folds into at inference it adds no latency. That efficiency is why
one frozen base model can host a whole library of task-specific adapters.
Chain-of-thought (Wei et al., 2022). Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
(NeurIPS 2022) showed that prompting a large model with worked reasoning
steps, not just final answers, sharply raises accuracy on arithmetic and commonsense
reasoning — and that the effect emerges with scale, appearing only above roughly
billion parameters and being absent or harmful in small models.8 Kojima et al. (2022)
added the follow-up that merely appending Let's think step by step
to a zero-shot
prompt triggers much of the same reasoning without any worked examples at all.9
InstructGPT / RLHF (Ouyang et al., 2022). The alignment stage is Training Language Models to Follow Instructions with Human Feedback
(NeurIPS 2022), the InstructGPT paper.10
Its pipeline has three steps: supervised fine-tuning on human-written demonstrations
(instruction tuning); training a reward model on human rankings of candidate outputs;
and optimizing the language model against that reward with the PPO reinforcement-learning
algorithm, regularized by a KL penalty that keeps it near the supervised model. The headline
result: human raters preferred outputs from the -billion-parameter InstructGPT over the
-billion-parameter base GPT-3. A smaller model won on helpfulness because it
was aligned; for a usable assistant, alignment mattered more than raw scale.
Retrieval-augmented generation (Lewis et al., 2020). Prompting and fine-tuning both leave
a model's knowledge frozen in its weights at training time, which goes stale and cannot cite a
source. RAG — Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
(NeurIPS 2020) — attaches a retriever that pulls relevant documents from an external corpus and
concatenates them into the prompt, so the model conditions its generation on retrieved
evidence rather than memory alone.11 This is a third adaptation axis, orthogonal to the
two in this lesson: new context fetched at inference, rather than new weights or a longer
instruction. It updates a model's knowledge by swapping the corpus, not retraining, and grounds
answers in text that can be shown to a user.
Fine-tuning versus prompting
The two families make opposite trade-offs, and the choice turns on how much labelled data you have and whether you can afford to store and serve a specialized model.
| Fine-tuning | Prompting | |
|---|---|---|
| Weights | updated (new specialized model) | frozen (one shared model) |
| Adaptation signal | labelled training data | instruction + a few in-context examples |
| When it happens | a training run, ahead of time | at inference, per request |
| Cost per task | a gradient-descent run + a model copy | none beyond a longer prompt |
| Data needed | hundreds–thousands of labels | zero to a handful of examples |
| Best when | you have data and want peak accuracy | little/no data, or many tasks on one model |
Neither wins outright. Fine-tuning (especially the parameter-efficient kind) tends to give the highest accuracy on a task with enough labelled data, and it bakes the task in so inference is cheap. Prompting needs no labels and no training, adapts a single frozen model to any number of tasks on the fly, and is the only option when the model is too large to fine-tune or reachable only through an API. The two also combine: instruction tuning is fine-tuning that makes a model better at prompting, and a fine-tuned model can still be prompted.
Both rest on the same foundation. The expensive work of pretraining is done once and frozen into the weights. Everything after is cheap adaptation: a thin head and a gradient step, or a few sentences of context.
Footnotes
- Jurafsky & Martin, Prompting — specifying a task in the model's input as text and reading the answer off the frozen model's continuation, with zero-shot (instruction only) and few-shot (instruction plus demonstrations) variants. ↩
- Jurafsky & Martin, In-Context Learning — a frozen model inferring a task from demonstrations placed in its context with no gradient update, the demonstrations present only within the single forward pass. ↩
- Jurafsky & Martin, Chain-of-Thought Prompting — demonstrations that show intermediate reasoning steps before the answer, so the model generates its own reasoning path and answers multi-step problems more reliably. ↩
- Jurafsky & Martin, Instruction Tuning — fine-tuning on a broad set of tasks phrased as (instruction, response) pairs so the model learns to follow instructions and generalizes the behaviour to unseen instructions. ↩
- Jurafsky & Martin, Ch. 11 — aligning a base model with human preferences via reinforcement learning from human feedback: a reward model trained on human comparisons, then RL optimization of the language model against that reward, producing an aligned assistant. ↩
- Devlin, Chang, Lee, Toutanova (2019),
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding,
NAACL 2019. Pretrains a bidirectional transformer encoder with masked language modeling (~15% of tokens) plus next-sentence prediction on BooksCorpus and Wikipedia; fine-tuning the single pretrained model with one added output layer set state-of-the-art on eleven NLP benchmarks. ↩ - Hu, Shen, Wallis, Allen-Zhu, Li, Wang, Wang, Chen (2021),
LoRA: Low-Rank Adaptation of Large Language Models,
ICLR 2022. Freezes pretrained weights and learns a low-rank update ; on GPT-3 175B it reduces trainable parameters by about four orders of magnitude versus full fine-tuning while matching quality, and folds into at inference so it adds no latency. ↩ - Wei, Wang, Schuurmans, Bosma, Ichter, Xia, Chi, Le, Zhou (2022),
Chain-of-Thought Prompting Elicits Reasoning in Large Language Models,
NeurIPS 2022. Few-shot prompts whose demonstrations include intermediate reasoning steps substantially raise accuracy on arithmetic, commonsense, and symbolic reasoning; the benefit emerges only in sufficiently large models (roughly 100B+ parameters). ↩ - Kojima, Gu, Reid, Matsuo, Iwasawa (2022),
Large Language Models Are Zero-Shot Reasoners,
NeurIPS 2022. Shows that simply appendingLet's think step by step
to a zero-shot prompt elicits multi-step reasoning and improves accuracy without any worked in-context examples. ↩ - Ouyang, Wu, Jiang, et al. (2022),
Training Language Models to Follow Instructions with Human Feedback
(InstructGPT), NeurIPS 2022. A three-stage alignment pipeline — supervised fine-tuning on demonstrations, a reward model trained on human output rankings, and PPO reinforcement learning against the reward with a KL penalty; human raters preferred the 1.3B InstructGPT over the 175B base GPT-3. ↩ - Lewis, Perez, Piktus, et al. (2020),
Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks,
NeurIPS 2020. Couples a neural retriever over an external document corpus with a sequence generator so that outputs are conditioned on retrieved passages; improves knowledge-intensive tasks and lets the model's knowledge be updated by changing the corpus rather than retraining. ↩
╌╌ END ╌╌