Paper · 2021-03-18 · cs.CL, cs.LG
GPT Understands, Too
P-Tuning adds trainable continuous prompt vectors, passed through a small LSTM or MLP, next to the words of a hand-written prompt. The language model is frozen for LAMA knowledge probing and tuned for SuperGLUE. Author-reported: LAMA-34k P@1 with BERT-base rises from 43.3 (AutoPrompt) to 48.3, and the spread across manual prompts shrinks.
Soft prompt tuningPrompt engineeringFew-shot learningprompt-learningcontinuous-promptsknowledge-probingfew-shot-learningnlu
arXivPDFCodeMarkdown15 min read
AI-compiled by claude-haiku-5-5 on 2026-10-19, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.
In plain words
A language model can be asked a question by writing a sentence pattern around the input and letting the model fill in a blank, for example "The capital of Britain is [MASK]." Small wording changes to such a pattern can change the answer quality a lot, and finding a good pattern by hand is slow and fiddly.
P-Tuning keeps the written words of the pattern and adds a few learnable vectors at chosen spots. These vectors are not real words, so training can adjust them directly with gradient descent. A small network links them so that they depend on each other. The method works with a frozen model, where only these vectors are trained, and with a model that is also fine-tuned. The authors report better scores on fact recall and on language-understanding tasks, and less spread between different hand-written patterns.
TL;DR
P-Tuning inserts trainable continuous vectors into a hand-written prompt, and a small LSTM or MLP encoder ties them together §2.2 §2.3. The language model stays frozen for LAMA knowledge probing and is tuned for SuperGLUE §3. The authors report gains over discrete prompt search on LAMA and over PET on few-shot SuperGLUE, and a smaller spread across manual prompts tab. 3 tab. 5 §3.4. Before implementing, read Paper vs code: the released LAMA code does not insert the hand-written relation prompt that the paper describes.
Problem
Hand-written discrete prompts are unstable. On LAMA-TREx P17 with BERT-base-cased, four manual prompts reach precision@1 of 31.3, 19.8, 31.4 and 51.1 without P-Tuning, so a one-word change can move the score by about 20 points §2.1 tab. 1. Automatic discrete search (AutoPrompt, LPAQA, mining, or prompts generated by another model) finds better prompts, but the prompts stay real words and the instability remains §1 §2.1. The paper asks whether trainable continuous prompts can stabilise and improve adaptation, with a frozen model (knowledge probing) and with a tuned model (SuperGLUE) §1 §3.
Method
Template and input §2.2. Let M be a pretrained language model with hidden size h and vocabulary V. A template T places discrete tokens [D_i] and continuous prompt slots [P_i] around the input x and the label y. Slots are placed before, between and after x and y. The paper writes the continuous template as {[P_0:i], x, [P_(i+1):j], y, [P_(j+1):k]} (unnumbered display equation in §2.2). The discrete tokens and the input tokens use the usual embedding table e. Each slot P_i is mapped by a function f to a vector h_i, so the model sees {h_0..h_i, e(x), h_(i+1)..h_j, e(y), h_(j+1)..h_k}.
Prompt encoder §2.3. f is a lightweight network. The paper tries an LSTM, an MLP and an identity map (called EMB in the few-shot ablation) §3.3. The stated reason is that f lets the slots depend on each other, instead of being independent free vectors §2.3.
Combination with discrete prompts §2.2. The paper concatenates continuous slots with discrete prompt tokens, and reports that this performs better. All its experiments use the concatenation.
Frozen or tuned model §2.2 §3. The same mechanism works with a frozen model, where only the slot vectors and f are trained, and with a fine-tuned model, where the model weights are trained together with them. LAMA uses frozen models. SuperGLUE uses tuned models, both fully supervised and few-shot.
# P-Tuning loss for one labelled example [§2.2] [§2.3]
# Input: text_ids, label_ids, template (layout of slots), model M, encoder f
# Output: scalar loss
def ptuning_loss(text_ids, label_ids, template, model, encoder):
# Lay out discrete tokens and continuous slots in the template [§2.2]
ids, slot_positions, label_positions = fill_template(
template,
text_ids,
label_ids,
)
# One trainable vector per slot, the input to the encoder [§2.3]
slot_inputs = prompt_table # shape (k, h), learned by backprop
# The encoder links the slot vectors to each other [§2.3]
slot_vectors = encoder(slot_inputs) # shape (k, h)
# Embed every token with the model's own embedding layer [§2.2]
inputs = model.embedding(ids) # shape (T, h)
# Put the encoder output in place of the slot embeddings [§2.2]
inputs[slot_positions] = slot_vectors
# Run M on the mixed sequence [§2.2]
logits = model(inputs_embeds=inputs)
# Score the label tokens at their positions [§2.2]
return cross_entropy(logits[label_positions], label_ids)Notes on the sketch. The paper gives the mapping but not the exact loss bookkeeping for each model family. How the label is scored (masked position for BERT-style models, last position for GPT-style models) follows the code, see Paper vs code.
Training, LAMA (frozen model) §3.1. Only the prompt encoder is trained, with Adam at learning rate 1e-5. The number of slots per position is selected on the development sets. The paper chooses one configuration for most relations.
Training, SuperGLUE fully supervised (tuned model) §3.2. The model and the slots are trained jointly with AdamW and a linearly decayed learning rate. The grid covers learning rate, batch size and warm-up ratio. Early stopping is used. Model selection uses the development sets.
Training, few-shot SuperGLUE (tuned model, ALBERT-xxlarge-v2) §3.3. The setup follows PET and the FewNLU evaluation procedure. The paper uses random data splits and selects models only on a small labelled set. It searches the learning rate, the maximum number of training steps and the evaluation frequency §3.3. Each result is averaged over four runs with different splits tab. 5. The paper inserts different numbers of continuous tokens at different positions in PET's manual patterns, then picks the best candidate with the FewNLU validation procedure §3.3.
Figures (described from captions only; no image is used on this page). fig. 1 is the introduction's summary plot, with the caption reporting the average development score over seven SuperGLUE datasets with P-Tuning. fig. 2 is the method illustration for the prompt "The capital of Britain is [MASK]". Panel (a) shows a discrete prompt generator that receives only discrete rewards. Panel (b) shows continuous prompt embeddings and an encoder that are optimised differentiably §2.2.
Hyperparameters
Values from the paper unless marked as code. "not stated" means the paper and the code do not give it.
| Name | Value | Where | Notes |
|---|---|---|---|
| LAMA optimizer | Adam, learning rate 1e-5 | §3.1 | Only the prompt encoder is trained; LM frozen |
| LAMA template, bidirectional (BERT) | (3, sub, org_prompt, 3, obj, 3) | §3.1 | Counts chosen on dev sets; code default (3, 3, 3) cli.py |
| LAMA template, unidirectional (GPT) | (3, sub, org_prompt, 3, obj) | §3.1 | Code forces the third count to 0 modeling.py |
| LAMA data | 41 relations, 34,039 test triples (LAMA-34k); LAMA-29k is the vocabulary intersection of GPT and BERT | §3.1 | Data split follows AutoPrompt |
| LAMA weight decay | not stated | cli.py | 5e-4 in code |
| LAMA learning-rate schedule | not stated | cli.py cli.py | Exponential decay, factor 0.98 per epoch |
| LAMA epochs and early stopping | not stated | cli.py cli.py | At most 100 epochs; stop after 20 epochs without a better dev Hit@1 |
| LAMA prompt encoder | not stated | prompt_encoder.py | Code: 2-layer bidirectional LSTM (hidden/2 per direction), then MLP Linear-ReLU-Linear |
| LAMA LSTM dropout | not stated | cli.py | 0.0 in code |
| Fully supervised learning rate | {1e-5, 2e-5, 3e-5} | §3.2 | Grid search, selection on dev |
| Fully supervised batch size | {16, 32} | §3.2 | |
| Fully supervised warm-up ratio | {0.0, 0.05, 0.1} | §3.2 | |
| Fully supervised epochs | 20 for COPA, WSC, CB, RTE; 10 for WiC, BoolQ, MultiRC | §3.2 | Early stopping |
| Fully supervised optimizer | AdamW, linear decay | §3.2 | |
| Few-shot backbone | ALBERT-xxlarge-v2 | §3.3 | Same backbone as PET |
| Few-shot learning rate | {1e-5, 2e-5} | §3.3 | In code, only the prompt encoder uses this value; LM uses fixed 1e-5 wrapper.py |
| Few-shot maximum training steps | {250, 500} | §3.3 | CB script uses 250 cb_pt_few_shot.sh |
| Few-shot evaluation frequency | {0.02, 0.04}, unit not stated | §3.3 | Code default is every 20 steps cli.py |
| Few-shot runs | 4, random data splits | tab. 5 §3.3 | Averages over the four runs |
| Few-shot prompt encoder | LSTM, MLP, EMB (identity) compared | §3.3 | Code exposes only lstm and mlp cli.py |
| Few-shot continuous tokens | varied per pattern | §3.3 tab. 7 | Code ties the count to the pattern id wrapper.py |
| Few-shot embedding size | not stated | cli.py | 128 in code |
| Few-shot weight decay | not stated | cli.py | 0.1 default in code |
| Few-shot warm-up steps | not stated | cli.py | 0 default in code, linear schedule |
| Few-shot batch size | not stated | cli.py | 2 per GPU in the CB script cb_pt_few_shot.sh |
Results
Author-reported. Setups are given per table.
Knowledge probing, LAMA, frozen LM, precision@1 tab. 3.
LAMA-34k (left in the paper; the paper says it covers all BERT vocabularies):
| Prompt type | Model | P@1 | Source |
|---|---|---|---|
| Original (manual) | BERT-base | 31.1 | tab. 3 |
| Original (manual) | BERT-large | 32.3 | tab. 3 |
| Original (manual) | E-BERT | 36.2 | tab. 3 |
| Discrete (LPAQA) | BERT-base | 34.1 | tab. 3 |
| Discrete (LPAQA) | BERT-large | 39.4 | tab. 3 |
| Discrete (AutoPrompt) | BERT-base | 43.3 | tab. 3 |
| P-Tuning | BERT-base | 48.3 | tab. 3 |
| P-Tuning | BERT-large | 50.6 | tab. 3 |
LAMA-29k (right in the paper; manual prompt vs P-Tuning per model):
| Model | Manual prompt | P-Tuning | Source |
|---|---|---|---|
| BERT-base (109M) | 31.7 | 52.3 | tab. 3 |
| BERT-base (109M), AutoPrompt | - | 45.2 | tab. 3 |
| BERT-large (335M) | 33.5 | 54.6 | tab. 3 |
| RoBERTa-base (125M) | 18.4 | 49.3 | tab. 3 |
| RoBERTa-base (125M), AutoPrompt | - | 40.0 | tab. 3 |
| RoBERTa-large (355M) | 22.1 | 53.5 | tab. 3 |
| GPT2-medium (345M) | 20.3 | 46.5 | tab. 3 |
| GPT2-xl (1.5B) | 22.8 | 54.4 | tab. 3 |
| MegatronLM (11B) | 23.1 | 64.2 | tab. 3 |
The text reports 43.3 to 50.6 on LAMA-34k and 45.2 to 64.2 on LAMA-29k §3.1. These compare different backbone sizes, see Pitfalls.
Fully supervised SuperGLUE, development sets, tuned LM tab. 4. Columns follow the paper. The Avg column averages the seven tasks, with CB and MultiRC each averaged over their two metrics. The paper's footnote says the BERT-large CLS-FT row is taken from the SuperGLUE paper.
| Backbone | Method | BoolQ (Acc) | CB (Acc) | CB (F1) | WiC (Acc) | RTE (Acc) | MultiRC (EM) | MultiRC (F1a) | WSC (Acc) | COPA (Acc) | Avg |
|---|---|---|---|---|---|---|---|---|---|---|---|
| BERT-Base (109M) | CLS-FT | 72.9 | 85.1 | 73.9 | 71.1 | 68.4 | 16.2 | 66.3 | 63.5 | 67.0 | 66.2 |
| BERT-Base (109M) | PET-FT | 73.7 | 87.5 | 90.8 | 67.9 | 70.4 | 13.7 | 62.5 | 60.6 | 70.0 | 67.1 |
| BERT-Base (109M) | P-Tuning | 73.9 | 89.2 | 92.1 | 68.8 | 71.1 | 14.8 | 63.3 | 63.5 | 72.0 | 68.4 |
| GPT2-Base (117M) | CLS-FT | 71.2 | 78.6 | 55.8 | 65.5 | 67.8 | 17.4 | 65.8 | 63.0 | 64.4 | 63.0 |
| GPT2-Base (117M) | PET-FT | 74.8 | 87.5 | 88.1 | 68.0 | 70.0 | 23.5 | 69.7 | 66.3 | 78.0 | 70.2 |
| GPT2-Base (117M) | P-Tuning | 75.0 | 91.1 | 93.2 | 68.3 | 70.8 | 23.5 | 69.8 | 63.5 | 76.0 | 70.4 |
| BERT-Large (335M) | CLS-FT | 77.7 | 94.6 | 93.7 | 74.9 | 75.8 | 24.7 | 70.5 | 68.3 | 69.0 | 72.5 |
| BERT-Large (335M) | PET-FT | 77.2 | 91.1 | 93.5 | 70.5 | 73.6 | 17.7 | 67.0 | 80.8 | 75.0 | 73.1 |
| BERT-Large (335M) | P-Tuning | 77.8 | 96.4 | 97.4 | 72.7 | 75.5 | 17.1 | 65.6 | 81.7 | 76.0 | 74.6 |
| GPT2-Medium (345M) | CLS-FT | 71.0 | 73.2 | 51.2 | 65.2 | 72.2 | 19.2 | 65.8 | 62.5 | 66.0 | 63.1 |
| GPT2-Medium (345M) | PET-FT | 78.3 | 96.4 | 97.4 | 70.4 | 72.6 | 32.1 | 74.4 | 73.0 | 80.0 | 74.9 |
| GPT2-Medium (345M) | P-Tuning | 78.9 | 98.2 | 98.7 | 69.4 | 75.5 | 29.3 | 74.2 | 74.0 | 81.0 | 75.6 |
Few-shot SuperGLUE, ALBERT-xxlarge-v2, mean over four runs tab. 5. The Avg column matches the paper's seven-task averaging.
| Method | BoolQ | RTE | WiC | CB (Acc) | CB (F1) | MultiRC (F1a) | MultiRC (EM) | WSC | COPA | Avg |
|---|---|---|---|---|---|---|---|---|---|---|
| Prompt Tuning | 58.47 ±1.00 | 54.42 ±3.05 | 52.74 ±2.36 | 75.45 ±2.25 | 67.73 ±5.70 | 59.28 ±4.73 | 15.03 ±4.11 | 74.04 ±2.99 | 61.50 ±4.36 | 58.56 |
| PET-FT | 76.70 ±1.85 | 72.83 ±1.30 | 53.87 ±4.47 | 84.38 ±4.47 | 62.56 ±7.66 | 76.51 ±1.52 | 36.46 ±2.13 | 80.05 ±2.53 | 81.75 ±4.03 | 70.74 |
| P-Tuning | 76.55 ±2.68 | 63.27 ±3.63 | 55.49 ±1.21 | 88.39 ±3.72 | 84.24 ±5.15 | 75.91 ±1.74 | 38.01 ±0.78 | 78.85 ±1.76 | 85.25 ±3.30 | 71.81 |
The ± values are the standard deviations the table reports.
Robustness to the choice of pattern tab. 6. Few-shot BoolQ with ALBERT over six manual patterns (P#0 to P#5), and LAMA-P17 with BERT-base-cased over the same six manual prompts.
| Setting | Method | P#0 | P#1 | P#2 | P#3 | P#4 | P#5 | Std across patterns |
|---|---|---|---|---|---|---|---|---|
| Few-shot BoolQ | PET-FT | 77.10 ±2.21 | 67.96 ±2.69 | 74.14 ±1.38 | 72.48 ±4.31 | 71.77 ±2.56 | 60.86 ±3.99 | 5.68 |
| Few-shot BoolQ | P-Tuning | 75.41 ±3.09 | 75.11 ±1.61 | 73.43 ±2.60 | 71.35 ±4.57 | 71.31 ±8.58 | 65.86 ±3.80 | 3.52 |
| LAMA-P17 | Manual prompt | 31.3 | 19.8 | 31.4 | 51.1 | 34.0 | 32.7 | 10.1 |
| LAMA-P17 | P-Tuning | 57.8 | 57.8 | 58.1 | 58.1 | 58.9 | 58.7 | 0.46 |
Few-shot: number and position of continuous tokens on CB, ALBERT tab. 7. Seg = whether the inserted tokens split a sentence. Pos = edge or middle of the input. [P] = continuous token; [M] = mask token.
| ID | Pattern | Seg | Pos | #[P] | Acc | F1 | Avg |
|---|---|---|---|---|---|---|---|
| 1 | [Premise] Question: [Hypothesis] [P] ? Answer: [M]. | Yes | Mid | 1 | 87.95 | 76.70 | 82.33 |
| 2 | [Premise] Question [P]: [Hypothesis] ? Answer: [M]. | Yes | Mid | 1 | 88.39 | 78.57 | 83.48 |
| 3 | [Premise] Question: [Hypothesis] ? [P] Answer: [M]. | No | Mid | 1 | 89.29 | 79.86 | 84.58 |
| 4 | [Premise] [P] Question: [Hypothesis] ? Answer: [M]. | No | Mid | 1 | 89.73 | 82.15 | 85.94 |
| 5 | [Premise] Question: [Hypothesis] ? Answer: [M]. [P] | No | Edge | 1 | 87.50 | 83.39 | 85.45 |
| 6 | [Premise] Question: [Hypothesis] ? [P][P] Answer: [M]. | No | Mid | 2 | 88.39 | 84.74 | 86.57 |
| 7 | [Premise] Question: [Hypothesis] ? [P][P][P][P] Answer: [M]. | No | Mid | 4 | 88.39 | 85.14 | 86.76 |
| 8 | [Premise] Question: [Hypothesis] ? [P][P][P][P][P][P][P][P] Answer: [M]. | No | Mid | 8 | 83.48 | 73.32 | 78.40 |
Few-shot: prompt encoder type, ALBERT tab. 8, mean ± std.
| Task | LSTM | MLP | EMB (identity) |
|---|---|---|---|
| WiC (Acc) | 56.27 ±1.54 | 55.25 ±3.09 | 53.96 ±3.23 |
| CB (Acc) | 81.70 ±7.49 | 88.39 ±3.72 | 82.59 ±3.69 |
| CB (F1) | 77.41 ±9.15 | 84.24 ±5.15 | 67.27 ±6.78 |
| BoolQ (Acc) | 75.41 ±3.09 | 76.46 ±2.84 | 76.87 ±1.69 |
Few-shot: comparison with auto-searched discrete prompts, RoBERTa-large tab. 9. The paper evaluates the top-3 LM-BFF prompts under its own protocol, and adds P-Tuning on top of the same discrete prompts.
| Task | LM-BFF (Auto) | P-Tuning |
|---|---|---|
| SST-2 | 92.89 | 92.78 |
| MNLI | 57.53 | 58.70 |
| MRPC | 68.26 | 69.49 |
Headline claims, as the paper states them: P-Tuning improves LAMA-34k from 43.3 to 50.6 with the best BERT models §3.1; on few-shot SuperGLUE it averages more than one point above PET and more than 13 points above prompt tuning §3.3; and on LAMA it cuts the spread across manual prompts from 10.1 to 0.46 §3.4.
Paper vs code
Code: the official repository THUDM/P-tuning at commit f4225d4d8003868b31ed659dfe9732a351ad42d9 (MIT). It contains two parts, LAMA and few-shot SuperGLUE README.md. It has no code for fully supervised SuperGLUE, which the paper reports.
- Hand-written prompt missing in the LAMA code. The paper says P-Tuning
concatenates continuous slots with the relation's manual prompt, with the
template (3, sub, org_prompt, 3, obj, 3) §3.1. In the P-tuning branch of
get_query, the query contains only slot tokens, the subject tokens and the [MASK] or '.' placeholder. The relation template fromrelations.jsonlis used only whenuse_original_templateis set [code: LAMA/p_tuning/modeling.py#L74-L105]. The default is False [code: LAMA/cli.py#L52]. Implement the paper's version only if you add the template yourself, and say so. - Slot order in the BERT branch. The paper's layout puts the subject before the object §3.1. The code's BERT branch places [MASK] (which receives the target label) before the subject tokens, then three slots, then the subject, then three slots or '.', then [SEP] modeling.py. The code comments are not clear on this. Treat the code as the reference for the BERT query layout, and check it against the paper's figure of the template.
- GPT branch. The template is forced to (t0, t1, 0) [code: LAMA/p_tuning/modeling.py#L43-L44]. The query is slots, subject, slots, and the label is predicted at the last position [code: LAMA/p_tuning/modeling.py#L97-L104] modeling.py. This matches the paper apart from the missing manual prompt (item 1).
- LAMA prompt encoder. The paper describes a lightweight network and tries LSTM, MLP and identity §2.3. The LAMA code always uses a 2-layer bidirectional LSTM followed by an MLP [code: LAMA/p_tuning/prompt_encoder.py#L26-L40]. The identity option is not in the LAMA code.
- LAMA optimisation details not in the paper. Weight decay 5e-4 [code: LAMA/cli.py#L47]. Exponential decay with factor 0.98 per epoch [code: LAMA/cli.py#L46] cli.py cli.py. At most 100 epochs cli.py. Early stopping after 20 epochs without a better dev Hit@1, with the test score recorded at the best dev epoch [code: LAMA/cli.py#L189-L196].
- Frozen LM runs in half precision. When the LM is frozen it is converted
with
.half()models.py. The forward pass casts inputs to half too modeling.py. The paper does not mention precision. - Few-shot learning rates. The paper searches one learning rate in {1e-5,
2e-5} §3.3. The code uses
--learning_rateonly for the prompt encoder and prompt embeddings wrapper.py [code: PT-Fewshot/cli.py#L117]. The LM optimiser uses a fixed 1e-5 [code: PT-Fewshot/pet/wrapper.py#L312]. - Few-shot prompt count is the pattern id. The number of continuous tokens
is set from
pattern_idwrapper.py. Pattern choice and token count are therefore one parameter in code. The paper varies them separately §3.3 tab. 7. - Few-shot CB pattern in code. The CB pattern used by the released script
(
--pattern_ids 1) is text_a [SEP] text_b ? [P] answer: [MASK], where the continuous slot is the position of the word "the" [code: PT-Fewshot/data_utils/task_pvps.py#L325-L329] [code: PT-Fewshot/scripts/cb_pt_few_shot.sh#L16]. This is not one of the rows of tab. 7. The paper does not state the exact patterns used for its main few-shot results, only that PET's manual patterns were extended with continuous tokens §3.3. - EMB option missing. The paper's ablation includes the identity encoder
(EMB) tab. 8. The few-shot CLI accepts only
lstmandmlp[code: PT-Fewshot/cli.py#L142]. - Few-shot LSTM size. The few-shot encoder uses an embedding and LSTM of size 128 and a two-layer MLP wrapper.py cli.py. The paper does not state these sizes.
- Evaluation frequency. The paper searches {0.02, 0.04} without a unit §3.3. The code evaluates every 20 steps by default [code: PT-Fewshot/cli.py#L143]. The CB script does not override it.
- Few-shot defaults not in the paper. Weight decay 0.1 [code: PT-Fewshot/cli.py#L119], linear warm-up with 0 steps by default [code: PT-Fewshot/cli.py#L125] wrapper.py, and a training batch of 2 per GPU in the CB script [code: PT-Fewshot/scripts/cb_pt_few_shot.sh#L12] cli.py.
No discrepancies were checked for the fully supervised SuperGLUE setting, because the repository has no code for it.
Pitfalls
- The LAMA code omits the manual prompt (Paper vs code, item 1). A faithful reimplementation of the paper's numbers needs the template with the relation prompt. The paper does not give the exact manual prompts in the text; they come from LAMA and are listed in tab. 1 only for P17.
- Compare like with like. The headline "43.3 to 50.6" §3.1 compares AutoPrompt with BERT-base against P-Tuning with BERT-large. The same-size comparison is 43.3 vs 48.3 tab. 3. LAMA-34k and LAMA-29k numbers are not comparable with each other.
- Text overstates GPT results. The paper says P-Tuning "consistently achieves the best performance on all tasks" for GPT2-Base and GPT2-Medium §3.2. tab. 4 shows PET-FT higher on WSC and COPA for GPT2-Base (66.3 vs 63.5, 78.0 vs 76.0), and on WiC, MultiRC EM and MultiRC F1a for GPT2-Medium (70.4 vs 69.4, 32.1 vs 29.3, 74.4 vs 74.2).
- Few-shot gains are small and noisy. The average gain over PET is 1.07 points tab. 5, inside the reported standard deviations on several tasks. RTE is lower than PET (63.27 vs 72.83) tab. 5. The text says model selection uses only a small labelled set §3.3. The repository ships the 32-example dev sets used for this (FewGLUE_32dev) README.md; check that your split matches them before comparing numbers.
- Appendix not in the compiled paper. The few-shot hyperparameter table
(K = 4 runs, split ratio 1:1, one continuous token, the encoder choices) sits in
an appendix file that is commented out in
main.tex. The paper's compiled PDF may not contain it. The values that appear in the main text §3.3 are the reliable ones. - Numbers from source order. The paper was read from LaTeX source. The section numbers (§1 Introduction, §2 Method, §3 Experiments, §4 Related work, §5 Conclusions) and table and figure numbers follow the order of their definitions in the source. Check them against the PDF before citing externally. The method's display equations are unnumbered, so the card cites them by section.
- Development set results, not test. The fully supervised numbers are on the SuperGLUE development sets tab. 4. The few-shot numbers come from the FewNLU protocol §3.3. Neither is a leaderboard score.
- Stability metric. The spread across patterns is a standard deviation over patterns tab. 6. The LAMA figure of 0.46 is for one relation (P17) tab. 6. It does not cover the other relations.
- MegatronLM 11B is frozen and loaded from merged model shards. The repository
provides a merge function in
megatron_11b/megatron_wrapper.py; the 11B weights themselves come from FairSeq README.md. Expect a large memory requirement; the code's loader warns of about 28 GB of GPU memory in fp16 models.py. - Results depend on the frozen-LM setup. The LAMA results need the frozen LM (fp16 in code). Tuning the LM changes the setting, and the paper reports the LAMA setup only with frozen LMs §3.
- Data split. The LAMA data comes from AutoPrompt and is an external download
README.md. The shared vocabulary option (
vocab_strategy) changes the candidate set cli.py.
Lineage
- Builds on: manual discrete prompting, as used by PET, which the paper follows
for few-shot patterns and for its SuperGLUE comparison §3.2 §3.3. Concept
slug:
prompt-engineering. - Compared against: AutoPrompt and LPAQA on LAMA tab. 3 §3.1; LM-BFF auto-searched prompts tab. 9; Prompt Tuning tab. 5; standard classification fine-tuning tab. 4.
- Concept slugs:
soft-prompt-tuning(the method),few-shot-learning(the few-shot setting).
Source and license
Adapted from “GPT Understands, Too” by Xiao Liu, Yanan Zheng, Zhengxiao Du, Ming Ding, Yujie Qian, Zhilin Yang, Jie Tang (arXiv:2103.10385), 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. Code citations refer to https://github.com/THUDM/P-tuning at commit f4225d4d8003 (MIT). Any quoted code is shown under that license.