Source-linked AI summary
Not All Drift Is a Mechanism: Tracing Prompt Adaptation in LLMs
Mikhail Aleksandrov, Nail Bashirov, Maksim Ivanov, Andrew Tsukanov, Timofey Karyagin, Alexander Miasnikov, Gleb Molodtsov, Valentin Samokhin, Aleksandr Beznosikov
TL;DR
Downstream scores and representation measurements alone do not show how prompt adaptation changes a frozen model’s computation or which state changes produce its outputs. The paper compares discrete and continuous prompts using controls and causal interventions in dense and MoE models. It finds that insertion site shapes the route by which adaptation influences outputs, while common representation metrics can respond to generic context changes rather than task-relevant mechanisms.
Problem
Downstream performance comparisons do not reveal which computations mediate gains, and representation analyses often do not test whether measured changes are sufficient to alter outputs.
Source: §1 · p. 1Method
Results
Adaptation insertion site constrains how it influences computation; common metrics often capture broad representation drift rather than the smaller state change sufficient to mediate adapted output.
Source: §1 · p. 2Takeaways & Limitations
Serving choices such as expert placement, caches, and pruning masks should be recomputed per adapter because adaptation changes routing and traffic alone may not reveal necessary experts.
Source: §5 · p. 9
Abstract
from arXiv · showhide
Prompt-based adaptation offers several ways to specialize a frozen language model, ranging from natural-language prompt optimization to learned continuous prompts. These methods are usually compared through downstream performance, although similar outputs need not arise from similar internal computations. We study how discrete prompt optimization, prompt tuning, and prefix tuning alter the processing of dense and mixture-of-experts language models. Our analysis shows that the location of the adaptation predicts how task information is carried to the output: optimized text primarily changes response construction, input-level prompts write their influence into content representations, and layer-wise prefixes maintain direct control through attention. In MoE models, these differences further induce distinct expert-routing patterns. At the same time, common representation-level measurements respond strongly to generic context changes and do not reliably distinguish useful adaptations from matched placebos. We argue that understanding prompt adaptation requires separating representation drift from the part of that drift that is aligned with, and causally used by, the model's task computation. This perspective provides practical guidance for selecting, evaluating, and interpreting prompt adaptation methods.
1 Introduction
Prompt adaptation can improve performance through different internal computations, so downstream scores alone do not explain what changed. This paper compares three adaptation interfaces and tests whether observed representation changes mediate their outputs.
1 Introduction
- Downstream scores cannot distinguish improved task decisions from better output-protocol adherence or a different route to the language-model head.In MoE models, contextual changes can also alter which experts process each token.Source: §1 · p. 1
- Performance studies rarely locate the computation mediating gains, while representation analyses often do not test whether measured changes are sufficient to alter outputs.The two research directions have largely developed separately.Source: §1 · pp. 1–2
- The study compares discrete prompt optimization, prompt tuning, and prefix tuning under a common frozen-model protocol, using placebos and causal interventions.It traces task information through a dense model and examines routing in sparse models.Source: §1 · p. 2
- The authors argue that adaptation insertion sites constrain how task information reaches outputs, while common metrics can capture broad drift rather than task-relevant state changes.Their account distinguishes representation movement from the smaller change that mediates adapted output.Source: §1 · p. 2
2 Related Work
Prior work studies continuous prompts, optimized text, contextual mechanisms, and MoE routing, but these lines have not fully explained how adaptation changes computation. This paper brings them together with matched placebos and causal transfer.
2 Related Work
- Continuous prompts differ in where learned states can influence computation: prompt tuning inserts input embeddings, while prefix tuning supplies keys and values throughout attention layers.Learned states can be difficult to interpret, and human-readable constraints may reduce task performance.Source: §2 · p. 2
- Discrete prompt optimization evolved from token search to systems that generate and refine full instructions, but evaluations often describe behavior rather than its producing computation.Examples include APE, ProTeGi, OPRO, GEPA, and SPRIG.Source: §2 · p. 2
- Mechanistic studies use probes, tuned lenses, steering, and patching to examine contextual computation, yet observational measurements alone do not establish that a change produces the output.This paper compares three adaptation mechanisms under one task and backbone, testing measurements with placebos and causal transfer.Source: §2 · p. 2
- MoE routing makes contextual adaptation an expert-selection question, but frozen-router responses to discrete, input-level, and layerwise prompts remain underexplored.The paper tests expert necessity through pruning and distinguishes selection changes from serving load.Source: §2 · pp. 2–3
- The contributions trace adaptation through attention, hidden states, and expert routing, using controls and interventions to separate useful adaptation from generic context effects.The MoE analysis also tests whether traffic statistics reveal which experts adaptation needs.Source: §2 · p. 3
3 Dense Models: From Adaptation Interface to Functional State Change
The dense-model analysis separates answer construction from task information, tests representation changes against a padding placebo, and uses interventions to identify transferable state differences. Learned affine corrections recover much of the adapted behavior, without establishing that they reproduce the native mechanism.
3 Dense Models: From Adaptation Interface to Functional State Change
- GEPA, prompt tuning, and prefix tuning expose different computation routes: text instructions, input-level content states, and layerwise attention access.The analysis asks which consequences remain active in output computation and which state changes are generic context effects.Source: §3 · p. 3
3.1 Adaptation changes both the decision and its realization
- Under set parsing, most of GEPA’s advantage disappears while prompt and prefix tuning retain their gains; seed states already encode substantial label information.Adapted contexts remain functionally involved: masking access returns performance to the seed level.Source: §3.1 · pp. 3–4, Figure 2 · p. 4
3.2 Generic context produces substantial representation drift
- A length-matched padding prompt changes residual geometry and lowers task performance, while shared shifts and high-rank remainders also arise without task optimization.Distance, probe transfer, mean energy, and effective rank do not identify which change is sufficient to reproduce adapted behavior.Source: §3.2 · p. 4
3.3 Per-example state differences transfer adapted outputs
- The tested dataset-mean displacement performs like a norm-matched random direction, whereas a matched-example late-state difference transfers most of the output-distribution difference.The exact patch closes most of the source–target KL gap across both transfer directions.Source: §3.3 · p. 5
3.4 Learned corrections recover adapted generation
- MSE+KL affine corrections recover 89% of prompt-tuning gains and 79% of prefix-tuning gains in complete-answer generation.The maps recover the small GEPA gap as well as most continuous-method gains.Source: §3.4 · p. 5, Table 2 · p. 6
- With MSE+KL, a single correction at answer start comes within 0.010 of the per-token predictor, while a constant bias does not beat the seed for prompt or prefix tuning.The learned maps reproduce behavior, but do not establish that they reproduce the native adaptation mechanism.Source: §3.4 · pp. 5–6
4 MoE Models: When Drift Becomes a Discrete Decision
In MoE models, adaptation can change expert assignments and full-sequence load, but traffic alone does not reveal which experts an adapted model needs. The insertion method shapes rerouting, and rarely used super experts can determine whether pruning preserves readable answers.
4.1 Only continuous adaptation substantially reroutes the shared tokens
- GEPA moved only a few percent of shared comment-token routing mass, while prompt and prefix tuning moved two to four times more on average across layers.Continuous displacement generally fell in later layers, except for gpt-oss prefix tuning, where it rose toward experts used by the base for generated text.Source: §4.1 · pp. 6–7, Figure 4 · p. 7
4.2 The load changes with the routed sequence, not with rerouting
- Although adaptation moved comment tokens between experts, every arm’s Gini stayed near the base; full-sequence load shifted mainly through tokens added or removed.GEPA’s longer instruction multiplies routed positions, while Qwen’s virtual tokens spread traffic to nearly idle experts.Source: §4.2 · p. 7, Table 3 · p. 7
- Including the base’s analysis in adapter training preserved reasoning but lowered task F1 across tested arms; forcing direct answers also lowered frozen-base F1.On the frozen base, direct-answer forcing changed F1 from 0.629 to 0.495 with the seed instruction and from 0.755 to 0.723 with GEPA.Source: Table 4 · p. 7, §4.2 · p. 7
4.4 Rarely used super experts decide whether an adapted model survives
- On Qwen, masks removing all three super experts erased readable answers; sparing them restored prompt-200 F1 0.803 vs 0.816 intact and prefix-500 F1 0.768 vs 0.805.These rescue controls show that removing little routing mass can still eliminate readable answers.Source: Table 5 · p. 8, §4.4 · p. 8
4.3 Frequency pruning removes experts the adapted model needs
- The least-used half of experts carried 2–13% of routing mass on average, and the least-used three quarters carried 18–40%; pruning them could still destroy readable answers.Experts were ranked on each arm’s own calibration map before masking.Source: §4.3 · p. 8
4.4 Rarely used super experts decide whether an adapted model survives
- GEPA left super-expert magnitudes unchanged, prompt tuning moved a peak onto a virtual token, and prefix tuning could suppress them by three orders of magnitude.The prefix effect depended on budget, learning rate, and seed.Source: Table 6 · p. 8, §4.4 · p. 8, Figure 5 · p. 9
5 Conclusion
The conclusion argues that prompt adaptations differ in where they act, with implications for evaluation and serving. It recommends checking output parsing and placebo context changes, and recomputing MoE serving choices for each adapter.
5 Conclusion
- Prompt methods differ less in how much they change a frozen model than in where they act, with practical consequences for evaluation, interpretation, and deployment.The conclusion cautions that an affine map can recover most continuous gains without the adapted context yet need not reproduce the native mechanism.Source: §5 · p. 9
- Set parsing removes most of GEPA’s gain while continuous methods retain theirs, and length-matched padding reproduces representation signatures without improving the task.The conclusion recommends evaluating optimized prompts under both parsing approaches and using matched placebos when interpreting representation metrics.Source: §5 · p. 9
- In MoE models, router retraining alone recovers most adaptation gain, and adaptation choice affects serving decisions such as expert placement, caches, and pruning masks.Traffic alone is an unsafe basis for pruning because rarely used super experts can still determine whether an adapted model answers.Source: §5 · p. 9
A Numerical Results
The results compare parser-dependent gains, while the methods differ in where learned or optimized context enters a frozen model. The section also defines ρ as an evaluator comparison, not a causal decomposition.
A Numerical Results
- ρ reports the fraction of the order-sensitive gain that disappears under order-invariant evaluation, but it is not a causal split between formatting and label prediction.Both seed and adapted scores change with the parser.Source: A Numerical Results · p. 14
- At n=1000, prompt tuning scores 0.8003 and 0.8017, with gains over the seed of 0.5166 and 0.1925 under order-sensitive and order-invariant parsing, respectively.The held-out test uses empty-aware samples F1 under both parsers; the seed scores 0.2837 strict and 0.6092 set, and the discrete branch has ρ=0.85.Source: A Numerical Results · p. 14, Table 7 · p. 14
B.1 Adaptation Objectives and Insertion Sites
- Prompt tuning concatenates learned input embeddings with the scaffold, whereas prefix tuning supplies learned keys and values at every attention layer.GEPA instead searches textual instructions; the label list, input wrapper, and output contract remain fixed.Source: §B.1 · p. 15
B.2 Diagnostic Setup
The diagnostics compare adaptation performance and representation readouts against controls, then examine how adapted contexts are attended to. Their results distinguish evaluator-sensitive performance from measurements that can also shift under generic context changes.
B.2 Diagnostic Setup
- A length-matched padding prompt adds context without adaptation, so measurements shared with padding can reflect added context positions alone.The adaptation, probe, intervention, and test partitions are disjoint, and the test set is not used to train probes or select prompts.Source: §B.2 · p. 15
- Averaged over three optimizer-pool sizes, prefix tuning leads GEPA by 0.179 under order-sensitive parsing and 0.126 under set parsing; ignoring order reduces the measured gap by about 30%.Continuous methods improve monotonically with pool size, while GEPA does not.Source: §B.2 · p. 15
- At layer 6, mean-displacement energy fractions are 0.961 for GEPA, 0.981 for prefix tuning, 0.967 for prompt tuning, and 0.948 for padding; at layer 18 they are 0.636, 0.676, 0.569, and 0.484, respectively.Steering recoveries for both branches are similar to norm-matched random controls.Source: §B.2 · pp. 15–16
B.3 Tuned Lens and Linear Probes
- GEPA remains above the seed in tuned-lens margin from layer 20; prompt tuning crosses at about layer 18, while prefix tuning crosses between layers 4 and 20.A seed-trained probe transfers poorly to adapted states, but retraining within each adapted stream restores validation scores to 0.74–0.80; padding also degrades transfer.Source: §B.3 · p. 16
B.4 Attention to the Adapted Context
- Prefix virtual-token attention mass rises from 0.523 to 0.940 and remains between 0.90 and 0.95 during generation, while prompt mass peaks at 0.252 and falls to 0.021.The models differ in seed and capacity, so these values do not isolate an adaptation-method effect. Masking either continuous context returns subset accuracy to zero-shot level; masking GEPA’s instruction lowers it slightly below seed.Source: §B.4 · p. 16
B.5 Mean Shifts and Cosine Geometry
The geometric diagnostics show that context changes can produce substantial representation shifts even without task improvement. Shift direction and distance also vary across methods and examples.
B.5 Mean Shifts and Cosine Geometry
- At layer 18, centered remainder effective rank is 476–573 across adaptation methods versus 500 for padding, so broad variation also occurs under a non-improving context change.The diagnostic uses 1,000 fixed examples; with hidden size 2,304, the centered matrix rank is at most 999.Source: §B.5 · pp. 16–17, Figure 7 · p. 17
- At block 25, mean per-example cosine is 0.011 for GEPA–prefix, 0.238 for prefix–prompt, and 0.327 for GEPA–prompt; GEPA–prompt has the broadest distribution.Each Figure 8 panel pools 1,000 fixed examples, and early-layer shift directions are less stable because their norms are small.Source: §B.5 · p. 17, Figure 8 · p. 18
- After centering, prefix tuning has the lowest seed cosine at 0.155, while padding remains much closer at 0.845; GEPA is more seed-aligned than either continuous method.Table 9 reports mean per-example cosine with the seed-prompt residual at layer 18 over three seeds.Source: §B.5 · p. 17, Table 9 · p. 18
- Padding stays close to the seed but performs worse, while GEPA improves despite moving less than either continuous method, so geometric distance alone does not identify a useful intervention.The matched context placebo reproduces prominent geometric signatures without improving the task.Source: §B.5 · p. 17, Figure 7 · p. 17
B.6 SAE Fidelity and Cross-Method State Patching
The appendix tests state transfer and learned corrections across adaptation methods, including whether those corrections improve outputs, reduce generation time, and differ geometrically. It also examines the limits of SAE-based transfer and predictor comparisons.
B.6 SAE Fidelity and Cross-Method State Patching
- Early-layer SAE reconstruction error can exceed displacement energy, so the recovered-energy analysis is restricted to late layers, where q25 is 0.421 for prompt, 0.582 for prefix, and 0.616 for GEPA.The q25 values come from the matched n=1000, m=20 comparison.Source: §B.6 · p. 18
- Exact patches recover 0.917 ± 0.049 of the GEPA/prompt gap and 0.832 ± 0.056 of the GEPA/prefix gap; SAE patches recover 0.868 ± 0.012 and 0.708 ± 0.084, respectively.The experiment measures transfer between selected models, not a controlled estimate of adaptation-method effects.Source: §B.6 · pp. 18–19, Figure 9 · p. 19
- The Top-128 most-changed SAE features recover 0.688 of the GEPA/prompt gap and 0.536 of the GEPA/prefix gap, but their transfer scores do not identify feature semantics.The subset is selected by displacement magnitude on 32 disjoint calibration examples.Source: §B.6 · p. 19, Figure 9 · p. 19
C.1 MSE and MSE+KL on 3000 Test Examples
- For prompt and prefix, bias-only scores (0.604 ± .006; 0.543 ± .057) stay below seed 0.617, while affine maps reach 0.759 ± .006 and 0.765 ± .006.This supports an input-dependent contribution for those two methods; GEPA's bias-only score is 0.633 ± .005 versus 0.681 ± .012 for its affine map.Source: §C.1 · p. 20, Table 10 · p. 20
C.2 Fixed Regime and Predictor Rank
- Under repredict, scores rise with predictor rank for every target, while rank 8 remains 0.023–0.047 below the full map; fixed-prefix scores stay below the seed at every rank.Rank-one input-dependent scores are 0.634 for GEPA, 0.596 for prompt, and 0.677 for prefix.Source: §C.2 · p. 20, Table 11 · p. 21
C.3 Early Exit
- Early exit takes about 43 ms per example versus 52.6 ms for the seed model, a 1.22× speedup; it is 1.28× and 1.26× faster than native prompt and prefix tuning.The timing run uses 16 generated tokens and one seed; native GEPA is 7.1× slower, mostly because its instruction is longer.Source: §C.3 · p. 21, Table 13 · p. 21
C.4 Geometry of the Learned Corrections
- Predicted shifts align closely with true shifts within each method, but cross-method first-token shift cosines vary from 0.18 to 0.46; mean directions have cosines of 0.09, 0.13, and 0.38.The sample-level analysis uses block 25, MSE, and seed 42; later-token comparisons are restricted by differing histories and short continuous-method generations.Source: §C.4 · p. 22, Table 14 · p. 22
C.5 Earlier Composite-Loss Experiment
An earlier composite-loss experiment compares predictor and application-mode variants, followed by a recurrent mean-shift intervention and examples of GEPA prompts. The reported comparisons are bounded by the experiment's tests and prompt-validation observations.
C.5 Earlier Composite-Loss Experiment
- In the earlier composite-loss experiment, recurrent scores exceed one-shot scores, but observed differences do not establish equivalence between predictor types or application regimes.The largest fixed-versus-repredict difference is 0.032; MSE results show transfer is possible without SAE supervision.Source: §C.5 · pp. 22–23, Table 15 · p. 23
C.6 Recurrent Mean Shift
- For prefix tuning, selected recurrent mean shifts recover 6.7%, 10.0%, and 10.0% of the gain across seeds, while raw mean shifts at block 25 lower scores below the seed for all six tested models.With the selected configuration, scores rise from 0.606 to 0.620, 0.625, and 0.627.Source: §C.6 · p. 23
D GEPA Prompt Examples
- GEPA's frozen instructions sometimes copied examples from its validation data, an observation that does not indicate overlap with the held-out test set.The appendix reproduces the n=200 instruction and includes task-specific labeling and output-contract guidance.Source: D GEPA Prompt Examples · pp. 23–24
E.1 Setup in full
The setup measures multi-label classification and expert routing using disjoint calibration and test data. Routing displacement varies by method and depth, with prefix tuning showing a distinct late-layer alignment to experts used for generated text.
E.1 Setup in full
- Civil Comments is evaluated by row-averaged set-level F1 on two 2,000-row test samples that share 1,993 rows; answering nothing scores 0.330 and 0.328, respectively.The samples contain 660 and 656 rows with no label.Source: §E.1 · p. 24
- Routing maps use 500 validation rows disjoint from test data, record expert counts by layer and sequence stage, and match each pruning run to its adapter checkpoint.The reported displacement uses the comment stage, which is shared across all arms.Source: §E.1 · p. 25
- Continuous-method displacement generally falls with depth, but gpt-oss prefix displacement rises from 0.10–0.15 to 0.23–0.28 and aligns with base reasoning and answer routing in late layers.Those late-layer cosines are 0.45–0.61 for reasoning and 0.35–0.44 for answer tokens; prompt tuning and GEPA cosines range from −0.16 to 0.16.Source: §E.1 · p. 25
E.2 Complete pruning results
The pruning sweep’s gpt-oss GEPA −75% result depends on the effort used to calibrate its expert map: the medium-effort map keeps expert 5 of layer 6, while the low-effort map removes it.
E.2 Complete pruning results
- 0.422 F1 with 36 percent of answers readable is the gpt-oss GEPA −75% result under the medium-effort map, which keeps expert 5 of layer 6.The expert is the 26th least used in its layer under that map.Source: §E.2 · p. 25
- The sweep’s masks use maps rendered at reasoning effort medium, while all scores use reasoning effort low.The low-effort map for the same arm differs in 14 of 576 experts and removes expert 5 of layer 6 as the 24th least used.Source: §E.2 · p. 25
- For the gpt-oss GEPA −75% cell, expert 5 of layer 6 is kept by the medium-effort map but removed by the low-effort map.The passage reports the result under the medium-effort map; it does not report the score for the low-effort mask.Source: §E.2 · p. 25
E.3 Super experts
Across these appendices, prompt adaptations show distinct effects on expert traffic, pruning sensitivity, and attention; router retraining recovers much of adaptation’s gain on the frozen base, while replayed routes alone explain little of the gain. Timing and load statistics are reported with explicit scope boundaries.
E.3 Super experts
- Qwen’s identified super experts are removed by frequency masks in every arm, whereas gpt-oss expert 5 of layer 17 remains among its layer’s three busiest experts and is never removed.Qwen expert 68 of layer 1 is already removed at −50%; gpt-oss expert 5 of layer 6 is removed in four of sixteen cells.Source: §E.3 · pp. 25–26, Table 17 · p. 27
- On Qwen, super experts build the attention sink from layer 2 onward; removing their peak-carrying channel takes two thirds of the sink share from layer 3 onward, unlike a same-norm random perturbation.The comparison is reported on Civil test rows and WikiText-2.Source: §E.3 · p. 27, Figure 11 · p. 28, Figure 12 · p. 29
- On gpt-oss, pruning super experts removes the position-0 peak and lowers its attention share to 1.1%, with 5.0 of the lost 11.4 points going to the learned sink.The authors say this task and text do not need the peak, while noting the sink cannot replace it [Queipo-de-Llano et al., 2025]; they describe sink behavior as consistent with prior work [Sun et al., 2024, Gu et al., 2025].Source: §E.3 · p. 27, Figure 13 · p. 30
- Two Qwen 500-token prefixes reach the same F1 but differ in super-expert dependence: the 10−4 prefix scores 0.807 intact and 0.803 pruned, while damaging WikiText-2 performance through its first six layers.Removing those early layers brings WikiText-2 perplexity close to the base for every Figure 10 prefix while preserving most of the 10−4 prefix’s task gain.Source: Figure 10 · p. 27, §E.3 · p. 28, Table 18 · p. 28
E.4 Retraining the router
- Retraining the router recovers most of the adaptation gain on the frozen base, but adds little on continuous arms and combining it with context adaptation never beats the better method by more than 0.007.GEPA gains 0.022 to 0.073 across learning rates; at the chosen rate the retrained base reaches 0.80, and GEPA adds nothing on top.Source: Table 19 · p. 29, §E.4 · p. 29
E.6 Complete load statistics
- The complete load-statistics release covers expert-by-layer distributions for sixteen checkpoints, prompt-stage distributions, per-layer Gini and busiest-expert shares, and before-and-after Gini for masked runs.Experts with no traffic are counted separately rather than included as zero rows in the distribution tables.Source: §E.6 · p. 30
E.5 Expert-parallel timing
- At 4096 tokens per device, adapted expert-parallel MoE-layer times stay within 6% of the base on two and four devices and within 14% on eight; at 512 tokens, they stay within 6% at every device count.The timing excludes attention and serving-framework costs, so it is not end-to-end latency.Source: §E.5 · p. 30, Table 20 · p. 31
E.7 Replaying routing decisions
- Replayed user-turn routes close none of prompt tuning’s 0.373 F1 gap and only 0.034 of prefix tuning’s 0.348 gap; joint replay exceeds matched random control by 0.011 and 0.020, respectively.Replay changes prefill routes only, leaving recipient states and decoding unchanged; the authors caution that this does not show routing is unnecessary or that remaining state change suffices.Source: Table 21 · p. 31, §E.7 · p. 31