TL;DR
While Large Language Models (LLMs) are increasingly deployed as autonomous agents, they struggle to reliably follow complex, time-dependent rules (e.g., "do X only after Y happens"). This paper introduces TRAC (Temporal Rule Assessment and Compliance), a framework that combines LLMs with formal verification methods to audit, monitor, and proactively steer AI behavior. By offloading temporal reasoning to exact mathematical logic, TRAC allows even small language models to outperform frontier models at safety and compliance monitoring.
What Problem Does This Paper Address?
As LLMs transition from passive chatbots to active agents in sectors like banking, aviation, and healthcare, ensuring they comply with safety regulations and business norms is critical. Many of these rules are temporally extended—meaning they dictate patterns of behavior over time with highly variable gaps between events (e.g., "If a valid invoice is received, it must eventually be paid").
Currently, the industry relies heavily on "LLM-as-a-Judge" setups, where a powerful model evaluates whether an agent followed the rules. However, this paper demonstrates that LLMs are fundamentally poor at tracking long-term temporal dependencies. Their reasoning accuracy degrades sharply as the time gap between events grows, when multiple rules must be tracked simultaneously, or when the environment contains distracting information.
Methods
The authors propose a clever division of labor: use LLMs for what they do best (semantic perception) and use classical formal methods for what they do best (exact logical reasoning).
The core framework, TRAC, breaks monitoring down into two steps:
- The Labeler (LLM): Translates unstructured natural language actions or environment states at each timestep into simple, atomic propositions (e.g.,
invoice_received = True). - The Monitor (Formal Logic): Evaluates these propositions using Linear Temporal Logic (LTL) progression. Instead of compiling rules into a rigid state machine (automaton), LTL progression incrementally rewrites the logical formula at each step, generating a "residual" formula representing what must still happen in the future to maintain compliance.
The authors expand this into a family of algorithms:
- TRAC: The base real-time monitoring and offline auditing algorithm.
- $\text{TRAC}_R$: Introduces a reset mechanism to continuously track rule compliance over long horizons, even after a rule is temporarily violated or satisfied.
- $\text{TRAC}_{P+I}$ (Predictive + Intervening): Uses trajectory sampling to forecast the probability of a future violation within a short horizon ($k$ steps). If the risk exceeds a threshold, it triggers a black-box intervention—such as rejection sampling (regenerating the action), constraint-guided prompting (injecting the residual rule into the prompt), or model substitution (switching to a safer, highly constrained model).
Datasets
The framework was evaluated across three distinct sequential decision-making environments featuring complex temporal constraints:
- IPC (Trucks): A logistics planning domain from the International Planning Competition where agents transport packages subject to strict delivery order preferences.
- TextWorld (Cooking Domain): A text-based interactive environment where agents must follow multi-step recipes while adhering to safety constraints (e.g., examining items before using them).
- ScienceWorld: A text-based environment for grounded scientific reasoning where agents perform elementary science experiments (e.g., measuring substance temperatures before moving them).
- Synthetic Traces: Procedurally generated event logs used to stress-test LLMs on temporal reasoning across varying event distances, constraint counts, and proposition densities.
Key Insights and Ideas
- Decomposition Wins: LLMs are highly accurate at identifying individual facts or events within a single text snippet, but they fail at stringing those facts together logically over long horizons. Separating perception from reasoning solves this.
- The "Frontier Budget" Illusion: You don't need expensive frontier models like Gemini 1.5 Pro or GPT-4 to act as compliance judges. A small model (like Qwen-7B) acting as a simple labeler inside the TRAC framework achieves superior auditing accuracy at a fraction of the cost.
- Quantifying LLM Blindspots: Controlled experiments revealed that native LLM temporal reasoning suffers from severe "temporal elasticity" degradation—smaller models drop to near-random accuracy when dependent events are separated by more than 10 steps, and even frontier models struggle when formulas scale in structural complexity.
Key Results
- Auditing Superiority: In all three environments, $\text{TRAC}_R$ paired with an LLM labeler consistently achieved near-perfect F1 scores (~0.95 to 1.0) for detecting rule violations, vastly outperforming standard zero-shot and few-shot LLM-as-a-Judge baselines.
- Proactive Risk Reduction: The predictive and intervening framework ($\text{TRAC}_{P+I}$) successfully slashed constraint violation rates across all tested agent models. For instance, in the IPC-Trucks domain, interventions dropped violation rates significantly while fully preserving the agent's underlying task performance (cumulative reward).
Limitations and Future Work
- The Labeling Bottleneck: TRAC's soundness relies on the accuracy of the underlying labeling function. If the LLM labeler misidentifies an event, the formal monitor will process incorrect data.
- The Formalism Trap: Translating vague, nuanced human values or regulations into rigid LTL formulas remains a challenging sociotechnical hurdle.
- Future Directions: The authors point toward fine-tuning smaller models specifically for the proposition labeling task, using LLMs to automatically generate code-based monitors, and expanding the framework to evaluate quantitative properties like fairness.
Summary updated