Promptexp: Multi-Granularity Prompt Explanation of Large Language Models
Authors:
- 19 November 2025
- conference paper
- Published by Institute of Electrical and Electronics Engineers (IEEE)
- p. 01-10
Abstract
Large Language Models (LLMs) excel in tasks like natural language understanding and text generation. Prompt engineering plays a critical role in leveraging LLM effectively. However, LLM's black-box nature hinders its interpretability and effective prompt engineering. A wide range of model explanation approaches have been developed for deep learning models (e.g., feature attribution-based and attention-based techniques). However, these local explanations are designed for single-output tasks like classification and regression, and cannot be directly applied to LLMs, which generate sequences of tokens. Recent efforts in LLM explanation focus on natural language explanations, but they are prone to hallucinations and inaccuracies. To address this, we introduce PromptExp, a framework for multi-granularity prompt explanations by aggregating tokenlevel insights. PromptExp introduces two token-level explanation approaches: (1) an aggregation-based approach combining local explanation techniques (e.g., Integrated Gradient), and (2) a perturbation-based approach with novel techniques to evaluate token masking impact. PromptExp supports both white-box and black-box explanations and extends explanations to higher granularity levels (e.g., sentences and components), enabling flexible analysis. We evaluate PromptExp in case studies such as sentiment analysis, showing the perturbation-based approach performs best using semantic similarity to assess perturbation impact. Furthermore, we conducted a user study in our industrial partner's company to confirm PromptExp's accuracy and practical value, and demonstrate its potential to enhance LLM interpretability.Keywords
All Related Versions
This publication has 23 references indexed in Scilit:
- Unique Security and Privacy Threats of Large Language Models: A Comprehensive SurveyACM Computing Surveys, 2025
- Explainability for Large Language Models: A SurveyACM Transactions on Intelligent Systems and Technology, 2024
- Defending Against Label-Only Attacks via Meta-Reinforcement LearningIEEE Transactions on Information Forensics and Security, 2024
- Recent Advances in Natural Language Processing via Large Pre-trained Language Models: A SurveyACM Computing Surveys, 2023
- From Discovery to Adoption: Understanding the ML Practitioners’ Interpretability Journey2023
- Counterfactual explanations for models of code2022
- VisQA: X-raying Vision and Language Reasoning in TransformersIEEE Transactions on Visualization and Computer Graphics, 2021
- Explaining Image Misclassification in Deep Learning via Adversarial Examples2021
- Perturbed Masking: Parameter-free Probing for Analyzing and Interpreting BERT2020
- On Attribution of Recurrent Neural Network Predictions via Additive Decomposition2019