Rule-Guided Reinforcement Learning Policy Evaluation and Improvement

Martin Tappler, Ignacio D. Lopez-Miguel, Sebastian Tschiatschek, Ezio Bartocci

Deep Reinforcement Learning (RL) has achieved remarkable success in complex games, yet its "black-box" nature remains a significant barrier for real-world applications like autonomous driving. A primary issue is the lack of logical generalization: an agent may learn to avoid an obstacle in one orientation but fail to apply that same logic when the environment is rotated or mirrored. Current evaluation methods often fail to explain why an agent fails or provide a mechanism to inject domain knowledge without extensive retraining.

This paper introduces LEGIBLE (poLicy Evaluation GuIded By ruLEs), a neuro-symbolic framework that extracts, generalizes, and enforces symbolic rules to evaluate and improve deep RL policies. By leveraging environmental symmetries through metamorphic relations, LEGIBLE identifies policy weaknesses and significantly enhances performance, achieving reward increases of up to 273% in complex environments.

The LEGIBLE Framework

The LEGIBLE framework addresses these challenges through a three-step neuro-symbolic pipeline designed to bridge the gap between high-dimensional neural policies and human-readable symbolic logic.

![The LEGIBLE framework pipeline:

  1. Rule Mining from traces, 2. Rule Generalization via Metamorphic Relations, and 3. Rule-Guided Execution using a runtime monitor.](/figures/art_1ee9891970a14e46a6ab259c753724b6) Source, p. 3

The pipeline consists of three core phases:

  1. Rule Mining: Using the RIPPER algorithm, the framework translates neural network behavior into symbolic Horn clauses (e.g., avoid(North) :- wall(North)). Feature importance is determined using LIME to ensure the mined rules reflect the actual decision-making drivers of the agent.
  2. Rule Generalization (Metamorphic Relations): To address generalization gaps, the system employs Metamorphic Testing (MT) principles. By defining domain-specific symmetries (metamorphic relations), a single mined rule can be automatically expanded to cover equivalent scenarios (e.g., rotating a "don't hit North wall" rule to South, East, and West).
  3. Rule-Guided Execution: A runtime monitor intercepts the agent's actions. It blocks actions that violate "negative rules" and enforces actions mandated by "positive rules." This serves both as a diagnostic tool—if the guided agent outperforms the original, a generalization weakness is confirmed—and a performance booster.

Experimental Results

The authors evaluated LEGIBLE on PAC-Man and highway-env benchmarks. The framework's ability to detect weaknesses was compared against Random Testing (RT) and Random Rules (RR) baselines.

Detected weaknesses and evaluation counts across highway-env scenarios. The MT approach consistently identifies more policy weaknesses than standard baselines.

Key findings include:

  • Weakness Detection: The MT-based approach identified policy weaknesses in 5% to 24% of evaluations, significantly outperforming random testing baselines.
  • Performance Enhancement: Rule guidance led to massive gains, such as a 273% increase in average cumulative reward in the highway-fast environment.
  • Training Efficiency: Rule-guided agents often outperformed models trained for twice as many steps (e.g., $10^6$ vs $5 \cdot 10^5$ steps), demonstrating that symbolic logic is a more efficient way to handle logical constraints than pure data-driven training.

Conclusion and Future Work

LEGIBLE provides a powerful method for making deep RL policies more interpretable and robust. By treating logical failures as detectable "weaknesses" and providing a symbolic "safety rail," the framework moves closer to trustworthy AI. While current metamorphic relations require manual expert definition, future work will focus on automating this process and integrating symbolic rules directly into the training loop via methods like imitation learning.

Summary updated

BibTeX
@inproceedings{tappler2025rule,
  author = {Martin Tappler and Ignacio D. Lopez-Miguel and Sebastian Tschiatschek and Ezio Bartocci},
  title = {{Rule-Guided Reinforcement Learning Policy Evaluation and Improvement}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.24963/ijcai.2025/696},
}
Figure