LLM Attributor: Interactive Visual Attribution for LLM Generation

Seongmin Lee, Zijie J. Wang, Aishwarya Chakravarthy, Alec Helbling, Shengyun Peng, Mansi Phute, Duen Horng Chau, Minsuk KahngAAAI 2024

TL;DR

LLM ATTRIBUTOR is a new Python library that provides interactive visualizations to help developers understand why a large language model (LLM) generates specific text by attributing it to the training data. This tool is crucial for debugging, improving trustworthiness, and identifying potential issues like misinformation in LLM outputs.

What Problem Does This Paper Address?

Large language models (LLMs) are incredibly powerful, but their "black box" nature makes it hard to understand how they arrive at their outputs. This lack of transparency is a significant concern, especially when LLMs generate incorrect information, spread misinformation, or even fabricate facts (like legal cases). While methods exist to attribute LLM outputs to training data, presenting these attributions in a way that developers can easily understand and act upon has been a challenge. This paper addresses this gap by providing an interactive, visual tool for training data attribution.

Methods

The core of LLM ATTRIBUTOR is its interactive visualization of training data attribution. It leverages the DataInf algorithm, which estimates how upweighting specific training data points would affect the LLM's output. The library offers two main views:

  • Main View: This view allows users to select specific tokens in an LLM-generated text and see which training data points most strongly (positively attributed) or weakly (negatively attributed) contributed to that generation. It presents this information through lists of data points, keyword summaries (using TF-IDF), and a histogram of attribution scores across the entire dataset.
  • Comparison View: This view enables users to compare the attribution of LLM-generated text with user-provided text. Crucially, it allows users to interactively edit the LLM-generated text (add, delete, or modify words) and immediately see how these changes affect the attribution, providing a powerful way to probe model behavior.

The library also includes a preprocessing step to save model gradients, improving efficiency. It's designed to be easily integrated into computational notebooks (Jupyter, Colab, VSCode) and is open-source.

Datasets

The paper uses LLaMA2 models fine-tuned on two datasets for demonstration:

  • A dataset of online articles about recent disasters.
  • A finance-related question-answer dataset (wealth-alpaca-lora).

No new benchmarks are introduced; the focus is on visualizing attributions for existing LLMs and datasets.

Key Insights and Ideas

  • The "Why" Behind the "What": LLM ATTRIBUTOR moves beyond simply what an LLM generates to why it generates it, by linking outputs directly to training data. This is fundamental for building trust and debugging.
  • Interactive Editing is Powerful: The ability to edit LLM-generated text within the Comparison View and see immediate attribution changes is a key innovation. It allows for rapid hypothesis testing about what specific phrases or concepts in the training data are driving certain outputs.
  • Conspiracy Theories and Misinformation: The example of the Hawaii wildfires highlights how LLM ATTRIBUTOR can pinpoint specific, problematic training data (like an X post spreading conspiracy theories) that leads to misinformation. This is critical for responsible AI development.
  • Beyond Input Attribution: Unlike some previous visualization tools that focused solely on input prompts, LLM ATTRIBUTOR emphasizes the crucial role of training data in shaping LLM outputs.

Key Results

The paper demonstrates LLM ATTRIBUTOR's utility through two usage scenarios:

  • Problematic Generation: Megan, an LLM developer, used LLM ATTRIBUTOR to identify a specific X post (data point #1388) as the source of a conspiracy theory about the Hawaii wildfires. By removing this data point and fine-tuning, she improved the model's accuracy.
  • Identifying Sources: Louis, a technologist, used LLM ATTRIBUTOR to verify the correctness of an LLM-generated definition of "IPO" for a finance course. The tool helped him identify supporting training data points and confirm the definition's credibility.

The library is presented as an efficient and user-friendly tool for LLM developers.

Limitations and Future Work

  • Limitations: The paper notes that while DataInf performs well on custom datasets, its performance can degrade with free-form prompts due to training data ordering effects. They mitigate this by shuffling data and using multiple checkpoint models.
  • Future Work: The authors suggest several promising directions:
  • TDA Algorithm Evaluation: Allowing researchers to integrate and visually evaluate new training data attribution (TDA) algorithms.
  • Integration of RAG: Adapting LLM ATTRIBUTOR's visualizations for retrieval-augmented generation (RAG) systems.
  • Token-wise Attribution: Extending attribution to the token level for more granular insights.

Summary updated

BibTeX
@inproceedings{lee2024llm,
  author = {Seongmin Lee and Zijie J. Wang and Aishwarya Chakravarthy and Alec Helbling and Shengyun Peng and Mansi Phute and Duen Horng Chau and Minsuk Kahng},
  title = {{LLM Attributor: Interactive Visual Attribution for LLM Generation}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  url = {https://openreview.net/forum?id=XI9uj3IVAk},
}
Figure