AutoSpec: Safety Rule Evolution for LLM Agents via Inductive Logic Programming

📅 2026-06-23
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This work addresses the risks posed by large language model (LLM) agents, which may execute harmful actions or leak sensitive data, while existing safety mechanisms are often brittle and lack interpretability. The authors propose a novel approach that integrates counterexample-guided inductive synthesis (CEGIS) with inductive logic programming (ILP) to automatically and iteratively refine interpretable safety rules from expert-defined constraints and user-annotated execution trajectories. Notably, this is the first application of ILP to efficiently identify critical predicates that distinguish safe from unsafe behaviors, drastically reducing the rule search space. Evaluated across two domains, the method achieves F1 scores of 0.98 and 0.93, reduces false positives by up to 94%, converges within 4–5 iterations, and outperforms heuristic CEGIS by 4.8× in F1 performance. The resulting rules are highly readable, auditable, and generalize effectively across scenarios.
📝 Abstract
Large language model (LLM) agents increasingly automate complex tasks by integrating language models with external tools and environments. However, their autonomy poses significant safety risks: agents may execute destructive commands, leak sensitive data, or violate domain constraints. Existing safety approaches face a fundamental tradeoff: hand-crafted rules are interpretable but brittle, with overly conservative rules blocking safe operations (high false positives) while permissive rules miss unsafe behaviors (high false negatives). Neural classifiers lack the interpretability required for safety-critical deployments. We present AutoSpec, a framework that automatically evolves deployed expert-designed safety rules from user safe/unsafe annotations through counterexample-guided inductive synthesis (CEGIS) guided by inductive logic programming (ILP). Starting from the expert rules and a stream of annotated traces, AutoSpec iteratively evaluates rules, mines false-positive and false-negative counterexamples, uses ILP to learn which predicates discriminate them, generates candidate rule edits, and verifies candidates to select the best revision. The key insight is that ILP efficiently identifies predicates that appear frequently in false negatives but rarely in false positives (or vice versa), dramatically pruning the exponential search space of rule edits. This continues until convergence, producing interpretable rules that balance precision and recall. We evaluate AutoSpec on 291 execution traces spanning code execution and embodied agent domains. AutoSpec raises rule F1 to 0.98 and 0.93 across the two domains, achieving up to 94% false positive reduction while maintaining high recall, and converges within 4-5 iterations. The ILP-guided approach achieves up to 4.8x higher F1 than heuristic CEGIS. The learned rules are human-readable, auditable, and generalize to unseen scenarios.
Problem

Research questions and friction points this paper is trying to address.

LLM agents
safety rules
false positives
false negatives
interpretability
Innovation

Methods, ideas, or system contributions that make the work stand out.

Inductive Logic Programming
Safety Rule Evolution
Counterexample-Guided Inductive Synthesis
Interpretable Safety Rules
LLM Agents
🔎 Similar Papers
No similar papers found.