TL;DR
JoPA (Joint Prompt Attribution) is a new framework that explains Large Language Model (LLM) outputs by identifying the most influential combinations of input tokens. By treating prompt attribution as a combinatorial optimization problem solved via gradient-guided probabilistic search, JoPA provides more faithful explanations than existing methods while being up to 100x faster.
What Problem Does This Paper Address?
Despite the meteoric rise of LLMs, they remain "black boxes." When a model generates a specific response, it is often unclear which parts of the input prompt triggered that behavior. Understanding this causality is crucial for debugging biased outputs, preventing "jailbreaks," and building human trust.
Existing attribution methods typically suffer from two flaws:
- Independence Assumption: Most tools (like Captum) evaluate tokens in isolation. If a prompt mentions both a "doctor" and a "patient," removing just one might not change the output because the other provides enough context. Consequently, both tokens receive low importance scores.
- Computational Cost: Searching for the perfect combination of influential tokens is a discrete optimization nightmare. With $T$ input tokens, there are $2^T$ possible combinations—an impossible space to search exhaustively for long prompts.
Methods
The authors introduce JoPA, which formulates prompt attribution as a search for a binary mask $m$ that, when applied to the input, maximizes the change in the model's output probability.
The framework uses a two-stage approach to solve this efficiently:
- Gradient-Guided Initialization: Instead of starting from scratch, JoPA performs a single gradient calculation to identify tokens that likely have a high impact on the output. This provides a "warm start" for the search.
- Probabilistic Search Update: The algorithm then iteratively swaps tokens in and out of the "important" set. This search is guided by the initial gradients but allows for exploration. If a swap leads to a larger drop in the original output's probability (indicating the masked tokens were indeed critical), the update is kept.
This approach avoids the need for expensive continuous-to-discrete projections and requires only one backward pass, making it highly efficient.
Datasets
The researchers evaluated JoPA across three diverse text generation tasks using long-context prompts (15+ words):
- Alpaca: General instruction-following tasks.
- tldr_news: Abstractive summarization of tech newsletters.
- MHC (Mental Health Counseling): A question-answering dataset derived from counseling conversations.
- AQuA: Used specifically to test generalizability on complex reasoning tasks (Chain-of-Thought).
Key Insights and Ideas
- The "Combinatorial Effect" is Real: The paper demonstrates that LLMs often rely on groups of semantically related tokens. As shown in the "doctor and patient" example, independent attribution fails to capture the core intent of the prompt, whereas JoPA successfully identifies the joint influence of these keywords.
- Efficiency through Sparsity: By using gradients only for guidance rather than direct optimization, JoPA bypasses the "rounding error" issues common when trying to turn continuous masks back into discrete ones.
- Counterfactual Faithfulness: A good explanation should be "faithful"—if you remove the tokens the algorithm claims are important, the model's output should change drastically. JoPA consistently achieves lower similarity scores (BLEU, ROUGE) between original and masked outputs compared to baselines, proving its identified tokens are truly "load-bearing."
Key Results
- Massive Speedup: JoPA is significantly faster than Captum. For the MHC dataset, Captum took an average of 1806 seconds per instance, while JoPA took only 14.47 seconds—a speedup of over 100x.
- Superior Faithfulness: Across all datasets and models (Llama-2 and Vicuna), JoPA outperformed baselines like Integrated Gradients and Attention-based methods. For example, on the
tldr_newsdataset with Llama-2, JoPA's Probability Ratio (PR) was 0.604 compared to Captum's 0.910 (lower is better, indicating a more effective mask). - Safety Applications: The authors showed that JoPA can identify the specific malicious "suffixes" used in jailbreak attacks. By removing just these identified tokens, the attack fails, suggesting JoPA's utility as a defense mechanism.
Limitations and Future Work
While JoPA effectively identifies which tokens are influential, it does not explain the internal mechanics of the LLM (i.e., how the model's weights process those tokens). The authors acknowledge that the underlying generation mechanism remains a "black box." Future work aims to extend this framework to explore deeper architectural aspects of LLM generation beyond just input-output attribution.
Summary updated