Mitigating the Problem of Strong Priors in LMs with Context Extrapolation

Raymond Douglas, Andis Draguns, Tomas Gavenciak · OpenReview

Abstract

The broad capabilities of Language Models (LMs) can be limited by their sensitivity to distractor tasks: LMs can infer secondary tasks from the prompt in addition to the intended one, leading to unwanted outputs. For example, prompt injection attacks can cause models to deviate from explicit directives. In some 'inverse scaling' cases, this unwanted behaviour actually worsens as models scale up to at least 540B parameters. We present a theoretical framework that interprets LMs as a product of experts that combine multiple data generation processes. Based on this framework, we demonstrate prior-aware decoding (PAD) - a simple contrastive inference method to reduce the influence of distractor tasks. We apply PAD to eleven models, across four datasets, and find improvements in 41 out of 44 task-model combinations, with a median increase in task completion proportion of 40%. The results suggest a promising direction for further development towards more reliable language models.

Introduction

Large Language Models (LLMs) often exhibit fragility when instructions conflict with "strong priors"—common patterns in training data that dominate the model's predictive behavior. For instance, a model asked to "Write all numbers up to 30 except multiples of 13" might fail to skip 26 because the sequential counting pattern acts as a powerful "distractor task."

This issue is particularly acute in larger models, a phenomenon known as inverse scaling. As models grow, they learn these common patterns more deeply, making them more likely to prioritize the distractor over the specific instruction. This paper introduces Prior-Aware Decoding (PAD), an inference-time technique designed to mitigate these effects by contrastively "subtracting" the influence of distractor tasks.

Methodology: Prior-Aware Decoding (PAD)

The authors propose a theoretical framework viewing an LM as a Product of Experts (PoE). In this model, the output distribution is a combination of different latent "experts"—one representing the intended instruction and others representing local, common patterns (distractors).

To isolate the intended task, PAD employs a contrastive approach:

  1. Original Logits ($L_O$): The model is queried with the full prompt (Instruction + Data).
  2. Weakened Logits ($L_W$): The model is queried with a "weakened" prompt, typically containing only the data portion. This captures the model's "autopilot" behavior driven by priors.
  3. Logit Extrapolation: A final set of logits is computed by extrapolating away from the weakened distribution: $$L = L_O + \alpha(L_O - L_W)$$ where $\alpha$ is a hyperparameter controlling the strength of the correction.
Illustration of the mixture model and PAD extrapolation. The weakened prompt increases the weight of the distractor task, which PAD then subtracts to recover the intended output.

By amplifying the difference between the instructed model and the "autopilot" model, PAD effectively suppresses the common patterns that would otherwise override the instruction.

Experimental Setup

The effectiveness of PAD was evaluated across 44 combinations of 11 models and 4 task sets:

  • Inverse Scaling Prize Tasks: Prompt Injection, Pattern Match Suppression, and Redefine (reassigning word meanings).
  • Strong Local Priors: A custom dataset requiring modifications to common sequences (e.g., skipping specific letters in the alphabet).
  • Models: A diverse suite including GPT-2, Llama-2 (7B, 13B), Mistral-7B, Mixtral-8x7B, and GPT-3 variants.

Results and Insights

The experimental results demonstrate that PAD is a robust and widely applicable method for improving instruction following:

  • Widespread Performance Gains: PAD improved performance in 41 out of 44 model-task combinations. At $\alpha = 2.0$, the median absolute increase in task completion was 40%.
  • Reversing Inverse Scaling: In tasks where larger models initially performed worse than smaller ones, PAD frequently recovered performance, often allowing larger models to surpass their smaller counterparts.
  • Internal vs. External Contrast: PAD outperformed "Inter-model Contrastive Decoding" (which contrasts a large model against a smaller one). This suggests that the most effective way to identify a distractor is within the model itself by manipulating the prompt context.
  • Inference-Time Efficiency: As a "plug-and-play" method, PAD requires no weight updates or fine-tuning, though it does necessitate two forward passes per token generation.

Conclusion and Future Work

Prior-Aware Decoding offers a simple yet powerful mechanism for steering LMs away from unwanted priors. While highly effective, the method currently relies on the ability to decompose prompts into "instruction" and "data" components. Future research may explore more sophisticated prompt weakening strategies for intertwined contexts. Additionally, PAD shows promise as a defense mechanism against prompt injection and jailbreaking, where the "distractor" is a malicious instruction embedded within user-provided data.

Summary updated

Abstract

The broad capabilities of Language Models (LMs) can be limited by their sensitivity to distractor tasks: LMs can infer secondary tasks from the prompt in addition to the intended one, leading to unwanted outputs. For example, prompt injection attacks can cause models to deviate from explicit directives. In some 'inverse scaling' cases, this unwanted behaviour actually worsens as models scale up to at least 540B parameters. We present a theoretical framework that interprets LMs as a product of experts that combine multiple data generation processes. Based on this framework, we demonstrate prior-aware decoding (PAD) - a simple contrastive inference method to reduce the influence of distractor tasks. We apply PAD to eleven models, across four datasets, and find improvements in 41 out of 44 task-model combinations, with a median increase in task completion proportion of 40%. The results suggest a promising direction for further development towards more reliable language models.
BibTeX
@misc{douglas2024mitigating,
  author = {Raymond Douglas and Andis Draguns and Tomas Gavenciak},
  title = {{Mitigating the Problem of Strong Priors in LMs with Context Extrapolation}},
  year = {2024},
  eprint = {2401.17692},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2401.17692},
}
Figure