In-Context Instruction Learning

Seonghyeon Ye, Hyeonbin Hwang, Sohee Yang, Hyeongu Yun, Yireun Kim, Minjoon Seo · OpenReview

Abstract

Instruction learning of Large Language Models (LLMs) has enabled zero-shot task generalization. However, instruction learning has been predominantly approached as a fine-tuning problem, including instruction tuning and reinforcement learning from human feedback, where LLMs are multi-task fine-tuned on various tasks with instructions. In this paper, we present a surprising finding that applying in-context learning to instruction learning, referred to as In-Context Instruction Learning (ICIL), significantly improves the zero-shot task generalization performance for both pretrained and instruction-fine-tuned models. One of the core advantages of ICIL is that it uses a single fixed prompt to evaluate all tasks, which is a concatenation of cross-task demonstrations. In particular, we demonstrate that the most powerful instruction-fine-tuned baseline (text-davinci-003) also benefits from ICIL by 9.3%, indicating that the effect of ICIL is complementary to instruction-based fine-tuning.

Introduction

Large Language Models (LLMs) are renowned for their ability to follow natural language instructions. Traditionally, this capability is developed through extensive instruction fine-tuning or Reinforcement Learning from Human Feedback (RLHF). While effective, these methods are computationally expensive and cannot be applied to proprietary "black-box" models where model weights are inaccessible.

In-Context Learning (ICL) offers a flexible alternative, allowing models to adapt during inference using task-specific examples. However, standard ICL requires users to provide relevant demonstrations for every new task. This research investigates a more universal approach: Is there a fixed "warm-up" prompt that can activate instruction-following across any task, even for models never explicitly fine-tuned for it?

Methodology: The Task-Agnostic Prefix Prompt (TAPP)

The researchers introduce the Task-Agnostic Prefix Prompt (TAPP) as a practical implementation of In-Context Instruction Learning (ICIL). Unlike standard prompts, TAPP is a fixed string of demonstrations prepended to every input, regardless of the target task. This single, static block of text serves to "prime" the model's latent instruction-following capabilities.

The TAPP framework prepends a fixed set of cross-task demonstrations to activate instruction-following in LLMs across diverse tasks.

To construct an effective TAPP, the authors followed four heuristic rules:

  1. Classification Focus: Use demonstrations from classification tasks that explicitly list answer choices in the instruction.
  2. No Label Overlap: Ensure answer choices (labels) do not overlap between different demonstrations in the prefix.
  3. Length Constraints: Keep demonstrations concise (under 256 tokens).
  4. Strategic Ordering: Order demonstrations by the number of answer choices in ascending order.

Experimental Results

The effectiveness of TAPP was evaluated using 119 held-out tasks from the SUPER-NATURALINSTRUCTIONS (SUPERNI) dataset. The study tested a wide range of models, including GPT-3 (Curie, Davinci), OPT (6.7B to 66B), and GPT-NeoX (20B).

Comparison of zero-shot performance between base input and TAPP-enhanced input across various Base and Instruction Fine-tuned LLMs.

Key Performance Insights

  • Massive Boosts for Base Models: Prepending TAPP to base LLMs resulted in an average performance jump of 34.58%.
  • Scaling Efficiency: A notable "David vs. Goliath" result emerged where the 6B-parameter GPT-J model equipped with TAPP outperformed the 175B-parameter GPT-3 Davinci model (30x larger) that did not use the prefix.
  • Complementary Gains: TAPP is not just for base models; it also improved instruction-tuned models by an average of 12.26%. Specifically, it boosted the state-of-the-art text-davinci-003 by 9.3%, suggesting that even the best tuning does not fully activate a model's latent potential.
  • Cross-Task Synergy: Surprisingly, using classification tasks as demonstrations in the TAPP helped models perform better on generation tasks. This suggests the model is learning the general "meta-task" of following instructions rather than just mimicking specific task patterns.

Analysis and Robustness

The authors hypothesize that TAPP acts as a signal that helps the LLM "focus" on the instruction of the target task, teaching it the "rules of the game." Robustness tests revealed a fascinating insight: replacing the input of the TAPP demonstrations with random sentences (corrupting the data) resulted in almost no performance drop. However, corrupting the instruction or the output caused performance to tank. This indicates the model is specifically learning the structural mapping between instruction-based choices and the final label.

Limitations and Future Work

While TAPP is highly effective, it increases the input sequence length, leading to higher computational costs. However, because the prefix is fixed, its Key-Value (KV) states can be cached, significantly mitigating this cost in production environments.

One notable exception was FLAN-T5, where TAPP actually harmed performance. The authors suspect this is because FLAN-T5 was so heavily trained on task-specific ICL that it attempts to "copy" the TAPP labels rather than following the new target instruction. Future work will involve investigating the internal attention patterns of models to see exactly how TAPP modifies the forward pass.

Conclusion

In-Context Instruction Learning via TAPP provides a simple, training-free method to significantly enhance the zero-shot generalization of LLMs. By using a single fixed prompt, researchers have demonstrated that instruction-following is a latent capability that can be activated at inference time, providing a powerful tool for both base and fine-tuned models.

Summary updated

Abstract

Instruction learning of Large Language Models (LLMs) has enabled zero-shot task generalization. However, instruction learning has been predominantly approached as a fine-tuning problem, including instruction tuning and reinforcement learning from human feedback, where LLMs are multi-task fine-tuned on various tasks with instructions. In this paper, we present a surprising finding that applying in-context learning to instruction learning, referred to as In-Context Instruction Learning (ICIL), significantly improves the zero-shot task generalization performance for both pretrained and instruction-fine-tuned models. One of the core advantages of ICIL is that it uses a single fixed prompt to evaluate all tasks, which is a concatenation of cross-task demonstrations. In particular, we demonstrate that the most powerful instruction-fine-tuned baseline (text-davinci-003) also benefits from ICIL by 9.3%, indicating that the effect of ICIL is complementary to instruction-based fine-tuning.
BibTeX
@inproceedings{ye2024context,
  author = {Seonghyeon Ye and Hyeonbin Hwang and Sohee Yang and Hyeongu Yun and Yireun Kim and Minjoon Seo},
  title = {{In-Context Instruction Learning}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  url = {https://openreview.net/forum?id=64fUXxim0a},
}
Figure