AutoPrompt: Eliciting Knowledge from Language Models with Automatically Generated Prompts
Paper · 2020 · Taylor Shin, Yasaman Razeghi, Robert L. Logan IV et al.
Summary
A pretrained language model can give the wrong answer because the question was phrased poorly. That possibility makes it hard to use a failed test as evidence about what the system learned during pretraining. AutoPrompt addresses the problem for masked language models, which predict what token belongs in a blank. It turns tasks such as sentiment analysis, natural language inference, and fact retrieval into fill-in-the-blank tests, then uses labeled examples to search for prompts that make the correct answers more likely. The pretrained weights stay fixed throughout.
Each prompt contains the task input, a blank, and a sequence of extra tokens called triggers. The triggers are the same for every example that uses a given prompt. During search, a gradient indicates which vocabulary items are worth trying as replacements for a trigger. The procedure then tests those candidates in the actual prompt. For tasks with abstract labels, such as whether a sentence contradicts another, the authors also train a small classifier to discover tokens that can stand for each class. At test time, the masked language model supplies the token probabilities, and the procedure adds together the probabilities assigned to the tokens associated with each class.
With automatically generated prompts, RoBERTa reaches 91% accuracy on the SST-2 sentiment test set, above the paper’s reference score for fine-tuned ELMo, and 69% accuracy on a balanced SICK-E inference variant. For fact retrieval on the original LAMA test set, prompted BERT reaches 43.3% precision-at-1, meaning the recorded answer ranks first, against 34.1% for the best earlier single-prompt approach. In a related information extraction experiment, prompted BERT ranks the correct object first more often than a supervised relation extractor on sentences expressing real facts. Its performance falls substantially when the authors replace those facts with false ones. The drop shows how much a test with genuine facts can reward answers supported by prior knowledge.
AutoPrompt also gives a way to adapt a shared pretrained system without storing a separately fine-tuned copy for each task. The small-data comparisons favor prompting in some settings, particularly for inference, and the outcome depends on the task and pretrained system. The search still needs labeled examples, can favor frequent answers, and often produces fragments that are hard to interpret. On QQP and RTE, the authors’ preliminary prompts perform close to chance. The study establishes capabilities that particular prompts can bring out and leaves open how much stronger a different test could be.
Deep dive: AutoPrompt: Eliciting Knowledge from Language Models with Automatically Generated Prompts
AutoPrompt searches for tokens that help a pretrained language model fill in a blank for tasks such as sentiment analysis, inference, and fact retrieval. · about 34 minutes to read
The problem and its context
Where a task capability comes from
When a pretrained system succeeds after fine-tuning, the result reflects the combination of pretraining and supervised adaptation. Pretraining supplies the starting weights. Fine-tuning changes those weights using examples from the task. A high score at the end shows that this combination can solve the task. The paper asks an earlier question in that sequence. How much of the capability was already accessible before the weights changed? The authors situate the question in the success of pretrained systems such as ELMo and BERT.
The distinction is easy to see in a review classification task. A system exposed to review text during pretraining might already use cues that distinguish enthusiasm from disappointment. A supervised classification procedure can also learn useful associations from the labeled reviews it receives later. Accuracy after adaptation leaves both explanations available. The question matters for interpretation because a researcher who wants to study pretraining needs a test whose success depends as directly as possible on the pretrained system’s own predictions.
The paper discusses two common approaches to that question. One uses a probing classifier, a small supervised predictor that takes the pretrained system’s internal representations as features. If the probe predicts a property from those representations, then the combination of the features and the classifier carries information useful for the task. The interpretation depends on what the classifier can learn from its training examples. A flexible enough readout can raise the score even when a stronger claim about the original system’s knowledge would be unwarranted. The authors discuss work that raises this issue through control tasks and minimum description length.
The other approach inspects internal attention patterns. Attention scores describe how strongly a computation weights different positions. A pattern can line up with a researcher’s linguistic interpretation while leaving open whether it explains the system’s prediction. The paper places that concern within the debate about attention as explanation and its response. The authors also point out that an analysis framed around predicting a simple property of a token or sequence can be awkward for some kinds of knowledge. A factual object, for instance, can be tested through the answer to a question expressed in text.
Using the pretrained prediction task
Prompting makes use of a prediction the system already knows how to produce. For a masked language model, that prediction is a distribution over tokens at a hidden position. A prompt provides the visible material around that position. The authors describe earlier examples of the broad idea in summarization, where a short cue at the end of an article invites a continuation, and in knowledge base completion, where a manually written sentence with a missing term asks for a fact. The summarization example uses continuation and the fact test uses a blank. Both put the task into a form that the pretrained system can score or complete directly.
In the factual probe introduced by Language Models as Knowledge Bases?, a fact has a subject, a relation, and an object. Given a person and the birthplace relation, the missing object is a place. A researcher can insert the person’s name into a sentence frame that expresses birthplace and use the frozen system’s preferred completion as the answer. The subject varies with the fact being tested. The wording of the frame tells the system which property of that subject to supply. A usable test therefore depends on the wording as well as on the subject and answer.
The paper treats a successful prompt as evidence for a lower bound. If the frozen system recovers a set of correct answers through a given interface, those answers are demonstrably accessible through that interface. Other prompts may make additional answers accessible. The asymmetry is important. A success gives a concrete example of what the prediction system can do under specified conditions. A failure can result from the wording, the choice of answer token, or the underlying task difficulty. Researchers need to account for that ambiguity before using a score to characterize the system’s knowledge.
Why hand-written prompts are hard to evaluate
A person can usually formulate a plausible birthplace question. Other relations can be harder to specify concisely, and classification tasks create a separate problem about how an abstract category should appear in ordinary text. An inference dataset can assign a pair of sentences the category neutral. The person writing the prompt still has to decide what sort of blank a neutral pair should produce and which completion will count as evidence for that outcome. The choice can govern the result even when the input and reference label are held constant.
Earlier work had already made prompt construction more systematic. The authors describe LPAQA as generating factual prompts through Wikipedia mining, paraphrasing, and contributions from people. Those sources broaden the range of candidate expressions for a relation. The paper also mentions work that relied on hand-written prompts alongside semisupervised learning for few-shot learning. In each case the way the question is expressed is part of the experimental design. The factual comparison most directly related to AutoPrompt is LPAQA, while the classification example comes from Exploiting Cloze-Questions for Few-Shot Text Classification and Natural Language Inference.
AutoPrompt shifts the choice toward the frozen system’s behavior on labeled examples. The output may be an ordinary phrase, a collection of topical cues, or a sequence that makes little sense to a human reader. What matters to the search is how the sequence changes the probability assigned to the labeled answer. The authors adapt a gradient-based search from earlier work on universal trigger tokens. They use the search to find a task-level input pattern that helps the frozen system produce the desired answers across examples.
This gives the paper a common experimental question across several tasks. How far can a frozen predictor get if the researcher learns how to present the input and how to interpret its completions? The question encompasses reviews, pairs of sentences, and factual objects because each can be expressed as a problem with an input and an answer. Their differences still matter. A review needs a mapping from completions to sentiment classes. A fact can use its object directly if it fits the output vocabulary. A sentence about a fact also introduces a choice between relying on the supplied text and relying on information associated with the subject.
The method, step by step
Put the input and the answer in the same format
Start with an example from the original task. For sentiment, it is a review. For natural language inference, it is a pair consisting of a premise and a hypothesis. For fact retrieval, it includes a subject and the identity of the relation being queried. A template determines where the input goes, where the trigger tokens go, and where the system must fill in a blank. A token is a unit in the system’s vocabulary. It can correspond to a word, a fragment of one, or another symbol, depending on the system’s tokenization.
The paper uses [T] for a place reserved for a trigger in the template. The search fills each of these positions with a vocabulary item. It uses [P] to identify the prediction position in the template, which becomes the special [MASK] token in the completed prompt. This distinction is useful during search because the trigger positions also start out filled with [MASK]. The template identifies which blank supplies the answer even when the input contains several instances of that symbol.
The paper calls the original input x_inp, the ordered trigger sequence x_trig, and the completed input to the masked predictor x_prompt. The template is λ. It specifies how to place the input sequences and triggers around the prediction position, along with any fixed material. Changing the review changes x_inp. Changing the triggers changes the prompt for every review that uses that template. Learning a sequence that works across examples is the point of sharing the triggers.
For a factual query, the template places the subject before the trigger slots and the prediction slot. The relation determines which learned trigger sequence to use. The object is the target during search and the answer to recover at test time. For relation extraction, the authors add a sentence expressing the relation before the subject and the rest of the prompt. The sentence supplies potential evidence about the object, while the subject and learned trigger sequence indicate what to look for.
For classification, the completed input can contain everything the dataset asks the system to consider and still leave the answer mapping unresolved. The word that naturally fits a blank about a movie could describe its acting, story, or pacing. The task wants a sentiment decision. AutoPrompt defines a set of vocabulary items for each sentiment and reads their collective probability as the evidence for that class. Inference uses the same device for relations between the premise and the hypothesis.
How AutoPrompt learns and uses a prompt
The steps in order.
Turn completions into class scores
A forward pass through the frozen predictor produces a distribution over vocabulary items at the designated blank. An entity that is itself the answer can be evaluated directly through its place in this distribution. For an abstract class, the authors sum the probability of each associated label token. They express that sum as follows.
p(y | x_prompt) = ∑_{w ∈ 𝒱_y} p([MASK] = w | x_prompt)
Here p denotes probability and | means “given.” The class is y, and x_prompt is the complete input to the masked predictor. [MASK] refers to the completion at the designated prediction position. The symbol w denotes a vocabulary token, 𝒱_y is the set assigned to the class y, and w ∈ 𝒱_y means that the token belongs to that set. The summation symbol ∑ tells the reader to add the probabilities across all those tokens. The equals sign on the left states the task’s class-scoring rule. Inside the probability on the right it identifies the event that the blank is filled by w.
This sum, called marginalization, lets several completions support the same answer. If different positive expressions are plausible for different reviews, they can all contribute to the positive score. A token outside the chosen sets can receive a high completion probability without being a candidate class answer. The decision compares the sums for the task labels. For factual ranking, the token distribution itself is the item being evaluated, since the target object already corresponds to a vocabulary entry.
A trigger and a label token play different roles. The trigger is visible in the input and influences the answer distribution. The label token is one of the possible outcomes at the blank and contributes to the interpretation of that distribution. The paper’s design lets a task choose several label tokens even if the number of trigger slots stays fixed. That independence allows the authors to vary both choices and see which matters more for sentiment performance.
Choose tokens for abstract labels
For fact retrieval and relation extraction, the object supplies the target token. Sentiment and inference require an additional decision. A class name is convenient for the person reading a dataset, but its literal vocabulary entry may receive little probability in a blank. AutoPrompt uses labeled examples to identify tokens that fit the pretrained system’s own output geometry. This stage starts with an input containing a designated mask and obtains its context-dependent representation from the frozen encoder.
h = Transformer_enc(x̃)
In this expression, x̃ is the token sequence with the prediction position masked. Transformer_enc denotes the pretrained Transformer encoder, and the parentheses indicate that the sequence is passed to it. The output h is the sequence of contextual representations, one for each token position. The equals sign identifies that output with the result of running the encoder on x̃. A contextual representation is a vector whose values depend on the surrounding input, so the vector for the blank can differ from example to example.
The authors take the representation at the prediction position and train a logistic classifier to predict the labeled category. Each class receives a learned weight vector and a bias. The classifier’s output takes the following form.
p(y | h⁽ⁱ⁾) ∝ exp(h⁽ⁱ⁾ · y⃗ + β_y)
Here p(y | h⁽ⁱ⁾) is the classifier’s probability for class y given the vector h⁽ⁱ⁾. The superscript i selects the position of the prediction mask in h. The weight vector for class y is y⃗, and β_y is its learned bias. The dot · is a dot product, which sums products of corresponding vector components. The plus sign adds the bias to that score. exp takes the exponential, and ∝ means the resulting value is proportional to the probability. Normalization over the available classes turns those positive values into a distribution.
Once the classifier has learned those class weights, the authors substitute the masked predictor’s output word embedding for a vocabulary item in place of the contextual vector. The aim is to see which vocabulary items score highly under the same learned class readout. This produces a score for each pairing of a word and a label.
s(y, w) = p(y | w_out)
The notation s(y, w) is the score for using token w to represent class y. The vector w_out is the masked predictor’s output embedding for that token, and p(y | w_out) is the logistic classifier’s probability for class y when it receives w_out. The equals sign defines the score by that substitution. The input to this scoring pass is a token vector from the vocabulary. The classifier was originally trained on vectors at the blank in actual task examples.
The intuition concerns the directions picked out by the vectors. A context that favors a particular completion has a representation compatible with that completion’s output vector. In the logistic classifier, a context that supports a class has a representation with a high score for that class’s weight vector. The substitution looks for output vectors that align with the learned class direction. For a fixed word vector, the expression before normalization is proportional to the classifier score.
s(y, w) ∝ exp(w_out · y⃗ + β_y)
The terms s(y, w), w_out, y⃗, and β_y retain their definitions as the token’s class score, its output embedding, the class weight vector, and the class bias. The dot product · measures the alignment used by the classifier, the plus sign includes the class bias, and exp takes the exponential. The proportionality sign ∝ reflects the class normalization for this word. The probability definition in the preceding formula specifies the score used when comparing different words.
The procedure then sorts vocabulary items by this score for each class and keeps the highest-ranked ones.
𝒱_y = top-k_{w ∈ 𝒱} [s(y, w)]
Here 𝒱 is the predictor’s full vocabulary, w ∈ 𝒱 means that w ranges over its tokens, and s(y, w) is the classifier-derived score for class y. The operator top-k returns the k items with the largest scores, where k is the chosen number of tokens per class. The square brackets enclose the quantity used to rank them. The equals sign sets 𝒱_y to those returned tokens. This use of k concerns label set size. The trigger search also has a shortlist size, which is a separate setting.
The classifier serves as a vocabulary selection device. Once it has supplied the label sets, predictions come from the frozen model’s completion probabilities and the sum over each class’s tokens. This distinction matters to the paper’s claim about parameters. The sentiment and inference setups use a classifier with learned weights during construction. The final task predictor uses the selected tokens and the original prediction head, with no additional classifier weights needed for test examples.
Search for a better trigger one position at a time
The search begins with mask tokens in the trigger slots. It selects a position to update and seeks a replacement that increases the likelihood of the reference label across training examples. Trying every vocabulary item with a full evaluation would require repeatedly running the predictor on modified inputs. A gradient provides a way to judge which items merit that expense. It describes how a small change in the input embedding at the chosen position would affect the current log probability of the correct class.
Tokens themselves are discrete choices. The search takes its derivative with respect to the continuous input embedding representing the current token at that position. It then uses a first-order approximation, which estimates the effect of a change using the local slope, to rank the embeddings of possible replacements. For a fixed position and current prompt, the contribution of the old token’s embedding is common to all substitutions. The ranking therefore depends on the dot product of the candidate embedding with the gradient.
𝒱_cand = top-k_{w ∈ 𝒱} [w_inᵀ ∇ log p(y | x_prompt)]
Here 𝒱_cand is the candidate set. The token w ranges over the vocabulary 𝒱, and w_in is its input embedding. The superscript ᵀ denotes the transpose, so the product with the gradient is a dot product. The operator ∇ takes the gradient with respect to the input embedding of the current trigger x_trig⁽ʲ⁾, where j is the trigger position being updated. The function log is the logarithm, and p(y | x_prompt) is the probability assigned to the correct label y for the current prompt. The bracketed term is the approximate ranking score. The top-k operator returns the k vocabulary items ranked highest by that score, and the equals sign identifies those items as 𝒱_cand.
A first-order estimate reflects the slope around the current embedding. The candidate token can sit far away from that embedding, so its actual effect may differ from the estimate. AutoPrompt tries the shortlisted replacements in the chosen position and reruns the predictor for each. It calculates the actual label probability for the updated prompts and carries forward the strongest candidate. The paper puts the work of obtaining the shortlist at approximately the cost of a forward and backward pass, followed by k forward passes for candidate evaluation. No weight update to the pretrained predictor follows the backward pass.
In the reported experiments, a batch of training examples supplies the gradient for proposing replacements. A separate batch supplies the scores used to choose among those candidates. After each iteration, the authors check the current prompt against withheld development data. They retain the best prompt observed during the search, so the final selection can come from an earlier iteration. A separate test set then measures task performance. The general procedure describes development selection by label likelihood, and the inference setup specifies development accuracy for choosing the best prompt.
The experiments use BERT-base, with 110M parameters, and RoBERTa-large, with 355M parameters. The authors use their pretrained weights and PyTorch implementations from the Transformers library. The task and the frozen predictor both matter to the search, since different predictors can assign different completion probabilities to the same text. The authors released the implementation and datasets for reproducing their experiments.
Experiments and results
Sentiment on movie reviews
The sentiment experiments use SST-2, the binary task derived from the Stanford Sentiment Treebank, with its standard training and test splits. Each input is a review text with a positive or negative reference label. The authors construct a manual comparison prompt before running AutoPrompt. It puts a short evaluation of the movie after the review and leaves the evaluative term blank. The negative and positive answers are represented by terrible and fantastic, respectively. This gives the manual baseline a template and answer choices informed by the subject matter.
For AutoPrompt, the authors use the same template design for identifying label tokens and initializing prompt search. They try replacement shortlists of 10 and 100 tokens, label sets of 1, 3, and 5 tokens per class, and trigger lengths from 3 to 6. These settings control different parts of the procedure. The shortlist changes the number of substitutions considered through full evaluation. The label set size changes how many completions can support a prediction. The trigger length changes how much of the input sequence the algorithm can choose. The paper reports that the grid search required 2 days on 8 NVIDIA 2080Ti GPUs.
The test metric is accuracy, the fraction of reviews given the reference sentiment label. Besides manual prompts, the paper compares with supervised classifiers and reference scores from GLUE. It also trains a linear probe using the coordinate-wise average of the frozen representations for the input tokens. Such a probe compresses the sequence to a single vector and learns a classifier on top. It provides a point of comparison for the strategy of asking the pretrained output head to fill a blank.
RoBERTa with AutoPrompt reaches 91% accuracy on the SST-2 test set. The paper reports this as better than the fine-tuned ELMo reference and describes it as comparable to fine-tuned BERT. Prompted BERT reaches performance comparable to a supervised bidirectional LSTM, a recurrent classifier that processes the input in both directions. The automatically generated prompts are more effective than the hand-written prompt in these experiments.
The better-performing RoBERTa trigger sequence illustrates the gap between a plausible human prompt and one found by search. It includes an atmosphere cue and a dialogue cue, along with a capitalized item and other tokens that do not form a normal evaluative phrase. The review still provides the content to classify. The inserted tokens change the distribution of plausible continuations in a way that makes the class score more useful. The score supports the effectiveness of that input pattern, while the lexical choices alone provide little explanation of its effect.
Inference between two sentences
Natural language inference asks how a hypothesis relates to a premise. With entailment, the premise supports the hypothesis. With contradiction, the two are incompatible in the relevant reading. A neutral pair leaves the hypothesis undetermined. The authors use the entailment portion of SICK, which contains around 10,000 annotated sentence pairs. In the standard data, 56.7% of instances carry the neutral label. A classifier that always chooses neutral therefore has a strong starting score without using the relationship between the two sentences.
The paper examines the standard dataset and two balanced variants. The 2-way variant retains contradiction and entailment. The balanced 3-way variant includes neutral as well. This design lets the authors ask whether the prompt can distinguish the opposed classes with the neutral option removed and how it fares when the full set of categories has equal representation. The automatic label-token selection stage is used in these experiments because the words that name the classes are an uncertain guide to which tokens will work in the prediction slot.
For the SICK-E search, the authors try candidate shortlists of 10 and 50, label sets of 1, 3, 5, and 10 tokens per class, and trigger lengths from 1 to 5. They select using development accuracy. On the test variants, AutoPrompt clearly exceeds the majority baseline in the paper’s comparisons. On 2-way SICK-E its performance is comparable to that of supervised fine-tuned BERT. Against linear probes applied to the averaged frozen representations, the paper reports comparable or higher accuracy for the prompted systems.
The paper reports 69% accuracy for prompted RoBERTa on a balanced SICK-E variant. This result is an overall accuracy, which answers how often the selected category matched the reference. The authors also study precision by label on the balanced 3-way test. Those measurements ask a different question about the reliability of predictions for each individual category. They reveal differences that are easy to miss when entailment, contradiction, and neutrality are combined into a single accuracy score.
Adaptation with fewer labeled examples
The authors also ask whether prompt search is practically competitive when the training set is small. They draw random training subsets of 10, 100, and 1000 examples for SST-2 and use the same experimental procedure for the balanced 3-way SICK-E task. The reported metric is development accuracy. The subset is used for training, while development examples provide a common basis for comparing adaptations on material outside that subset. The experiments compare AutoPrompt with fine-tuning the corresponding pretrained system using the same training data.
AutoPrompt uses 10 trigger slots, 3 label tokens per class, and a replacement shortlist of 10 in this comparison. For fine-tuning, the authors follow a recommended small-data schedule. It runs for 20 epochs, or passes through the training data, using AdamW with bias correction. The learning rate rises linearly to 2e-5 during the first 10% of iterations and then declines linearly to 0. The authors repeat the experiment 10 times with random training subsets and also vary the seed for the fine-tuned condition.
The comparison tracks the average as well as the highest and lowest development accuracies observed across runs. That matters when fine-tuning can produce failed runs. A good outcome on one favorable draw would reveal little about reliability on another draw. The paper’s reported results are from the revised experiment, which corrected a bug in the conference version. Its discussion describes fine-tuning as stronger on sentiment overall in the small-data comparison and identifies inference as the clearer case for prompting.
On balanced 3-way SICK-E, AutoPrompt is comparable to fine-tuned BERT and does substantially better than fine-tuned RoBERTa in the paper’s account of the low-data experiment. The authors highlight improved average performance with only 10 examples and more stable prompted RoBERTa results across sample sizes. The practical claim is specific to such comparisons. A prompt stores a small task-specific artifact that can be used with the same pretrained weights across tasks. The relative accuracy still has to be measured for the task, data size, and pretrained system in question.
Retrieving facts from a subject and a relation
LAMA provides facts as triples. For each triple, the subject can be supplied explicitly and the relation communicated through the prompt. The object is the correct completion. The paper calls the existing LAMA test set Original. It compares AutoPrompt with LAMA’s manual prompts and with LPAQA’s alternatives, which include prompts mined from text and an ensemble that combines predictions from several prompts for a relation.
To assemble search data for this evaluation, the authors gather at most 1000 facts per relation from T-REx for the 41 LAMA relations and supplement relations that are short of 1000 with facts from Wikidata. They exclude T-REx triples present in the Original test set and use an 80-20 split for training and development. This gives the prompt search labeled examples of the relevant relations while reserving different triples for evaluation. The authors also create a 60-20-20 training, development, and test split from T-REx triples to evaluate prompts when the search data and test examples come from the same distribution.
The factual prompts use 5 or 7 triggers, and the authors choose search parameters on the T-REx development set. They exclude proper nouns and tokens that appear as training-set objects from the trigger vocabulary. This prevents a relation’s learned prompt from directly supplying those candidate answers through its trigger slots. For example, a prompt shared across a birthplace relation is supposed to help the system use the named person to select a place. Inserting a common gold object into the shared trigger sequence would give it an additional route to that answer.
The evaluation records the rank of the gold object as a completion. Precision-at-1, abbreviated P@1, credits an example when that object is ranked first. Precision-at-10, or P@10, credits it when it is within the first 10 positions. Mean reciprocal rank averages the reciprocal of the gold object’s rank, so it gives more weight to moves near the top of the ranking. Taken together, these measures distinguish the ability to make the right answer the top completion from the ability to place it among plausible alternatives.
Single-prompt fact retrieval with BERT on Original LAMA
AutoPrompt places the recorded object first more often than the earlier single-prompt approach.
The numbers
| System or setting | P@1 % |
|---|---|
| LPAQA, best single prompt | 34.1 |
| AutoPrompt (this paper) | 43.3 |
On the Original LAMA test set, BERT with AutoPrompt attains 43.3% P@1 against the earlier single-prompt result of 34.1%. The paper reports improvements of up to 12 points in P@1 over earlier prompting methods and an advantage of approximately 4 points over the LPAQA ensemble, which averages predictions from up to 30 prompts. AutoPrompt uses one learned sequence for each relation. The paper also reports higher mean reciprocal rank and P@10 for the automatically generated prompts in the BERT comparison on Original LAMA.
The ranking results support a specific interpretation. More held-out objects become retrievable from the same frozen predictor when the question is expressed with the searched trigger sequence. The use of held-out triples checks whether the shared prompt works beyond the exact facts used to find it. The separate T-REx evaluation addresses the distribution of the search and test data. Its setup helps distinguish a question about what a prompt can recover within a source of facts from a question about how well the prompt carries over to the original benchmark.
Recovering an object from a sentence about it
The relation extraction experiment adds a sentence that mentions the subject and object. It uses T-REx because its facts are paired with contexts containing surface forms of those entities. A surface form is the wording that appears in the sentence, which can differ from the object’s canonical name in the fact record. The evaluation accepts the canonical object or a recorded rendering from the fact’s contexts. This matters when a sentence expresses the entity by an adjective or variant name that would otherwise be scored as a different answer.
The task supplies the subject and the relation and asks for the object. The supervised comparison system uses a recurrent relation encoder with an attention mechanism and produces a knowledge graph of extracted triples. A graph edge represents a relation linking a subject to an object. To align the comparison with the prompted task, the evaluation queries the extracted graph by the given subject and relation and picks the object from the highest-confidence matching triple. The scores are averaged across relations.
The evaluation also accommodates the supervised extractor’s coverage. It keeps only relations covered by the system’s training inventory and sentences in which its named entity extractor successfully found both the subject and the object. The study adapts the handling of relation predictions for the supplied-relation task. These choices give the benchmark a narrower scope than a test of end-to-end relation extraction from arbitrary sentences, since the subject and relation are already part of the query and the entity recognition filter determines which sentences remain eligible.
AutoPrompt is compared with LAMA and LPAQA prompts used in the same setting, as well as with the supervised extractor. BERT performs best among the systems the authors discuss for the original sentences, and RoBERTa also exceeds the supervised comparison. The metric is mean P@1 across relations. The authors describe the improvement from AutoPrompt as up to a 33% increase on this task. They observe relation-specific cues in the learned triggers, including vocabulary associated with brands and manufacturers in queries about who produces a product.
The authors then replace the object in test facts with a randomly chosen alternative and make the corresponding edit to the context sentence used in the prompt. The expected answer becomes the substituted object. The perturbed data are used to generate the prompts again. The supervised extractor’s performance changes little according to the paper. Both prompted masked predictors perform substantially worse with the altered sentences, although BERT with AutoPrompt still does better than BERT with the LAMA and LPAQA prompts in this condition. The contrast gives the paper a way to examine what its strong original-sentence score measures.
What the ablations show
More ways to express a label helped sentiment classification
The appendix varies two choices in the SST-2 setup: the size of each label set and the number of trigger tokens. It keeps the replacement shortlist fixed at 100 and reports the same broad trends with a shortlist of 10. The comparison uses validation accuracy. Holding the shortlist size fixed during the main comparison makes it easier to see whether the prompt benefits more from extra positions in its input or from a broader set of completions for each class.
Increasing the number of label tokens from 1 to 3 produces a substantial gain. According to the paper, validation accuracy rose by about 5% for BERT and about 10% for RoBERTa. Varying the number of trigger tokens has relatively little effect across the tested settings. The comparison locates a source of improvement in the way the method converts vocabulary predictions into task decisions. Several usable completions can collect evidence that a single privileged completion misses.
The authors also inspect the tokens chosen for sentiment. RoBERTa’s selected positive vocabulary includes an admiring adjective and a fragment associated with philanthropy. Its negative vocabulary includes terms associated with worsening and incompetence. Some individually intelligible label tokens occur alongside triggers whose combined meaning is obscure. The analysis distinguishes the readability of the candidate answers from the readability of the query. Because larger sets include additional tokens in the order ranked by the classifier, it remains unclear how much of the improvement is due to the specific alternatives chosen.
Contradiction was easier to identify than neutrality
The authors compare per-label precision on the balanced 3-way SICK-E test. For this metric, the denominator is the set of examples predicted as a given class. A high contradiction precision means that a prediction of contradiction is frequently correct. Recall would ask how many of the true contradictions received that prediction. Equal representation of the reference labels helps contextualize the precision comparison, while the actual frequencies of the system’s predictions can still differ.
AutoPrompt label precision on the balanced 3-way SICK-E test set
Contradiction predictions are the most precise for both pretrained systems.
The numbers
| System or setting | Precision % |
|---|---|
| BERT, contradiction | 74.9 |
| BERT, entailment | 54.4 |
| BERT, neutral | 36.8 |
| RoBERTa, contradiction (this paper) | 84.9 |
| RoBERTa, entailment | 65.1 |
| RoBERTa, neutral | 57.3 |
BERT records 74.9% precision for contradiction, 54.4% for entailment, and 36.8% for neutral. RoBERTa records 84.9%, 65.1%, and 57.3%, respectively, on the same balanced test. Both systems rank the classes in the same order by precision. The authors observe that the selected contradiction tokens are easier to interpret as answers for that relation than the tokens for entailment or neutrality. The results are consistent with the possibility that classes with readily available lexical cues are easier to elicit through a masked token.
The class analysis is observational. It compares the categories and examines the chosen tokens, leaving both the meaning of the category and the output mapping in play. A direct test of the label-token explanation would have to vary how the categories are represented while keeping the underlying examples comparable. Here the evidence is an association between more interpretable tokens and higher precision. It gives a concrete account of where the overall score is strongest and a hypothesis about the output vocabulary’s role.
Factual prompts varied more by relation than by length
The fact retrieval experiments compare 5 and 7 trigger positions. The longer setting produces slightly higher scores, and the authors describe the difference as small. That pattern is compatible with the sentiment analysis, where changing trigger length within the tested range mattered less than some other design choices. The experiments establish that the method works across those tested lengths. Prompt length outside those settings and the number of positions needed for a particular relation remain open questions.
The relation breakdown explains why a single average can conceal differences in what the search achieves. A hand-written birthplace prompt is already a concise way to request a particular place associated with a person. The manual baseline is competitive for such relations. The relation for a position played on a team is more awkward. A standard word such as position can fit many contexts. AutoPrompt discovers a cluster of sports terms, including references connected to striking or fielding, that cues a narrower type of answer even when the resulting prompt is ungrammatical.
The authors also compare BERT and RoBERTa on a common subset of the Original test set. The starting benchmark restricts objects to single tokens for BERT. The authors apply the same single-token requirement for RoBERTa to create the shared subset, called Original-RoBERTa. Both systems then face the same eligible examples, using AutoPrompt with 5 triggers. BERT performs slightly better in this comparison. The authors observe apparently irrelevant material more often in the RoBERTa prompts, including punctuation in a sports-related query. That observation describes the prompts the search found. Their scores measure which objects each system could recover under its own learned prompt on the shared subset.
The edited sentences separate some of the sources of success
An original relation extraction sentence gives the model two possible ways to arrive at the expected object. It can use the information written in the sentence, or it can produce an object already associated with the subject and queried relation. Both routes give the same result when the context states a known real-world fact. The edited condition makes those sources of evidence disagree by pairing the same kind of query with a sentence that supplies a different object.
The relatively stable performance of the supervised extractor and the drop for prompted BERT and RoBERTa show that the two approaches respond differently to the change. The authors interpret the drop as evidence that background factual knowledge contributes substantially to the masked predictors’ original scores. The fact that AutoPrompt retains an advantage over the earlier prompts for BERT on the edited set also shows that the benefit of trigger search extends to a more demanding setting, where the answer supplied in the sentence can conflict with a familiar association.
The procedure regenerates prompts on the perturbed data. Its comparison therefore asks how well each prompting method works in the altered condition after search, instead of measuring the reaction of one fixed prompt to an isolated word change. The object replacement also creates deliberately artificial examples. The findings identify a dependence on the consistency of the supplied sentence with background associations. They leave room for several factors in any individual prediction, including how plausible the replacement is in its sentence and whether the learned prompt makes the relevant relation easy to recover.
Limitations
Limits the authors identify
AutoPrompt requires labeled examples for search. The trigger update needs a target whose probability can be increased, and the optional procedure for selecting label tokens needs examples to train its classifier. Manual prompting can start from a person’s knowledge of the language and the domain. AutoPrompt trades some of that design effort for supervision and computation. The balance is attractive where usable annotations exist, while a task with no labels falls outside the demonstrated search procedure.
The authors also identify interpretability as a limitation of the generated prompts. A person can ordinarily inspect a manual template and describe how its wording specifies the relation or judgment being tested. A sequence chosen for its effect on completion probabilities may contain fragments, punctuation, or topical words with unclear individual roles. A high score establishes that a prompt works on the measurement used. Understanding why a particular sequence works requires further analysis of the system’s behavior.
Imbalanced labels can lead the search toward a shared sequence that increases the probability of a frequent answer. Because the triggers are used across examples, increasing that answer’s probability can improve the training objective without making the system much more sensitive to individual inputs. The authors point to this risk in inference and factual retrieval and describe rebalancing as a partial remedy. The balanced SICK-E variants give a direct view of performance when neutral dominates less of the evaluation.
The search is greedy. It evaluates a local change, accepts a candidate, and continues from the updated sequence. The available vocabulary makes the space of complete trigger sequences large. A useful combination can require changing several positions together even when each individual change looks unpromising at the current point. The authors describe the procedure as sometimes brittle and leave alternatives to that search strategy for future work.
Finally, some tasks remain hard to elicit with either hand-written or automated prompts. Preliminary experiments on QQP and RTE produce scores close to chance. The authors caution against interpreting those scores as evidence that BERT lacks the relevant paraphrase or entailment abilities. They present AutoPrompt as one method for studying how pretrained systems behave. They also suggest that a version for autoregressive predictors could put the prediction position at the end. The experiments in the paper concern masked prediction, so the suggested extension is a direction the method could take.
Limits visible in the experimental design
The output format determines which answers the factual test can recognize. An object must fit the masked prediction setup, and the Original LAMA test already selects for objects that are single tokens for BERT. The requirement that both systems represent an object in a single token further narrows their direct comparison. A strong P@1 result describes ranking on those eligible objects. It leaves open what would happen with longer names, alternative segmentations, or tasks that require a free-form answer.
Holding the pretrained weights fixed makes a strong distinction between what happens during prompt construction and what happens during fine-tuning. There is still supervision in the experiment. The labels guide the trigger choices, the development data guide model selection at the level of the prompt, and the sentiment and inference tasks use trained classifier weights to discover a mapping from tokens to classes. The reported scores demonstrate what the frozen system can do through this learned interface. They give no direct account of how it would respond if someone presented the same problem without that preparation.
The factual data splits address overlap between triples used for prompt search and triples used for testing. The experiment deliberately asks what is available from a pretrained predictor, so the relationship between the evaluated facts and the pretraining material is a separate question. A correct answer can reflect an association formed from earlier text, an inference based on other information, or a combination. An object’s rank alone cannot identify which history produced the prediction.
The relation extraction test has a supplied subject and relation, an entity-recognition filter for the comparison, and an answer rule that accepts specified surface forms. These details make the reported P@1 meaningful for the task as defined. A system asked to discover all entities and relations in a fresh document faces a different task. The edited-sentence comparison likewise gives evidence of sensitivity to prior factual associations while leaving the size of their contribution underdetermined. The edited examples change the text and the expected answer and can introduce unnatural combinations.
The low-data experiment measures development accuracy over a specified range of training sizes and runs, using selected settings for prompt search and fine-tuning. Its average and extremes show how these procedures behaved under those choices. Their relative reliability can change with the task, as the difference between the sentiment and inference results already illustrates. The storage advantage of retaining task prompts also addresses a different cost from the work required to discover them. The reported sentiment grid search makes that distinction concrete.
What came after
Later work citing AutoPrompt pursued several questions that its discrete search brings into view. One concerns the kind of object a prompt can be. AutoPrompt has to choose an actual vocabulary item for each trigger slot, so its search needs both an approximate ranking and a discrete replacement step. A soft prompt expresses the task input through continuous values. The Power of Scale for Parameter-Efficient Prompt Tuning studies the scale question for a parameter-efficient form of prompt adaptation. Its topic connects to AutoPrompt’s suggestion that a shared pretrained system can serve multiple tasks through small task-specific changes.
Another question is how to represent a factual query. AutoPrompt learns one sequence per relation and shows that it can be competitive with a combination of earlier prompts. Learning How to Ask: Querying LMs with Mixtures of Soft Prompts examines querying through mixtures of soft prompts. It puts the possibility of combining prompts together with the possibility of representing them continuously. The connection is particularly direct for fact retrieval, where a query has to call for a specific relationship while still working across different subjects and answers.
The classification comparisons raised a practical question about whether tuning the input can compete with adapting the pretrained weights. AutoPrompt examined that question under small training subsets and found that the answer depended on the task and pretrained system. P-Tuning: Prompt Tuning Can Be Comparable to Fine-tuning Across Scales and Tasks takes that comparison across scales and tasks as its subject. It pursues the adaptation question that AutoPrompt opened alongside its use of prompts as instruments for studying pretrained behavior.
The factual results also make consistency an object of study in its own right. Finding a prompt that recovers a fact gives a positive result under a particular formulation. An evaluation of consistency asks how reliably a predictor maintains its answer as the query changes. Measuring and Improving Consistency in Pretrained Language Models makes that measurement and its improvement the focus. The connection is to the original motivation for prompt search: a conclusion about accessible knowledge can depend heavily on which formulation elicited the answer.
Other work examines what goes into the prompt when examples themselves form part of the input. What Makes Good In-Context Examples for GPT-3? asks how to choose those examples. Fantastically Ordered Prompts and Where to Find Them studies sensitivity to their ordering in few-shot prompts. AutoPrompt uses labeled examples to choose a shared sequence of trigger tokens. The later questions concern the choice and placement of examples that the predictor sees in the prompt. Both lines of inquiry treat the input formulation as a variable that can change what an evaluation reveals.
Pre-train, Prompt, and Predict surveys prompting methods in natural language processing. The range of work in this area gives context to AutoPrompt’s central design choice. One can change the tokens queried, the representation of the prompt, the material included as input, or the interpretation of the output, and each choice can affect the measured capability. AutoPrompt’s contribution was to make two of those choices, the shared trigger sequence and the vocabulary used for abstract labels, amenable to supervised search while keeping the pretrained prediction system fixed.
Institutions
Fields, topics and concepts
Shelves 4The field of science this work belongs to (OpenAlex fields).Computer Science · 19,503 worksArtificial Intelligence · 18,805 worksArts and Humanities · 17,959 worksLanguage and Linguistics · 17,789 works
Topics 1Research subjects and languages the work is about.Language models & pretraining · 4,145 works
Appears in
Mentioned in articles aboutLos Angeles
Cite
Cite as Taylor Shin, Yasaman Razeghi, Robert L. Logan IV, Eric Wallace and Sameer Singh. 2020. AutoPrompt: Eliciting Knowledge from Language Models with Automatically Generated Prompts. Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP).
@inproceedings{shin2020autoprompt,
title = {{AutoPrompt: Eliciting Knowledge from Language Models with Automatically Generated Prompts}},
author = {Taylor Shin, Yasaman Razeghi, Robert L. Logan IV, Eric Wallace and Sameer Singh},
booktitle = {Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)},
year = {2020},
doi = {10.18653/v1/2020.emnlp-main.346},
eprint = {2010.15980},
archivePrefix = {arXiv},
url = {https://doi.org/10.18653/v1/2020.emnlp-main.346}
}References
- Zied Bouraoui, Jose Camacho-Collados, and Steven Schockaert. 2019. Inducing relational knowledge from BERT. In AAAI. our card
- Samuel R Bowman, Gabor Angeli, Christopher Potts, and Christopher D Manning. 2015. A large annotated corpus for learning natural language inference. In EMNLP. our card
- Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. 2020. Language models are few-shot learners. arXiv preprint arXiv:2005.14165. our card
- Alexis Conneau, Germán Kruszewski, Guillaume Lample, Loïc Barrault, and Marco Baroni. 2018. What you can cram into a single vector: Probing sentence embeddings for linguistic properties. In ACL. our card
- Ido Dagan, Oren Glickman, and Bernardo Magnini. 2005. The PASCAL recognising textual entailment challenge. In Machine Learning Challenges Workshop. OpenAlex ↗ · Scholar ↗
- Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: pre-training of deep bidirectional transformers for language understanding. In NAACL. our card
- Jesse Dodge, Gabriel Ilharco, Roy Schwartz, Ali Farhadi, Hannaneh Hajishirzi, and Noah Smith. 2020. Fine-tuning pretrained language models: Weight initializations, data orders, and early stopping. arXiv preprint arXiv:2002.06305. OpenAlex ↗ · Scholar ↗
- Hady ElSahar, Pavlos Vougiouklis, Arslen Remaci, Christophe Gravier, Jonathon S. Hare, Frédérique Laforest, and Elena Simperl. 2018. T-REx: A large scale alignment of natural language with knowledge base triples. In LREC. our card
- John Hewitt and Percy Liang. 2019. Designing and interpreting probes with control tasks. In EMNLP. our card
- Shankar Iyer, Nikhil Dandekar, and Kornel Csernai. 2017. First quora dataset release: Question pairs (https://data.quora.com/First-Quora-Dataset-Release-Question-Pairs). OpenAlex ↗ · Scholar ↗
- Sarthak Jain and Byron C Wallace. 2019. Attention is not explanation. In NAACL. our card
- Zhengbao Jiang, Frank F Xu, Jun Araki, and Graham Neubig. 2020. How can we know what language models know? In TACL. our card
- Sunjae Kwon, Cheongwoong Kang, Jiyeon Han, and Jaesik Choi. 2019. Why do masked neural language models still need common sense knowledge? arXiv preprint arXiv:1911.03024. OpenAlex ↗ · Scholar ↗
- Patrick Lewis, Ludovic Denoyer, and Sebastian Riedel. 2019. Unsupervised question answering by cloze translation. In ACL. our card
- Nelson F Liu, Matt Gardner, Yonatan Belinkov, Matthew Peters, and Noah A Smith. 2019. Linguistic knowledge and transferability of contextual representations. In NAACL. our card
- Ilya Loshchilov and Frank Hutter. 2018. Decoupled weight decay regularization. In International Conference on Learning Representations. our card
- Marco Marelli, Stefano Menini, Marco Baroni, Luisa Bentivogli, Raffaella Bernardi, Roberto Zamparelli, et al. 2014. A SICK cure for the evaluation of compositional distributional semantic models. In LREC. our card
- Marius Mosbach, Maksym Andriushchenko, and Dietrich Klakow. 2020. On the stability of fine-tuning bert: Misconceptions, explanations, and strong baselines (http://arxiv.org/abs/2006.04884). OpenAlex ↗ · Scholar ↗
- Matthew E. Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. 2018. Deep contextualized word representations. In NAACL. our card
- Fabio Petroni, Tim Rocktäschel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, Alexander H Miller, and Sebastian Riedel. 2019. Language models as knowledge bases? In EMNLP. our card
- Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. Technical report. OpenAlex ↗ · Scholar ↗
- Timo Schick and Hinrich Schütze. 2020. Exploiting cloze questions for few-shot text classification and natural language inference. arXiv preprint arXiv:2001.07676. our card
- Vered Shwartz, Peter West, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. 2020. Unsupervised commonsense question answering with self-talk. arXiv preprint arXiv:2004.05483. our card
- Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew Ng, and Christopher Potts. 2013. Recursive deep models for semantic compositionality over a sentiment treebank. In EMNLP. our card
- Daniil Sorokin and Iryna Gurevych. 2017. Context-aware representations for knowledge base relation extraction. In EMNLP. OpenAlex ↗ · Scholar ↗
- Trieu H Trinh and Quoc V Le. 2018. A simple method for commonsense reasoning. arXiv preprint arXiv:1806.02847. our card
- Elena Voita and Ivan Titov. 2020. Information-theoretic probing with minimum description length. In EMNLP. our card
- Eric Wallace, Shi Feng, Nikhil Kandpal, Matt Gardner, and Sameer Singh. 2019. Universal adversarial triggers for attacking and analyzing NLP. In EMNLP. our card
- Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. 2019. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In ICLR. our card
- Sarah Wiegreffe and Yuval Pinter. 2019. Attention is not not explanation. In EMNLP. our card
- Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander M. Rush. 2019. HuggingFace's Transformers: State-of-the-art natural language processing. arXiv preprint arXiv:1910.03771. our card
This page in Markdown https://md.research.elamur.ai/free/en/papers/shin-2020-autoprompt-eliciting-knowledge-language-models/