Compositional Task Representations for Large Language Models

Nan Shao, Zefan Cai, Hanwei xu, Chonghua Liao, Yanan Zheng, Zhilin YangICLR 2023

TL;DR

Researchers have developed Compositional Task Representations (CTR), a prompt-free approach that represents AI tasks as combinations of discrete "latent codes" rather than natural language instructions. By learning a modular codebook of skills, Large Language Models (LLMs) can generalize to entirely new tasks simply by recombining seen codes, significantly outperforming traditional prompt-based methods in zero-label and few-shot scenarios.

The Problem with Natural Language Prompts

While Large Language Models (LLMs) like GPT-3 and FLAN show incredible "cross-task generalization," they typically rely on natural language prompts to understand what a user wants. This creates a few significant hurdles:

  1. Brittleness: Small changes in prompt wording can lead to wildly different results.
  2. Optimization Difficulty: Finding the "perfect" prompt often requires extensive manual engineering or complex automated searches.
  3. The Language Assumption: Most researchers assume natural language is the only or best way to extract knowledge from a model.

The authors of this paper challenge that assumption. They ask: Can we represent a task as a mathematical composition of discrete skills instead of a sentence? If a "summarization" task and a "translation" task share certain underlying logic, a model should be able to learn those shared "latent codes" and recombine them to solve a third, unseen task.

Methods: Compositional Task Representations (CTR)

Training and Inference Phases of CTR

The authors introduce Compositional Task Representations (CTR). Instead of a text prompt, the model uses a sequence of discrete codes retrieved from a learned codebook.

The Architecture

  • The Codebook: A table of embeddings (vectors) where each entry represents a "latent skill" or task attribute.
  • The Encoder: Maps a task's unique ID into "query vectors."
  • Retrieval: These query vectors look up the nearest neighbors in the codebook (similar to the VQ-VAE architecture used in image generation).
  • The Decoder: Takes the sequence of retrieved codes and transforms them into a format the LLM can process as a prefix (replacing the prompt).

Training and Inference

  • Multi-Task Training: The system is trained on dozens of different task types simultaneously. It learns to decompose these tasks into the codebook.
  • Zero-Label Inference: When faced with a brand-new task and no labels, the model uses Code Ensemble. It looks at unlabeled data to see which existing task codes produce the most "confident" (least uniform) predictions.
  • Few-Shot Inference: If a few examples are available, the model performs a Bitwise Search, iteratively flipping bits in the task code to see which combination maximizes accuracy on those few examples.

Datasets

The researchers used the T0 benchmark for their experiments:

  • Training: 39 tasks across 8 categories (e.g., Sentiment Analysis, Topic Classification, Summarization).
  • Evaluation (Held-out): 11 tasks across 4 categories that the model never saw during training (e.g., Natural Language Inference, Coreference Resolution, Sentence Completion).
  • Specific Datasets: Includes well-known benchmarks like RTE, CB, ANLI, COPA, and Winogrande.

Key Insights and Ideas

Compositional Task Codes and Interpretability
  • Tasks are Modular: The core "aha moment" is that tasks aren't monolithic. A task like COPA (sentence completion) can be viewed as a mix of "reasoning-based QA" and "long-sentence generation." CTR learns to "borrow" codes from these seen tasks to solve the new one.
  • Interpretability: Surprisingly, the learned codes aren't just random numbers. The authors found that specific codes consistently appeared in similar tasks. For example, Code 111 almost always appeared in tasks requiring long-sentence generation, while Code 69 was shared by multiple-choice reasoning tasks.
  • Controllability: By manually flipping a single bit in the task representation, the researchers could "steer" the model's behavior—changing its output from a dialogue response to a topic classification while keeping the input text exactly the same.

Key Results

CTR demonstrated a clear advantage over state-of-the-art prompt-based methods:

  • Zero-Label Performance: CTR achieved an average accuracy of 58.88%, outperforming the T0-Large baseline (54.79%) and even a self-training approach (57.38%).
  • Few-Shot Performance: In the 32-shot setting, CTR reached 60.66%, beating standard Model Tuning (58.18%) and Prompt Tuning (57.25%).
  • Efficiency: CTR provides a more stable way to generalize than "Genetic Prompt Search" (GPS) or "Black-Box Tuning" (BBT), showing more consistent gains across a wider variety of tasks.

Limitations and Future Work

  • Search Optimization: The authors noted a significant gap between their current results and the "upper bound" (the best possible code combination). This suggests that their current search algorithms (Code Ensemble and Bitwise Search) could be improved to find even better representations.
  • Dependence on Pseudo-labels: In zero-label coreference tasks (like WSC), CTR performed slightly worse because the unlabeled data didn't provide high-quality "pseudo-labels" to guide the code selection.
  • Scaling: The experiments were conducted on T5-Large (approx. 770M parameters). Future work could explore how this compositional approach behaves in massive models with hundreds of billions of parameters.

Summary updated

BibTeX
@inproceedings{shao2023compositional,
  author = {NAN SHAO and Zefan Cai and Hanwei xu and Chonghua Liao and Yanan Zheng and Zhilin Yang},
  title = {{Compositional Task Representations for Large Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=6axIMJA7ME3},
}
Figure