# Finetuned Language Models Are Zero-Shot Learners

Jason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester and 3 more · arXiv · 2021-9-3

- **Problem** Large language models such as GPT-3 do well with few-shot exemplars but lag at zero-shot, which limits their use when no exemplars are available.
- **Method** Finetunes the 137B-parameter LaMDA-PT on more than 60 NLP datasets rewritten as natural language instructions, holding out one task cluster at a time for zero-shot evaluation.
- **Results** Zero-shot FLAN 137B scores 56.2 on natural language inference, against 42.9 for zero-shot GPT-3 175B and 53.2 for few-shot GPT-3 175B.

## Why zero-shot performance lags

Large language models such as GPT-3 learn well from a few task examples placed in the prompt. Without those examples, their zero-shot results fall well short on reading comprehension, question answering and natural language inference. The authors suggest one possible cause: without exemplars, prompts that differ from the format of the pretraining data are harder for the model to handle.

The study asks whether a simple change to training lets a language model follow task descriptions it was never trained on. The change is to finetune on tasks written as instructions, such as asking whether a movie review is positive or negative, or asking for a phrase to be translated into Chinese. Success is then measured on a task type held out of training, so the test is one of generalization to a new task type rather than to a new example from a seen task.

## Instruction tuning on described tasks

The method keeps the supervision of finetuning but applies it to instructions, so that the model learns to respond to text instructions at inference time.

Pretrain-finetune trains a separate specialized model for each task and typically needs many task-specific examples. Prompting, as used with GPT-3, asks a model that was not finetuned to perform the task through few-shot prompts or prompt engineering. Instruction tuning trains one model on many tasks and then tests it on a task type outside that set.

## Turning existing datasets into instructions

Writing an instruction dataset from scratch would be resource-intensive, so existing datasets were converted into an instructional format. The mixture combines 62 publicly available text datasets from TensorFlow Datasets, covering both language understanding and language generation tasks.

Each of the 62 datasets belongs to one of twelve task clusters, and datasets in the same cluster share a task type. Clusters with understanding tasks and generation tasks are colored differently in the figure.

Ten unique templates were written by hand for each dataset. Most describe the original task, and up to three per dataset reverse it, for example by asking for a movie review to be generated for a sentiment label. During training, each example is formatted with a template chosen at random from its dataset's set of templates.

Figure 4 shows several templates written for a single natural language inference dataset.

## Defining an unseen task

Some prior work treats a task as unseen only when the same dataset is absent from training. This study uses a stricter rule based on the task clusters. A dataset counts as unseen only if no dataset from any task cluster it belongs to was used in instruction tuning. For an entailment task, that means no entailment datasets appear in instruction tuning, and the model is tuned on all other clusters.

Evaluating on c task clusters therefore means instruction tuning c models, each holding out a different cluster. Overlapping clusters are removed too: when evaluating reading comprehension with commonsense, both of those clusters are dropped from instruction tuning, and the paraphrase cluster is dropped when evaluating NLI, with the reverse also holding.

## How classification answers are scored

A task output is either one of several classes or free text. FLAN is an instruction-tuned decoder-only language model, so it answers in free text and generation tasks need no change. For classification, prior work such as GPT-3 compares only candidate answers, such as yes and no, and takes the more probable one. This is logically sound, but the probability can spread across many phrasings of the same answer, so a single answer word may receive less mass than it deserves.

The authors therefore append the token OPTIONS to a classification prompt, followed by the list of output classes. This tells the model which choices are expected, and Figure 1 shows this for NLI and commonsense examples.

## The LaMDA-PT base model

LaMDA-PT has only language-model pretraining, whereas LaMDA was further finetuned for dialog, so FLAN begins from the pretrained-only model.

## Zero-shot natural language inference

Figure 1 covers three unseen task types where instruction tuning improved performance most: natural language inference, reading comprehension and closed-book QA. Its bottom panel compares zero-shot FLAN with zero-shot and few-shot GPT-3.

On natural language inference, zero-shot FLAN 137B scores 56.2. Zero-shot GPT-3 175B scores 42.9, and few-shot GPT-3 175B scores 53.2.

Across the datasets evaluated, zero-shot FLAN surpasses zero-shot GPT-3 175B on 20 of 25 datasets. Zero-shot FLAN also exceeds few-shot GPT-3 by a large margin on ANLI, RTE, BoolQ, AI2-ARC, OpenbookQA and StoryCloze.

## Task clusters and model scale

The same ablation studies indicate that the benefits of instruction tuning emerge only with sufficient model scale. Taken together, these two ablations address whether the breadth of the tuning mixture and the size of the model each matter for zero-shot generalization.

## Limitations

Each held-out task cluster needs its own instruction-tuned model, so evaluating c clusters requires c tuning runs. The zero-shot comparisons here use the 137B LaMDA-PT base model, so results for other base models are not shown. The ablations described cover task clusters and model scale, and the OPTIONS suffix is not varied in them.

## Paper info

- **Authors**: Jason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M. Dai, Quoc V. Le
- **Venue**: arXiv · Preprint
- **First published**: 2021-9-3
- **Added**: 2026-10-20
- **Updated**: 2022-2-8
- **Version**: v5
- **arXiv**: 2109.01652
- **Category**: cs.CL
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/2109.01652v5) · [PDF ↗](https://arxiv.org/pdf/2109.01652v5)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Jason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M. Dai, Quoc V. Le (2021). Finetuned Language Models Are Zero-Shot Learners. arXiv:2109.01652v5. https://arxiv.org/abs/2109.01652v5

**BibTeX**

```
@misc{wei2021finetuned,
  title = {{Finetuned Language Models Are Zero-Shot Learners}},
  author = {Jason Wei and Maarten Bosma and Vincent Y. Zhao and Kelvin Guu and Adams Wei Yu and Brian Lester and Nan Du and Andrew M. Dai and Quoc V. Le},
  year = {2021},
  eprint = {2109.01652},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2109.01652v5}
}
```

## Other paper commentary

- [Scaling Instruction-Finetuned Language Models](https://refivu.com/en/papers/6f9b141d-190c-4397-9e41-4f796f4ef56e-scaling-instruction-finetuned-language-models.md)
- [LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale](https://refivu.com/en/papers/263598fd-8186-4bb8-858a-0eba8ecdb369-llm-int8-8-bit-matrix-multiplication-for-transformers.md)
- [Efficient Memory Management for Large Language Model Serving with PagedAttention](https://refivu.com/en/papers/a69a26aa-a470-4bff-9c73-2a7fe8ffd528-efficient-memory-management-for-large-language-model-serving.md)
- [Retentive Network: A Successor to Transformer for Large Language Models](https://refivu.com/en/papers/ca4ee5c6-87cf-427b-ae91-b593c10e0b48-retentive-network-a-successor-to-transformer-for-large.md)
- [OLMo: Accelerating the Science of Language Models](https://refivu.com/en/papers/674dc7cc-bbc8-47b3-a55b-69c562d96047-olmo-accelerating-the-science-of-language-models.md)
- [Tree of Thoughts: Deliberate Problem Solving with Large Language Models](https://refivu.com/en/papers/708b6d99-e4dc-4582-abc4-e2de5a72d5d3-tree-of-thoughts-deliberate-problem-solving-with-large.md)
- [Dynamic Routing Between Capsules](https://refivu.com/en/papers/a4e87f62-36cc-47df-991e-87dd01b1a4ef-dynamic-routing-between-capsules.md)
- [Neural Machine Translation of Rare Words with Subword Units](https://refivu.com/en/papers/0950e659-f6cc-4852-b244-bbb2742bf059-neural-machine-translation-of-rare-words-with-subword.md)
- [Fast Inference from Transformers via Speculative Decoding](https://refivu.com/en/papers/41a03564-b5d1-4b7f-8db4-502dbc43fbe0-fast-inference-from-transformers-via-speculative-decoding.md)
- [Constitutional AI: Harmlessness from AI Feedback](https://refivu.com/en/papers/91e9437c-36ce-49cd-965c-18d9ca4664d6-constitutional-ai-harmlessness-from-ai-feedback.md)
- [Distilling the Knowledge in a Neural Network](https://refivu.com/en/papers/d39fc594-ec58-4492-b1f4-d2d3600a6455-distilling-the-knowledge-in-a-neural-network.md)
- [GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers](https://refivu.com/en/papers/46a31638-80a6-4626-a5e7-028ae5ccea93-gptq-accurate-post-training-quantization-for-generative-pre.md)

## Terms in this paper

- [few-shot learning](https://refivu.com/en/terms/fd39bfbe65e5-few-shot-learning)
- [natural language inference](https://refivu.com/en/terms/6645756fb938-natural-language-inference)
- [zero-shot learning](https://refivu.com/en/terms/a9be4dad9497-zero-shot-learning)
- [FLAN](https://refivu.com/en/terms/fbea0a362ee3-flan)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/3dedf278-64d7-4653-93ff-bf4504ae70ac-finetuned-language-models-are-zero-shot-learners)
