acceptodds
Published as a conference paper at NeurIPS 2026

Prefix-Tuning for Arbitrary Output Sequences on Pretrained Transformers

Peter Cho-Ho Lam, Ziyi Wang, Zirui Zhou

Abstract

Prefix-tuning is a parameter-efficient fine-tuning method for large language models (LLMs) that steers model outputs by prepending task-specific prefix representations to the input sequence. Despite its practical success, the theoretical understanding of the expressiveness of prefixes remains incomplete. In particular, the following question remains open: \it Given a pretrained autoregressive Transformer such as the GPT series, for any input-output sequence pair , does there always exist a prefix such that prepending to induces the model to generate the target output ? In this work, we prove that under the assumption that is in the \it range of the pretrained Transformer, such a prefix exists and can be explicitly computed by solving multiple linear systems. We further show that this assumption is necessary, in the sense that such a prefix may not exist when the assumption fails, thereby providing a complete answer to the above question. Our analysis is constructive and the obtained theoretical results hold under fairly general assumptions on model architecture. As a notable example, the whole GPT-2 architecture satisfies our model assumptions.

Keywords:
Sydney, Main Track

Reviews

Among:
Shape:
123456this paper, Top 24%
Figure 1. Mean review rating of the reviewed papers at NeurIPS 2026. This paper averages 4.67 over 3 reviews, above 76% of the others.
Reviewer_428FOpenReview ↗
Rating
5
Clarity
3
Confidence
3
Originality
3
Quality
3
Significance
3
Read review
Summary

The paper studies the expressiveness of prefix-tuning for a fixed pretrained autoregressive Transformer. The central question is whether, for a user input x and desired output sequence y, one can construct a prefix that makes the frozen model generate y. The authors restrict attention to targets that are already reachable from the pretrained model from some source input x', and they prove an existence result under an additional rank/distinguishability condition on the attention heads. For Transformers with residual connections and positional encodings, the theorem also requires the source and user inputs to have matching lengths and the same final token. The constructive proof uses attention matching: the prefix is designed so that the attention outputs during generation from the prefixed user input match those from the source input. By allowing generalized, head-specific key/value prefixes, the construction reduces to solving linear systems and then repeating prefix vectors enough times to override the original input contribution. Experiments on GPT-2, using synthetic sentence buckets generated with Gemini Flash, report high success rates for short outputs and lower but still substantial success rates for longer outputs; appendices include counterexamples, parameter ablations, and a proof-of-concept memory/KV-cache attack scenario.

Strengths and weaknesses

The paper is solid.

The authors give an explicit construction of the prefix tokens for each head for each layer, via attention matching. One question I have is whether the construction is sensitive to small details of the architecture—if there are positional encodings (discussed briefly on line 160), or a W_V matrix, does a modification of the construction still work?

Decoding is done via greedy decoding, and it is argued that as long as the number of times the prefix tokens are repeated is sufficiently large, then each MHA layer’s output will be the same between the prefix-tuned user input and the source input. My intuition from reading the main paper is that when m is sufficiently large, the self attention contributions from the user input is drowned out. Is there a sense of how large m needs to be to achieve some approximation guarantees to when the input is the source input?

I feel the main weakness is the restriction to the one-input one-output case. Theorem 2.2 provides an impossibility result for the case of even two input-output pairs, but this feels worst-case/adversarially constructed. The multi input-output case is probably hard without assumptions on the input-output so I am fine with the limitation of the current scope to one input/output pair. But I am curious if there is a way to understand the multi input-output pair setting from the one input-output pair setting.

Questions
  1. Is the construction is sensitive to small details of the architecture
  2. Is there a sense of how large m needs to be to achieve some approximation guarantees to when the input is the source input?
  3. Is there is a way to understand the multi input-output pair setting from the one input-output pair setting.
Limitations
  1. The paper discusses assumptions made (Equation (10)). It could discuss a little more how the theoretical formulation differs or is similar to prefix tuning used empirically — e.g. in practice, do practitioners actually instantiate m different tokens for each head for each layer?

  2. Is it realistic to assume access to the source input? If you want to steer your LLM to generate y given user input x, but the source input is unknown, are there reasonable heuristics to find an approximate source input? What are the ways people steer their LLM to generate a particular output y in the absence of a source input?

  3. They mention that this is for the one-input one-output setting, whereas fine-tuning involves multiple pairs. They prove a negative result in the case where there are just two input-output examples.

Paper formatting concerns

n/a

Final justification

Rebuttal addresses my questions

1 comment

We thank the reviewer for their thoughtful feedback. Below, we address the concerns and questions raised in the review.

Question 1: Is the construction is sensitive to small details of the architecture

We are currently conducting experiments on additional models, but the results are not yet available due to the limited rebuttal timeframe. We will report these findings as soon as they are ready.

Question 2: Is there a sense of how large m needs to be to achieve some approximation guarantees to when the input is the source input?

In principle, it may be possible to derive such a bound theoretically. However, any general worst-case guarantee is likely to be extremely large. Empirically, as reported in Section 5, we find that 90 repetitions are sufficient for GPT-2.

Question 3: Is there is a way to understand the multi input-output pair setting from the one input-output pair setting.

Although our work substantially extends the existing theory, the multi-input/output setting remains an important open problem. We hope our results will motivate further research in this direction. On a positive note, our counterexamples suggest that the primary challenge arises from inconsistencies between the pretrained model's behavior and the desired fine-tuning dataset. We believe these insights provide useful guidance for formulating assumptions that work for the multi-input/output setting.

Limitation 1: The paper discusses assumptions made (Equation (10)). It could discuss a little more how the theoretical formulation differs or is similar to prefix tuning used empirically — e.g. in practice, do practitioners actually instantiate m different tokens for each head for each layer?

There are two main differences between our theoretical settings and the practical settings: (i) As we discussed, our work focuses on one input-output pair but in practice the fine-tuning dataset is much larger. (ii) In practice, the prefix is often obtained from training but not explicit construction. Our work essentially provides evidence that some good prefix exists, but we do not expect people simply use our constructed prefix for their downstream applications. That said, since prefix optimization can sometimes be unstable, our construction may potentially serve as a useful initialization, which we leave as an interesting direction for future work.

As to whether practitioners actually instantiate mm different tokens for each head for each layer, from the documentation of one of our references (Poth et al., 2023), they seem to allow the prefix to be head-dependent. Therefore we believe our head-dependent assumption is reasonable.

Limitation 2: Is it realistic to assume access to the source input? If you want to steer your LLM to generate y given user input x, but the source input is unknown, are there reasonable heuristics to find an approximate source input? What are the ways people steer their LLM to generate a particular output y in the absence of a source input?

The lack of access to the source input in practice does not affect our result as we are analyzing prefix-tuning from a theoretical perspective. Nevertheless, practical heuristics for identifying suitable source inputs do exist, and we discuss several of them in Appendix C.

Reviewer_hnweOpenReview ↗
Rating
5
Clarity
4
Confidence
5
Originality
4
Quality
4
Significance
3
Read review
Summary

Summary

  1. Claim: There’s no sound mathematical proof around prefix tuning LLMs. Specifically: “does there always exist a prefix S such that prepending S to x induces the model to generate the target output”

  2. Context: prefix-tuning is a well-reserched method of param-efficient fine tuning, where one prefix a set of floats (embeddings) to a pre-trained model’s internal states, and just trains these prefixes on new data. It avoids the pitfalls associated with full model SFT (like catastrophic forgetting, high cost, etc), but has its challenges (instability, inability to learn novel skills, etc)

  3. In the paper, they prove mathematically that prefix tuning can be used in general pre-trained LLMs to guide output towards arbitrary sequences

  4. They try to prove the following: if Transformer T can auto-regressively generate a sequence Y with an initial input X’ (ie, Y is within the space of possible outputs), then one can always find a prefix s.t the modified transformer, T_s can also auto-regressively generate Y regardless of the input.

    A. Terminal tokens & total input count need to match for skip-connections for pos-embeddings.

Problem

  1. Existing mathematical analysis of prefix tuning has these issues:

    A. results are established for hand-crafted Transformers with some simplifications

    B. Different generation mechanism for proofs

    C. impractical model width, depth, or prefix length assumptions

  2. They attach the prefix embeddings to encoded Q matrix in attention heads and try to arrive at general mathematical proof of

Process

  1. Prefix embeddings attached to encoded Q matrices in attention.

  2. They work with variants involving: prefixes on a per-head basis, and, separate prefixes for K, V

  3. “restrict attention to output sequences that are realizable by the underlying Transformer” - fair assumption, since prefix tuning has to operate on the same general space of sequences.

  4. They formulate the above requirement in mathematical terms, use some clever assumptions and simplifications to create a set of linear equations to impose that requirement. Solving these can yield the prefix necessary for the model to completely ignore the user input & generate a specific output

    a. The attention output for the source input sequence is calculated (org model: T). They set up equations to force the attention output of the prefixed user sequence to match this source output.

    b. The authors simplify the non-linear quotients by introducing an "override" strategy. By repeating specific prefix vectors multiple times, the prefix's attention mass dominates the softmax denominator, effectively nullifying the influence of the user input x.

  5. As far as I can tell, the math is all accurate and steps follow logically with explanations.

Strengths and weaknesses

Strengths

  1. Complete and theoretically tight resolution to the expressiveness of prefix-tuning in a real-world, autoregressive LLM setting.
  2. Algorithm is entirely training-free, utilizing standard linear algebraic solvers to compute the prefixes efficiently.
  3. Theoretical analysis is validated with empirical validation on GPT-2

Weaknesses

  1. The proof relies on repetitions of the prefix vectors (90 times) to override native attention scores - it feels like a hack which, though mathematically sound, still weakens the claim of a “proof” of effectiveness of prefix tuning.
  2. They admit that the set of linear eqn will not have a solution in case consecutive attention values are exactly same. This won’t happen with same token since pos embedding will change the embeddings, but can happen for arbitrary tokens: “condition 10”
  3. The requirement that the source input length matches the user input length to handle positional encodings is theoretically restrictive
  4. The guarantee applies only to a single input-output sequence pair
Questions

Questions/ Suggestions

  1. Paper refers to “Condition (10)” in Theorem 2.1, but the condition is not laid out until much later. This makes the paper harder to read & understand. Consider making relevant assumptions and conditions clear upfront, or at least explain it.

    • I understand that expressing the condition 10 at the outset will be confusing, since it ties strongly to the the math, but please consider finding some other way of writing this part.
  2. Please add explanation of what A^h_{t,i} notation around equation 5 is - even if it is obvious. Right afterwards, “A_h” is used for something different - causing additional confusion

Limitations

Yes - covered by authors.

Paper formatting concerns

N/A

Final justification

I acknowledge author's rebuttal. thanks for the detailed response, and happy to see good results without requiring large number of repititions

I'll maintain my rating. The only minor concern that remains is the unavoidable theoretical assumptions that don't always translate to real-world use cases. The paper is pretty strong nevertheless

1 comment

We thank the reviewer for the detailed review of our paper and for the insightful suggestions. In particular, we agree that the current presentation of condition (10) is not ideal, as it is introduced much earlier than it is fully explained. We retained the current presentation because the necessary mathematical objects had not yet been introduced at that point, as the reviewer also noted. We will look for a better way to present this condition in the final version.

Below, we respond to the remaining concerns raised by the reviewer.

Weakness 1: The proof relies on repetitions of the prefix vectors (90 times) to override native attention scores - it feels like a hack which, though mathematically sound, still weakens the claim of a “proof” of effectiveness of prefix tuning.

Our goal, as with prior work on prefix-tuning expressiveness, is to establish a theoretical expressiveness result to support the effectiveness of prefix-tuning. Inevitably, there is a gap between theory and practice, and we do not claim to eliminate it entirely. Instead, we argue that our theoretical setting is substantially closer to modern LLMs than previous work. As the reviewer noted, prior results typically rely on highly simplified Transformer architectures or different generation settings. In contrast, our construction applies to modern autoregressive Transformers, is fully constructive, and is supported by experimental validation. While the repeated prefix vectors may appear like a "hack", we believe this is a reasonable trade-off for obtaining a rigorous result under much more realistic settings.

Weakness 2: They admit that the set of linear eqn will not have a solution in case consecutive attention values are exactly same. This won’t happen with same token since pos embedding will change the embeddings, but can happen for arbitrary tokens: “condition 10”

There is a decent chance that this condition can be relaxed or removed, as there are several other aspects of the proof that we may be able to exploit. For example, if we have two identical tokens, we might be able to perturb one of their embeddings slightly so that the outputs of all the equations remain essentially the same while condition (10) becomes satisfied. This is something we can explore further.

However, even if we are unable to remove this assumption, positional encodings are already ubiquitous in modern LLMs. Since our goal is to describe modern LLM architectures (which almost always use positional encodings), we believe this limitation has minimal impact on the practical completeness of our theoretical result.

Weakness 3: The requirement that the source input length matches the user input length to handle positional encodings is theoretically restrictive

As discussed in Appendix B, this assumption is unfortunately necessary, as otherwise a counterexample exists. On the other hand, this and several other assumptions can be removed if residual connections are omitted (see Theorem 2.1). Our priority is to establish a mathematically rigorous result for a model that closely reflects modern LLM architectures, including both residual connections and positional encodings, even if doing so requires somewhat stronger assumptions.

Weakness 4: The guarantee applies only to a single input-output sequence pair

Unfortunately, this limitation is also unavoidable, as there are counterexamples preventing a more general guarantee. Nevertheless, we hope our work motivates further research in this direction. As discussed in the paper, an interesting future direction is to develop a suitable notion of dataset "consistency" that rules out these pathological counterexamples and enables stronger expressiveness guarantees.

Reviewer_vpi6OpenReview ↗
Rating
4
Clarity
3
Confidence
3
Originality
3
Quality
3
Significance
2
Read review
Summary

This paper analyzes the expressiveness of prefix-tuning for pretrained autoregressive Transformers. It proposes an attention matching framework that transforms a high-dimensional nonlinear problem into a linear system by using split key/value prefixes. Given the attention coefficient matrix SS, the value prefixes can then be computed in a training-free manner. Experiments are conducted on GPT-2 using synthetic datasets generated by Gemini Flash to evaluate whether the computed prefix can make a user input reproduce the target output generated from a source input.

Strengths and weaknesses

Strengths

  1. This paper addresses an interesting problem by studying the expressiveness of prefix-tuning in the autoregressive generation setting.
  2. The proposed attention matching framework is technically interesting. The paper does not merely argue for the existence of a prefix, but also provides a constructive procedure for computing such prefixes by solving linear systems of the form SV=[X∣Y]SV=[X|Y] in a training-free manner.

Weaknesses

  1. The paper argues that by repeating the prefix sufficiently many times, the attention output can be made arbitrarily close to that of the source run. However, the final generation is performed through argmax decoding. Since argmax is discontinuous, even very small differences in logits may change the selected token when the margin between the top-1 and top-2 logits is small.
  2. There is a gap between the proof construction and the practical algorithm. In the proof, the authors use a Vandermonde matrix to guarantee that SS has full rank. However, the algorithm states that this construction is numerically poor and instead uses the construction in Eq. (12). Although the paper reports that this construction empirically satisfies the full-rank requirement, it is not clear whether this property is theoretically guaranteed.
  3. The experimental validation is limited to GPT-2. It is not sufficient to support broad claims about modern LLMs. Additional experiments on more recent LLMs using RoPE, long context windows, MQA/GQA, and instruction tuning would strengthen the empirical evidence.
Questions
  1. Does approximate attention matching require a positive logic margin for the target token at each decoding step in order to guarantee exact greedy decoding? Could the authors provide a formal margin argument or an explicit error bound?
  2. How would the proposed method and its theoretical guarantee change under decoding strategies other than greedy decoding, such as top-k sampling?
  3. Does the practical construction in Eq. (12) theoretically guarantee that SS is full-rank or well-conditioned, or is this only an empirical property observed in the GPT-2 experiments?
  4. Does the proposed method work reliably on more recent LLMs that use RoPE, instruction tuning, or long context windows?
Limitations

yes

Paper formatting concerns

N/A

Final justification

My concerns have been addressed.

1 comment

We appreciate the careful review and are pleased that the reviewer finds the problem of prefix-tuning and our attention matching framework interesting. Below, we summarize and address the concerns raised by the reviewer.

Question 1: Does approximate attention matching require a positive logit margin for the target token at each decoding step in order to guarantee exact greedy decoding? Could the authors provide a formal margin argument or an explicit error bound?

Our argument applies whenever there is a positive margin between the largest and second-largest logits (assuming greedy decoding). In contrast, if the two largest logits are exactly equal, the argmax decision is inherently ambiguous and therefore not well-defined. Such cases are not covered by our theoretical guarantee. Although exact ties are exceedingly rare in practice, this is an important point, and we will clarify this limitation in the final version of the paper. We thank the reviewer for this careful observation.

In case this is not sufficiently clear that positive margin is all we need from the paper, here is an additional explanation. With the positive margin assumption, there exists an r>0r>0 such that the entire decoding trajectory remains unchanged even if every logit at every decoding step is perturbed by at most rr. As shown in Appendix D, for any ϵ>0\epsilon>0, there exists a (generalized) prefix such that the attention output is perturbed by at most CϵC\epsilon, where CC is a positive constant depending on the model. Choosing ϵ\epsilon such that Cϵ<rC\epsilon < r guarantees that the decoding trajectory is preserved. (Technically, this argument must be applied iteratively from the last layer to the first layer, but the extension is straightforward)

Question 2: How would the proposed method and its theoretical guarantee change under decoding strategies other than greedy decoding, such as top-k sampling?

For probabilistic decoding strategies such as top-k sampling, the theoretical guarantee naturally changes from "there exists a prefix that generates the target output" to "there exists a prefix that induces the same probability of generating the target output as the source input." More generally, this conclusion holds for any decoding strategy whose sampling distribution depends continuously on the output logits, since our construction can approximate those logits arbitrarily well.

Question 3: Does the practical construction in Eq. (12) theoretically guarantee that is full-rank or well-conditioned, or is this only an empirical property observed in the GPT-2 experiments?

The construction in Eq. (12) is primarily heuristic, and we have not established a theoretical guarantee that the resulting matrix SS is always full-rank or well-conditioned. Nevertheless, in our experiments, we have successfully constructed and solved the linear system SV=[X∣Y]SV=[X | Y] more than one million times using this procedure, suggesting that it is highly reliable in practice.

Moreover, even if pathological cases exist in which this heuristic fails, Appendix D provides an alternative construction that is theoretically guaranteed to work. Thus, the heuristic in Eq. (12) is introduced solely for practical efficiency, while the theoretical guarantees rely on the construction presented in Appendix D.

Question 4: Does the proposed method work reliably on more recent LLMs that use RoPE, instruction tuning, or long context windows?

We are currently conducting experiments on additional models, but the results are not yet available due to the limited rebuttal timeframe. We will report these findings as soon as they are ready.

Comments on the paper

1 comment
Meta-review

This work proposes a theory explaining the success of prefix-tuning, a cost-effective method for fine-tuning LLMs by appending task-specific vectors to the input. Here is a crisp summary of the main findings. Roughly speaking, within the theoretical setup considered in the manuscript, it is shown that: for an input-output pair (x, y) such that y is in the (autoregressive) range of the transformer, there exists a prefix p such that running the transformer on the augmented in put z = (x, p) produces y. Moreover, the prefix can be explicitly computed by solving a system of algebraic equations using off-the-shelf solvers. On the other hand, it is shown that such a prefix does not exist when y is not in the range of the transformer. Experimental results on models from the GPT-2 series are presented and discussed.

A few points about possible limitations. Some theoretical assumptions, for example condition (10), appear to be rather restrictive (e.g., see comments by Reviewer hnwe). Also, assuming access to the source sequence seems contestable.

The practical relevance of the theory and method proposed is also questionable. For example, on line 298 the authors say " The prefix repetition count was fixed at 90 to align with the context window of GPT-2, allowing the repeated prefix to occupy a substantial portion of the available context without exceeding the model’s maximum input length." Without further clarification, a repetition count of 90 sounds problematic since the authors also claim their work builds a theoretical foundation of prefix-tuning as done in practice.

I'm hoping the rebuttal phase will provide the authors with an opportunity to thorougly clarify the issues raised by the reviewers.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.