Papers
Topics
Authors
Recent
Search
2000 character limit reached

LPG: Balancing Efficiency and Policy Reasoning in Latent Policy Guardrails

Published 17 May 2026 in cs.CR and cs.AI | (2605.17329v1)

Abstract: Guardrails are a critical safety layer for modern AI systems, but their operating regime is changing. As LLMs are deployed as customized assistants, safety policies are increasingly specified at inference time by users, organizations, or regulatory contexts. This makes safety enforcement fundamentally dynamic: the guardrail should adapt to changing safety policies without retraining. Yet this requirement creates a fundamental tension: faithfully judging complex policy contexts demands reasoning capability, while practical deployment requires low-latency responses. We introduce Latent Policy Guardrail (LPG), a guardrail framework that learnssemantic latent deliberation over dynamic policies. LPG compresses the internal deliberation needed for intent interpretation and policy grounding into continuous states supervised by decision-relevant semantics. At inference time, it generates only a compact verdict anchored to the violated policy clauses, preserving auditability while avoiding the latency of explicit reasoning. Across policy guardrail benchmarks, LPG-4B reaches 84.5% average safety accuracy and 77.9% F1 by compressing deliberation into just 10 latent tokens, outperforming the strongest dynamic baseline while running roughly 11 times faster than Qwen3-4B-Thinking under the single-sample evaluation setup. Code and data are available at https://github.com/SaFo-Lab/Latent_Policy_Guard.

Authors (3)

Summary

  • The paper introduces LPG, a framework enhancing policy reasoning efficiency in LLMs by compressing semantic content into latent space.
  • LPG achieves 84.5% safety accuracy with 11x lower latency compared to explicit reasoning methods, ensuring robust clause-level attribution.
  • Through adaptive latent structures, LPG demonstrates strong performance across novel benchmarks, advancing guardrail systems' versatility.

LPG: Balancing Efficiency and Policy Reasoning in Latent Policy Guardrails

Motivation and Problem Context

The increasing deployment of LLMs in agentic and domain-specific settings necessitates adaptive guardrails capable of enforcing user- or context-specified safety policies at inference without retraining. Traditional guardrail approaches, often rooted in static taxonomies and trained on fixed policy sets, lack flexibility for dynamic rule enforcement. Policy-aware guardrails address this by conditioning moderation on natural-language policy lists provided at inference; however, a trade-off emerges: explicit reasoning required for robust policy grounding incurs substantial latency, while non-reasoning classifiers are fast but brittle in their verdicts, often failing to anchor decisions to relevant clauses.

LPG Framework: Semantic Latent Deliberation

LPG (Latent Policy Guardrail) proposes a novel architecture for dynamic guardrails by compressing structured policy reasoning into a compact latent space, thereby balancing semantic depth with inference efficiency. LPG’s reasoning process is organized into three distinct stages: intent analysis, policy analysis, and verdict formulation. The first two are executed entirely in continuous latent space; only the final verdict is materialized as discrete tokens, enhancing both speed and auditability.

Core Design Choices

  • Stage-Aligned Latent Slots: LPG employs separate latent slots for intent and policy analysis, ensuring that reasoning about user intent and policy violations occurs within differentiated subspaces.
  • Semantic Content Supervision: Rather than reconstructing teacher rationale token-by-token, LPG supervises latent slots via compact teacher-generated summaries routed through the base LM, preserving stage-specific semantic content.
  • Teacher Hidden-State Distillation: At stage boundaries and the verdict onset position, LPG aligns its latent representations with explicit teacher hidden states, transferring decision-relevant computation and ensuring that deliberation remains grounded in policy semantics.
  • Policy Anchoring: LPG’s verdicts explicitly cite violated policy indices, enforcing a strong inductive bias toward clause-level attribution and facilitating downstream auditing.

Empirically, LPG achieves high semantic fidelity in reasoning while operating with minimal latent tokens—just 10 are needed to approach explicit reasoning performance.

Training Procedure and Corpus

LPG is trained on a heterogeneous mix of policy-grounded and general moderation datasets, unified by a shared schema comprising policy lists, moderation targets, verdicts, and clause indices. The training pipeline ensures that models cannot overfit to policy phrasing or ordering: each training example receives freshly synthesized and shuffled policy lists, and teacher-generated structured traces provide ground-truth intent, policy relevance, and verdict content.

The multi-objective loss comprises:

  • Verdict output cross-entropy,
  • Teacher hidden-state distillation on stage boundaries and answer position,
  • Semantic summary reconstruction,
  • Backbone LM reference regularization.

Empirical Evaluation

Policy-Grounded Benchmarks

Across GuardSet-X and an augmented, adversarial DynaBench split, LPG demonstrates 84.5% safety accuracy and 77.9% F1—outperforming dynamic and explicit reasoning baselines such as DynaGuard-8B and Qwen3-4B-Thinking. LPG retains robustness to counterfactual policy removal (violated clause dropped) and surface-form perturbations (policy order shuffled), and its verdicts are anchored to specific clauses, addressing brittleness found in prior approaches. Remarkably, LPG achieves these results with ~11x lower latency than explicit chain-of-thought reasoning methods.

Out-of-Distribution Generalization

LPG transfers effectively to unseen benchmarks, scoring 96.4% F1 on HarmBench and 84.1% F1 on WildGuardTest, outperforming both static and dynamic guardrails not trained on these datasets. Fixed-taxonomy models, by contrast, exhibit substantial accuracy drop when exposed to novel policies, confirming LPG’s superiority as policies evolve.

Ablation Insights

Loss-component ablations reveal that answer-position distillation is the critical supervision signal: removing it diminishes accuracy by nearly 20 points. Semantic summary reconstruction contributes complementary interpretability, while increasing latent token budget yields diminishing returns beyond 10 tokens.

Practical and Theoretical Implications

LPG’s capability to compress policy reasoning into latent space aligns with latency constraints of real-time moderation pipelines and enables deployment where explicit reasoning is prohibitive. Its clause-level verdict attribution enhances transparency and auditability, mitigating risks of over-restrictiveness. The framework is backbone-agnostic, allowing scaling to larger models and more expressive teachers without architectural changes.

The latent compliance reasoning paradigm introduced by LPG generalizes beyond safety moderation. Any AI system requiring runtime conditioning on context-specific natural-language rules—including agentic tool-use restrictions, regulatory compliance, and constitutional-AI alignment—can leverage LPG-style latent deliberation for efficient policy enforcement.

Future Directions

Potential avenues for expansion include:

  • Integration of LPG within agent frameworks for on-the-fly tool action moderation;
  • Co-evolving student guardrails and policy corpora, using clause-attribution feedback to iteratively refine deployed policies;
  • Curriculum-based training across latent budgets to serve latency-tolerant and latency-constrained settings from a single checkpoint;
  • Applying latent semantic reasoning to broader compliance scenarios, including multimodal safety and jurisdiction-aware regulation.

Conclusion

LPG introduces a structured framework for compressing dynamic policy reasoning into continuous latent space, achieving robust clause-level attribution and superior accuracy-latency trade-offs compared to both static classifiers and explicit reasoning guardrails. Its generalization capacity, transparency, and efficient deployment profile position LPG as a compelling solution for adaptive policy moderation and broader rule-conditioned inference challenges in large-scale AI systems.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.