Skip to content

Exploiting Cloze Questions for Few Shot Text Classification and Natural Language Inference

main track #1corefundamentalpaperrubric 10/122020 · EACL 2021 · ~40 min

Timo Schick, Hinrich Schütze

Status

TL;DR. A language model becomes a classifier when you stop sampling text and instead read the probabilities of a fixed set of answer strings. PET (Schick & Schütze) named the two parts: a pattern that rewrites the input as a cloze question, and a verbalizer that maps each label to a word whose logit becomes the label score. monoT5 applied the same move to relevance ranking with “true”/“false”. Today’s decision models (Jev, Perplexity Decider, Liquid d1, Cloudflare Clef, OpenAI Decisions) are this idea packaged as an API. They differ in how the option scores are read out, and in whether options and questions are scored jointly or in isolation.

Why it matters now. Every pointwise LLM reranker and LLM relevance assessor you have used is a decision model in disguise. That includes monoT5, the yes/no rankers, and the graded prompts behind UMBRELA. The readout determines three things: what the score means, whether it is comparable across prompts, and how much it costs per candidate. Those three facts decide whether you can threshold it (calibration), batch it, or use it as an eval judge (decision models as judges).

Pattern + verbalizer (PET, §3.1). A pattern PP turns input xx into text with one mask. The verbalizer vv maps each label ll to a vocabulary word. The label score is the masked-LM logit of that word, and a softmax over the labels only gives the class distribution:

s(l∣x)=M(v(l)∣P(x)),q(l∣x)=es(l∣x)∑l′es(l′∣x).s(l \mid x) = M\big(v(l) \mid P(x)\big), \qquad q(l \mid x) = \frac{e^{s(l \mid x)}}{\sum_{l'} e^{s(l' \mid x)}} .

PET fine-tunes on a few labelled examples with cross-entropy on qq. It trains one model per pattern–verbalizer pair, distils their ensemble into a classifier on unlabelled data, and in iPET repeats the process.

Modern readout synthesis (later work, not from PET)

Section titled “Modern readout synthesis (later work, not from PET)”

The readouts below build on PET’s idea but come from later papers and products; none of them is attributed to PET.

Binary readout = sigmoid of a logit difference. monoT5 reads Query: q Document: d Relevant: and compares the logits of “true” and “false”. With two labels the softmax reduces to

P(rel∣q,d)=eztrueeztrue+ezfalse=σ(ztrue−zfalse).P(\text{rel} \mid q, d) = \frac{e^{z_{\text{true}}}}{e^{z_{\text{true}}} + e^{z_{\text{false}}}} = \sigma(z_{\text{true}} - z_{\text{false}}).

Only the difference matters. Anything in the prompt that shifts that difference shifts every score. This is why a threshold tuned for one template does not transfer to another.

Multi-token options: a prefix-free suffix trie. Letter readouts (A/B/C…) stop at 26 options. LLM-as-Jev (2610.02076, §3) numbers the options [1]…[K] and ends the prompt with Best answer: [. Option kk is then the suffix ckc_k = “k]”, scored by summing token log-probabilities and normalising over the KK candidates:

sk=∑j=1nklog⁡pθ(ck,j∣x,ck,<j),p(k∣x)=esk∑k′esk′.s_k = \sum_{j=1}^{n_k} \log p_\theta\big(c_{k,j} \mid x, c_{k,<j}\big), \qquad p(k \mid x) = \frac{e^{s_k}}{\sum_{k'} e^{s_{k'}}} .

The closing bracket makes the suffixes prefix-free, so no option is a prefix of another. They form a shallow trie, with depth at most ⌊log⁡10K⌋+2\lfloor \log_{10} K \rfloor + 2 for digit-level tokenizers. Scoring therefore needs one prefill plus one to three teacher-forced steps and no decoding.

Graded labels and expected values. For graded relevance, Zhuang et al. (2310.14122, §3.3) take a softmax over the log-likelihoods of kk label strings and rank by the expected value f(q,d)=∑kpk ykf(q,d) = \sum_k p_k \, y_k with yk=ky_k = k. Decision APIs expose the same idea. Perplexity’s score type returns the probability-weighted mean level, and its choice type reports a confidence (ptop−1/n)/(1−1/n)(p_{\text{top}} - 1/n)/(1 - 1/n). That confidence is 0 when all nn options are equally likely and 1 when one option has all the mass.

Trained readout heads. Production decision models replace the vocabulary readout with trained machinery, and the vendors only describe it at a high level (vendor-described, not independently verified):

  • Perplexity’s v1.1 model card describes a [255, 5120] readout head with a calibration temperature.
  • Cloudflare’s Clef freezes a Qwen backbone and trains a routing head plus rank-256 LoRA adapters. It runs a prefill-only pass and then scores the valid schema choices in parallel.
  • TypeSafe’s Jev describes a parallel sampler that returns all option probabilities at once.

Joint versus isolated. This choice applies at two levels:

  • Options within a question. A softmax over all options (joint) lets options compete. Separate yes/no calls per option (isolated) give independent probabilities that need not sum to 1. Liquid’s choice with multiple: True returns one P(yes) per option, which suits multi-label decisions.
  • Questions within a request. TypeSafe’s docs say each question is evaluated “in parallel and in isolation” against the same state. Perplexity’s pplx-decider-v1.2 instead answers grouped questions together in one pass, and its docs warn that grouping changes the answers. They recommend separate requests for independent candidates such as one question per document or tool.
Four readouts that turn a language model into a classifier One prompt containing the input, the question and the options is prefilled once. Four readouts follow. One: label-word logits with a softmax over the label tokens; with two labels this is a sigmoid of the logit difference, as in monoT5. Two: a prefix-free suffix trie where each numbered option is scored by summing its token log-probabilities and normalising across all options. Three: a separate yes or no question per option, giving independent probabilities that need not sum to one. Four: a trained readout head on top of the backbone, as described by vendors. The first two are joint readouts; the third is isolated. prompt = instructions + input x + question + options one prefill, KV cache reused by every readout below 1 · Label-word logits (joint) logits of label words (yes/no, A/B/C) p = softmax over those tokens only 2 labels: p = σ(z_true − z_false) (monoT5) letters cap the option count at 26 PET: pattern P(x) + verbalizer v(label) 2 · Prefix-free suffix trie (joint) prompt ends with Best answer: [ option k = suffix "k]" (prefix-free) s_k = Σ log p(suffix), softmax over K 1 prefill + ≤ 3 steps for K ≤ 999 (digit tokens) steps grow as ⌊log10 K⌋ + 1, e.g. 77 or 150 intents 3 · Per-option yes / no (isolated) ask P(yes | x, option k) for each k K calls, or K cached branches: O(K) probabilities need not sum to 1 no comparison between options fits multi-label and pointwise relevance 4 · Trained readout head frozen or adapted backbone → small head e.g. a [255 × hidden] head + temperature trained with CE + Brier, or RL vendor-described; mostly opaque joint or isolated depends on the API
Original sketch. Four ways to turn one forward pass into option probabilities. Joint readouts normalise across options; isolated readouts give one independent probability per option.

PET (paper-reported, RoBERTa-large, Table 1).

  • Ten labelled examples. Standard supervised training reaches 21.1 / 25.0 / 10.1 accuracy on Yelp / AG’s News / Yahoo, close to or below chance. PET reaches 52.9 / 87.5 / 63.8.
  • 1,000 examples. Supervised training reaches 63.0 / 86.9 / 70.5 and PET 64.8 / 86.9 / 72.7. On MNLI-matched PET leads 85.3 to 73.1.
  • Zero-shot spread. Without training, the patterns average 33.8 (SD 9.6) on Yelp and the best one reaches 40.8, so the template matters as much as the model.

Graded vs binary relevance labels (paper-reported, 2310.14122, Table 2). Setup: FLAN PaLM2 S reranks BM25 top-100 on 8 BEIR sets. Average nDCG@10 is 0.4770 for yes/no, 0.4789 for two labels, 0.4992 for three labels and 0.5022 for a 0–4 rating scale. The last two are significantly better than two labels (paired t-test, p < 0.05).

Joint vs isolated options (paper-reported, 2610.02076).

  • A frozen Qwen3.5-4B with the joint suffix readout scores 81.4% on public JevBench (188/231). An isolated per-option yes/no readout on the same backbone scores 76.2% (Table 15).
  • The joint readout reaches 69.0% zero-shot on 77-way Banking77, which letter readouts cannot evaluate.
  • Joint scoring is somewhat sensitive to option order. The authors shuffle options during fine-tuning to counter it.

Vendor latency claims (vendor-reported). Cloudflare reports a median latency of 209 ms for Clef, 38.8 ms for Clef-flash and 524 ms for Jev on its own benchmark setup. These figures come from the vendor’s environment and are not comparable across providers.

  • Readout probabilities are not calibrated by construction. A softmax over label logits inherits the model’s priors toward particular strings, positions and option IDs. Zheng et al. (2309.03882) trace multiple-choice “selection bias” to token priors on option IDs. See calibration for corrections.
  • Joint readouts make probabilities context-dependent. The same passage can score differently depending on what else is in the prompt. That is useful for routing but a problem for reproducible qrels.
  • Trained heads are opaque. Vendors describe heads, adapters and RL-for-calibration (TypeSafe’s “RLCD”) only briefly. It is not public how much of a model’s accuracy comes from the backbone and how much from the head.
  • Open question: when is a readout over a fixed option set worse than letting the model reason first? LLM-as-Jev’s “Thinking Jev” variant reaches 94.8% on JevBench at a 4,096-token reasoning budget, against 81.4% without reasoning. The gap suggests that hard decisions still need generated reasoning.
  • monoT5 is the binary readout applied to ranking, and RankGPT the listwise generation alternative.
  • UMBRELA uses graded relevance labels, generated as text rather than read out as probabilities.
  • Calibration asks whether readout probabilities can be read literally. Thresholds and metrics covers how to turn them into decisions.
  • The model pages in this section (Jev, Perplexity Decider, LLM-as-Jev and others) describe each vendor’s readout in detail.

Questions to think through

These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.

  1. Derive / compute

    A monoT5-style relevance model gives the logits z_true = 2.0 and z_false = 0.5 for one query–passage pair. (a) Compute P(relevant). (b) A second prompt template adds +1.0 to both logits; what changes? (c) A third template adds +1.0 to z_true only; what is P(relevant) now, and what does this imply for a 0.50 cut-off applied to scores from different templates?

    What a strong answer covers
    • (a) Softmax over two logits equals a sigmoid of their difference: σ(2.0 − 0.5) = σ(1.5) ≈ 0.818.
    • (b) Nothing: adding the same constant to both logits cancels in the softmax, so only the logit difference matters.
    • (c) σ(2.5) ≈ 0.924. A template-dependent shift of the logit difference moves every score, so ranking within one template is unchanged but a fixed 0.50 threshold flags a different set of passages.
    • Thresholds and probabilities are tied to the exact prompt and readout; any change of template, verbalizer or grouping requires re-tuning the threshold on labelled data.
  2. Derive / compute

    An intent router uses the LLM-as-Jev readout with K = 150 options rendered as [1] … [150] and the prefix "Best answer: [". With a tokenizer that splits digits into single tokens, (a) what is the maximum depth of the suffix trie, and how many forward steps follow the prefill? (b) If you instead asked a separate yes/no question per intent, how many prefills would you pay for? (c) Why can letter-logit readouts not do this task at all?

    What a strong answer covers
    • (a) Depth ≤ ⌊log10 K⌋ + 2 = 2 + 2 = 4 tokens (up to three digits plus the closing bracket). The first token's distribution comes from the prefill's last position, so at most three more teacher-forced steps are needed.
    • Each candidate's score is the sum of the log-probabilities of its suffix tokens; candidates share trie prefixes, so all 150 are scored in one batched pass.
    • (b) 150 prefills of the full prompt (or one prefill plus 150 KV-cached branches), i.e. O(K) cost, and the scores are independent, so they do not sum to 1.
    • (c) A single-letter readout has at most 26 options (16 in some implementations); the closing bracket makes the numbered suffixes prefix-free ("1]" is not a prefix of "12]"), so K is not capped by an alphabet. Steps still grow with log10 K, and prompt length grows with K.
  3. Mechanism

    LLM-as-Jev reports that scoring all options in one prompt beats scoring each option in isolation by about 5 points on JevBench (81.4% vs 76.2% on the same backbone). Explain at the level of what each readout conditions on why joint scoring wins there, and name one class of decision where isolated per-option probabilities are the better design.

    What a strong answer covers
    • Joint scoring conditions every candidate's suffix on a prompt that lists all candidates, and normalises with a softmax, so options compete; the model can compare them, and "none of the above" or "closest match" questions become well defined.
    • Isolated scoring asks P(yes | x, option k) separately; each call sees one option, so comparative information is lost and the K probabilities have no shared normaliser.
    • Isolated scoring is right for multi-label decisions ("select all that apply") and for pointwise relevance, where one candidate's score should not depend on which other candidates happen to be in the batch.
    • Perplexity's docs make the same point from the API side: group facets of one decision, but send independent candidates (one per document, tool or function call) as separate requests, because grouping changes the answers.
  4. What if…

    Zhuang et al. (2310.14122) score BM25 top-100 lists on 8 BEIR sets with FLAN PaLM2 S. Binary yes/no relevance gives average nDCG@10 0.4770; three graded labels with expected relevance give 0.4992; a 0-to-4 rating scale gives 0.5022. What changed in the readout between these conditions, why could that help ranking even on datasets with binary qrels, and what control would you add before attributing the gain to "finer labels"?

    What a strong answer covers
    • Same pointwise model and candidates; only the label set changes. The score becomes the expected label value, the sum of p_k·y_k with y_k = k over a softmax of the label log-likelihoods, instead of P(yes).
    • Aggregating several label likelihoods gives a smoother, less saturated score; partially relevant passages get intermediate scores instead of being forced to yes or no, which helps the order even when qrels are binary (e.g. SciFact).
    • Ranking only needs order, so the gain is in resolving ties and near-ties among top candidates, not in better absolute probabilities.
    • Controls: the same label count with permuted or meaningless label names, and peak-label probability versus expected value, to separate label semantics from simple score aggregation; per-dataset paired tests, since gains differ across sets.
  5. Design

    You want a cheap relevance assessor for a deep-research benchmark: about 400k query–passage pairs, a 0–3 graded scale, and the output will be used both to rank systems and to decide which passages count as relevant for recall. You have a decision API that offers a yes/no question type (returns P(yes)) and a score type (returns probabilities over levels and their weighted mean). Choose the readout, how many pairs per request, and how you would set and validate the relevance cut-off.

    What a strong answer covers
    • Use the score type over the 4 grades so you keep graded information (needed for nDCG); derive both the expected grade for ranking and P(grade ≥ 2) for the binary relevant cut-off.
    • One passage per request (or a provider that evaluates questions in isolation), so a passage's grade does not depend on its batch neighbours and qrels are reproducible.
    • Hold out a few hundred human-judged pairs stratified by grade; tune the cut-off on part of them, measure precision, recall and Cohen κ on the rest, and report the system-ranking agreement (Kendall τ) on runs judged both ways.
    • Re-tune whenever the prompt, model version or grouping changes; check for circularity if any evaluated system uses the same model as a reranker.
  6. Research idea

    Propose a study of whether listing a query's candidate passages jointly in one decision prompt (a listwise decision readout) beats isolated pointwise decisions for building relevance labels. State the hypothesis, the minimal experiment, and the result that would falsify it.

    What a strong answer covers
    • Hypothesis: joint readouts improve top-k ordering (relative judgements) but hurt absolute label calibration because each passage's probability depends on its neighbours.
    • Experiment: same model and prompt, TREC DL or TREC RAG qrels, three conditions (isolated, joint over 5 candidates, joint over 20), with candidate order shuffled across seeds; metrics nDCG@10 of the induced ranking, Cohen κ against human grades, and ECE of P(relevant).
    • Measure order and neighbour sensitivity directly: the change in one passage's score when the other candidates are swapped for stronger or weaker ones.
    • Falsified if joint scoring does not improve nDCG@10 beyond seed variance, or if it improves calibration as well (then neighbour dependence is not the trade-off claimed).

Done with this page?

Status