Progressive Inference: Explaining Decoder-Only Sequence Classification Models Using Intermediate Predictions

Sanjay Kariyappa, Freddy Lecue, Saumitra Mishra, Christopher Pond, Daniele Magazzeni, Manuela Veloso

TL;DR

Researchers have developed Progressive Inference (PI), a framework that exploits the causal nature of decoder-only Transformers (like GPT and Llama) to generate high-quality feature attributions. By treating intermediate token predictions as "free" evaluations of input prefixes, PI provides more accurate explanations for sequence classification tasks with significantly less computational overhead than traditional perturbation-based methods.

What Problem Does This Paper Address?

As Large Language Models (LLMs) are increasingly deployed in sensitive areas like finance and healthcare, understanding why a model made a specific classification is crucial. This is the domain of Explainable AI (XAI).

Current XAI methods for Transformers generally fall into two camps:

  1. Attention-based/Gradient-based: These are fast but often yield "noisy" or unfaithful explanations that don't accurately reflect the model's internal logic.
  2. Perturbation-based (e.g., SHAP): These are highly accurate but computationally expensive, requiring hundreds or thousands of forward passes to see how "masking" different parts of the input changes the prediction.

The authors identify a missed opportunity in decoder-only architectures. Because these models use "causal attention," the hidden state at any given token position only depends on the tokens that came before it. This paper asks: can we use these intermediate "partial" predictions to explain the final result without the massive cost of traditional perturbation?

Methods

The authors propose two flavors of Progressive Inference:

Overview of the Progressive Inference framework showing intermediate predictions for SP-PI and MP-PI.
  • Single-Pass Progressive Inference (SP-PI): This is the "budget" version. It requires only one forward pass. The attribution for a specific token is calculated by simply taking the difference between the model's prediction at that token's position and the prediction at the previous token's position. It essentially measures: "How much did my confidence in the final class change after seeing this specific word?"
  • Multi-Pass Progressive Inference (MP-PI): This is the "high-fidelity" version. It samples multiple masked versions of the input (e.g., "The [MASK] sat on the [MASK]"). Because of the causal property, one forward pass on a masked sequence of length $n$ actually provides $n$ different data points for how different sub-sequences affect the prediction. The authors then use a clever optimization to ensure these samples follow the "Shapley distribution," allowing them to approximate Kernel SHAP values much faster and more accurately than standard sampling.

Datasets

The researchers evaluated their methods across a diverse set of text classification tasks and model sizes:

  • Sentiment Analysis: IMDB (GPT-2 124M), SST-2 (GPT-2 355M), Twitter-Sentiment (GPT-2 124M).
  • Topic Classification: AG-News (Llama-2 7B).
  • Financial/Emotion Analysis: Twitter-Fin (Llama-2 7B), Twitter-Emotion (GPT-2 124M).
  • Natural Language Inference: TrueTeacher NLI (GPT-2 1.5B).

Key Insights and Ideas

  • The "Causal" Advantage: In a decoder-only model, the $i$-th intermediate prediction is mathematically equivalent to running the model on a prefix of the input. This means we get $n$ "perturbation" samples for the price of one forward pass.
  • Efficiency Gains: Because MP-PI extracts multiple samples per pass, it is significantly more "sample-efficient" than standard Kernel SHAP. For the same computational budget, MP-PI provides a much clearer picture of feature importance.
  • Fixing Misclassifications: Qualitatively, the paper shows that PI methods are much better at identifying "negative" evidence. In a misclassified movie review, PI correctly highlights the negative sentences that should have led to a different prediction, whereas older methods (like GAE or LRP) often fail to show why the model was "confused."
Qualitative comparison showing MP-PI correctly identifying negative evidence in a text review compared to baseline methods.

Key Results

The authors used Activation Studies (AS) and Inverse Activation Studies (IAS) to quantify quality. These measure how quickly the model's confidence changes as you add (or remove) the most "important" features identified by the XAI method.

  • SP-PI (zero extra cost) consistently outperformed other low-cost methods like Attention-Last and GAE. For example, on the IMDB dataset, SP-PI achieved an AUC of 0.951 compared to GAE's 0.916.
  • MP-PI (high cost) outperformed the gold-standard Kernel SHAP and Integrated Gradients across almost every dataset. In the Inverse Activation Study (where lower is better), MP-PI reduced the AUC on the Twitter-Emotion dataset to 0.214, compared to Kernel SHAP's 0.337—a massive improvement in identifying the most influential features.

Limitations and Future Work

  • Out-of-Distribution (OOD) Issues: Like all perturbation methods, PI relies on "masking" tokens. If the model hasn't seen many masked sequences during training, these intermediate predictions might be slightly unreliable.
  • Sample Correlation: The intermediate predictions in a single pass are naturally correlated (since they share prefixes). While the authors use a filtering step to handle redundant coalitions, the impact of this correlation on the underlying SHAP math is a potential area for deeper theoretical study.
  • Beyond Text: While this paper focuses on text classification, the "Progressive Inference" logic could theoretically be applied to any decoder-only sequence model, including those used for time-series or genomic data.

Summary updated

BibTeX
@inproceedings{kariyappa2024progressive,
  author = {Sanjay Kariyappa and Freddy Lecue and Saumitra Mishra and Christopher Pond and Daniele Magazzeni and Manuela Veloso},
  title = {{Progressive Inference: Explaining Decoder-Only Sequence Classification Models Using Intermediate Predictions}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=hRX1o7FBhT},
}
Figure