XYZNOT

Papers · arXiv 2109.01652

Finetuned Language Models Are Zero-Shot Learners

Published cs.CL arXivPDF

Read with translation and AI

Summary in three lines

  1. 🎯 Untrained large language models struggle at zero-shot tasks because raw prompts deviate from pretraining token distribution.
  2. 🔧 Instruction tuning: finetune a 137B decoder LM across 62 NLP datasets verbalized via natural language templates, holding out evaluation clusters.
  3. 📈 Zero-shot FLAN surpasses zero-shot 175B GPT-3 on 20 of 25 evaluated datasets and beats few-shot GPT-3 on tasks like ANLI and BoolQ.

Abstract

This paper explores a simple method for improving the zero-shot learning abilities of language models. We show that instruction tuning -- finetuning language models on a collection of tasks described via instructions -- substantially improves zero-shot performance on unseen tasks. We take a 137B parameter pretrained language model and instruction-tune it on over 60 NLP tasks verbalized via natural language instruction templates. We evaluate this instruction-tuned model, which we call FLAN, on unseen task types. FLAN substantially improves the performance of its unmodified counterpart and surpasses zero-shot 175B GPT-3 on 20 of 25 tasks that we evaluate. FLAN even outperforms few-shot GPT-3 by a large margin on ANLI, RTE, BoolQ, AI2-ARC, OpenbookQA, and StoryCloze. Ablation studies reveal that number of finetuning datasets, model scale, and natural language instructions are key to the success of instruction tuning.

Reading guide

Problem and motivation

Large language models (such as GPT-3 175B) excel at few-shot learning by leveraging in-context exemplars. However, their zero-shot capabilities remain substantially weaker on complex NLP benchmarks such as reading comprehension, natural language inference (NLI), and question answering. Untuned models rely on prompts formatted as continuations of pretraining data, which is an unnatural and brittle format for tasks typically articulated as explicit directions or queries.

The authors explore whether supervised finetuning on a broad collection of diverse NLP tasks, explicitly phrased as natural language instructions, enables language models to generalize zero-shot to completely unseen task types at inference time.

Key ideas

  • Instruction Tuning: Convert existing NLP datasets into instruction-response formats using natural language prompt templates, combining multitask supervision with prompting.
  • Task Cluster Holdout: Group datasets into thematic clusters (e.g., NLI, Closed-Book QA, Translation, Sentiment). When testing zero-shot generalization on a target cluster , all datasets belonging to (and closely tied clusters) are excluded from training to guarantee true zero-shot cross-task evaluation.
  • Classification with Options: For classification tasks, append an OPTIONS: suffix listing the valid candidate labels directly in the prompt, guiding the generative model's output distribution without restricting it purely to rank-classification logit comparisons.

Method

The base model is LaMDA-PT, a dense, left-to-right, decoder-only transformer with 137 billion parameters, pretrained on 2.49T BPE tokens across web documents, code, Wikipedia, and dialog data (about 10% non-English).

  1. Data Aggregation: 62 datasets from TensorFlow Datasets are grouped into 12 clusters. For each dataset, 10 unique natural language instruction templates are composed (including up to 3 'inverted' templates, e.g., generating text given sentiment).
  2. Training Setup: Training examples per dataset are capped at 30k. Batches are constructed using an examples-proportional mixing scheme with a mixing rate maximum of 3,000 to prevent large datasets from dominating. Training runs for 30k gradient steps with batch size 8,192 tokens using the Adafactor optimizer (learning rate ), sequence length 1024 (input) and 256 (target), with sequence packing.
  3. Evaluation Protocol: To evaluate across held-out clusters, distinct FLAN models are trained. Performance is reported both as the average across all instruction templates and with the best template chosen on a validation set.
  4. Inference with Few-Shot Exemplars: When exemplars are available, inputs are formatted as: where represents concatenation with a separator token, capped at 16 exemplars and 960 tokens.

Results

  • Zero-Shot Comparison against GPT-3: Using the best dev template, zero-shot FLAN 137B outperforms zero-shot GPT-3 175B on 20 of 25 evaluated benchmarks and surpasses few-shot GPT-3 on 10 datasets, including ANLI R1–R3, RTE, BoolQ, OpenbookQA, and StoryCloze.
  • Task Types: Large gains occur on tasks naturally formulated as instructions (e.g., NLI, reading comprehension, closed-book QA, translation). On RTE, FLAN achieves 84.1% (best dev template) vs. zero-shot GPT-3's 63.5% and few-shot GPT-3's 72.9%. On BoolQ, FLAN reaches 82.9% vs. GPT-3's 60.5% zero-shot and 77.5% few-shot.
  • Scale Dependency: Ablations across 422M, 2B, 8B, 68B, and 137B parameters reveal that instruction tuning hurts zero-shot generalization on unseen tasks for models parameters. The positive transfer emerges only at scale ( and ).
  • Instruction Importance: Finetuning with no instruction templates (input-output only: 37.3% 4-cluster average) or dataset names only (46.6%) yields significantly worse zero-shot performance than natural instructions (55.2%).
  • Prompt Tuning Compatibility: Parameter-efficient prompt tuning applied to FLAN yields higher SuperGLUE accuracy than when applied to the untuned LaMDA-PT base model, especially in 32-example low-resource regimes.

Limitations and open questions

  • Sentence-Completion Tasks: Instruction tuning yields minimal benefit (and sometimes hurts) on language modeling-style tasks where instructions are redundant, such as Winogrande or sentence completions in commonsense reasoning.
  • Instruction Complexity: The paper only investigates short, single-sentence instructions rather than long, elaborate prompt guidelines typically given to human raters.
  • Context Window & Compute: FLAN's 1024-token context length prevented rigorous evaluation of summarization tasks. Furthermore, running and serving a 137B parameter dense model requires high compute resources.

Key terms

instruction tuning
Finetuning a pretrained language model on a diverse collection of datasets formatted using natural language instruction templates to improve generalization to unseen tasks.
FLAN
Finetuned Language Net; the 137B parameter instruction-tuned model based on the LaMDA-PT decoder-only architecture.
task clusters
Groupings of NLP datasets by task type (e.g., NLI, Closed-Book QA) used to enforce strict leave-one-cluster-out evaluation splits for zero-shot testing.
LaMDA-PT
A 137B parameter dense, left-to-right, decoder-only transformer pretrained on 2.49T tokens of web documents, code, Wikipedia, and dialog data.
classification with options
An output formatting strategy where an 'OPTIONS:' token followed by possible candidate classes is appended to classification prompts to direct free-text generation.
examples-proportional mixing
A dataset weighting strategy during multitask training where dataset sampling is proportional to size up to a specified maximum mixing cap (3,000 examples).
data contamination analysis
A post-hoc evaluation measuring pretraining corpus n-gram overlap with benchmark test sets to verify that performance gains are not due to memorization.

Questions

How does instruction tuning differ from standard multitask finetuning?

Traditional multitask finetuning aims to optimize performance across the specific training tasks or adapt to new domains. Instruction tuning uses natural language instructions to train the model to understand task descriptions, targeting zero-shot generalization on unseen task types held out entirely during training.

Why does instruction tuning hurt performance on smaller language models?

For models with 8B parameters or fewer, learning roughly 40 distinct instruction-tuning tasks appears to consume the model's entire parameter capacity, degrading unseen task generalization. Only at and 137B parameters does the capacity allow learning both task execution and general instruction-following.

On which tasks does FLAN fail to outperform the untuned base model?

Instruction tuning shows little benefit on tasks formulated directly as language modeling completions, such as coreference resolution (e.g., Winogrande) and sentence continuation commonsense benchmarks, where instructional prompts are largely redundant with the base pretraining objective.

How was data contamination handled in the pretraining corpus?

The authors searched for 13-gram overlaps between test examples and the 2.49T-token pretraining dataset, creating clean subsets without collisions. Performance on clean subsets showed no correlation with performance drops, indicating memorization did not drive FLAN's zero-shot gains.

The overview on this page was written by AI from the paper and may contain mistakes. Read the paper for the details.

Read with translation and AI