Explainable Reinforcement Learning

Machine Learning
Introduced by
Puiutta, E. & Veith, E. M. S. P. (survey); broader XAI community
Year
2018–2020
Type
Hybrid approach (RL + explainability methods)
Family
Deep learning / NLP / CV

What does it do?

Explainable Reinforcement Learning (XRL) is the set of methods that make the policies, decisions, and learned behaviour of reinforcement learning agents understandable to people.

It either attaches explanation tools to an agent after training (post-hoc) or constrains the policy to a form a person can read from the start (inherently interpretable). The aim is to support auditing, debugging, and trust checks where automated decisions must be justified.

The intuition behind the method

A standard RL agent learns by trial and error which action to take in each state. The result is often a neural network whose parameters give no direct reason for any particular choice. XRL adds interpretability tools to this picture: saliency maps that show which parts of the input state most affected an action, surrogate decision trees that approximate the policy in readable form, or attention weights that indicate which features the model weighted most heavily. A high attention weight or saliency score does not by itself show that the feature caused the choice. Whether an explanation is useful depends on how faithfully it reflects the policy, so the explanation itself has to be tested.

History

Explainable Reinforcement Learning is a subfield of explainable AI, the broader effort to make machine-learning decisions understandable to people. The survey by Puiutta and Veith, published in 2020 and cited on this page, reviews explanation approaches for RL agents. Earlier individual methods and their first applications to RL are not traced here.

When to use it

Choose XRL when an RL agent will make or support decisions in a setting where people must audit, verify, or justify them, such as treatment optimisation in healthcare, autonomous driving, financial trading, or safety-critical robotics. It is also useful during development, when an agent behaves unexpectedly and the cause must be traced, or when domain experts need to check that the learned policy matches their knowledge. Do not add XRL overhead where real-time latency rules out explanation generation, or where errors carry so little consequence that interpretability adds no practical value. Do not treat surrogate explanations as a substitute for analysing the policy itself; surrogate fidelity should be measured before the explanations are trusted.

Limitations and considerations

  • Post-hoc explanations may be unfaithful: a surrogate that fits the policy well on average can still misrepresent individual decisions.
  • Inherently interpretable policy classes may underfit high-dimensional environments, reducing task performance relative to deep policies.
  • Generating and evaluating explanations adds computation that can be prohibitive in real-time or latency-sensitive control.
  • Attribution methods such as SHAP depend on a choice of reference distribution or baseline, and that choice can change which state features are credited for an action.
  • Human evaluations of explanation quality are subjective and hard to standardise across studies.
  • No single XRL method covers all RL paradigms; the appropriate approach depends on whether the agent is value-based, policy-based, or actor-critic, and on its state representation.
  • Explanations are conditional on the reward specification and state representation: an explanation describes the behaviour learned under that reward and encoding, and it may not carry over if either changes.
  • Standard RL formulations assume a Markov decision process in a stationary environment. If the state omits information the decision depends on, or the environment shifts after training, explanations of the learned policy may no longer describe its behaviour.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Gives auditors and domain experts a basis for checking an agent's decisions against known constraints or expert knowledge.
  • Helps locate why an agent took an unexpected or unsafe action by linking the action to specific state features or rules.
  • Post-hoc tools such as SHAP, LIME, and saliency maps can be applied to an already trained agent without retraining it, since they operate on its inputs, outputs, or internal values.
  • Inherently interpretable policies such as decision trees and rule lists can be read and checked directly, with no separate explanation model whose fidelity must be established.
  • When the task is simple enough for a compact tree or rule list to represent the policy well, the transparent policy can perform comparably to the opaque one.

Applications

  • Healthcare: explaining treatment recommendation policies to clinicians for validation and trust.
  • Autonomous driving: auditing why a self-driving agent chose a specific maneuver in a near-miss scenario.
  • Financial trading: providing regulators with interpretable rationales for algorithmic trading decisions.
  • Robotics: debugging robot manipulation policies by visualising which sensory inputs drove each motion command.
  • Game AI research: analysing learned game-playing strategies to extract human-interpretable rules.
  • Energy management: justifying demand-response control actions to grid operators and regulators.

How it works

How it works

1

The agent observes states, selects actions, receives scalar rewards, and moves to new states. The resulting (state, action, reward, next-state) tuples record the agent's experience, and both the learned policy and any later explanation are derived from them.

2

The policy is improved to increase expected cumulative reward. The formula in this step expresses the greedy rule for a learned action-value function Q: in each state, the chosen action is the one with the highest Q-value. Because the rule selects a single action, the resulting policy is deterministic, even though the notation writes the policy as a conditional over actions. The rule describes only value-based methods. Policy-gradient and actor-critic methods learn the policy directly and do not use this argmax rule. In inherently interpretable variants, the learned policy may be a decision tree, linear model, or rule list that approximates or replaces the network.

Formula
\pi^*(a|s) = \arg\max_a Q(s,a)
3

Post-hoc explanations are computed after the policy is learned. Common examples include saliency maps, LIME and SHAP applied to individual decisions, surrogate tree approximations of the policy, and attention-based highlighting of state features. Inherently interpretable approaches instead restrict the policy class to human-readable forms during training.

4

Explanations are checked for faithfulness (whether they reflect what the policy actually does), comprehensibility (whether a person can follow them), and completeness (whether they cover the factors that mattered). Practical measures include the fidelity of a surrogate model to the policy on held-out trajectories, user studies of whether people can predict the agent's actions from the explanation, and explanation-policy agreement rates.

Common pitfalls

  • Accepting surrogate-model explanations without measuring fidelity: a low-fidelity tree can give a clear-looking but wrong account of the policy.
  • Reading saliency or attribution as causation: a highlighted feature is associated with the chosen action in the model, but this does not show that changing the feature would change the outcome in the environment.
  • Using post-hoc explanations to justify a policy that was not designed with safety constraints, which can create a false impression that the agent is accountable.
  • Assuming explanations are neutral when shown to decision-makers: a plausible-looking explanation can encourage over-trust in an agent whose policy has not been verified.
  • Treating a single XRL technique as sufficient when the task requires weighing interpretability against policy performance; this trade-off has to be assessed for the specific environment.

Frequently asked questions

What is the difference between post-hoc XRL and inherently interpretable RL?

Post-hoc XRL trains a black-box RL policy first, then applies explanation tools (SHAP, LIME, saliency) afterwards. Inherently interpretable RL constrains the policy class itself to a human-readable form (decision tree, rule list) from the start. Post-hoc methods can be applied to existing agents, but their explanations may be less faithful to the policy; inherently interpretable methods are fully transparent but may sacrifice performance in complex environments.

Can SHAP values be applied directly to an RL agent?

Yes. SHAP can be applied to the Q-function or policy network to attribute each action decision to input state features. The attribution depends on the reference distribution used for missing features. State features in sequential problems can be correlated across time steps, so the choice of baseline should be justified and the results interpreted with caution.

Does adding explanations hurt the agent's performance?

Post-hoc explanations are generated after the policy is learned and do not alter it, so they carry no performance cost at training time. Inherently interpretable policy classes may perform worse than deep networks in high-dimensional tasks because they restrict the hypothesis space. The trade-off depends on environment complexity and the required level of transparency.

How do I evaluate whether an explanation is trustworthy?

Measure surrogate fidelity (how accurately the explanation model reproduces the policy's decisions on held-out trajectories), run user studies to check that humans can correctly predict the agent's actions given the explanation, and test explanation stability (do similar states yield similar explanations?).

Is XRL required for AI regulatory compliance?

XRL is not a legal requirement in itself. Some regulatory frameworks, such as the EU AI Act, include transparency requirements that may apply to certain automated decisions, and XRL is one technical route to providing explanations for RL-based systems. Whether a given system is covered, and what counts as a meaningful explanation, should be checked against the legal text.

Related methods

Sources

  1. Puiutta, E., & Veith, E. M. S. P. (2020). Explainable Reinforcement Learning: A Survey. In Machine Learning and Knowledge Extraction (CD-MAKE 2020), Lecture Notes in Computer Science, vol. 12279, pp. 77–95. Springer.

    Open DOI reference
  2. Explainable artificial intelligence. Wikipedia.

    Open publication reference