Differentiable Prompt Makes Pre-trained Language Models Better Few-shot Learners

Ningyu Zhang, Luoqiu Li, Xiang Chen, Shumin Deng, Zhen Bi, Chuanqi Tan, Fei Huang, Huajun Chen

Introduction

DART (Differentiable pRompT) is a pluggable, parameter-efficient method that transforms small pre-trained language models into high-performing few-shot learners. By replacing manual prompt engineering with the differential optimization of both templates and label tokens in continuous space, DART achieves up to 90% of state-of-the-art performance with as few as 8 samples per class.

What Problem Does This Paper Address?

While massive models like GPT-3 have shown incredible few-shot capabilities, their size makes them impractical for most real-world deployments. Smaller models (like BERT or RoBERTa) can be "prompted" to perform few-shot tasks, but this usually requires a "black art" of manual prompt engineering—hand-crafting templates like [Movie Review] It was [MASK].

Manual prompts are brittle: a single word change can cause performance to swing from "state-of-the-art" to "random guess." Furthermore, many tasks have complex labels (e.g., "country of birth") that don't map neatly to a single vocabulary word. The authors aim to remove the human-in-the-loop bottleneck by making the entire prompting process—both the template and the labels—mathematically differentiable and automatically optimizable.

Methods

The authors introduce DART (Differentiable pRompT), which treats prompts not as strings of text, but as sets of trainable parameters. Key components include:

DART Architecture
  • Differentiable Template Optimization: Instead of using real words, DART uses "pseudo tokens" (unused tokens from the model's vocabulary). These tokens are initialized and then optimized via backpropagation in the continuous embedding space.
  • Differentiable Label Optimization: This is a major departure from previous work. Instead of mapping a class (like "Positive") to a fixed word (like "great"), DART maps classes to trainable vectors. This allows the model to learn the best internal representation for a label, which is especially helpful for complex categories.
  • Fluency Constraint Object: To prevent the optimized prompt embeddings from becoming "nonsense" that confuses the pre-trained model, the authors add an auxiliary loss. This forces the model to maintain its language modeling capabilities (via a masked language modeling objective) while learning the prompt, ensuring the prompt tokens remain "fluent" within the model's internal logic.
  • Pluggable Architecture: Unlike some competitors (like P-tuning) that require adding an external LSTM to help train the prompt, DART uses the model’s own transformer architecture, keeping it simple and efficient.

Datasets

The researchers evaluated DART across 15 NLP tasks, categorized into:

  • Classification Benchmarks: SST-2, MR, CR (Sentiment); MNLI, SNLI, QNLI (Inference); MRPC, QQP (Paraphrase); TREC (Question type); Subj (Subjectivity).
  • Complex Label Tasks: Relation Extraction (SemEval-2010 Task 8, TACRED-Revisit, Wiki80, ChemProt) and Event Extraction (ACE-2005). These are significantly harder for few-shot learners because the label space is large and semantically dense.

Key Insights and Ideas

  • Labels are Vectors, Not Just Words: The most significant "aha" moment is that forcing a model to use a specific vocabulary word as a label (e.g., "Yes" for "Entailment") is a bottleneck. By letting the label itself be a learnable vector, the model can find a more discriminative representation that isn't tied to the baggage of a specific natural language word.
  • The Fluency-Performance Link: The "Fluency Constraint" isn't just for show. By forcing the prompt tokens to be "co-dependent" and linguistically coherent to the model, the resulting representations are more compact and better separated in the embedding space.
  • Small Models Can Punch Up: DART allows a RoBERTa-large model (355M parameters) to achieve 90% of the performance of SOTA models trained on full datasets, using only 8 samples per class. This suggests that "intelligence" in few-shot learning is often a matter of how you access the model's knowledge, not just the model's size.

Key Results

  • Relation Extraction Gains: On tasks with complex labels like TACRED-Revisit, DART outperformed conventional fine-tuning by a staggering 18.4% in the 8-shot setting.
  • Consistency: Across 15 datasets, DART consistently beat or matched other popular prompting methods like LM-BFF and P-Tuning.
Few-shot Classification Results
  • Efficiency: DART achieves these results without adding external neural network layers (like LSTMs), making it more "parameter-efficient" than many existing "soft prompt" methods.
  • Visual Evidence: t-SNE visualizations show that DART produces much tighter, more distinct clusters for different classes compared to fixed-prompt methods, explaining its superior classification accuracy.

Limitations and Future Work

  • Domain Shift: The authors acknowledge that DART may struggle if the task corpus is significantly different from the model's pre-training data (e.g., moving from general web text to highly specific medical journals).
  • Hyperparameter Sensitivity: Like many few-shot methods, DART exhibits some instability depending on the choice of hyperparameters, a common "volatility" in low-data regimes.
  • Future Directions: The authors suggest exploring DART for other tasks like intent detection and extending the method to even more diverse architectures like BART.

Summary updated

BibTeX
@inproceedings{zhang2022differentiable,
  author = {Ningyu Zhang and Luoqiu Li and Xiang Chen and Shumin Deng and Zhen Bi and Chuanqi Tan and Fei Huang and Huajun Chen},
  title = {{Differentiable Prompt Makes Pre-trained Language Models Better Few-shot Learners}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=9RCwelNSWc},
}
Figure