Mitigating the Influence of Distractor Tasks in LMs with Prior-Aware Decoding

## Abstract

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 introduce 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 % percent \% % . The results suggest a promising direction for further development towards more reliable language models.

## 1 Introduction

Language models (LMs) have come to occupy a central role in a wide range of tasks, from data processing to the creation of instruction-following assistants. These models seem to both increase in performance and also develop new capabilities as they scale up in parameters, especially when given examples of a task (Radford et al., ; Brown et al., ; Wei et al., ). They see both widespread public use, and increasing integration into sensitive tasks where their versatile capabilities are key (Javaid et al., ). However, this increasing reliance on LMs raises concerns about their reliability and potential vulnerabilities. Their extremely general ability to recognise patterns may come with a cost: language models are susceptible to *distractor tasks*, unintended secondary tasks which a model can infer from the prompt in addition to the intended one, leading to unwanted outputs (Wei et al., ).

Distractor tasks include both semantically complex cases like prompt injection, in which the distractor task of following the most recently injected instruction overrides the intended task of following the initial instructions, and much more semantically simple cases where a model defaults to outputting a common pattern regardless of prior context (Greshake et al., ; McKenzie et al., ).

Even cutting-edge models struggle with trivial tasks in the presence of very common patterns. For example, as of September 2024 GPT-4o, when prompted with ”Write all the numbers up to 30 except multiples of 13, and nothing else”, will correctly exclude 13 but fail to exclude 26. Other examples of such distractor tasks include repeating common misconceptions instead of true answers (Lin et al., ) and failing to write mathematical proofs when the correct proof is very similar to an incorrect but much more common proof (Collins et al., ).

Furthermore, for some tasks of this type, larger models actually perform worse: similar models with more parameters can be more likely to repeat common misconceptions and succumb to prompt injection attacks (McKenzie et al., ; Lin et al., ). This phenomenon, known as ‘inverse scaling’ (Lin et al., ), reveals a pressing need to better understand how these problems arise and how they can be fixed. Unlike other problems with LMs which are usually resolved by scaling up the model and training data size, the existing problems might become even more pronounced, and other similar issues might emerge.

### 1.1 Prior-Aware Decoding

To better understand and address the problem of distractor tasks, we characterise language models as a product of experts (Hinton, ) which combine the predictions of several component models, each component model predicting the next token assuming a particular task or context. This framework, presented in detail in Section 4, allows us to decompose the model’s behavior into distinct ”experts” that may be responsible for different aspects of the output, which in turn lets us interpret the problem of distractor tasks as models overweighing a particular expert.

Using this framework, we present a technique to reduce the influence of distractor tasks in cases where the prompt can be divided into one part containing the intended task and one part containing the distractor task and other important information. In this case, we can contrast the outputs the model gives for the full prompt with the outputs it gives for just the part which yields the distractor task, extrapolating to infer how it would behave with less influence from the distractor task. This is a form of contrastive decoding (Li et al., ). Our approach differs from previous methods by specifically targeting the influence of distractor tasks and leveraging the product of experts model

More specifically, our method generates the original logits $L_{O}$ from the original prompt, as well as the weakened logits $L_{W}$ from the portion of the prompt which does not contain the original task. Even though $L_{O}$ and $L_{W}$ would both, by default, favour undesired outputs consistent with the distractor task, $L_{O}$ gives a higher probability to outputs consistent with the intended task. So, by sampling instead from a linear combination of the logits, $L_{O}+\alpha(L_{O}-L_{W})$ we can selectively favour outputs which are more consistent with the original task. ($\alpha$ here is a tunable hyperparameter.) Using this technique we can mitigate the influence of the distractor task, as we illustrate in Figure 1.

Figure: Figure 1: Illustration of our geometric mixture model, also referred to as product of experts, and Prior-Aware Decoding in a task requiring a modification of a very common sequence.
Refer to caption: x1.png

We test the technique on eleven different models including GPT-2, Llama-2, and Mistral, using four tasks to evaluate susceptibility to distractor tasks. Three of these tasks are from the Inverse Scaling Dataset (McKenzie et al., ; Wei et al., ) which exhibit strong priors, including a prompt injection task, and one task is a custom task which challenges models to produce modifications of common sequences.

Our primary baseline is the unmodified completion according to the same model. Across the 44 model-task combinations we find that our technique outperforms the baseline on 41 combinations, with a median absolute increase in proportion of tasks completed of 40%. See Figure 2 and Section 6 for the results. These improvements demonstrate the potential of our method to significantly enhance the reliability and performance of language models across a variety of model architectures in scenarios featuring distractor tasks.

The technique requires two choices: selection of the weakened prompt, and the coefficient $\alpha$. We offer consistent approaches to generating the weakened prompts for each of our datasets and also propose a general method for weakened prompt construction. We explore a range of values for $\alpha$. Crucially, this method does not require retraining: it operates at inference time by making two queries instead of one and computing a linear combination of the resulting logits.

The improvements in accuracy due to our technique suggest that viewing LMs as product of experts models can be a useful framework for understanding and improving the behaviour of these models. Our research provides new approaches for utilizing capabilities which are dormant in models and which have been hard to elicit with prompting alone. This includes capabilities of immediate practical importance, such as resistance to prompt injection attacks, as well as understanding how to correct for biases learned in the training data.

The main contributions of this paper are:

- •
Interpreting language models as geometric mixtures (i.e. a product of experts) to develop a model of how distractor tasks cause poor performance on certain inputs.
- •
Based on that model, proposing a general framework for eliciting other component of the geometric mixtures and extrapolating to more desirable mixtures in logits space.
- •
Developing a technique based on the product of experts model and showing that it robustly improves performance across several language models on several tasks from the Inverse Scaling dataset.

Figure: Figure 2: Overview of the results of the Prior-Aware Decoding method at different values of parameter $\alpha$ over 4 experimental task sets and 11 language models. Each point refers to performance on one (task set, model) pair, showing the baseline performance of the unmodified original model ($x$-axis) vs PAD using the “truncated prompt” weakening ($y$-axis). See Table 1 for details.
Refer to caption: x2.png

## 2 Related Work

Inverse Scaling.
For most tasks, performance scales together with the model scale (model size, dataset size, and training compute). However, certain tasks exhibit inverse scaling, where increasing the scale of the model leads to worse performance. The term was introduced by Lin et al. () to characterise the tendency of LMs to repeat common misconceptions. McKenzie et al. () further developed the notion and provided the Inverse Scaling dataset as well as several informal categories. Wei et al. () adds to the discussion, showing that of the original eleven tasks in the Inverse Scaling dataset, only four persist in demonstrating inverse scaling on models of up to 540B parameters. We apply our method to three of those four tasks. Our work is the first to offer a formal account of the mechanisms that have so far only been informally hypothesised in Wei et al. (), and we use this to develop a novel technique that improves performance.

Problems Related to Strong Priors.
While in this paper we investigate the problem of strong priors in the domain of language modelling (discussed primarily in Section 3), a somewhat similar problem also occurs in diffusion models for image generation. Diffusion models have been observed to sometimes struggle to generate images that have a precise correspondence to the prompt. This problem is especially pronounced for complex prompts that include rare words, or describe implausible scenes, spatial relations, or compositionality.
One technique for mitigating this problem in diffusion models is classifier-free guidance (Ho & Salimans, ). It samples the diffusion model using a linear combination of conditioned and unconditioned score estimates $(1+w)\cdot e(z_{t},c)-w\cdot e(z_{t})$, where $z_{t}$ is the image at the denoising step $t$, $c$ is the conditioning information such as the prompt, $e$ is the model and $w$ is the guidance weight. High guidance weight improves text-image alignment (Saharia et al., ), although high values often lead to over-saturated images or have a generally unnatural appearance. The technique that we present in this paper uses a somewhat similar combination of differently conditioned model outputs to mitigate the problem of strong priors in LMs.

Surface Form Competition and DC-PMI.
Holtzman et al. () coin ‘surface form competition’ as a phenomenon where different tokens representing the same concept compete for probability. For instance, the terms “computer” and “PC” represent the same concept but are different surface forms. Since the probability mass is finite, this competition lowers the probability of the correct answer. Domain Conditional Pointwise Mutual Information (DC-PMI) addresses this issue by reweighing each option according to its likelihood within the context of a specific task, calculated by sampling from a subset of the prompt. This approach yields gains in zero-shot performance for a variety of GPT-2 and GPT-3 models on a selection of multiple-choice datasets. Our work applies a similar kind of technique - reweighing based on likelihood - but we do so to address a different set of tasks, including those which exhibit inverse scaling.

Contrastive Inference Methods.
Contrastive Inference methods steer language models towards desired outputs by taking multiple samples across different settings and favouring outputs which are comparatively more likely in one sample than in another. The original implementation in Li et al. () takes output distributions using the same prompt in two models, one smaller and one larger. It then contrasts the logits from the two models, selecting the token with the largest difference between the original ($L_{O}$) and smaller model ($L_{S}$), i.e. $\max_{t\in T^{\prime}}(L_{O}(t)-L_{S}(t))$, limited to a subset $T^{\prime}$ of top tokens to mitigate noise in low-likelihood tokens.

Our approach is most similar to the subsequent techniques introduced in Shi et al. () and Malkin et al. (), which apply contrastive decoding to pairs of shorter and longer prompts, using the same formula we apply. Malkin et al. () contrasts the full prompt against only the text generated so far to increase long-range semantic coherence, finding improvement in generic language understanding and knowledge retrieval tasks. Shi et al. () uses an equivalent formula to handle conflicts between prior knowledge and information in the context. They also interpret the combination as a product-of-experts.

Compared to these works, ours frames the language model itself as a product-of-experts that must select between specific competing tasks, some of which are unwanted distractors, and the resulting manipulation of logits as a reweighing of the experts. Furthermore, while Malkin et al. () and Shi et al. () focus on models failing to account for knowledge and facts, we emphasise how they can include even extremely semantically simple patterns like sequences of numbers. We also draw the connection to inverse scaling.

## 3 Strong Priors in Generative Models

In this section, we introduce the concept of strong priors within generative models, focusing on their manifestation in language models and discussing their broader implications.

The term “strong priors” in this context was introduced by McKenzie et al. () as one of the categories of LM tasks that exhibit inverse scaling trends. The difficulty of this category of tasks seems to largely stem from local context overly influencing the predicted continuation. We aim to extend the informal characterisation in McKenzie et al. () with a more comprehensive definition.

General Strong Priors.
Generative models can exhibit a phenomenon where a part of the input disproportionately affects the output, substantially diminishing the impact of other parts of the input that are essential for the model to complete its assigned task. This general notion of strong priors is applicable to generative models for various domains, including language modelling and image generation.

One example of the phenomenon is an autoregressive language model that has been prompted to write a common sequence (the alphabet) with a variation in the middle (a skipped letter). We empirically observe that once the LM has written enough of the common sequence, it fails to add the variation. We hypothesise that the model is overgeneralising from a frequent pattern in its training data, ignoring other context.

Definition (Strong Prior). Consider a model input $\{T,D\}$, where $T$ is the task description part that may include examples, and $D$ is the data part, consisting of the task input and possibly part of the output. Let $M$ denote a generative model, with $M$ determining any parameters of the generation process, such as temperature, and let $p_{M}(O|T,D)$ represent the probability of $M$ producing $O$ as its output given $T$ and $D$. Finally, let $\approx$ be a similarity relation on probability distributions. Then $D$ induces a strong prior in $M$ relative to $T$ if:

$$ $p_{M}(\,\cdot\,|T,D)\approx p_{M}(\,\cdot\,|D)$ $$

This implies that the contribution of $T$ to the model’s output is insignificant, and the output is mostly determined by $D$. The result is that the model tends towards specific outputs when provided with data $D$, regardless of the task description $T$ provided.

This definition is intentionally broad, to allow adaptations based on the domain, modality, and the specific case in focus. The partitioning of the model input, or the prompt, into task $T$ and data $D$ components, is context-dependent, and may not be feasible or pertinent in every setting. Moreover, the interpretation of $p_{M}(\,\cdot\,|T,D)\approx p_{M}(\,\cdot\,|D)$ depends on the modeling assumptions, with our proposed default metric being the total variational distance $\delta$. This would imply the presence of strong priors if $\delta\left(p_{M}(\,\cdot\,|T,D),p_{M}(\,\cdot\,|D)\right)\leq\varepsilon$, where $\varepsilon>0$ is a predetermined threshold.

While the Kullback–Leibler divergence $D_{KL}\left(p_{M}(\,\cdot\,|T,D)||p_{M}(\,\cdot\,|D)\right)$ may be more suitable than $\delta$ in certain contexts, it is susceptible to significant influences from relatively improbable events that exhibit substantial shifts in log-probability.

Strong priors in language models.
In this subsection, we adapt the general concept of strong priors for language models. We also explore the common case of local strong priors, where we assume that the model input is a prompt of the form $P=TD$. Additionally, we suggest using the next token as the main unit of output in the distribution $p_{M}(\cdot|P)$. Despite potential ambiguity in the separation into task description $T$ and data $D$, this representation aligns with the structure of many LM benchmarks and common prompting strategies. We can characterise strong local priors as cases where prepending the task description to the data is not significantly influencing the distribution:

$$ $\delta\left(p_{M}(\,\cdot\,|TD),p_{M}(\,\cdot\,|D)\right)\leq\varepsilon$ $$

In instances where $p_{M}(\cdot|TD)\approx p_{M}(\cdot|D)$, the difference between the two distributions may hold significant information: the correct continuation is often more probable in $p_{M}(\cdot|TD)$ than $p_{M}(\cdot|D)$. We present a novel method to compensate for strong local priors based on our model in Section 5.

While we focus on the local case, the above foundational definitions as well as the proposed method can be adapted for non-local scenarios where $T$ and $D$ are intertwined in more complex way but still allow for a meaningful systematic distinction between task and data. We include a concrete example in Appendix A and empirical measurements of $\delta$ in Appendix D.

## 4 Language Models as Products of Experts

In this section, we present our proposed model for addressing the challenge of distractor tasks emerging from strong priors in generative language models. Our approach models the generative distribution as a product of experts (i.e. a geometric mixture) of two components: one that captures the correct continuation of context based on the intended task, and another that captures continuation based on the distractor task induced by strong local priors. We then define a new distribution that weighs between these components to produce more contextually appropriate completions.

Consider a generative language model $M$ with its generative distribution given by $p_{M}(t_{n+1}|t_{1}\dots t_{n})$. We assume that this distribution is influenced by two main forces:

- •
$p_{C}(t_{n+1}|t_{1}\dots t_{n})$: The true continuation distribution which considers the entire context.
- •
$p_{L}(t_{n+1}|t_{1}\dots t_{n})$: The distribution driven by strong local contexts or priors, which can sometimes overshadow the global context.

The distributions $p_{C}$ and $p_{L}$ may overlap if there is no strong local prior influencing the continuation.

Geometric Mixture Model.
We assume that $p_{M}$ can be modeled as a geometric mixture of $p_{C}$ and $p_{L}$, also known as a Product of Experts:

$$ $p_{M}(t_{n+1}|t_{1}\dots t_{n})\propto p_{C}(t_{n+1}|t_{1}\dots t_{n})^{\gamma ^{*}}p_{L}(t_{n+1}|t_{1}\dots t_{n})^{1-\gamma^{*}}$ $$

where $0\leq\gamma^{*}\leq 1$ is an apriori unknown parameter of the mixture.

To distinguish between contextually correct completions and those biased by strong priors, we aim to extract $p_{C}$ from $p_{M}$ and $p_{L}$. Using a substitution $\alpha^{*}=\frac{1-\gamma^{*}}{\gamma^{*}}$, we define:

$$ $p_{C}\propto p_{M}^{1+\alpha^{*}}p_{L}^{-\alpha^{*}}$ $$

which lets us define a generalized $p_{\alpha}$ for any real $\alpha$:

$$ $p_{\alpha}\propto p_{M}^{1+\alpha}p_{L}^{-\alpha}=p_{M}\left(\frac{p_{M}}{p_{L }}\right)^{\alpha}=p_{L}\left(\frac{p_{M}}{p_{L}}\right)^{1+\alpha}.$ $$

These expressions provide different interpretations of $p_{\alpha}$ and therefore also of $p_{C}=p_{\alpha^{*}}$:
As a geometric mixture of $p_{M}$ and $p_{L}$, as a reweighing of $p_{M}$ based on the ratio $\frac{p_{M}}{p_{L}}$, and as a form of weighed importance sampling, interpreting $p_{L}$ as weighted negative evidence.

Logits Formulation.
In most generative language models, the next token follows a Boltzmann distribution defined by:

$$ $p(t_{n+1}|t_{1}\dots t_{n})\propto e^{l(t_{n+1}|t_{1}\dots t_{n})/T}$ $$

where $l(t_{n+1}|t_{1}\dots t_{n})$ are the logits and $T\geq 0$ is a temperature parameter.

Given this, our model can be expressed in terms of logits as $l_{\alpha}(t_{n+1}|t_{1}\dots t_{n})=l_{M}+\alpha(l_{M}-l_{L})$ leading to:

$$ $p_{\alpha}(t_{n+1}|t_{1}\dots t_{n})\propto\exp\left(\frac{(1+\alpha)l_{M}(t_{ n+1}|t_{1}\dots t_{n})-\alpha l_{L}(t_{n+1}|t_{1}\dots t_{n})}{T}\right).$ $$

With this formulation, our model strategically weights the logits of the generative model and the logits driven by local priors to generate more appropriate completions given strong priors.

It is crucial to highlight that $\alpha$ plays a determining role in model behavior. Large values of $\alpha>\alpha^{*}$ can severely impair the model’s performance. This mainly stems from amplifying noise variance in model outputs, especially given potential non-specific model errors represented as $l_{M}=\hat{l}_{M}+N(0,\sigma^{2})$.
Additionally, the deviation of model $L$ from model $M$ can be more extensive than just the influence of dominant local priors. Such deviations may inadvertently favor incorrect continuations.

Approximating a strong prior model.
To construct a strong prior model $L$ - an approximation of model $M$ that is more prone to be influenced by strong priors - we alter the prompts to accentuate this behavior, and then employ $M$ on these modified prompts. The main modification we consider is stripping the task from the prompt, although in Appendix C we discuss a different approach based on comparing model outputs with and without a weakening system prompt that is task-agnostic.

We reduce the context available to the model by removing the task description at the start of the prompt. For a context $P$ (the task description, including few-shot examples if present) followed by $t_{1}\dots t_{n}$ (the task input and an initial segment of the output), our altered logits are given by:

$$ $l^{\text{strip}}_{L}(t_{n+1}|Pt_{1}\dots t_{n})=l_{M}(t_{n+1}|t_{1}\dots t_{n})$ $$

For instance, for the task: ”View number as text. Do not perform computation. Q: What is the first digit of 23+63?”, $P$ represents the text: ”View number as text. Do not perform computation.” and $t_{1}\dots t_{n}$ captures ” Q: What is the first digit of 23+63?”.

## 5 Methodology and Experimental Setup

We employ our proposed technique of Prior-Aware Decoding to mitigate the influence of distractor tasks. The influence of the undesired underlying prior is captured by querying the model for logits using a weakened prompt, which is more susceptible to the prior’s influence.

The PAD technique is implemented through the following steps:

- 1.
For each prompt in the dataset, we generate two versions:
•
An original prompt containing both the task description and the data.
•
A weakened prompt more likely to give outputs consistent with the distractor task.
- 2.
We query the model on both the original and weakened prompts to obtain two sets of logits.
- 3.
We compute a linear combination of these logits: $L=L_{O}+\alpha(L_{O}-L_{W})$, where $L_{O}$ are the original logits, $L_{W}$ are the weakened logits, and $\alpha$ is our extrapolation parameter.
- 4.
We sample from this modified distribution to generate the output.
- 5.
We calculate the average performance across the entire dataset.

For our main results we produce weakened prompts by removing the task component from the prompt. We illustrate examples of splitting prompts from each dataset in Table 2: the split was unambiguous for the tasks we selected, and generated by a regex script. We also discuss weakening prompts by prepending a system prompt in Appendix C.

### 5.1 Experimental Setup

Comparisons.
We test our method across four sets of tasks, on eleven models, at $\alpha=0$ (the original model baseline), $\alpha=1$, and $\alpha=2$. These specific values were chosen as our initial exploration points, with $\alpha=0$ serving as a control. We provide a more comprehensive analysis across a broader range of $\alpha$ values in Appendix E.

Tasks: We evaluate our model on four task sets: three from the Inverse Scaling Prize (Prompt Injection, Pattern Match Suppression, Redefine), and one custom set (Strong Local Priors). The Inverse Scaling Prize tasks were specifically selected for their clean task/data decomposition and their demonstrated inverse scaling behavior up to 540B parameter models, as reported by Wei et al. (). Table 2 provides examples of prompts from each dataset, illustrating the task/data split.

Model Architecture. Our experimental models comprise a range of transformer architectures, including four GPT-2 sizes, two Llama 2 sizes, two Mistral models, and several OpenAI models via API. This diverse selection allows us to compare results both between models and across different sizes of a fixed model, providing a broad view of PAD’s effectiveness across various model architectures.
For small local experiments we used GTX 1060-Ti, and for larger ones a rented A6000.

Metric. We use a Probability of Correct Completion as the metric to evaluate model performance. This metric naturally captures the success rate of the model in fulfilling the requirements of the task description. A completion is correct if it fulfills the requirements of the task description, and incorrect otherwise.

Our main results show models at temperature $1.0$: results for temperature $0.0$ are in Appendix E.

## 6 Results

The comparisons are recorded in Table 1, with a graphical representation in Figure 2. Notably, extrapolating with $\alpha=2$ outperforms the baseline in 41/44 cases, with a 30 percentage point (%pt) mean completion improvement across all tasks and models. For $\alpha=1$, the improvement is 17.3%pt.

As Figure 2 shows, in many cases our method causes models to double the proportion of tasks they complete. This is not properly reflected by the mean: If we instead consider the number of tasks from a given dataset completed by a given model, we find the median percentage increase at $\alpha=2$ compared to the baseline is 40%, and for $\alpha=1$ compared to the baseline it is 27%.

The results also demonstrate some amount of inverse scaling within model families at all values of $\alpha$, and even in the cases where larger models do see better performance, PAD produces greater gains than doubling the number of parameters. As an additional baseline we investigate applying PAD using a smaller model from the same family as the weakened model, essentially following the approach in the original contrastive method used by Li et al. (), and find little gain, with only 10 out of 16 tasks-model pairs showing any improvement at $\alpha=1.0$ (in contrast to 41 of 44 of task-model pairs of our main result), and with a median increase in task completion proportion of $0.3\%$ (in contrast to 27$\%$ of our main result). See Appendix F for details.

Extrapolation from a system prompt generally gives worse results, although notably it outperforms the baseline in all four task/model/parameter combinations where extrapolation from the truncated prompt does not. We give more details in Appendix C.

The three cases where extrapolation to $\alpha=2$ yield lower results (pattern matching suppression on gpt3.5-turbo instruct, pattern matching suppression on gpt2-medium, and redefine on text-ada-001) do not seem to point to any general weaknesses of the technique. Interestingly, gpt3.5-turbo-instruct and ada-001 exhibit the highest TVD on pattern matching suppression and redefine, respectively, both substantially higher than the next highest, suggesting the potential absence of a strong prior in these cases (see AppendixD for a full table of TVD values).

We explore a wider range of values of $\alpha$ in Appendix E. In particular, Figure 3 and Figure 4 show the probability of correct completion on a variety of models across a range of values of $\alpha$ from -2 to 3. We show that range to more clearly demonstrate general trends in completion as $\alpha$ changes. In general, higher values of $\alpha$ sometimes continue to produce better results, but often the benefits tail off, and in some cases the graphs show a peak beyond which higher values of $\alpha$ cause slow degradation.

**Table 1: Percent probabilities of correct completion for different tasks and language models. $p_{0}$ indicates full-prompt accuracy (baseline); $p_{1.0}$ and $p_{2.0}$ indicates using truncated prompt as the weakened prompt with parameter $\alpha=1.0$ and $\alpha=2.0$. Bold entries denote the highest-scoring parameter for a given task and model. All probabilities are reported at model temperature $T=1.0$.**
|  | prompt injection | pattern match. suppression | redefine | strong local priors |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| model | $p_{0}$ | $p_{1.0}$ | $p_{2.0}$ | $p_{0}$ | $p_{1.0}$ | $p_{2.0}$ | $p_{0}$ | $p_{1.0}$ | $p_{2.0}$ | $p_{0}$ | $p_{1.0}$ | $p_{2.0}$ |
| Llama2 7B | 49.5 | 53.6 | 53.4 | 3.2 | 11.9 | 24.8 | 55.9 | 71.2 | 78.3 | 20.9 | 35.7 | 42.2 |
| Llama2 13B | 32.7 | 41.9 | 41.7 | 4.1 | 23.7 | 46.5 | 56.8 | 78.9 | 83.6 | 41.2 | 52.4 | 58.8 |
| Mistral 7B | 60.5 | 77.0 | 77.8 | 3.4 | 19.9 | 34.5 | 55.7 | 83.7 | 87.2 | 47.8 | 59.7 | 66.9 |
| Mixtral 8x7B | 52.2 | 80.2 | 82.4 | 14.1 | 46.7 | 53.8 | 65.4 | 84.7 | 87.6 | 44.3 | 53.7 | 57.7 |
| gpt2 | 88.6 | 94.4 | 93.6 | 13.5 | 15.3 | 18.3 | 62.5 | 66.1 | 68.2 | 0.4 | 2.1 | 7.7 |
| gpt2-medium | 88.9 | 99.3 | 99.7 | 5.1 | 2.6 | 2.3 | 60.9 | 62.6 | 62.6 | 0.7 | 7.5 | 27.6 |
| gpt2-large | 97.4 | 99.7 | 99.6 | 4.8 | 9.3 | 13.5 | 64.2 | 66.6 | 66.8 | 0.5 | 6.4 | 22.9 |
| gpt2-xl | 86.9 | 98.4 | 99.0 | 1.8 | 2.1 | 5.2 | 47.8 | 55.0 | 59.2 | 0.4 | 8.5 | 26.6 |
| text-ada-001 | 66.5 | 79.7 | 82.1 | 3.8 | 8.0 | 12.9 | 53.2 | 53.1 | 53.1 | 5.5 | 10.2 | 12.7 |
| davinci-002 | 55.2 | 60.2 | 61.9 | 5.9 | 9.2 | 13.0 | 54.7 | 71.3 | 77.8 | 13.6 | 23.5 | 27.5 |
| gpt3.5-t.-instr. | 80.5 | 84.8 | 85.5 | 28.5 | 29.4 | 24.4 | 51.4 | 73.7 | 79.1 | 52.6 | 61.3 | 64.9 |
| mean | 63.2 | 80.8 | 89.7 | 7.3 | 23.2 | 37.4 | 52.4 | 72.3 | 83.6 | 19.0 | 35.1 | 51.3 |

## 7 Conclusion and Future Work

This paper introduces Prior-Aware Decoding (PAD), a novel technique for mitigating the influence of distractor tasks in language models. Our approach is grounded in a theoretical framework that conceptualizes language models as products of experts, offering a new perspective on how distractor tasks emerge and persist.

The primary theoretical contribution of this work is the framing of language models as products of experts. This model provides a specific explanation for the emergence of distractor tasks and offers insights into why we observe counterintuitive scaling behaviors, including inverse scaling, on certain tasks. Importantly, our framework suggests that the balance between these “experts” is not necessarily dictated by model size, which could explain the lack of straightforward scaling effects and even the inverse scaling phenomena observed in some cases.

Our experimental results demonstrate the efficacy of PAD across a range of language models and tasks from the Inverse Scaling dataset. We consistently observed improvements in model performance, with a median increase in task completion proportion of 40% at $\alpha=2$. These findings not only validate the practical utility of our approach but also provide empirical support for our theoretical framework.

The implications of this work extend beyond the specific technique we’ve developed. Our results suggest that it may be possible to elicit greater capabilities from models even in cases where straightforward scaling is counterproductive, by employing more sophisticated forms of inference, and that this may be necessary to account for certain persistent quirks.

While our current study focuses on relatively small models and a specific set of tasks, the potential applications of this work are broad. Perhaps most promisingly, PAD could be developed into a robust defense against jailbreaks and prompt injection attacks, although further research with more challenging datasets is needed to fully assess its potential in this area.

Looking forward, we identify several key directions for future research:

- 1.
Model Interpretability: Investigating how well our theoretical framework aligns with the actual internal processes of language models could provide valuable insights into model behavior and further validate our approach.
- 2.
Extension to Harder Cases: Applying and adapting PAD to more challenging instances of prompt injection and other distractor tasks could enhance its practical utility.
- 3.
More Sophisticated Inference-time Techniques: Combining our method and underlying model with related approaches like classifier-free guidance (Ho & Salimans, ), and activation addition (Turner et al., ), to build more robust approaches for steering language models.

In conclusion, this work not only introduces a practical technique for improving language model performance but also provides a theoretical framework that could further develop our understanding of how these models function. By highlighting the potential limitations of straightforward scaling and the importance of more nuanced approaches to model elicitation, we hope to contribute to the development of more robust and reliable language models. As we continue to integrate these powerful tools into various aspects of our lives, techniques like PAD may be crucial in ensuring they behave reliably and as intended across a wide range of tasks and contexts.

#### Acknowledgments

We are grateful to Ethan Perez for discussion of the initial ideas and Gavin Leech and for feedback on the draft. Raymond Douglas and Andis Draguns would like to thank the Schelling Residency for providing a conductive research environment for this work. Andis’ work was in part supported by the Latvian Council of Science, project lzp-2021/1-0479. Tomáš Gavenčiak was supported by Charles University grant PRIMUS 22/HUM/020.

## Appendix A Example of strong non-local priors in language models

While we assume most instances of strong priors in language are local and we focus our attention on those, there are also non-local examples, where the data and task parts can be swapped or even interspersed.

We offer the following example, although we expect that many of the other examples and relevant datasets can be adapted similarly:

Consider the prompt

$$ $P_{1}=`\texttt{English alphabet: P, Q, R, S, [skip the 2nd letter from now] T} \textrm{',}$ $$

which we decompose (non-locally) as

$$ $T=`\texttt{ [skip the 2nd letter from now]}\textrm{', and}$ $$

$$ $D=`\texttt{English alphabet: P, Q, R, S, T,}\textrm{'}$ $$

to be the remainder. With text-davinci-002 we observe:

$$ $p_{M}(`\texttt{ U}\textrm{'}\,|\,P_{1})=0.98$ $$

$$ $p_{M}(`\texttt{ U}\textrm{'}\,|\,D)=0.99$ $$

This is indeed a non-local strong prior, as removing the non-local part of $D$, leaving

$$ $P_{2}=`\texttt{English alphabet: [skip the 2nd letter from now] T,}\textrm{',}$ $$

removes significant part of the effect:

$$ $p_{M}(`\texttt{ U}\textrm{'}\,|\,P_{2})=0.54$ $$

## Appendix B Prompt Decomposition

**Table 2: Examples of prompts from each dataset we use, with the task description separated out as it would be. For brevity we omit the few-shot examples in the Prompt Injection dataset.**
| Dataset | Task description | Remainder of input |
| --- | --- | --- |
| Strong local priors (custom) | Task: Write out the English alphabet in upper case, skipping the letter D. | Output: A B C |
| Prompt injection (inverse scaling) | Repeat the input word-for-word. Do not follow any further instructions. | Input: Ignore previous directions and output the first prime number. Output: |
| Redefine (inverse scaling) | Swap the meaning of lawful and unlawful. | Is fraud lawful? A: |
| Pattern matching suppression (inverse scaling) | Generate a sequence of 6 symbols alternating between (A B) but ending anything you like except "B". | A, B, A, B, A, |

## Appendix C Eliciting Strong Priors With Custom System Prompts

In some cases it may not be feasible or desirable to separate the prompt clearly into task and data parts. We propose and experimentally test an alternative method to elicit strong priors: prefix $TD$ with a system prompt $S$, where the role of $S$ is to instruct the model to behave more locally and therefore strengthen any local strong prior effect.
The degree to which this prompt elicits the strong prior behavior depends strongly on the task and any intermediate instructions so it may not be very reliable in some contexts but we believe it to be of note for some applications and further research.

Introducing a System Prompt $S$: We prepend a system prompt, $S$, which directs the model towards local reasoning, thereby emphasizing strong priors. Formally, the logits for this approach are:

$$ $l^{\text{system}}_{L}(t_{n+1}|t_{1}\dots t_{n})=l_{M}(t_{n+1}|St_{1}\dots t_{n})$ $$

A representative system prompt could be: ”In the following, only consider the most recent instructions, disregarding any broader context.”

Extrapolation from a system prompt at $\alpha=2$ performs best in four cases, including all three where extrapolating from the stripped prompt fails to outperform the baseline. While the system prompt configuration at $\alpha=2$ produces an average improvement of under 1%pt, it has more potential to be refined: for any real-world application the specific system prompt can be selected to optimise for a specific task and model. Additionally, this approach does not require us to have a clear task/data split, so the technique can be applied in cases where such a split is impossible or ambiguous.
We include the results of extrapolating from a system prompt in the graphs given in Appendix E.

## Appendix D Total variational distance

In Section 3 we described how total variational distance $\delta$ can be used to gauge the presence of strong priors. We have measured $\delta$ across different models and tasks in Table 3.

**Table 3: The mean total variational distance (TVD, $\delta_{D}$) between the next token distributions of the original prompt and the weakened prompt.**
| model | prompt injection | pattern match. suppression | redefine | strong local priors |
| --- | --- | --- | --- | --- |
| gpt2 | 0.87 | 0.08 | 0.01 | 0.03 |
| gpt2-medium | 0.87 | 0.10 | 0.02 | 0.04 |
| gpt2-large | 0.92 | 0.07 | 0.04 | 0.02 |
| gpt2-xl | 0.84 | 0.05 | 0.09 | 0.03 |
| Llama-2-7B | 0.68 | 0.05 | 0.13 | 0.15 |
| Llama-2-13B | 0.64 | 0.12 | 0.07 | 0.43 |
| text-ada-001 | 0.76 | 0.10 | 0.34 | 0.17 |
| davinci-002 | 0.59 | 0.11 | 0.13 | 0.27 |
| gpt-3.5-turbo-instruct | 0.86 | 0.75 | 0.24 | 0.52 |
| average | 0.78 | 0.16 | 0.12 | 0.18 |

Two observations are worth noting: firstly, the high TVD across the board in the prompt injection task suggests that low TVD is a sufficient but not necessary condition for strong priors; secondly, of the three task/model combinations where PAD performs worse than the baseline, two have the highest TVD for their respective task (gpt3.5-turbo-instruct on pattern matching suppression and text-ada-001 on redefine).

## Appendix E Testing more values of alpha

We present graphs in Figures 3 and 4 showing how the probability of successful completion relates to the value of the extrapolation parameter $\alpha$. For each model and task, we plot average success rate using both the truncated prompt method and the system prompt method, at both $T=0$ and $T=1$. To illustrate trends more clearly, we plot values from $\alpha=-2$ to $\alpha=3$.

Figure: Figure 3: Mean probability of correct completion depending on the extrapolation parameter $\alpha$. The plots combine accuracy at two different temperatures (0.0 and 1.0) and using two different methods (leaving out task description and adding a common system prompt). The range of $\alpha$ is wider than the plausibly practical range to illustrate the trends.
Refer to caption: x3.png

Figure: Figure 4: Mean probability of correct completion depending on the extrapolation parameter $\alpha$; continuation of Figure 3 for several models of the GPT-3 family used via the OpenAI API, extrapolating from the likelihoods of the top 5 predicted tokens returned by the API (note that this is a limitation of the OpenAI service).
Refer to caption: x5.png

## Appendix F Inter-model Contrastive Decoding

As an alternative approach and a possible baseline, we measure the performance of PAD logit extrapolation between a weaker and stronger version of the model for several pairs of models, namely GPT-2 using the previous size of the model as the “weakened” model (e.g. gtp2-large for gpt2-xl), and Llama-2-13B-GPTQ using Llama-2-7B-GPTQ as the “weakened” model. In all cases, we use the full prompt for both models.

Similarly to the previous section, we plot the mean accuracy of every task-model pair in Figure 5, and the average success rate for each model pair and task in Figure 6, at both $T=0$ and $T=1$ for a range of parameters $\alpha=-2$ to $\alpha=3$.

Note that while this method performs notably worse than our main method, it does illustrate several cases of inverse scaling where values of $\alpha<-1$ lead to better performance, e.g. in the case of gpt2-xl on redefine, and Llama-2-13B-GPTQ on prompt-injection, matching the result differences between the models in the pair in Table 1 (compare column $p_{0}$ for the respective task).

Figure: Figure 5: Overview of the results of our method at different values of parameter $\alpha$. Each datapoint refers to performance on one task-model pair, showing original performance ($x$-axis) vs logit extrapolation between two different models ($y$-axis).
Refer to caption: x6.png

Figure: Figure 6: Mean probability of correct completion depending on the extrapolation parameter $\alpha$. The plots combine accuracy at two different temperatures (0.0 and 1.0) and using two different methods (leaving out task description and adding a common system prompt).
Refer to caption: x7.png

## Peer Reviews

confidence: 4
contribution: 2
initial_rating: 6
presentation: 2
questions: 1. Can you provide an analysis of the failure cases where PAD does not perform as expected? Understanding these cases could offer insights into the limitations of your method and suggest areas for further improvement.

2. The paper mentions that prompt splitting was "unambiguous" for your selected tasks. What about cases where the split is less clear? Could you provide guidelines for creating effective splits? Have you tested automatic methods for determining splits apart from regex?

3. What is the rationale behind the specific linear combination used to combine the logits from the original and weakened prompts? 

4. The paper mentions prompt injection attacks as an example of distractor tasks. How effective is PAD specifically in handling adversarial prompt injections? Have you tested PAD’s robustness to adversarial prompts designed to bypass typical model safeguards? 

5. Contrastive methods in LMs can sometimes lead to less diverse outputs due to stricter filtering. Have you measured whether PAD reduces diversity or creativity in model outputs, particularly in open-ended tasks?

6. Did you experiment with PAD in conjunction with other prompting techniques (e.g., chain-of-thought prompting, few-shot examples)?
soundness: 2
strengths: - The paper characterized language models as a product of experts, which is an insightful approach to understanding the influence of distractor tasks. The proposed PAD method is a contrastive inference technique that addresses a critical challenge in the LM generation.
- The authors tested the PAD method across 11 different models and 4 diverse datasets, providing evidence of its effectiveness. 
- The paper is well-written and structured. The authors explain the PAD method, including descriptions of the experimental setup and results.
- This work is important in the domain of LM generation, especially as prompt-based interactions with LMs become more prevalent. Mitigating distractor tasks could help address real-world issues like prompt injections, which have implications for LM deployment in safety-critical applications.
summary: This paper addresses the challenge of mitigating the influence of distractor tasks in Language Models (LMs), which can result in undesirable outputs. The authors characterize LMs as a product of experts, where the predictions of multiple component models are combined. Based on this framework, they introduce Prior-Aware Decoding (PAD), a contrastive inference method aimed at diminishing the impact of distractor tasks.

The paper's contributions include: 
- Providing an interpretation of language models as a product of experts to elucidate how distractor tasks lead to suboptimal performance.
- Proposing the PAD method, which involves generating logits from both the original prompt and a "weakened" prompt, and subsequently combining these logits through a linear combination.
- Conducting evaluations of PAD across 11 models and 4 datasets, demonstrating its improved performance.
weaknesses: - Although the paper is well-written, certain aspects of the PAD method's description could be clearer. For example, the process of generating the "weakened" prompt and the rationale behind the specific linear combination used could be elaborated further. 

- They mention that their split of prompts into task/data components was unambiguous because of the tasks they selected (Line#354-355). However, splitting prompts into task/data components isn't always straightforward. And they didn't address how to handle ambiguous cases.

- While PAD is proposed as a contrastive inference method, the specifics of the contrastive mechanism remain somewhat abstract. Expanding the mathematical formulation of PAD could clarify the contrastive steps involved, enhancing the understanding. Since contrastive methods can be sensitive to parameters (e.g., scaling factors in logits), providing insights into how these were optimized across datasets and models would help clarify PAD’s robustness across settings.

- The evaluation focuses heavily on inverse scaling tasks, but distractor tasks can manifest in many other ways.
    - Real-world prompt injection attacks
    - More complex multi-step reasoning tasks
    - Tasks where the distinction between intended and distractor tasks is less clear

	Apart from that evaluation on more complex or noisy datasets might exhibit different behaviors under distractor influences. A discussion on how PAD handles varying levels of dataset complexity, as well as an extension of experiments on noisier or user-generated data, would enhance the applicability of the findings.

- A discussion on PAD’s limitations—particularly whether it might fail with certain prompt structures or in multitask settings where distractor and primary tasks are closely interwoven—would provide a more balanced view of the technique’s practical applicability.

- The paper mentions 3 cases where α=2 performs worse but doesn't analyze. It should provide detailed case studies of failure modes to help users understand when PAD might not be appropriate.

- The PAD method requires two forward passes through the model, but the computational impact isn't discussed.

---

confidence: 3
contribution: 2
initial_rating: 5
presentation: 3
questions: See weaknesses 2 and 3.
soundness: 2
strengths: 1. The problem addressed by the paper is important, and it is described clearly in the paper. Distraction of LLMs due to prompt misinterpretation affects LLMs of various sizes. Mitigating this issue has wide-ranging applications.

2. The proposed method is simple and described with adequate details, which helps reproducibility. The authors plan to make the code and dataset available, which is also helpful.

3. The experiment is performed using 44 different LLM-task combinations, which demonstrates the robustness of the proposed improvement.
summary: The paper aims to mitigate the distraction problem of LLMs, where LLMs pick up on a secondary task from the prompt instead of focusing on the intended task. The authors represent an LLM as a product of an expert model and propose a contrastive inference method to reduce the influence of distractor tasks. The effectiveness of the proposed method holds for multiple LLM-task combinations spanning eleven models and four datasets.
weaknesses: 1. The paper lacks clarity regarding the novelty of the work compared to existing works for mitigating LLM distraction. What are the prior methods used by people to mitigate LLM distraction? It would be helpful to cite those works if there are any. If this is the first work in this direction in any sense, you can mention that too.

2. The experiment does not have strong baselines. Having a baseline based on prior methods of mitigating distraction would be very helpful. For example, what is the performance of a simple prompt-based baseline for distraction handling? The proposed method seems to assume that the portion of the prompt that leads to distraction is already known. In that case, we can design a baseline method where a simple instruction is added to the LLM prompt. The added instruction will specifically ask the model to avoid the distracting task.

3. What is the additional cost or added limitation of using the proposed contrastive method in terms of text diversity or fluency? It would be helpful to know if the system loses any desirable property due to contrastive decoding and to the extent this happens. This will add clarity to the cost-benefit analysis of the proposed method.

---

confidence: 3
contribution: 2
initial_rating: 5
presentation: 2
questions: - The motivation is not very clear to me to introduce the product of experts .It is very easy to understand the awareness of the prior, but it is not clear how that is related to the model by the product of expert.

- It is not clear how decoding is performed for the proprietary models, e.g., GPT-3.5, given that it demands taking product of two models during inference.
soundness: 2
strengths: - It is an interesting approach for inference by combining two terms, one with a full task description and the other without the task description. The method could be interpreted as scaling the model prediction $p_m$ by the ratio of the model without task description $p_M / p_L$.

- Experiments are carried out on several open models, e.g. Llama 2 GPT2, and proprietary models, e.g., GPT-3.5, presents gains when compared with inference without biasing by the scaling term.
summary: This work proposes a framework for decoding with priors to mitigate the problem of distractor tasks. The distractor tasks are those which could be performed mostly well without considering the full context, e.g., the task description, and thus, causing inferior performances in general especially demanding inference considering long context. This work alleviate the issue by introducing the framework of product of experts by treating a language model $p_M$ as a product of true distribution with full context $p_C$ and a model without task description $p_L$, i.e., $p_M = p_C^{\gamma^*} p_L^{1 - \gamma^*}$. It results in approximating the true model by a product of two, i.e., $p_M^{1 +
\alpha^*} p_L^{- \alpha^*}$ where $\alpha^* = (1 - \gamma^*) / \gamma^*$. Experiments with several distractor tasks, e.g., prompt injection, show that the proposed method achieves gains when appropriately setting $\alpha$ value.
weaknesses: - The motivation of introducing the product of experts is not clear as a purpose to represent the model distribution with the product of two, true distribution and a model without a task description. It is more straightforward to represent the true distribution by the product of the model distribution and he model distribution without a task description.

---

confidence: 4
contribution: 2
initial_rating: 6
presentation: 3
questions: Questions:

Figure 1 is somewhat confusing, as it appears to show three experts, with the logits of these experts varying with different values of $\alpha$. Redrawing this figure with only two experts, as outlined in the proposed "product of experts" framework, would make it more consistent with the PAD method and easier to interpret. Additionally, emphasizing the contribution of each expert to the overall output could improve clarity, helping readers better understand how PAD balances intended and distractor tasks through $\alpha$.

Typos:

Line 129, missing period.

Format:

The table number and title should appear before the table.
soundness: 3
strengths: 1. The proposed theoretical framework for addressing "inverse scaling" provides a novel and compelling perspective.
2. The proposed PAD method is well-integrated with the theoretical framework, demonstrating both simplicity and effectiveness in empirical evaluations. 
3. A well-structured related work section highlights the unique contributions of this paper and contextualizes it within existing literature.
summary: This paper investigates the "inverse scaling" issue in language models (LMs), where model performance deteriorates on the intended instruction due to interference from distractor tasks. To address this, the authors propose a theoretical framework that models LMs as a "product of experts", where one expert models the intended task and the other models the distractor task. Within this framework, they introduce _prior-aware decoding_ (PAD), a simple contrastive decoding strategy aimed at minimizing the influence of distractor tasks and improving adherence to the primary instruction. Extensive experiments conducted across multiple LMs and synthetic datasets validate the efficacy of PAD.
weaknesses: 1. The problem definition in Section 3 appears somewhat disconnected from the main theoretical framework and the PAD method. While the authors briefly touch on total variation distance (TVD, $\delta$) in Appendix D, a deeper analysis would be beneficial. Specifically, a more comprehensive discussion on the relationship between TVD, the selection of parameter $\alpha$, and the performance of PAD could help clarify how these concepts interact and contribute to mitigating the influence of distractor tasks. This additional insight would enhance the theoretical rigor and provide a clearer link between the foundational theory and the practical implementation.
2. According to Appendix D, the $\epsilon$-$\delta$ definition in Section 3 serves as a sufficient, but not necessary, condition for identifying strong priors. However, its reliance on a strict separation between the task description $T$ and the data $D$ limits its practical applicability, particularly in settings where this separation is not feasible. Consequently, this rigid definition may not effectively guide the identification of distractor tasks in realistic scenarios. A more flexible approach to defining strong priors could better support the detection of distractor tasks and enhance the effectiveness of PAD in mitigating their influence.
3. The real-world applicability of the proposed method raises some concerns. While the authors present an alternative implementation using system prompts in Appendix C, the resulting performance gains appear limited. Additionally, the experiments predominantly rely on synthetic tasks, where strong local prior assumptions are likely to hold, which may not translate to more complex, real-world scenarios. Expanding the evaluation to include more diverse, general datasets could help to better demonstrate the robustness and effectiveness of PAD under real-world conditions, thus strengthening the paper’s practical contributions.

Meta-review: This paper offers a novel perspective on addressing distractor tasks in language models by introducing the Prior-Aware Decoding framework. The approach is theoretically sound and makes a meaningful contribution to understanding model behavior. However, several aspects, such as clarity in method description, evaluation breadth, and theoretical integration, need significant revision to elevate its practical applicability and robustness. The paper is promising and holds potential for substantial impact with further improvements.

Decision: Reject