Learning to Predict Task Transferability via Soft Prompt

Lingyun FengEMNLP 2023

Abstract

Selecting the optimal intermediate task for transfer learning typically requires exhaustive and computationally expensive brute-force searches. This paper proposes a novel approach that leverages "soft prompts" as compact task embeddings to train a learned affinity scoring function. By training on a sparse sample of task pairs, this method accurately predicts transferability with significantly lower overhead than traditional techniques, achieving performance near the theoretical upper bound.

Introduction

In Natural Language Processing (NLP), "pre-fine-tuning" a model on an intermediate source task—such as natural language inference—before training on a target task—like sentiment analysis—can significantly enhance performance. However, this process is fraught with the risk of "negative transfer," where a poorly chosen source task degrades the model's final performance.

The central challenge lies in prediction: identifying which source tasks will be most beneficial for a given target. Current strategies often rely on human intuition, simple similarity metrics (e.g., cosine similarity), or "brute-force" evaluation of all possible combinations. While brute force is accurate, its cost scales poorly with the number of tasks. This research introduces an efficient alternative: a learned affinity function that treats soft prompts as semantic "fingerprints" of tasks.

Methodology

The authors propose a three-stage pipeline designed for efficient transferability prediction:

1. Prompt Pool Construction

To avoid the high cost of full-model fine-tuning for every task, the framework utilizes Prompt Tuning. A large language model (specifically RoBERTa-large) is kept frozen, and only a small set of continuous vectors—a "soft prompt"—is trained for each task. These soft prompts act as task embeddings, effectively summarizing the task-specific knowledge required by the model.

2. Learning the Affinity Function

The system learns to predict transferability by sampling a subset of task pairs from the pool. For each pair, the "transfer gain" is measured—defined as the improvement in target task performance when initialized with the source task's prompt versus a random initialization. A neural network, the affinity scoring function, is then trained to map pairs of task embeddings to their predicted transfer gain. To ensure robustness against outliers in the transfer data, the function is optimized using a Smooth L1 loss.

3. Predictive Transfer

When presented with a novel target task, the system first learns its soft prompt embedding. This embedding, along with those from the source pool, is fed into the scoring function. The function ranks the source tasks, and the model is initialized with the highest-ranked prompt for final training on the target task.

Overview of the proposed framework: (a) Prompt Pool Construction and (b) Evaluation on Novel Tasks.

Experimental Setup

The methodology was evaluated using a comprehensive suite of 50 NLP tasks, spanning Natural Language Inference (NLI), Sentiment Classification, Question Answering, Sequence Labeling (e.g., NER), and Commonsense Reasoning. Of these, 44 tasks served as potential sources, while 6 were held out as targets to test the system's predictive accuracy on unseen tasks.

Results and Discussion

The experimental results validate the core hypothesis that soft prompts serve as excellent semantic task embeddings.

Near-Oracle Performance

The proposed method achieved an average accuracy gain of 3.78% across target tasks. This performance is remarkably close to the 4.29% gain achieved by the "Brute Force" upper bound, which requires exhaustive training on every single combination.

Comparison with Baselines

As shown in the performance analysis, the learned affinity scoring function significantly outperforms traditional heuristic metrics. While standard cosine similarity ($D_{cos}$) between embeddings only managed a 1.68% gain, the learned function captures the complex, non-symmetric relationships inherent in task transfer.

Transfer gain comparison between the learned affinity scoring function and baseline similarity metrics (Best of Top-1) across different training pair budgets.

Efficiency and Generalization

One of the most striking findings is the efficiency of the approach. Training on just 400 random task pairs—a small fraction of the nearly 2,000 possible combinations—was sufficient to achieve near-optimal results. Furthermore, the scoring function demonstrated strong generalization, successfully predicting transferability for task types (like NER) that were not present in its training set.

Conclusion

This work demonstrates that soft prompts can be repurposed as effective task embeddings for predicting transferability. By replacing expensive brute-force searches with a learned affinity function, researchers can more effectively navigate the landscape of transfer learning. Future work will investigate multi-source transfer, exploring how to "mix" or "merge" prompts from multiple beneficial tasks to further push performance boundaries.

Summary updated

BibTeX
@inproceedings{feng2023learning,
  author = {Lingyun Feng},
  title = {{Learning to Predict Task Transferability via Soft Prompt}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.emnlp-main.546},
}
Figure