Abstract
Instruction-following Large Language Models (LLMs) typically process task instructions by concatenating them with every input example, leading to a significant "instruction tax" in terms of computational cost. We introduce HINT (Hypernetwork Instruction Tuning), an architecture that decouples instruction processing from input processing. HINT utilizes a hypernetwork to transform natural language task definitions and few-shot examples into lightweight, parameter-efficient modules (adapters and prefixes) that are then injected into an underlying model. Our approach achieves up to a 4x reduction in inference compute costs while maintaining or exceeding the performance of state-of-the-art baselines on major benchmarks like Super-Natural Instructions (SNI) and P3.
Introduction: The Instruction Tax
Large Language Models have demonstrated remarkable zero-shot and few-shot capabilities through natural language instructions. However, the standard practice of prepending instructions to every input example is computationally inefficient. For a task with a 500-token instruction and a 50-token input, processing 100 examples requires the model to re-encode the same 500 tokens 100 times. This "instruction tax" scales linearly with the number of examples and the length of the instruction, becoming particularly prohibitive as prompts grow with few-shot demonstrations.
Methodology
HINT addresses this inefficiency through a two-part architecture consisting of a Hypernetwork and an Underlying Model (typically a T5 encoder-decoder).
The Hypernetwork
The Hypernetwork is responsible for task-specific adaptation. It consists of:
- HyperEncoder: A pretrained text encoder that generates a contextual representation of the task definition and any few-shot examples.
- Parameter Generator: A module that employs cross-attention to read the HyperEncoder's output and generate weights for Adapters and Prefixes. To maintain efficiency, weights are generated using a column-wise decomposition trick.
Underlying Model and Instruction Fusion
The generated parameters are plugged into the underlying transformer model. A key innovation is Instruction Fusion: the encoded instruction from the HyperEncoder is saved and concatenated with input representations during the decoding stage. This ensures the model retains access to task details without re-processing the full instruction for every token generation.
Experimental Setup
We evaluated HINT on two primary instruction-tuning benchmarks:
- Super-Natural Instructions (SNI): Over 1,600 diverse NLP tasks.
- P3 (Public Pool of Prompts): The dataset used for the T0 model.
The models underwent an initial pretraining phase on the C4 dataset to help the hypernetwork learn general mappings from text to model adaptations before fine-tuning on task-specific instructions.
Key Results
Computational Efficiency
HINT fundamentally changes the complexity of instruction processing from $O(n \times t)$ to $O(n + t)$, where $n$ is the number of examples and $t$ is the instruction length. Once the hypernetwork generates the task modules, the marginal cost of processing additional examples is nearly independent of the original instruction length.
Performance and Scaling
- Efficiency Gains: HINT models are up to 4x more compute-efficient than similarly-sized state-of-the-art baselines like Tk-Instruct. When matched for compute budget, HINT outperforms baselines by over 10%.
- Few-Shot Generalization: HINT can incorporate additional few-shot examples to boost performance by up to 25% with only a ~5% increase in total compute. In contrast, standard models experience a massive spike in FLOPs as more examples are added to the prompt.
- Model Comparison: An 11B-parameter HINT model outperformed a 13B-parameter OPT model by 5 points on SNI, highlighting the efficiency of the encoder-decoder hypernetwork approach over larger decoder-only models.
Limitations and Future Work
While HINT offers significant inference-time savings, it introduces higher training overhead as the hypernetwork must be executed for every training batch. Furthermore, the efficiency gains are most pronounced when processing batches of examples for the same task; for single, isolated queries, the hypernetwork overhead may negate the savings. Future research will explore multilingual setups and optimized hypernetwork initialization strategies.
Summary updated