Investigating the Effectiveness of Task-Agnostic Prefix Prompt for Instruction Following

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

TL;DR

Instead of expensive fine-tuning or tedious task-specific prompt engineering, you can boost an LLM's instruction-following capability simply by prepending a fixed, static set of cross-task examples to every input. This method, called Task-Agnostic Prefix Prompting (TAPP), improves base models by 34.6% and instruction-tuned models by 12.3% on average, even enabling a 6B parameter model to outperform a raw 175B model.

What Problem Does This Paper Address?

Teaching Large Language Models (LLMs) to follow user instructions typically relies on instruction fine-tuning or Reinforcement Learning from Human Feedback (RLHF). While highly effective, these approaches require massive compute, multiple backpropagation passes, and direct access to model weights—making them impractical for proprietary APIs or resource-constrained settings.

Alternatively, standard In-Context Learning (ICL) requires users to curate task-specific demonstrations for every single new task, which is labor-intensive and hard to scale. The authors ask a compelling question: Can we activate an LLM's latent instruction-following capabilities at inference time using a single, fixed prompt that remains invariant across all downstream tasks?

Methods

The authors introduce Task-Agnostic Prefix Prompt (TAPP). Unlike traditional task-specific prompts, TAPP is a static sequence of $K$ (defaulting to 8) diverse demonstrations prepended to the target task input during zero-shot inference.

Figure 1: Overview of Task-Agnostic Prefix Prompt (TAPP). We construct a fixed set of demonstrations consisting of instruction, input, and output instances to evaluate base and instruction-fine-tuned LLMs for all tasks. The task categories included in the demonstrations are strictly held-out and from the tasks being evaluated, ensuring a zero-shot setting.

To construct an effective TAPP, the authors developed four simple heuristics:

  1. Task Selection: Demos are drawn exclusively from classification tasks where the instruction explicitly lists the valid answer choices (e.g., Answer with "agent" or "customer").
  2. No Answer Choice Overlap: The valid labels across the 8 demonstrations must not overlap, preventing the model from simply copying a frequent label.
  3. Length Constraints: The total length of each demonstration is capped at 256 tokens to preserve context window space.
  4. Strict Ordering: Demonstrations are sorted in ascending order based on the number of answer choices, and then by token length.

During inference, this exact same block of 8 examples is prepended to every single incoming target task, regardless of whether the target is a classification, extraction, or free-form generation task.

Datasets

The method was evaluated using the SUPER-NATURALINSTRUCTIONS (SUPERNI) benchmark, a diverse collection of NLP tasks.

  • Task Pool for TAPP: The 756 English training tasks were used to sample the prefix demonstrations.
  • Evaluation Set: 119 strictly held-out test tasks spanning 12 distinct categories (including textual entailment, cause-effect classification, question rewriting, and title generation) were used to evaluate zero-shot generalization.

Key Insights and Ideas

  • Classification Primers Help Generation Tasks: Surprisingly, prepending classification examples significantly boosts performance on generation tasks. This directly contradicts traditional ICL wisdom, which dictates that prompt demonstrations should closely match the target task distribution.
  • The "Instruction-to-Label" Shortcut: Through input corruption experiments (replacing the input text of the prefix examples with random sentences from a news corpus), the authors discovered that the actual input text matters very little. However, corrupting the instructions or the output labels tanks performance. This suggests that TAPP works by priming the LLM to map the explicit choices listed in an instruction directly to the output space, forcing the model to pay closer attention to the target task's prompt.
  • Complementary to Instruction Tuning: TAPP doesn't just help raw base models; it provides an orthogonal performance boost when applied to state-of-the-art instruction-tuned models like text-davinci-003.

Key Results

The authors evaluated TAPP across multiple model families (GPT-3, OPT, GPT-NeoX, GPT-J) and scales (6B to 175B parameters).

Figure 2: Average performance of 119 evaluation tasks on SUPERNI benchmark. TAPP is effective for both base and instruction- fine-tuned LLMs. We report the mean score of three random seeds for different demonstration sets for TAPP and the error bars of standard deviation. We also perform an evaluation using INSTRUCTSCORE (Xu et al. 2023) in Appendix B and provide the full demonstration sets in Appendix H
  • Base Models: TAPP yielded a massive 34.58% average relative improvement. Remarkably, the 6B GPT-J model equipped with TAPP outperformed the 30x larger 175B GPT-3 (Davinci) base model without TAPP.
  • Instruction-Tuned Models: TAPP provided a 12.26% average relative improvement. It boosted OpenAI's text-davinci-003 by 9.3%, achieving the highest overall score on the benchmark.
  • Few-Shot Synergy: When combined with traditional few-shot ICL, adding TAPP further pushed the performance envelope (from 56.65 to 60.21), demonstrating that it works well alongside task-specific examples.

Limitations and Future Work

  • Inference Overhead: Prepending a fixed set of 8 examples increases the input sequence length, which raises compute costs and latency. However, because the prefix is entirely static across all tasks, this overhead can be heavily mitigated in production using prefix caching mechanisms.
  • Evaluation Metrics: The study relies primarily on automated string-matching heuristics (Exact Match, ROUGE-L). The authors note that qualitative human evaluations are an important next step.
  • Mechanistic Understanding: The explanation for why TAPP increases attention to instructions remains a well-supported hypothesis; a deeper look into the internal attention heads and circuit mechanics of the transformers is left for future research.

Summary updated

Abstract

In this paper, we present our finding that prepending a Task-Agnostic Prefix Prompt (TAPP) to the input improves the instruction-following ability of various Large Language Models (LLMs) during inference. TAPP is different from canonical prompts for LLMs in that it is a fixed prompt prepended to the beginning of every input regardless of the target task for zero-shot generalization. We observe that both base LLMs (i.e. not fine-tuned to follow instructions) and instruction-tuned models benefit from TAPP, resulting in 34.58% and 12.26% improvement on average, respectively. This implies that the instruction-following ability of LLMs can be improved during inference time with a fixed prompt constructed with simple heuristics. We hypothesize that TAPP assists language models to better estimate the output distribution by focusing more on the instruction of the target task during inference. In other words, such ability does not seem to be sufficiently activated in not only base LLMs but also many instruction-fine-tuned LLMs. All experiments are reproducible from https://github.com/seonghyeonye/TAPP.
BibTeX
@inproceedings{ye2024investigating,
  author = {Seonghyeon Ye and Hyeonbin Hwang and Sohee Yang and Hyeongu Yun and Yireun Kim and Minjoon Seo},
  title = {{Investigating the Effectiveness of Task-Agnostic Prefix Prompt for Instruction Following}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  url = {https://openreview.net/forum?id=64fUXxim0a},
}
Figure