Towards Unified Task Embeddings Across Multiple Models: Bridging the Gap for Prompt-Based Large Language Models and Beyond

Xinyu Wang, Hainiu Xu, Lin Gui, Yulan He

Introduction

In the field of meta-learning, task embeddings serve as numerical representations—digital fingerprints—that characterize the specific operation a model is performing, such as sentiment analysis or question answering. Traditionally, these embeddings are derived from a model's internal parameters or gradients. However, this approach faces two critical challenges in the era of Large Language Models (LLMs). First, incompatibility: embeddings from different architectures (e.g., BERT vs. GPT) reside in distinct vector spaces, making direct comparison impossible. Second, the "Black Box" problem: many state-of-the-art LLMs are accessed via APIs where internal gradients are unavailable, rendering traditional embedding methods obsolete.

The FUTE Framework

To address these limitations, we introduce the Framework for Unified Task Embedding (FUTE). FUTE establishes a model-agnostic representation of tasks within a single, universal vector space. This allows for cross-model comparisons and optimized prompt selection without requiring access to internal model weights.

Overview of the FUTE framework, illustrating the transition from model-specific, coupled embeddings to a unified, decoupled universal embedding space.

Methodology: Decoupling and Surrogacy

The core innovation of FUTE lies in three architectural shifts designed to standardize task representation:

1. Decoupling DTE and MTE

FUTE splits the concept of a task embedding into two distinct components:

  • Dataset Task Embedding (DTE): Captures the intrinsic characteristics of the data itself.
  • Model Task Embedding (MTE): Captures the specific behavior of a model when performing a task, independent of the training data.

2. The Surrogate Model

To ensure all embeddings inhabit the same vector space, FUTE bypasses the target model's internal parameters. Instead, it utilizes a consistent surrogate model (specifically T5-base) to generate the final embeddings. This surrogate acts as a "universal translator" for model behaviors.

3. The Black-Box Pipeline

For models like Llama 2 or GPT-4, FUTE treats the model as a black box. It feeds unsupervised text into the target model, collects the resulting predictions, and then processes these predictions through the surrogate model to generate the MTE. For LLMs, the framework treats the combination of a [Prompt + LLM] as a single functional unit, allowing it to quantify how different instructions steer model behavior.

Detailed pipelines for generating Dataset Task Embeddings (DTE) and Model Task Embeddings (MTE) across various model types, including prompt-based black-box LLMs.

Experimental Evaluation

The framework was validated using a diverse set of benchmarks, including 11 Classification/Regression (CR) datasets (e.g., GLUE, SNLI) and 11 Question Answering (QA) datasets (e.g., SQuAD). To provide a "neutral ground" for behavior fingerprinting, the authors utilized over 100,000 text entries from the CrossFit dataset.

Key Results

  • Cross-Model Transferability: Despite its model-agnostic nature, FUTE performs competitively with architecture-specific methods. In identifying which source models best assist a target task, FUTE achieved an average rank of 3.3 on CR tasks, nearing the 2.5 achieved by specialized methods like TuPaTE.
  • Prompt Selection: FUTE demonstrated superior performance in selecting optimal zero-shot prompts for LLMs. On Llama 2 70B for NLI tasks, it achieved an NDCG of 81.8, significantly outperforming the SPELL baseline (77.2).
  • Unified Visualization: Using T-SNE, the authors successfully mapped BERT, GPT-2, and T5 into a single plot. The results showed clear clusters based on task type (QA vs. CR) rather than model architecture, proving the framework's ability to capture functional commonalities.

Discussion and Conclusion

The primary insight of FUTE is that a model's output behavior on diverse data is a sufficient proxy for its internal state. By focusing on behavior over parameters, FUTE enables a new level of interoperability between disparate AI systems.

While the framework currently depends on the choice of a surrogate model and requires inference overhead on unsupervised data, it paves the way for more robust meta-learning across the growing ecosystem of black-box LLMs. Future research may extend this unified space to include traditional machine learning classifiers like SVMs and Decision Trees, further bridging the gap between classical ML and modern deep learning.

Summary updated

BibTeX
@inproceedings{wang2024towards,
  author = {Xinyu Wang and Hainiu Xu and Lin Gui and Yulan He},
  title = {{Towards Unified Task Embeddings Across Multiple Models: Bridging the Gap for Prompt-Based Large Language Models and Beyond}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.findings-acl.493},
}
Figure