Learning Efficient Guardrails for Compliance

Xiaofei Wen, Wenjie Jacky Mo, Yanan Xie, Peng Qi, Muhao Chen

TL;DR

This paper introduces POLICYGUARDBENCH, a 60k-scale benchmark for detecting when autonomous web agents violate complex, multi-step policies. The authors also release POLICYGUARD-4B, a lightweight guardrail model that outperforms much larger foundation models in both accuracy and inference speed, proving that efficient, specialized safety layers are a practical path for real-world agent deployment.

What Problem Does This Paper Address?

As autonomous web agents move from research labs to real-world applications (like travel planning or procurement), we face a critical gap: compliance. While existing research focuses heavily on "safety" (e.g., preventing toxic language or catastrophic hacks), it largely ignores whether an agent follows specific, often cumulative, rules.

For example, a shopping agent might successfully buy office supplies but violate a "no alcohol" policy or exceed a $200 budget. Traditional safety guardrails like LlamaGuard often fail here because they look for "bad" content in single steps, whereas policy violations are often context-dependent and emerge over a long sequence of actions.

Figure 1. Example trajectory illustrating agent actions, policies, and violations. The agent completes the task but violates policies both directly (alcohol) and cumulatively (more than one cake, total cost > $200), cases that traditional guardrails fail to detect.

Methods

The researchers developed a systematic pipeline to bridge this gap:

  1. Trajectory Standardization: They took raw browser logs (clicks, typing, scrolls) and converted them into a clean, step-wise textual format.
  2. Policy Synthesis & Matching: Using GPT-4o, they generated 2,195 atomic, checkable policies (e.g., "Do not proceed to checkout without using Instacart credits"). These were then paired with trajectories using embedding-based similarity and keyword triggers.
  3. Violation Annotation: They used a high-capacity LLM (gpt-oss-120B) to label pairs as "violation" or "no violation," verified by human re-annotation (achieving ~90% agreement).
  4. Model Training: They fine-tuned a Qwen3-4B-Instruct backbone on this dataset. Unlike general-purpose models, this "PolicyGuard" model is specifically optimized to detect compliance breaches.
  5. Prefix-Based Detection: Crucially, they evaluated the model's ability to predict violations from partial trajectories (the first 1-5 steps). This is vital for "online" guardrails that need to stop an agent before it commits an irreversible action.
Figure 2. Data processing pipeline for constructing POLICYGUARDBENCH, from raw trajectories to standardized trajectories, synthesized policies, and annotated violations.

Datasets

The primary contribution is POLICYGUARDBENCH, a curated subset of 59,997 policy-trajectory pairs.

  • Source Data: Derived from SCRIBEAGENT logs in the WEBARENA environment.
  • Domains: Covers five distinct areas: Reddit, Map, GitLab, Shopping, and Shopping-Admin.
  • Generalization: The dataset includes cross-subdomain pairings to test if a model can apply a policy learned in one context to a new one.

Key Insights and Ideas

  • Safety $\neq$ Compliance: The authors empirically show that safety-oriented models (like LlamaGuard-3) perform poorly on compliance tasks, often labeling clear policy violations as "safe." Compliance is an orthogonal dimension of reliability.
  • Small Models Can Win: A specialized 4B model can beat 70B+ models. By focusing the model's capacity on a single task (violation detection), the researchers achieved high accuracy without the massive latency of frontier models.
  • The "Early Signal" Advantage: Performance is often highest at $N=1$ (the very first step). This suggests that an agent's initial intent (e.g., searching for a restricted category) is a strong signal for future violations, allowing for early intervention.
  • Robust Generalization: The model maintains high performance even on "unseen" domains (Leave-One-Domain-Out testing), suggesting it learns transferable patterns of compliance rather than just memorizing domain-specific keywords.

Key Results

  • Accuracy & Efficiency: POLICYGUARD-4B achieved 90.1% accuracy and 87.6% F1 score.
  • Latency: It operates with a latency of just 22.5ms per example, which is ~13x faster than Llama-3.3-70B and ~145x faster than DeepSeek-V3.1.
  • Efficiency-Adjusted F1 (EA-F1): On this new metric that balances performance and speed, POLICYGUARD-4B scored 38.9, more than double the next best open-source model (Gemma-3-12B at 17.1).
  • Closed-Loop Impact: In simulations, using the model as an "interceptor" improved the agent's Completion-Under-Policy (CuP) rate from 10.2% to 16.3%, a 60% relative improvement.

Limitations and Future Work

  • Textual Abstraction: The current benchmark uses text-based action sequences. It misses visual context (like screenshots or layout info) that might be necessary to understand complex GUI-based violations.
  • False Negatives: The error analysis shows that 90.3% of errors are false negatives. The model is more likely to miss a subtle violation than to block a benign action.
  • Domain Scope: While it generalizes well across web domains, future work is needed to see if these patterns hold for coding agents, embodied AI, or complex enterprise workflows.
  • Grounding: Some failures stem from the model not fully "grounding" textual actions to interface semantics (e.g., confusing a textbox click with a text entry).

Summary updated

BibTeX
@inproceedings{wen2026learning,
  author = {Xiaofei Wen and Wenjie Jacky Mo and Yanan Xie and Peng Qi and Muhao Chen},
  title = {{Learning Efficient Guardrails for Compliance}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=y3niyCNvAp},
}
Figure