Improving LLM Attributions with Randomized Path-Integration

Oren Barkan, Yehonatan Elisha, Yonatan Toib, Jonathan Weill, Noam KoenigsteinEMNLP 2024

Abstract

Randomized Path-Integration (RPI) is a novel attribution method for Large Language Models (LLMs) that explains model predictions by integrating gradients along randomized paths over internal attention scores. By sampling baselines from a Gaussian diffusion process, RPI generates a diverse pool of candidate explanations, allowing it to adapt to different evaluation criteria. Experimental results across multiple datasets and architectures—including BERT-family encoders and modern decoders like Llama2—demonstrate that RPI consistently outperforms existing state-of-the-art attribution methods.

Introduction: The Challenge of Rigid Attributions

As Large Language Models (LLMs) grow in complexity, understanding the "why" behind their predictions becomes increasingly difficult. Attribution methods aim to solve this by identifying which input tokens most influenced a model's output. However, traditional methods like Integrated Gradients (IG) often rely on a single, fixed "uninformative" baseline and a straight-line integration path.

This rigidity is problematic because explanation quality is often subjective and metric-dependent. For instance, a "sufficient" explanation (one that contains enough information to maintain the prediction) might look very different from a "comprehensive" one (one that, when removed, significantly changes the prediction).

Figure 1: Illustration of how different metrics (Sufficiency vs. Comprehensiveness) prioritize different tokens in negative and positive sentiment predictions.

Methodology: Randomized Path-Integration (RPI)

RPI departs from standard path-integration methods through three core innovations:

  1. Attention-Level Integration: Instead of operating on raw input embeddings, RPI integrates gradients with respect to internal attention scores. This captures the model's internal logic of how it aggregates information across different heads and layers.
  2. Randomized Baselines via Diffusion: Rather than using a fixed baseline (like a zero tensor), RPI models the baseline as a random tensor drawn from a Gaussian diffusion process. This introduces controlled noise, allowing the integration path to explore the model's decision boundary more thoroughly.
  3. Attribution Map Selection: RPI generates a pool of candidate attribution maps. It then selects the most effective map based on the specific evaluation metric being used (e.g., Sufficiency or Comprehensiveness). This "versatility by design" ensures high performance regardless of how explanation quality is measured.

Experimental Results

The researchers evaluated RPI across four diverse NLP datasets: SST2 (sentiment), Rotten Tomatoes (RTN), Emotion Recognition (EMR), and AG News (AGN). The method was tested on both encoder models (BERT, DistilBERT, RoBERTa) and decoder models (Llama2 7B, Mistral 7B).

Figure 2: Comprehensive evaluation of RPI against 11 baseline methods across three encoder models and four datasets. RPI (bolded) consistently achieves the best performance across nearly all metrics.

Key Findings

  • State-of-the-Art Performance: RPI established a new benchmark, outperforming 11 other methods including SHAP, LIME, and Integrated Gradients. Sequential Integrated Gradients (SIG) emerged as the most frequent runner-up.
  • The Importance of Attention: Ablation studies confirmed that integrating at the attention level is significantly more effective than at the input level, suggesting that Transformer "reasoning" is most visible in token-to-token relationships.
  • Failure of LLM Self-Explanation: Interestingly, asking LLMs to rank their own token importance performed poorly due to hallucinations, where the model would cite tokens not present in the original input.

Conclusion

Randomized Path-Integration (RPI) addresses the limitations of fixed-baseline attribution methods by embracing randomness and attention-level analysis. While computationally more intensive due to its multi-pass nature, its ability to provide high-quality, metric-specific explanations makes it a powerful tool for debugging and auditing black-box LLMs. Future work will explore adaptive sampling techniques to reduce computational overhead while maintaining explanation diversity.

Summary updated

BibTeX
@inproceedings{barkan2024improving,
  author = {Oren Barkan and Yehonatan Elisha and Yonatan Toib and Jonathan Weill and Noam Koenigstein},
  title = {{Improving LLM Attributions with Randomized Path-Integration}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  url = {https://openreview.net/forum?id=pupAwfBV21},
}
Figure