Paper · 2022-12-08 · cs.CL
Demystifying Prompts in Language Models via Perplexity Estimation
Lower-perplexity zero-shot prompts tend to score better with OPT and Bloom, with negative correlations on most tasks (not IMDB). SPELL paraphrases seed prompts with GPT-3 and backtranslation, then keeps the 3 lowest-perplexity prompts. Author-reported gains over manual prompts: 1.8 accuracy points (OPT) and 2.3 (Bloom).
Prompt engineeringLanguage model surprisalZero-shot learningpromptingperplexityzero-shotprompt-selection
AI-compiled by claude-haiku-5-5 on 2026-11-01, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.
In plain words
Two people can send a language model almost the same instruction and get very different results. This paper asks why. Its answer: a prompt tends to work better when the model finds its wording familiar, meaning the model would have predicted those words easily. The authors measure familiarity with perplexity, a score in which lower means the text is less surprising to the model.
Across seven classification tasks, an antonym task and a translation task, prompts with lower perplexity usually got better results. The paper also builds a simple recipe on this idea. Write a few prompts by hand, ask a large model for paraphrases, translate each one to other languages and back, rank everything by perplexity, and try only the most familiar few. No labels are needed, only some example inputs. On average this beat the hand-written prompts, though the gains are modest.
TL;DR
Zero-shot prompt performance correlates with the perplexity of the prompt under the model, mostly negatively, on OPT and Bloom tab. 5 §5. The authors turn this into SPELL: expand seed prompts by GPT-3 paraphrasing and backtranslation, rank by mean perplexity over about 1,000 inputs, and take the 3 lowest §7. Author-reported accuracy gains over the manual prompts are 1.8 points with OPT and 2.3 with Bloom §7.1. The study is English-only, uses two model families, and the correlations are not uniform across tasks §6 [Limitations].
Problem
Prompt performance varies widely with wording. On AG News with OPT 175B, four manual prompts range from 40.9 to 71.2 accuracy tab. 1 §2. Pretraining data is often unavailable or too large for exact-match counting, so the authors use prompt perplexity as a proxy for how often the model has seen the prompt in some form §2. The setting is zero-shot: no demonstrations, and the label is not part of the scored prompt §2 §4.2.
Method
Hypothesis. The authors propose that, averaged over tasks and models, a lower-perplexity prompt gives better task performance. Perplexity is computed on the full prompt, including the task input, but without the label, averaged over 1,000 examples §2. For word-prediction tasks the input is part of the prompt by design; for classification the input is included on purpose §2.
Performance measure. The score is the log-likelihood the model gives the correct label after the prompt §2. For classification the authors also report accuracy, where each class is scored and the top one is the prediction §4.2. Accuracy is reported for classification tasks only; for word prediction the authors use the label score alone because accuracy is less stable there §4.2 tab. 5.
Scoring one prompt (zero-shot), as the paper runs it.
- Classification: input, then prompt, then the class list as "Choices: X, Y, Z. Answer:" §4.1.
- Label score: sum of token log-probabilities of the label §4.2.
- Perplexity: the prompt is instantiated with each of 1,000 examples, the perplexity is computed per instance, and the values are averaged §4.2.
SPELL, the proposed prompt-creation procedure §7 §3:
- Collect a small set of manual prompts for the task §3 Step 0.
- Paraphrase each seed with GPT-3 (text-davinci-002), using 7 meta-prompts §3 Step 1 tab. 2.
- Backtranslate the seeds and paraphrases through NLLB languages: 8 European languages, plus 8 more if the first set gives too few prompts. The goal is about 100 prompts per task §3 Step 2.
- Rank all prompts by perplexity averaged over a representative sample of about 1,000 task inputs §7.
- Keep the k lowest-perplexity prompts; the example uses k = 3 §7.
The label is never used by SPELL §2 §7. The per-task counts after each step are in tab. 3.
# SPELL: pick prompts by perplexity [§7 items 1-4]
# Input: seed_prompts (manual, list of str); task_inputs (about 1,000)
# Output: the k prompts with the lowest mean perplexity
def spell(seed_prompts, task_inputs, k):
# 1. Paraphrase each seed with GPT-3 text-davinci-002 [§3 Step 1]
# using 7 meta-prompts [tab. 2]
paraphrases = gpt3_paraphrases(seed_prompts, META_PROMPTS)
# 2. Backtranslate seeds and paraphrases through NLLB languages [§3 Step 2]
# 8 languages; 8 more if too few results
candidates = backtranslations(seed_prompts + paraphrases)
# 3. Score each candidate by its mean perplexity over task inputs [§4.2]
mean_ppl = {}
for prompt in candidates:
values = []
for x in task_inputs:
# Classification: input first, then prompt [§2] [§3 Step 0]
# Word prediction: prompt already contains the input [§2]
text = prompt_with_input(prompt, x)
# Perplexity of the label-free sequence [§2]
values.append(perplexity(text))
# Average of per-instance perplexities [§4.2]
mean_ppl[prompt] = mean(values)
# 4. Keep the k lowest-perplexity prompts [§7 item 4]
return sort_by_value(mean_ppl)[:k]# Zero-shot scoring of one labelled example [§4.1] [§4.2]
# Input: prompt (str), example (input and gold label), classes (list)
# Output: log-likelihood score of the gold label; predicted class
def score_example(prompt, example, classes):
# Classification: input, prompt, then the class list [§4.1]
text = example.input + " " + prompt
text = text + " Choices: " + ", ".join(classes) + ". Answer:"
scores = {}
for label in classes:
# Sum of token log-probabilities of the label [§4.2]
scores[label] = sum_token_logprobs(text, label)
# Accuracy: highest-scoring class is the prediction [§4.2]
prediction = argmax(scores)
# Performance measure: log-likelihood of the gold label [§2]
return scores[example.gold], predictionNo numbered equations appear in the paper; the perplexity and label-score definitions are given in prose §2 §4.2.
Hyperparameters
The method has no training. Values below are the ones the paper states.
| Name | Value | Where | Notes |
|---|---|---|---|
| Models | OPT 1.3B, 30B, 175B; Bloom 176B | §4.1 | Auto-regressive; OPT mainly English |
| Evaluation setting | zero-shot | §4.2 | |
| Examples per prompt | 1,000 | §4.2 | Perplexity averaged over instantiations |
| Classification datasets | 1,000 random examples each | §4.1 | GLUE Cola, Newspop, AG News, IMDB, DBpedia, Emotion, Tweet Offensive |
| Antonym pairs | 1,000 random pairs | §4.1 | From a WordNet-based Kaggle dataset |
| Word-level translation | 1,016 words; 9 Latin-script languages (both models); 5 more for Bloom | §4.1 tab. 6 | NorthEuraLex; Bloom extras: Japanese, Arabic, Russian, Korean, Greek |
| Choice suffix | "Choices: X, Y, Z. Answer:" | §4.1 | Class names from the dataset |
| Label score | sum of token log-probabilities | §4.2 | Commented-out footnote in source says Bloom averages; see Pitfalls |
| Paraphrase model | GPT-3 text-davinci-002 | §3 Step 1 | |
| Meta-prompts | 7 | §3 Step 1 tab. 2 | |
| Backtranslation languages | 8 main; 8 fallback | §3 Step 2 | Fallback used only when the first set gives too few prompts |
| Prompts per task after expansion | about 100 (target) | §3 Step 2 tab. 3 | Counts per task in tab. 3 |
| SPELL k | 3 | §7 §7.1 tab. 10 | Text gives "e.g., 3"; the only reported k is 3 |
| Significance | * p < 0.05; ** p < 0.00625 (Bonferroni) | tab. 5 | Bonferroni thresholds for word-level translation: OPT p < 0.0055, Bloom p < 0.00357 tab. 6 |
| Noise check | 2 tasks filtered manually | §6.2 tab. 8 | Word-level translation and AG News |
| Learning rate, optimiser, batch size, seeds, hardware | not stated | No training is performed |
Results
Author-reported. Setup: zero-shot, 1,000 examples per prompt, OPT and Bloom, compared with the manual prompts §4 §5 §7.1. Hardware and total compute are not stated.
Correlation of perplexity with score and accuracy (classification and antonyms). Negative values mean lower perplexity goes with higher label score or accuracy. Columns: Pearson and Spearman correlation with the label score, and with accuracy; average accuracy over all prompts; average accuracy of the best 50% of prompts tab. 5. Markers as in the caption: * p < 0.05, ** Bonferroni p < 0.00625. Accuracy correlations are blank for antonyms.
| Model | Task | r (score) | ρ (score) | r (acc) | ρ (acc) | Avg acc | Acc 50% |
|---|---|---|---|---|---|---|---|
| OPT 175B | Antonyms | -0.41** | -0.53** | -- | -- | -- | -- |
| OPT 175B | GLUE Cola | -0.15 | -0.14 | -0.04 | -0.02 | 47.7 | 57.1 |
| OPT 175B | Newspop | -0.24* | -0.26** | -0.20* | -0.18 | 66.4 | 72.9 |
| OPT 175B | AG News | -0.63** | -0.68** | -0.77** | -0.81** | 57.5 | 68.7 |
| OPT 175B | IMDB | 0.35** | 0.40** | 0.14 | 0.20* | 86.2 | 91.0 |
| OPT 175B | DBpedia | -0.50** | -0.44** | -0.51** | -0.42** | 46.7 | 55.2 |
| OPT 175B | Emotion | -0.14 | -0.19 | -0.30** | -0.32** | 16.4 | 23.0 |
| OPT 175B | Tweet Offensive | -0.19* | 0.07 | 0.18 | 0.23* | 51.3 | 55.8 |
| Bloom 176B | Antonyms | -0.37** | -0.23** | -- | -- | -- | -- |
| Bloom 176B | GLUE Cola | 0.07 | 0.11 | -0.25** | -0.26** | 55.5 | 65.6 |
| Bloom 176B | Newspop | -0.50** | -0.42** | -0.59** | -0.51** | 78.9 | 87.8 |
| Bloom 176B | AG News | -0.62** | -0.54** | -0.44** | -0.44** | 50.3 | 59.4 |
| Bloom 176B | IMDB | 0.04 | 0.09 | -0.08 | -0.14 | 89.3 | 92.2 |
| Bloom 176B | DBpedia | -0.47** | -0.27* | -0.35** | -0.21* | 27.2 | 33.4 |
| Bloom 176B | Emotion | -0.33** | -0.42** | -0.48** | -0.55** | 29.3 | 31.7 |
| Bloom 176B | Tweet Offensive | 0.14 | 0.24* | -0.20* | -0.03 | 41.6 | 46.2 |
| OPT 30B | Antonyms | -0.54** | -0.70** | -- | -- | -- | -- |
| OPT 30B | GLUE Cola | -0.05 | 0.03 | -0.13 | 0.02 | 32.2 | 35.5 |
| OPT 30B | Newspop | -0.23* | -0.25* | -0.18 | -0.12 | 60.3 | 66.6 |
| OPT 30B | AG News | -0.66** | -0.71** | -0.81** | -0.80** | 49.3 | 60.7 |
| OPT 30B | IMDB | -0.06 | 0.17* | 0.04 | 0.22** | 81.6 | 86.1 |
| OPT 30B | DBpedia | -0.41** | -0.34** | -0.21* | -0.25* | 35.9 | 42.4 |
| OPT 30B | Emotion | 0.00 | -0.03 | 0.18 | 0.13 | 12.3 | 16.2 |
| OPT 30B | Tweet Offensive | -0.44** | -0.39** | -0.11 | -0.05 | 54.6 | 60.2 |
| OPT 1.3B | Antonyms | -0.45** | -0.53** | -- | -- | -- | -- |
| OPT 1.3B | GLUE Cola | -0.39** | -0.36** | -0.09 | -0.19* | 60.3 | 65.9 |
| OPT 1.3B | Newspop | 0.33** | 0.21* | -0.07 | -0.07 | 37.6 | 40.3 |
| OPT 1.3B | AG News | -0.33** | -0.29** | -0.56** | -0.49** | 31.9 | 37.6 |
| OPT 1.3B | IMDB | -0.11 | -0.07 | 0.24** | 0.22** | 86.0 | 89.1 |
| OPT 1.3B | DBpedia | -0.16 | -0.14 | -0.02 | -0.01 | 8.7 | 9.2 |
| OPT 1.3B | Emotion | 0.08 | 0.08 | -0.29** | -0.30** | 7.0 | 9.1 |
| OPT 1.3B | Tweet Offensive | -0.42** | -0.35** | -0.50** | -0.38** | 58.6 | 62.6 |
Text summary: most correlations are negative and significant, and the trend persists at 30B and 1.3B, though weaker §5 tab. 5. Repeating the analysis with prompt length instead of perplexity gives weak positive correlations, mostly not significant §5, footnote.
Word-level translation (Pearson r and Spearman ρ, label score) tab. 6:
| Language | OPT 175B r | OPT 175B ρ | Bloom 176B r | Bloom 176B ρ |
|---|---|---|---|---|
| ita | -0.44 | -0.57 | -0.37 | -0.63 |
| spa | -0.47 | -0.61 | -0.51 | -0.66 |
| cat | -0.47 | -0.58 | -0.24 | -0.31 |
| fra | -0.48 | -0.57 | -0.48 | -0.64 |
| deu | -0.44 | -0.60 | -0.46 | -0.65 |
| fin | -0.44 | -0.62 | -0.34 | -0.56 |
| por | -0.45 | -0.62 | -0.46 | -0.61 |
| eus | -0.47 | -0.61 | -0.45 | -0.61 |
| tur | -0.44 | -0.62 | -0.33 | -0.62 |
| jpn | -- | -- | -0.33 | -0.26 |
| arb | -- | -- | -0.36 | -0.47 |
| rus | -- | -- | -0.54 | -0.69 |
| kor | -- | -- | -0.42 | -0.58 |
| ell | -- | -- | -0.40 | -0.51 |
Non-significant under Bonferroni: Catalan (Pearson) and Japanese (Spearman) for Bloom tab. 6 caption. OPT 175B was run only on the 9 Latin-script languages §4.1 tab. 6.
SPELL versus manual prompts (accuracy, average over prompts in each set) tab. 10. "low-ppl" is the 3 lowest-perplexity prompts; "manual" is all manual prompts for the task tab. 3 tab. 10:
| Task | OPT low-ppl | OPT manual | OPT Δ | Bloom low-ppl | Bloom manual | Bloom Δ |
|---|---|---|---|---|---|---|
| GLUE Cola | 51.7 | 48.5 | 3.1 | 64.5 | 60.9 | 3.6 |
| Newspop | 80.6 | 70.4 | 10.2 | 90.0 | 80.0 | 10.0 |
| AG News | 68.4 | 61.9 | 6.5 | 51.0 | 63.5 | -12.5 |
| IMDB | 90.4 | 88.9 | 1.4 | 91.3 | 88.8 | 2.5 |
| DBpedia | 46.0 | 51.7 | -5.7 | 31.2 | 30.2 | 1.0 |
| Emotion | 21.6 | 22.6 | -1.1 | 35.8 | 32.1 | 3.6 |
| Tweet Offensive | 48.4 | 50.6 | -2.3 | 48.6 | 40.8 | 7.8 |
Headline (author-reported): average gain 1.8 accuracy points with OPT and 2.3 with Bloom §7.1 §7. Standard deviation within the 3 low-perplexity prompts: 5.07 for OPT 175B versus 6.86 for manual prompts; 2.6 versus 7.47 for Bloom §7.1. Using as many low-perplexity prompts as manual ones gives standard deviations of 6.32 (OPT) and 3.78 (Bloom) §7.1, footnote.
Noise check tab. 8 §6.2: removing noisy prompts by hand (external annotators) barely changes the correlations:
| Task | Lang | Pearson before | Spearman before | Pearson after | Spearman after |
|---|---|---|---|---|---|
| AG News | - | -0.63 | -0.68 | -0.62 | -0.54 |
| WLT | ita | -0.44 | -0.58 | -0.44 | -0.57 |
| WLT | spa | -0.47 | -0.61 | -0.47 | -0.61 |
| WLT | cat | -0.45 | -0.57 | -0.47 | -0.58 |
| WLT | fra | -0.47 | -0.57 | -0.48 | -0.57 |
| WLT | deu | -0.43 | -0.60 | -0.44 | -0.60 |
| WLT | fin | -0.41 | -0.60 | -0.44 | -0.62 |
| WLT | por | -0.43 | -0.61 | -0.45 | -0.62 |
| WLT | eus | -0.45 | -0.60 | -0.47 | -0.61 |
| WLT | tur | -0.43 | -0.61 | -0.44 | -0.62 |
Prompt-set statistics tab. 3: number of prompts after manual creation (Step 0), after GPT-3 paraphrasing (Step 1), and after backtranslation (Step 2).
| Task | Step 0 | Step 1 | Step 2 |
|---|---|---|---|
| Word-Level Translation | 12 | 59 | 118 |
| Antonyms | 12 | 85 | 176 |
| GLUE Cola | 4 | 27 | 144 |
| Newspop | 13 | 43 | 119 |
| AG News | 4 | 23 | 108 |
| IMDB | 10 | 45 | 178 |
| DBpedia | 8 | 23 | 103 |
| Emotion | 4 | 14 | 94 |
| Tweet Offensive | 5 | 41 | 119 |
Other reported analysis (no table numbers):
- Word-level translation: the 10 lowest-perplexity prompts overlap by 8.6 (OPT 175B) and 8.4 (Bloom) prompts on average across language pairs; the top-10 label-score prompts overlap by 7 and 6.5 §6.1.
- Within word-level translation (French, OPT 175B), prompts with quotation marks around the words are both lower in perplexity and better; within that cluster the correlations are -0.28 to -0.38 §6.1 fig. 2.
- Lowest-perplexity prompts overlap by 7.1 across OPT 175B and Bloom for the classification tasks; the top-10 accuracy prompts overlap by 3.1 §6.3.
- Smaller OPT models show the same trend, with weaker correlations §5.
Paper vs code
No official code.
Searched, in order:
- Links in the LaTeX source: none to a code repository. The only links are to dataset and tool pages (NorthEuraLex, a Kaggle WordNet antonym set, Hugging Face Datasets, PromptSource). No arXiv comment or project page was found in the fetched source.
- GitHub repository search for "SPELL prompts perplexity", "demystifying
prompts", and "perplexity prompt" with and without
org:facebookresearch: no matches for this paper. - First author's GitHub account (gonenhila): public repositories exist for other papers; none for this one.
- A repository named
rimon15/demyst_optim_promptsclaims to be code for an EMNLP 2025 paper on optimised prompts. It is not by an author of this paper, so it was not used.
Account searches for Srini Iyer (sviyer) found no repository for this paper.
The search for Terra Blevins returned an error, and the remaining authors were
not searched.
Pitfalls
- Perplexity is not defined by formula in the paper. Tokenisation, whether a beginning-of-sequence token is added, and the context window are not stated §2. Per-instance perplexities are averaged over 1,000 inputs §4.2; this differs from taking the perplexity of averaged log-probabilities.
- Label score convention for Bloom is ambiguous. The compiled text says the sum of token log-probabilities for both models §4.2. The LaTeX source contains a commented-out footnote saying the sum is used for OPT and the average for Bloom, and that correlations look similar either way. Choose one, and report which.
- Sign convention. In tab. 5, "Perplexity-score" correlates perplexity with label score and "Perplexity-acc" with accuracy. A negative value means lower perplexity goes with better performance.
- Positive correlations are not discussed in the text. IMDB is positive for OPT 175B (+0.35 Pearson, +0.40 Spearman, both significant for score), and Newspop at OPT 1.3B is positive (+0.33) tab. 5. The stated hypothesis therefore fails on some tasks, and the paper does not say why.
- Unknown n for the correlations. The text does not say which prompt set (Step 0, 1 or 2 in tab. 3) enters each correlation, or how many prompts that is.
- SPELL gain: rounding. The text says 1.8 accuracy points for OPT §7.1. The seven per-task deltas in tab. 10 sum to 12.1, an average of 1.73 ([tab. 10] values as printed). For Bloom they average 2.29, matching 2.3. The difference is not explained.
- Large per-task variance. The average hides a -12.5 point drop on AG News with Bloom and a -5.7 drop on DBpedia with OPT tab. 10. Under this method these tasks can get worse.
- No significance test for the SPELL gains. Table 10 gives per-task differences, some of 1 to 3 points, with no confidence intervals or tests. The per-task accuracy is computed over 1,000 examples §4.2, but the comparison averages over three prompts only.
- Step 1 needs GPT-3 text-davinci-002. That is an API model. The number of paraphrases per seed is not stated, and the cost is not given.
- Step 2 constraints are unspecified. The paper says specific words are enforced, or that prompts are made into questions, depending on the task §3 Step 2. How this is checked is not described.
- Word-prediction prompts are cut before the label. When backtranslating word-prediction prompts, the sequence is kept only up to the label position, with the label excluded §3 Step 2.
- Noise check is partial. Only 10% of the highest-perplexity prompts were inspected, and only by subjective judgment §6.2. The manual filtering covers two tasks only §6.2 tab. 8. Annotator count and agreement are not stated.
- Seed prompts. The manual prompts were added to, removed from and edited for this setting. A PromptSource AG News prompt was left out because it did not fit [App. A] tab. 11. The full seed list is in tab. 11 of the paper and is not reproduced here.
- Cost scales with candidate count. Each candidate is scored on 1,000 instantiations §4.2. Candidate counts per task are in tab. 3. Total cost and hardware are not stated.
- Scope. English only; OPT and Bloom only; human-readable prompts only [Limitations]. Only OPT and Bloom were evaluated, so the findings for other models are untested [Limitations].
- Abstract wording differs. The arXiv metadata abstract for v2 says the prompt's performance is "coupled with" familiarity. The LaTeX abstract says "predicted by" and adds "when considering reasonable prompts that are related to it". This card uses the LaTeX.
Lineage
- Builds on: OPT: Open Pre-trained Transformer Language Models and BLOOM, two of the models evaluated.
- Compared against: manually written prompts (the paper's own seed sets, tab. 11). Related prompt-search work named in §8 (AutoPrompt, prefix-tuning, RLPrompt and others) has no cards here.
- Uses GPT-3 only as the paraphrasing model in Step 1 §3 Step 1; no card exists.
- Superseded by: not known from content already in this wiki.
Source and license
Adapted from “Demystifying Prompts in Language Models via Perplexity Estimation” by Hila Gonen, Srini Iyer, Terra Blevins, Noah A. Smith, Luke Zettlemoyer (arXiv:2212.04037), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors.