Skip to content

Influence Score and Transformer Interpretability: A Measure of Effective Attention Head Influence at Inference TimeInfluence Score and Transformers interpretability: Measure of the Effective Impact of Attention Heads at inference time

arXiv: Jailbreaks, Prompt Injection, Poisoning & Defenses· arXiv:2609.05074· Lisa Bouger, Yannick Teglia, Philippe Loubet Moundi·Indexed by this site · 2026-10-01· Originally publishedAlignment

Quick read

Interpretability

Based on the paper PDF (AI-generated); refer to the original

The influence score is used to analyze the attention heads of a DeBERTa injection detector; the TP group ablation ΔF1 is 0.014.

Questions
The upstream classifier is used to intercept prompt injection, but fine-grained circuit analysis requires complex instrumentation, and looking only at the output cannot reveal the internal components that produce the decision. The goal is to quantify the effective contribution of each attention head to the classification logit.
Methods
On a 12-layer DeBERTa-v3-base detector, project head activations onto the difference of positive and negative class weights, multiply by the head's relative contribution within the layer and the layer's weight in the residual stream, yielding an influence score that can be aggregated by head, layer, or layer subset.
Experiments and results
The authors state that the score distributions for correct and incorrect predictions differ, with decision signals concentrated in a few deep-layer heads. In the TP group, ablating 6 heads by combined score gives a ΔF1 of 0.014; in the TN group, using only the direction projection gives a ΔF1 of 0.015, higher than the combined score's 0.009 (Table 2).
Limitations and future work
The authors note that direct projection onto the final logit direction does not address the representation shift between intermediate and final layers, and list progressive ablation, compression, or pruning as future directions. The analysis targets 1 classifier; evaluation set size is 30,000 in the main text and 33,965 in Appendix B.
Experimental setupDeBERTa-v3-base (protectai/deberta-v3-base-prompt-injection) · 自建二分类评测集(第3节写30,000条;附录B写33,965条)、Alpaca et al. · Sk,h、Sfinal et al.
Evaluated models
DeBERTa-v3-base (protectai/deberta-v3-base-prompt-injection)
Benchmarks
自建二分类评测集(第3节写30,000条;附录B写33,965条)AlpacaOpenOrcaUltraChatOpen-InstructAwesome ChatGPT Promptsjackhhao/jailbreak-classificationTaskTracker Prompt Injection DatasetJailbreakBench
Metrics
Sk,hSfinalF1AccuracyΔF1ΔTPΔTN
AI summaryThe researchers propose an Influence Score to quantify the contribution of attention heads to classification decisions in Transformer classifiers. The score combines the directional influence of attention heads on logits with their structural contribution in the residual stream, supporting analysis at the head, layer, and network scales. Applied to a DeBERTa model dedicated to prompt injection detection, the method reveals different decision behaviors between correct and incorrect predictions. The study states it provides an effective compromise between fine-grained circuit analysis and global output methods, and can be used to systematically study the decision mechanisms of Transformer classifiers.

The researchers propose an Influence Score to quantify the contribution of attention heads to classification decisions in Transformer classifiers. The score combines the directional influence of attention heads on logits with their structural contribution in the residual stream, supporting analysis at the head, layer, and network scales. Applied to a DeBERTa model dedicated to prompt injection detection, the method reveals different decision behaviors between correct and incorrect predictions. The study states it provides an effective compromise between fine-grained circuit analysis and global output methods, and can be used to systematically study the decision mechanisms of Transformer classifiers.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    Use influence score to quantify the contribution of each attention head in the injection detector to the classification decision.

    How to quantify, at inference time, the effective contribution of each attention head to the final classification in a prompt injection detection classifier, and compare the internal mechanisms of correct and incorrect predictions.

    • Deployment scenario: The authors state that large language models introduce prompt injection and jailbreaks, and upstream classifiers are often used to intercept malicious queries, with these systems mainly employing Transformers. When training data is not fully accessible or controllable, interpretability is used to analyze behavior, bias, and internal decisions; as scale increases, interpretation becomes more time- and compute-intensive.
    • Existing shortcomings: The authors state that fine-grained circuit analysis has high granularity but often requires complex instrumentation; output-only methods are suitable for large-scale evaluation but cannot directly access the internal mechanisms that produce decisions.
    • Observation: Section 5 states that contributions concentrate in a few heads, more pronounced in deeper layers, and vary with predicted class and correctness; removing high-contribution heads degrades performance; projections onto logits have opposing directions, and predictions arise from competing signals. Therefore, looking at contribution or direction alone is insufficient.
    • Proposed score: The influence score multiplies the directional influence of an attention head on logits by its structural contribution in the residual stream, and can be aggregated at the head, layer, and network levels. It is applied to a DeBERTa classifier trained for prompt injection detection. The authors state it sits between fine-grained circuit analysis and global output methods.
  2. What related research exists?

    Located between circuit analysis, logit lens, and ALTI, with the experimental controls being three head-selection criteria.

    The introduction and Related Work are grouped by analysis granularity, and this paper is placed at the intersection of several routes.

    Post-hoc explanations of input features

    • LIME and SHAP: LIME (Ribeiro et al., 2016) and SHAP (Lundberg and Lee, 2017) approximate the model near a single sample and estimate input feature importance. The paper notes that they stop at observable features and cannot point out which internal components actually drive the decision.

    Internal circuits

    • Circuits and substructures: Conneau et al. (2018), Elhage et al. (2021), and Bricken et al. (2023) from the introduction are grouped as finding internal substructures responsible for specific behaviors. The paper notes that such work often relies on qualitative analysis or targeted case studies, making systematic comparison across decision categories more difficult.

    Inter-layer states and component geometry

    • Logit lens: Nostalgebraist (2020) applies the unembedding matrix to intermediate residuals to see the logit at that point. The paper notes that it can trace how the decision forms step by step but does not give the relative contribution of individual internal components.
    • ALTI: Ferrando et al. (2022) uses the geometric proximity between component contributions and the overall residual for intra-layer and cross-layer comparisons. The paper notes that it does not account for decision polarity related to the logit.

    Output-only approaches

    • Output-level methods: The introduction lists Liu et al. (2023) and Wei et al. (2022) as global methods that rely only on model outputs, calling them convenient for large-scale evaluation but without direct access to internal mechanisms. The paper does not elaborate on the specific algorithms of these two works.

    Controls in the experiments

    • Three head-selection criteria: The experiments do not use LIME, SHAP, logit lens, or ALTI as baselines. The causal test compares the combined score, direction-projection-only, and contribution-only. The data is a self-built binary classification evaluation set, not the benchmarks that come with these works.

    The authors place this paper at the intersection of the above routes: analyzing down to individual internal components, and using normalized contributions plus directional influence on the logit to connect components with the final prediction, used to see where the decision forms, which heads are driving it, and the mechanistic differences between correct and incorrect predictions. Section 7 also cites Michel et al. (2019) and Sanh et al. (2020) as existing results that "performance does not necessarily degrade significantly after removing a considerable fraction of heads or parameters," used to contrast with this paper's redundancy assumption.

  3. How does the paper address this problem?

    Multiply the logit direction projection by the relative contribution of the heads and layers, then aggregate by head or layer.

    Define an influence score on a prompt injection detection classifier: estimate how strongly and in which direction each attention head pushes the logit, then multiply by its relative component in the residual stream, so decisions can be viewed by head, layer, or layer subset. Figure 1 plots this product as a direction term times residual contribution.

    Model and Residual Decomposition

    • Classifier: Based on DeBERTa-v3-base, 12 layers, using DeBERTa's disentangled attention, followed by a binary classification head. The main text treats INJECTION as the positive class and BENIGN as the negative class; correct predictions are denoted TP, TN, and errors FP, FN. The training corpus is described separately in Appendix A.
    • Residual approximation: The final residual is written as the input embedding plus the sum of each layer's attention output Ak and MLP output. The authors note this formulation omits normalization layers. The class logit is obtained by a linear projection of the classification weights onto the final residual.
    • Per-head decomposition: The k-th layer attention block is written as a sum of N heads. The paper does not specify N.

    Directional Influence and Relative Contribution

    • Direction term: Directional influence is defined as Δk,h(x)=⟨ w,Hk,h(x)⟩, where w is the difference between the positive and negative class classification weights. A positive value pushes toward INJECTION, a negative value toward BENIGN; the quantity also carries magnitude.
    • Structural term: Relative contribution follows ALTI. Proximity takes the residual L1 norm minus the L1 distance between the component and the residual, then takes the maximum with 0, and is then normalized within the same comparison set. The authors state it requires no gradients or ablations; LayerNorm may change scale or orientation, but within the same sample and residual state, the effects on each component are comparable, so it is still used as a relative score.

    Weighted Influence Score

    • Definition: The weighted score is Sk,h(x)=Δk,h(x) Ck,h(x) αk(x). Ck measures how much that layer's attention output changes the current residual; αk is the layer weight after normalizing Ck over the considered layers, with the sum over layers equal to 1; Ck,h is the relative share of head h in that layer's attention output.
    • Rationale for multiplication: The authors state that a head counts as high-impact only if it simultaneously enters the residual stream, lies in an important layer, and pushes toward the examined logit. This corresponds to the three observations in Section 5: concentrated contribution, opposite directions, and high-contribution heads related to performance.
    • Reading: The sign indicates which class it pushes toward, and the absolute value indicates magnitude. After normalization, scores within the same sample are comparable.

    Multi-Scale Aggregation

    • Sfinal: Sum Sk,h over all heads in a selected layer subset. The subset can be early, middle, or deeper layers, to see how predictions accumulate. The authors emphasize that it can be viewed by head, layer, or aggregated, distinguishing it from approaches that only give local metrics.
    • Ends and cancellation: The authors state that Sfinal is a weighted average of the Δk,h; near the ends indicates same-sign contributions dominate, near 0 indicates opposite influences cancel out.

    Where Labels Come From

    • Evaluation annotation: Appendix B first aggregates open-source prompts, then uses Mistral, Gemma 2, Llama 3.2, and GPT-4o-mini as LLM-as-a-judge. If at least two models judge a prompt as malicious, it is labeled MALICIOUS; if at least one judges it as benign, it is labeled BENIGN. The paper does not specify how to adjudicate when both rules are satisfied simultaneously. Sampling limits the maximum number of entries from a single source.
    • Separate from training corpus: Appendix A describes the training data of the analyzed model, including public datasets and injection samples constructed from papers, competitions, and LLM Guard community feedback. The paper does not provide training hyperparameters.
  4. What experiments did the paper conduct?

    The ΔF1 for the combined-score ablation in the TP group is 0.014; in the TN group, only the direction projection is higher, at 0.015.

    Experimental setup

    • Analyzed model: 1 prompt-injection binary classifier based on DeBERTa-v3-base, 12 layers, disentangled attention, followed by a binary classification head. The training corpus is in Appendix A. The paper does not directly give the F1 or accuracy without ablation.
    • Evaluation set: Section 3 says 30,000 entries, about two-thirds benign and one-third attacks. Appendix B says 33,965 entries, of which 23,775 are benign (70%) and 10,190 are injection (30%). The paper does not explain why the two sizes differ. The source proportions for Table 3 are: instruction/assistant data (Alpaca, OpenOrca, UltraChat, Open-Instruct) 62.8%, TaskTracker injection data 30.2%, jailbreak-classification 3.2%, Awesome ChatGPT Prompts 2.6%, JailbreakBench 1.2%.
    • Annotation: four rater models and the consensus rule are in Appendix B. Appendix B.1 divides malicious samples into jailbreak, DAN-type scenarios, explicit malicious instructions, role-play, and bypass via fictional narrative, and gives examples, not excerpted here. The paper does not report rater agreement.
    • Unit of analysis: scores are examined by TP, TN, FP, FN. INJECTION is the positive class. The main text does not separately list the counts of these four classes.
    • Ablation: for the TP group and the TN group, 6 dominant heads are removed under each of three criteria: combined score Sk,h, direction projection only, and contribution only. Table 2 reports post-ablation F1, Acc, and ΔF1, ΔTP, ΔTN relative to the base model; the table note states that the differences are base model minus ablated model, so positive values indicate performance degradation. The paper does not state whether the ablation used all evaluation samples, nor does it report the number of repetitions or significance tests.
    • Clustering: because TN's Sfinal is trimodal, K-means is used on Sfinal to split into C0, C1, C2. Descriptive statistics are in Table 4 and Appendix C.

    Main results

    The table below is the ablation results from Table 2, all for the same DeBERTa classifier described above. Acc is not included; the six rows of Table 2 are, in order, 0.944, 0.947, 0.948, 0.946, 0.944, 0.947.

    Swipe horizontally to read the table

    Group and criterionPost-ablation F1ΔF1ΔTPΔTN
    TP / Score0.8980.014257-50
    TP / Logit only0.9040.009161-32
    TP / Contrib only0.9050.007117-8
    TN / Score0.9030.0091389
    TN / Logit only0.8970.015273-47
    TN / Contrib only0.9040.0091308
    • Section 6.4 states that the drop caused by heads selected by the combined score is comparable to or larger than that of the individual criteria, so these heads participate in the decision rather than merely being correlated. Section 7 further states that the combined criterion causes the largest drop. According to Table 2, the latter claim appears in the TP group; in the TN group the largest ΔF1 is for Logit only.
    • The authors state that the effect remains moderate, and therefore hypothesize compensation and distributed representation, possibly related to overparameterization on this task. Testing this hypothesis is listed as future work.
    • According to the table note, a negative ΔTN means a higher TN count after ablation. The authors state that removing some TP-dominant heads slightly increases correctly classified TN, indicating that some contributions strengthen competing signals.

    Score distributions and layer depth

    • What was measured: the distribution of Sfinal across all layers (Figure 3), and the mean of Sfinal, the INJECTION signal (sum of positive contributions), and the BENIGN signal (magnitude of negative contributions) as cumulative layer count increases (Figure 4). The text does not retain curve endpoints or axis ticks.
    • Authors' interpretation of Figure 3: TP is mainly unimodal and relatively concentrated; TN has three peaks, which the authors consider to correspond to multiple circuits or strategies leading to the correct BENIGN decision; FP/FN are more spread out and closer to the two ends, with FP leaning toward higher values and FN toward lower values.
    • Authors' interpretation of Figure 4: across most layers the mean and the two signals change gradually and offset each other; changes are more pronounced in the last few layers, especially for the error classes. The authors state that FP shows a sudden rise in INJECTION signal at the end, while FN shows a rise in BENIGN signal later, and consider that this may suppress injection detection. Correct predictions are described as a more stable balance of opposite-sign contributions.

    Dominant heads

    • Table 1: lists, by class, the positive heads with the highest mean Sk,h, and, when Sk,h<0, the negative heads selected by |Sk,h|; the scores in the table are the mean of Sk,h over samples of each class. The highest positive score is FP's L11 H6 at 0.13; in the same table FN's L11 H6 is -0.06 and L11 H3 is -0.04. TP's three positive scores are 0.03, 0.03, 0.01.
    • Same head, two signs: heads such as L11 H6 appear in both the positive and negative columns for the same class. The main text states that the same head can push toward INJECTION or BENIGN depending on the input. The paper does not state whether these two column means are computed over the whole class or only over samples satisfying the sign constraint.
    • Authors' interpretation: the signal is concentrated in a few heads, mainly in L10–L11, consistent with the late-layer changes in Section 6.2. Error classes are more imbalanced: FP is dominated by strong pro-INJECTION heads, and FN is more clearly dominated by pro-BENIGN heads. L0 H0 and L0 H7 have milder but common effects, which the authors consider may play a preparatory role. The paper does not list whether the 6 ablated heads are the heads in Table 1.

    The three TN clusters

    • How they were split: after TN appeared trimodal in Figure 3, K-means was used on Sfinal to split into three clusters. Table 4: C0 has 2 112 entries, repetition rate 0.52%, median 2 103 characters, median 366 words, 74.6% over 1 000 characters; C1 has 11 377 entries, 0.26%, 313 characters, 53 words, 8.9%; C2 has 6 942 entries, 4.78%, 115 characters, 19 words, 14.3%.
    • Authors' statements about text form: C0 is long, structured, often question-and-answer prompts; C1 makes up the majority of TN, is medium length, and is often written as instructions; C2 is mainly short tasks such as micro-prompts and translation.
    • Figure 5: the authors state that the three clusters' trajectories gradually separate with depth; shallow-layer distributions overlap, middle layers gradually separate, and after counting all layers the clusters are clearly separated. The authors consider that the BENIGN decision can arise from different balances of pro-MALICIOUS and pro-BENIGN contributions. The values in the figure are not retained in the text.

    Other ablations and analyses

    • Figure 2 compares mean head contributions (not Sk,h) at layer 0 and layer 11: the authors state that at shallow layers the classes are similar, with layer 0 dominated by shared head H0; at deep layers it is highly concentrated, with TN dominated by H6 and TP by H2, and the error-class profiles close to the opposite class. The figure caption suggests this indicates activation of inappropriate circuits. The figure has no specific contribution values.
    • Section 5 states that removing the highest-contribution heads degrades performance; that section gives no numbers; the quantitative ablation is only in Table 2.
    • The paper does not report the number of heads N, training hyperparameters, or parameter sweeps beyond the three head-selection criteria.
  5. What are some points that can be further explored?

    The authors note that the projection does not handle representation shifts across layers, and the redundancy assumption still needs to be tested.

    Limitations and Future Directions Noted by the Authors

    • Direct projection and representation shift: The direction influence projects intermediate activations directly onto the final logit direction, while there is a distribution shift between intermediate and final layer representations. The authors state that a per-layer learned projection like tuned lens could more faithfully estimate local decision impact; incorporating such a transformation is a possible methodological improvement (Section 7). The authors state this is a major limitation of the method.
    • Redundancy hypothesis not yet tested: The compensation in ablations is hypothesized by the authors as functional redundancy, possibly related to the model being overparameterized for this task. The authors state that testing this hypothesis with progressive ablation, compression, or pruning is a future direction (Sections 6.4, 7), citing Michel et al. (2019) and Sanh et al. (2020) as relevant prior results.

    Experimental Coverage

    • The analyzed model is 1 12-layer DeBERTa-v3-base prompt injection classifier (Section 3); scores and ablations target attention heads.
    • Evaluation set is 30,000 samples in Section 3 (approximately two-thirds benign, one-third attacks), and 33,965 in Appendix B (23,775 benign, 10,190 injection); source proportions in Table 3. Annotation uses Mistral, Gemma 2, Llama 3.2, and GPT-4o-mini.
    • Distribution and layer-depth analyses cover TP, TN, FP, FN; Table 2 ablations target TP and TN groups, 6 heads per criterion, three criteria.
    • TN's Sfinal is split into 3 clusters with K-means, sample sizes and length statistics in Table 4.
    • The paper does not report reviewer agreement, number of repetitions, significance tests, total number of attention heads N, unablated F1 and Acc, counts for TP/FP/FN classes, whether ablated samples equal the full evaluation set, or why the two evaluation set sizes differ; the MLP term in the residual formula is not given a separate contribution.
  6. Summarize the main content of the paper

    The score links the direction and residual contribution of attention heads to classification, and separates correct from incorrect predictions.

    This work assigns an influence score to the attention heads of a prompt injection detection classifier at inference time, to see which heads the classification decision comes from.

    The gap is that circuit analysis often requires re-instrumentation, and looking only at outputs does not reveal the contributions of internal components. The authors want to see at which layer the decision forms, which heads are driving it, and whether correct and incorrect cases correspond to different mechanisms.

    The score is the product of three terms: the projection of head activation onto the difference in positive and negative class weights, the head's relative share within its layer, and the layer's normalized weight in the residual stream. It can be summed over any subset of layers. The object is a 12-layer DeBERTa-v3-base binary classifier, with the positive class denoted INJECTION in the text.

    • The authors state that on the full-layer Sfinal, TP is more concentrated, TN has three modes, and FP/FN are more scattered and more toward the extremes (Figure 3). Shallow heads contribute similarly across classes, while deeper heads are more concentrated (Figure 2).
    • In Table 1, the highest positive score is FP's L11 H6, with a mean of 0.13; FN's L11 H6 has an average negative score of -0.06. The authors state that error classes are more imbalanced, with the signal mainly in L10–L11.
    • After removing the 6 dominant heads, the TP group's combined score has a ΔF1 of 0.014, higher than the other two criteria for that group; for the TN group, direction-only projection has a ΔF1 of 0.015, higher than the combined score's 0.009 (Table 2). The authors state the drop is still moderate.
    • The TN three clusters are 2 112, 11 377, and 6 942 items (Table 4). The authors state they correspond to different text forms and separate with layer depth (Figure 5).

    The authors conclude that this score sits between fine-grained circuit analysis and output-only observation, and can identify heads relevant to the decision; correct predictions look more like a balance of opposite-sign contributions, while errors are related to deep-layer imbalance. The authors also believe that projecting intermediate activations directly onto the final logit direction does not handle representation shift between layers; whether the compensation in ablations indicates the model is overparameterized for this task still needs to be tested with progressive ablation, compression, or pruning.

Read originalarxiv.org