Quantifying Adaptability in Pre-trained Language Models with 500 Tasks (2022)

Abstract: When a neural language model (LM) is adapted to perform a new task, what aspects of the task predict the eventual performance of the model? In NLP, systematic features of LM generalization to individual examples are well characterized, but systematic aspects of LM adaptability to new tasks are not nearly as well understood. We present a large-scale empirical study of the features and limits of LM adaptability using a new benchmark, TaskBench500, built from 500 procedurally generated sequence modeling tasks. These tasks combine core aspects of language processing, including lexical semantics, sequence processing, memorization, logical reasoning, and world knowledge. Using TaskBench500, we evaluate three facets of adaptability, finding that: (1) adaptation procedures differ dramatically in their ability to memorize small datasets; (2) within a subset of task types, adaptation procedures exhibit compositional adaptability to complex tasks; and (3) failure to match training label distributions is explained by mismatches in the intrinsic difficulty of predicting individual labels. Our experiments show that adaptability to new tasks, like generalization to new examples, can be systematically described and understood, and we conclude with a discussion of additional aspects of adaptability that could be studied using the new benchmark.

## introduction much of the recent research effort in nlp has shifted from training task-specific models to adapting pre-trained language models (lms) by finetuning their parameters or input prompts for downstream tasks @xcite @xcite . this paradigm is general, in the sense that a large number of distinct nlp tasks benefit from pretraining @xcite @xcite . but many questions about the nature and limits of lm adaptation remain unanswered. for example: given a new task, can we predict how quickly (and how effectively) pre-trained lms can be adapted to perform it? from among the variety of different adaptation techniques (e.g. finetuning or prompt-tuning), can we predict which one will be most effective? today, new pre-training and adaptation schemes are evaluated using small suites of curated tasks, typically featuring classification, textual inference, and question answering @xcite . these benchmarks have been extremely successful in identifying new tools for adaptation, but they are poorly suited for answering larger, structural questions like the ones above. we present a large-scale study of lm adaptability using a new suite of benchmark tasks called taskbench500. foot_0 taskbench500 consists of 500 procedurally generated tasks involving lexical semantics, factual information, memorization of random relations, list processing, and logical composition (fig. 1 ). analogous to past work that uses synthetic data to characterize lm performance on single examples @xcite @xcite @xcite , taskbench500 enables systematic study of lm adaptability at the task level. in this paper, we use it to study three aspects of adaptability: memorization: when can adaptation successfully memorize new functions (e.g., to update factual knowledge about entities, or learn arbitrary new token correspondences)? we find that lms' ability to memorize new input-output mappings is strongly influenced by task type. datasets of lexical relations (like antonym pairs) are easier to memorize than factual information (like nameoccupation pairs). both are easier to memorize than lists of random word pairs. these findings are particularly striking in the case of prompt tunwe begin by defining a set of atomic tasks that all synthetic tasks are built upon. these include lexical tasks (blue text/outline), random tasks (green text/outline), and factual tasks (orange text/outline). they also include both predicates and relations. these tasks are combined using composition functions to form more complex, compositional tasks. given a particular task specification, we synthetically create a dataset for each task. finally, we fine-tune or prompt-tune a pre-trained language model on each task dataset. composition: is lm performance on simple tasks predictive of their performance on compositions of those tasks? (if the father and occupation relations are easy to learn via adaptation, does this imply that the father's occupation relation is also easy to learn?) we find a nuanced answer. lms exhibit compositional adaptation to lexical and factual relations (like father's occupation), with success on composed tasks strongly correlated (r 2 > 0.5) with success on atomic tasks. however, when composing these relations with sequence processing operations, success on the base task does not predict success on the composed task. ## a 500-task benchmark our goal is to study the generalizability of task adaptation paradigms. in particular, we would like to identify which attributes of a task make it easy or difficult to learn, across different models and training schemes. while this work shares many of its high-level goals with existing benchmarks built from collections of real-world datasets, the makeup and difficulty of these datasets is often difficult to characterize precisely: differences in annotation standards, annotation quality, and dataset size mean that models often exhibit very different performance on datasets designed to evaluate model performance on the same abstract task. in addition, existing datasets cover an exceedingly small subset of the space of all tasks that future nlp practitioners might wish to perform. to account for all these limitations, we propose to generate tasks synthetically as described below. the space of tasks taskbench500 is constructed compositionally: we begin by defining a space of atomic tasks, which are combined using a set of composition operators to produce more complex tasks. every task takes as input a word or word sequence, and outputs either a boolean value or a set of words/word sequences. we refer to any task that outputs booleans as a predicate task, and any task that outputs sets of words or word sequences as a relation task. a subset of relation tasks involve modeling relations between single words at the input and output; we refer to these as word-level tasks and the remaining relation tasks (that take sequences as input or output) as sequential tasks. the choice of atomic tasks and composition functions aims to capture aspects of real language processing tasks. accordingly, the set of atomic tasks comprises of: to recursively create arbitrarily complex tasks, we define a set of composition functions. these take tasks as arguments and return other tasks. these functions fall into two categories: there are two functions in this category: map takes a word-level relation task and returns a task that maps a sequence of n words to a set of all possible sequences resulting from applying f w to each input word. 2 filter takes word-level predicate tasks and returns a sequence consisting only of words for which the task returns true, preserving the original ordering of those words. the full list of atomic tasks and composition function can be found in appendix tables 4 and 5 . we surmise that typical nlp tasks may require some combination of lexical knowledge, factual knowledge, sequential processing, and other task-specific reasoning; our data distribution lets us evaluate all these aspects separately and in combination. ## experimental setup model & training for all experiments, we adapt a pre-trained t5-base model @xcite . we examine two types of training paradigms: fine-tuning and prompt-tuning. during fine-tuning, we update all model parameters on the training set. during prompt-tuning, we follow @xcite and introduce a new set of prompt-tokens {p 1 , • • • , p n } to the vocabulary, which will be prepended to every sample from the task during inference, i.e., each sample input x becomes p 1 p 2 • • • p n x. let ✓ denote the parameters of the original pretrained lm. during training, the entire model is frozen and only the word embeddings of the new tokens {✓ p 1 , • • • , ✓ pn } ⇢ ✓ are updated. we use prompts of length @xmath0. we also study each paradigm on various quantities of training data, and separately evaluate their memorization and generalization adaptabilities. in particular, for word-level tasks the test-set words are disjoint from the train-set words, so evaluating on the test set will strictly measure generalization capacity. we optimize all models using adamw. see appendix b for full hyperparameters. evaluation for each task f and model m[✓] (with parameters ✓), we measure the model's average per-token accuracy on both training and test splits of the dataset d(f ). as each task defines multiple acceptable outputs for each input, we credit models for producing any acceptable output. letting y 0 = m(x), we measure the fraction of positions i at which any valid answer y i matches the we average over all atomic tasks from each task category: lexical tasks, factual tasks, and random tasks. the shaded region shows the standard error of the mean. transparent lines are each individual task, colored by task category. in both paradigms, lexical tasks are easiest to memorize, followed by factual tasks, then random tasks. however, prompt-tuning has overall much less memorization capacity than finetuning, which can perfectly memorize even completely random relations. further details can be found in appendix b. given a pretrained model m[✓ pretrain ], an adaptation procedure t , and a task suite f , let m[✓ t ,d(f ) ] denote the model trained using t on training data d(f ). we then define the adaptability of a (pretrained model, adaptation paradigm, task suite) as: we denote by adapt mem the value of this metric over training data (d @xmath1, and by adapt gen the metric over test data (d @xmath2. ## memorizing datasets our first experiment investigates the extent to which task adaptation paradigms can memorize different types of tasks. we are interested in memorization because many real nlp tasks involve some degree of memorization. for example, translation builds on memorizing lexical associations between words in various languages, and semantic similarity and paraphrasing require memorizing word meanings and/or groupings of semantically similar words. method we use training-set adaptability (adapt mem ) as an indicator of a model's memorization ability (fig. 2 ). we train on a set of 1000 examples, and plot the value of eq. ( 2 ) on each atomic task as models are adapted via fine-tuning or prompt-tuning. this allows us to visualize both the final training-set performance, as well as the time it took to achieve that performance, both of which we use to quantify memorization ability. ## composing tasks in the previous section, we found that while prompttuning cannot memorize arbitrary tasks like finetuning, it can still generalize well on simple atomic tasks, almost comparably to fine-tuning. in this section we investigate whether this finding extends to more complex tasks. specifically, we examine the behavior of prompt-tuned and fine-tuned models when adapted to compositions of atomic tasks. many prior studies of compositionality focus on instance-level compositionality @xcite : they test whether models can generalize to new instances by combining information from previously-seen instances within the same task. for example, lake and baroni (2018) study whether models can learn to jump left, after learning to jump, run, and run left. in our work, we instead focus on task-level compo-sitionality, studying whether models can adapt to new tasks that are compositions of simpler tasks on which they are known to perform well. thus, while a model exhibiting compositional generalization will correctly compose fragments of previously observed training examples, a training procedure exhibiting compositional adaptability will perform well on tasks involving compositions of previously learned skills. method we study adaptation to complex tasks by relating performance on atomic tasks with performance on depth-2 compositional tasks. we also study each paradigm under few-shot learning, by creating a random 32-sample subset of each training dataset, and training on that subset. to mitigate the effect of the random seed, we report average performance over 4 different subsets. what allows models to adapt to these complex tasks? we hypothesize that their adaptability is (in part) compositional-when they can adapt to simple tasks, they can also adapt to compositions of those tasks. for each training paradigm t and each composition function c, we run linear regression to estimate the pearson correlation coefficient r 2 between adaptability to a compositional task figure 3 depicts the procedure graphically. 3 can language models learn compositional tasks? the average model adaptability to compositional and atomic tasks, under each training paradigm, is reported in figure 3 : left: overview of the composition experiment. we evaluate how well the adaptability on a compositional task can be predicted by the (averaged) adaptabilities of the atomic constituent tasks. right: correlation between compositional adaptability vs. averaged atomic adaptabilities, for the chaining, union, and map composition types, under each training paradigm. on word-level chaining and union compositions, compositional adaptability is observed: composed task performance is highly correlated with atomic task performance (r 2 > 0.5) under all training paradigms. however, on sequential map compositions, all models perform poorly, and thus noncompositionally. this results from challenges in segmenting input sequences; if token boundaries are explicitly marked (map (+separators)), compositional adaptability is again observed. ## learning new distributions previous sections investigated the degree to which models could fit particular tasks using a binary metric that assigned credit to any acceptable answer. our final set of experiments explores a finergrained notion of correctness: when there are multiple acceptable answers, as is often the case in real nlp tasks, when does the output distribution of a model match the distribution empirically observed during adaptation? method we specifically investigate whether models are biased towards predicting "easy" labels, in the sense measured in section 5. we consider all possible pairs of atomic tasks f 1 , f 2 (for which f 1 and f 2 take in overlapping sets of inputs). let f e to be the easier task in this pair and f h be the harder task, relative to a model m and training paradigm t , in the sense that adapt gen (m, t , f e ) > adapt gen (m, t , f h ). we compose f e and f h using union to create compositional task [(f e , f h ), and construct the training dataset for this task to be balanced -such that the model sees an equal number of examples of form (x, f e (x)) as (x, f h (x)). now let m [(fe,f h ) denote a model adapted to this task. during test-time, we provide m [(fe,f h ) with novel inputs x 0 from the domain of both f e and f h , and record the average probability mass it assigns to all y i e 2 f e (x 0 ) versus all y i h 2 f h (x 0 ). 4 finally, we average these datasetwide probabilities over all pairs of tasks, to get an aggregated probability mass assigned to all easier tasks and all harder tasks in a task pair, invariant of the actual underlying task identity. more details on this procedure can be found in appendix d. ## conclusion in this paper, we construct taskbench500, a synthetic task set which serves as a testbed for task adaptability. we focus on three axes of adaptability: ability to memorize, ability to (compositionally) generalize, and ability to fit to novel distributions. we study two adaptation paradigms: finetuning and prompt-tuning, finding that: 1. unlike fine-tuning, prompt-tuning cannot memorize completely arbitrary tasks beyond a small number of examples, 2. all adaptation paradigms demonstrate compositional adaptation to word-level compositions, but not sequence-level compositions, and 3. no paradigm is able to perfectly replicate the downstream distribution-all paradigms learn output distributions that align with its inductive biases. in future work, taskbench500 can be used to study other factors that may affect adaptability, such as length of the prompt in prompt-tuning, similarity between the task distribution and the pretraining distribution, or finer-grained distinctions between tasks (beyond lexical/factual/random, or composition type) that predict task adaptability. taskbench500 can also be used to explore the limitations of prompt engineering on a gpt3-scale model. finally, the current set of tasks and primitives in taskbench500 are by no means complete. future work can expand on these primitives and study the relationships between the tasks put forth here and real nlp tasks.