Understanding Your Agent: Leveraging Large Language Models for Behavior Explanation

Xijia Zhang, Yue Guo, Simon Stepputtis, Katia P. Sycara, Joseph Campbell · Submission to ICLR 2024 · Rejected

TL;DR

Deep reinforcement learning policies are notorious black boxes, and standard Large Language Models (LLMs) hallucinate when tasked with explaining them. This paper introduces a model-agnostic framework that distills an agent’s policy into a decision tree, extracts a compact "behavior representation" (a decision path of relevant rules), and feeds it to an LLM via in-context learning. The resulting natural language explanations dramatically reduce hallucinations, match the helpfulness of human expert rationales, and enable interactive conversational follow-ups.

What Problem Does This Paper Address?

Deploying autonomous agents into safety-critical environments—such as search-and-rescue or robotics—requires that non-expert human collaborators understand why an agent made a particular decision. While natural language is the most intuitive medium for laypeople, existing solutions fall short:

  1. Rule- or visual-based systems are difficult for non-specialists to parse.
  2. Template-based language generators lack nuance and expressivity.
  3. Directly prompting LLMs fails because LLMs lack access to the agent’s internal decision-making process and frequently hallucinate false justifications.

The challenge is designing a policy-agnostic framework that generates faithful, low-hallucination natural language explanations and supports clarification and counterfactual queries.

Methods

The authors propose a three-stage pipeline:

Black-Box Policy 
       │ 
       ▼ (DAgger Distillation)
Decision Tree Surrogate 
       │ 
       ▼ (Traverse Root-to-Leaf)
Behavior Representation (Decision Path)
       │ 
       ▼ (In-Context Prompting)
LLM Interactive Explanation
  1. Policy Distillation via DAgger: Given an arbitrary black-box policy $\pi^*$, the authors train an interpretable surrogate decision tree $\hat{\pi}$ using the Dataset Aggregation (DAgger) imitation learning algorithm to minimize error under the induced state distribution.
  2. Behavior Representation (BR) Generation: For any given state-action pair $(s_t, a_t)$, the algorithm traverses the distilled tree to extract the specific decision path ($dp$). This ordered subset of evaluated state conditions captures the local rationale behind the action without requiring model fine-tuning.
  3. In-Context Learning with LLMs: The decision path is translated into structured text and placed inside an LLM prompt (tested using GPT-4). The prompt specifies the environment rules, explains what features represent, provides three few-shot examples, and instructs the LLM to explain the behavior. Because the system retains conversational context, users can submit follow-up queries (e.g., asking for conciseness or counterfactual “What if…?” scenarios).

Datasets

The authors evaluate their method on a simulated partially observable multi-agent Urban Search and Rescue (USAR) task (a $5 \times 4$ gridworld with 20 rooms):

  • Agents: A heterogeneous team featuring an Engineer (clears rubble) and a Medic (rescues victims).
  • Policy Behaviors: Trajectories were generated across three distinct behavioral strategies:
  • Explore: Systematically discover all rooms before clearing rubble or saving victims.
  • Exploit: Greedily remove rubble and rescue victims immediately upon encounter.
  • Fixed: Navigate along a predetermined patrol route while ignoring victims and rubble.
  • Evaluation Data: State-action samples were hand-annotated across goal horizons (Long-term, Short-term, and Ambiguous). The user study evaluated 40 participants across 1,106 comparison trials, alongside a 10-participant interactive evaluation.

Key Insights and Ideas

  • LLMs harbor strong default behavioral priors: When given partial information, LLMs default to assuming agents act exploitatively (greedily pursuing immediate rewards). If an agent exhibits exploratory or fixed behavior in an ambiguous state, baseline models achieve 0% accuracy in identifying strategy. Conditioning the LLM on a distilled decision path overcomes this bias, jumping to 90% accuracy.
  • Humans are blind to plausible hallucinations: In user preference tests, half of the explanations generated by a baseline state-sampling method contained hallucinations—yet participants preferred hallucinated explanations at virtually the same rate as non-hallucinated ones. Because lay users cannot easily detect fabricated reasoning, bounding hallucinations upstream via behavior representations is critical.
  • Interaction is most valuable when expectations are violated: Participants found interactive follow-up clarification unneeded when the agent acted predictably (exploitatively). However, when the agent performed unintuitive actions (e.g., bypassing a visible victim to explore), participants relied heavily on conversational follow-ups.

Key Results

  • Explanation Accuracy: Across Long-term, Short-term, and Ambiguous states, BR (Path) consistently outperformed state-sample baselines (BR (States)) and prompt-only baselines (No BR). For example, on the Fixed agent, BR (Path) scored 0.80 on Strategy identification, while BR (States) and No BR scored 0.05 and 0.00, respectively.
  • Future Action Prediction: Using BR (Path) explanations, the LLM successfully inferred subsequent actions with 80%–95% accuracy on long-term and ambiguous states.
  • Hallucination Reduction: Hallucination rates across generated explanations and action predictions dropped significantly compared to baseline methods.
  • Human Helpfulness Studies: In paired comparison tests, human evaluators significantly preferred BR (Path) explanations over textual templates and state-sample baselines ($p < 0.05$). Notably, participant ratings showed no statistically significant preference for human-expert explanations over BR (Path).

Limitations and Future Work

  • Input Dimensionality: Decision tree distillation requires structured, non-dense feature spaces. The pipeline cannot directly ingest raw sensor data or high-dimensional pixel observations without an upstream feature extractor.
  • Short-Term Goal Horizon Locality: When an agent accomplishes a goal within a single step, the local decision path only explains that immediate action, causing future action prediction accuracy to drop to ~40%. Incorporating surrounding world observations alongside the path could mitigate this blind spot.
  • Future Directions: The authors propose integrating differentiable decision trees and concept-based feature extractors to scale the framework to continuous and visual domains.

Summary updated

BibTeX
@misc{zhang2023understanding,
  author = {Xijia Zhang and Yue Guo and Simon Stepputtis and Katia P. Sycara and Joseph Campbell},
  title = {{Understanding Your Agent: Leveraging Large Language Models for Behavior Explanation}},
  year = {2023},
  eprint = {2311.18062},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.18062},
}
Figure