XAgent: A Conversational XAI Agent Harnessing the Power of Large Language Models

Van Bach Nguyen, Jörg Schlötterer, Christin SeifertxAI (Late-breaking Work, Demos, Doctoral Consortium) 2024

Introduction

XAgent is a deployment-ready conversational eXplainable AI (XAI) agent designed to bridge the gap between rigid model explanations and natural human dialogue. By integrating the Llama-2 large language model (LLM) into a modular framework, researchers have transitioned XAI from static "lab-only" environments like Jupyter notebooks into a flexible, web-based interface. This system is capable of handling both technical model explanations and general factual queries, addressing the critical need for interactive, two-way communication in AI transparency.

The Challenge of Static Explanations

In real-world scenarios, an explanation is rarely a one-way data dump; it is a conversation. For instance, if a bank’s AI denies a loan, a user might not just want a chart of "feature importance" but follow-up answers to questions like "What does 'credit history' mean?" or "What if my income was higher?"

Most current XAI tools are limited by rigid templates, a lack of context for general machine learning terminology, and environment constraints that make them inaccessible to non-technical users. XAgent addresses these issues by using LLMs to polish explanations and handle the nuances of human inquiry.

System Architecture

XAgent utilizes a four-component architecture that enhances traditional Natural Language Understanding (NLU) and Generation (NLG) layers:

  • NLU (Natural Language Understanding): Employs SimCSE and RoBERTa-large to map user questions to a predefined XAI question bank. It includes a fallback mechanism that suggests the top five most similar questions if intent is unclear.
  • QX (Question-XAI): Connects questions to specific XAI methods (e.g., SHAP or LIME). Llama-2 is integrated here to answer "factual" questions about ML terminology that do not require specific model data.
  • NLG (Natural Language Generation): Uses a "Template-then-Refine" approach. The system generates a raw, template-based answer, which Llama-2 then "polishes" to improve linguistic quality while preserving the original data.
  • Dialog Manager: Tracks the conversation state (Input, Explanation, Suggestion, or Missing Data) to ensure the agent gathers necessary information before providing an explanation.
The XAgent architecture integrates an LLM to refine template-based explanations into natural language.

Key Insights: LLMs as Refiners

A core innovation of XAgent is using the LLM as a "refiner" rather than a "creator." By polishing template-generated text instead of generating explanations from scratch, the system mitigates the risk of "hallucinations" while maintaining the fluid feel of a modern chatbot. Additionally, the system prioritizes conversation flow; for general terminology, it provides an LLM-generated answer even if slightly imprecise, rather than failing to respond.

The agent is also proactive. If a user provides a vague query, the Dialog Manager enters a "Missing Data" state to prompt the user for specific details, such as which feature they are inquiring about.

Results and User Experience

XAgent was successfully deployed as a multi-user web application using the Streamlit framework, demonstrated on the German-credit dataset. The integration of Llama-2 significantly improved the user experience by allowing the agent to handle "out-of-bounds" questions and ML definitions.

XAgent provides proactive question suggestions when the NLU component is uncertain of user intent.

The "Question Suggestion" feature prevents "dead-end" conversations by providing users with a path forward when the NLU component is confused by a query.

Limitations and Future Work

While XAgent represents a significant step forward, some "LLM quirks" remain, such as occasional formatting inconsistencies and variations in punctuation styles. Future work will focus on fine-tuning models based on real-world logs and exploring multimodal XAI to explain visual data alongside tabular information.

Summary updated

BibTeX
@inproceedings{nguyen2024xagent,
  author = {Van Bach Nguyen and Jörg Schlötterer and Christin Seifert},
  title = {{XAgent: A Conversational XAI Agent Harnessing the Power of Large Language Models}},
  booktitle = {xAI (Late-breaking Work, Demos, Doctoral Consortium)},
  year = {2024},
  url = {https://openreview.net/forum?id=Qdfx2OCXEA},
}
Figure