Skip to content

PolicyMem: Geometric Policy Memory for LLM GovernancePolicyMem: Geometric Policy Memory for LLM Governance

arXiv· arXiv:2609.13734· Yuanchen Bei, Zhengzhang Chen, Yanjun Zhao, Haoyu Wang, Hanghang Tong, Haifeng ChenUniversity of Illinois Urbana-Champaign; NEC Laboratories AmericaIndexed by this site · 11 days ago· Originally publishedDefenses

Quick read

Defenses

Based on the paper PDF (AI-generated); refer to the original

The authors propose PolicyMem, which compiles safety policies into low-rank subspaces for reuse in detection, attribution, and rewriting; the authors claim that its average detection F1 on five benchmarks is better than the listed baselines.

Threat modelDefender governance of a deployed LLM: given a user query and candidate response as input, the evaluator outputs a safe/unsafe judgment and policy attribution; unsafe responses are corrected by the rewriter and re-checked, falling back to refusal after at most B rounds. The paper does not set an adversarial attacker, nor does it evaluate adaptive attacks.

Questions
LLM governance needs to complete the closed loop of policy attribution, rewriting, and rechecking beyond detection, but the authors argue that learned guardrails implicitly couple policy knowledge in parameters, while programmable guardrails rely on manual engineering, lacking an explicit policy representation that is both learnable and reusable across stages.
Methods
PolicyMem compiles each policy description into a low-rank subspace in a shared geometric space, reads policy evidence via projection energy, and the same evaluator performs detection, attribution, and re-checking after rewriting; the rewriter is trained with SFT and DPO on self-generated candidates filtered by the frozen evaluator, without an external teacher.
Experiments and results
On five safety benchmarks, the authors report that the 3B Specialist averages Safe-F1 0.9238 and Unsafe-F1 0.8874, higher than the listed baselines; attribution averages mAP 0.8632; rewriting Overall is 0.7677; leave-one-out generalization macro-average AUROC is 0.930.
Limitations and future work
The paper does not specifically discuss limitations. The experiments cover five English safety benchmarks and Qwen2.5 0.5B/3B backbones; rewriting quality is reviewed by o3 and GPT-5.2, and the paper does not report agreement between the reviewers and humans; adaptive attacks are not evaluated.
Experimental setupPolicyMem · BeaverTails、WildGuardMix et al. · Safe-F1、Unsafe-F1 et al.
Evaluated models
PolicyMem
Benchmarks
BeaverTailsWildGuardMixAegis 2.0BingoGuardSafeRLHF
Metrics
Safe-F1Unsafe-F1mAPAUROCOverall good-rewrite rate
AI summaryPolicyMem is a geometric policy memory for LLM governance that compiles natural-language policies into learnable low-rank subspaces for reuse across stages. The policy evaluator projects query-response representations onto these subspaces, providing evidence for safety judgments and policy attribution; the response rewriter revises unsafe responses accordingly, and the same evaluator then re-evaluates them. On five widely used benchmarks, PolicyMem achieves the best average unsafe behavior detection performance among representative baselines.

PolicyMem is a geometric policy memory for LLM governance that compiles natural-language policies into learnable low-rank subspaces for reuse across stages. The policy evaluator projects query-response representations onto these subspaces, providing evidence for safety judgments and policy attribution; the response rewriter revises unsafe responses accordingly, and the same evaluator then re-evaluates them. On five widely used benchmarks, PolicyMem achieves the best average unsafe behavior detection performance among representative baselines.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The problem the authors aim to solve: the lack of an explicit policy representation that is both learnable and reusable across detection-rewriting-rechecking.

    Core question: how to obtain an explicit policy representation that is both learnable and reusable across governance stages, supporting closed-loop LLM governance.

    • Needs of closed-loop governance: The authors argue that governance should not only give a safety verdict, but also attribute violations to specific policies and use the attribution to guide rewriting and re-verification, forming an assessment-revision-verification loop.
    • Shortcomings of existing paradigms (authors' view): Learned guardrails (e.g., Llama Guard, WildGuard) have strong semantic discrimination ability, but policy knowledge is coupled in parameters and the trained classification system, making individual policies difficult to access, modify and reuse separately; programmable guardrails (e.g., NeMo Guardrails) make policies explicit, but turning policies into executable flows requires substantial manual engineering.
    • Core observation: The authors advocate organizing policy knowledge as externalized, individually addressable policy memory, and using a shared read operation to express the relationship between policies and model behavior as policy-level evidence, uniformly supporting evaluation and correction.
    • Paper's approach: Proposes PolicyMem, which compiles natural language policies into low-rank geometric subspaces; the same memory supports unsafe behavior detection, policy attribution, rewriting guidance, post-rewrite re-verification, and few-shot integration of new policies.
    • Threat model:
      • Defender's perspective: the governance target is the candidate response generated by a deployed LLM to a user query, and the goal is to intercept unsafe outputs and rewrite them into safe and helpful replies.
      • Defender's capabilities: can configure the policy set, access query-response representations, call the evaluator and rewriter, perform at most B rounds of rewrite-recheck, and fall back to a fixed refusal on failure.
      • The paper does not set an adversarial attacker (e.g., jailbreak or adaptive attacker); all experiments are conducted on static samples from existing safety benchmarks.
  2. What related research exists?

    Related work falls into two categories: learned/programmable guardrails and external memory systems; the authors argue that both lack a learnable explicit policy state.

    LLM safety governance

    • Learned guardrails: Llama Guard (Inan et al., 2023), WildGuard (Han et al., 2024), etc. are fine-tuned on curated safety data to evaluate prompts/responses, and are extended to risk classification and reasoning-based evaluation (Markov et al., 2023; Ghosh et al., 2024; Yin et al., 2025; Liu et al., 2025; Zhao et al., 2025). The paper notes that the policy knowledge of such methods is generally embedded in parameters or provided as textual context, rather than being a separately addressable learned representation.
    • Programmable guardrails: NeMo Guardrails (Rebedea et al., 2023) coordinates prompts, rules, actions and safety backends around a generator, providing flexible application-layer control; the paper notes that translating policies into executable governance flows still requires substantial manual engineering.

    LLM external memory

    • General memory systems: Mem0 (Chhikara et al., 2025) and A-Mem (Xu et al., 2026) organize facts and experience for retrieval, supporting subsequent reasoning and interaction.
    • Memory/retrieval in safety scenarios: Class-RAG (Chen et al., 2024) retrieves labeled samples and explanations to assist fine-tuning a classifier; RAR (Buonocore & Parimbelli, 2025) inserts specified documents into the retrieval library to trigger refusal of unsafe queries. The paper notes that these memory entries mainly serve as contextual references or retrieval triggers, while the interpretation and application of policies are still left to downstream models or task rules.

    Baselines and benchmarks

    • Comparison baselines cover four categories: general LLMs (Qwen2.5-3B/72B, Qwen3-4B/8B), programmable guardrails (NeMo Guardrails, with Claude-Sonnet-4.5), learned guardrails (Nemotron-Safety-Reasoning, NeMoGuard-ContentSafety, Granite Guardian, MD-Judge, Llama Guard 3, WildGuard, GuardReasoner), and memory/retrieval methods (Mem0, A-Mem, Class-RAG, RAR).
    • The evaluation benchmarks are five safety governance benchmarks: BeaverTails, WildGuardMix, Aegis 2.0, BingoGuard, and SafeRLHF.

    Positioning of this paper: The authors position PolicyMem as a method that represents policies as learnable objects and provides a common source of evidence for evaluation, attribution and correction, distinguishing it from memory methods that only perform context retrieval and from guardrails that internalize policies in parameters.

  3. How does the paper address this problem?

    PolicyMem compiles policies into low-rank subspaces and uses projection energy to uniformly support detection, attribution, rewriting and re-verification.

    Overall approach: each policy is written as a low-rank subspace (memory slot) in a shared geometric space; a case representation is projected onto each slot to obtain a policy evidence vector; the same evidence runs through detection, attribution, rewriting and re-verification, and is used to train a self-supervised rewriter.

    Problem setting and closed-loop process

    • Given a user query q, a candidate response r(0) and a policy set T (NT policies, each with an address p and a natural language description tp), the governor consists of a shared evaluator AΘ and a rewriter RΨ.
    • Closed loop: the evaluator outputs a verdict ŷ∈{safe, unsafe} and evidence e∈[0,1]^NT for each policy; when unsafe, the TopK slots with the highest energy are mapped back to policy text as feedback, and the rewriter generates the next candidate; the same evaluator re-checks, for at most B rounds, and if still unsafe it falls back to a fixed refusal.

    Geometric policy memory (writing)

    • Policies and cases share the same adapted LLM encoder Fω; policy descriptions are encoded to obtain representations, and during training a detached anchor ap is maintained as a stable input at write time.
    • The subspace compiler Γγ maps the anchor to a dg×rs matrix, and a reduced QR is used to take the orthogonal factor Up as the policy slot; the projection matrix Pp = Up Up⊤ is invariant to basis change and is the object of geometric analysis. All policies share the same compiler, rather than each having its own independent classifier.
    • Memory MT binds each address p to (tp, Up): the description is used to map the slot back to natural language feedback, and Up is used for projection reading; slots are materialized once after training and cached, and adding or removing policies only changes the corresponding entries.

    Memory reading and verdict

    • A case (q, r) is serialized via a template, encoded, mapped to the governance space and normalized to a unit vector z; the read of each slot is the projection energy ep = |Up⊤ z|2 ∈ [0,1]; energy is not normalized across policies, allowing multiple policies to score high simultaneously.
    • The verdict module receives only a 7-dimensional permutation-invariant summary ϕ(e) of the evidence vector (including max energy, mean, second-largest energy, entropy, etc., Appendix B.3.1), and does not access the query-response text or policy names; the authors use this to ensure that case information can reach the verdict only through policy evidence.
    • Attribution: energy coordinates are sorted and the TopK are taken, naturally supporting multi-label; localization: after masking segment j, the energy difference ∆p,j measures that segment's contribution to policy p; coverage κT(z)=max_p e_p(z) measures the alignment of a case with any policy.

    Training and new policy integration

    • Evaluator objective Lassess = Lverdict + λalign·LNCE + λsep·Loverlap + λaux·Lpolicy: verdict cross-entropy, contrastive alignment with the labeled policy as positive, subspace overlap regularization (to prevent slot collapse), and policy-level auxiliary supervision; weights are 1.0/0.5/0.05/0.3, and the anchor is refreshed by EMA at 0.9/0.1 every 100 steps.
    • The rewriter (LoRA adaptation) is trained in two stages, both supervised by scores from the frozen evaluator: Stage 1 takes the highest-scoring candidate with safe confidence ≥ τ+ from self-generated candidates for SFT; Stage 2 constructs preference pairs from candidates with ≥ τ+ and ≤ τ− for DPO, without external teacher generation or external reviewer scores.
    • New policy integration: new slots are initialized with the existing encoder and compiler, then few-shot alignment is performed using at most nshot samples per new policy plus replay of old policies (ratio αs); the authors note that alignment changes existing evidence, so acquisition and retention are evaluated separately.
    • The theoretical part (Appendix A) gives: a coverage transfer lower bound (Theorem 1), the read distance between slots equal to the spectral norm of the projection matrix (Theorem 2), exact recovery of the violated policy set by Top-m under block incoherence conditions (Theorem 4), etc., all of which are conditional sufficiency results.
  4. What experiments did the paper conduct?

    Experiments on detection, attribution, rewriting, new-policy integration, and generalization on five benchmarks; the authors claim that average detection F1 is better than all listed baselines.

    Experimental setup

    • Methods evaluated: PolicyMem 0.5B and 3B (backbones Qwen2.5-0.5B/3B-Instruct), each with two training regimes: Specialist (trained separately for each benchmark) and Co-Trained (a single model sharing 77 policy memories).
    • Baselines: general LLMs (Qwen2.5-3B/72B, Qwen3-4B/8B), NeMo Guardrails (with Claude-Sonnet-4.5), 7 learned guardrails, 4 memory/retrieval methods, all evaluated with official code and checkpoints, temperature 0, and the same data splits on A100.
    • Datasets (Table 3): BeaverTails (14 policies, test 3,021), WildGuardMix (13, 1,709), Aegis 2.0 (20, 813), BingoGuard (11, 1,658), SafeRLHF (19, 16,419); training sets about 13K–136K.
    • Metrics and review: detection reports Safe-F1/Unsafe-F1; attribution reports mAP; rewriting is scored by two reviewers, OpenAI o3 and GPT-5.2, on a 1–4 scale for safety, information preservation, and safe helpfulness, with Overall being the joint success rate averaged over the two reviewers (each item ≥3); generalization reports AUROC. The paper does not report the number of repetitions or human agreement.

    Main results

    According to Table 1 (detection, before rewriting) and Table 2 (attribution mAP):

    Swipe horizontally to read the table

    ModelAverage Safe-F1Average Unsafe-F1Attribution average mAP
    PolicyMem (Specialist) 3B0.92380.88740.8632
    PolicyMem (Co-Trained) 3B0.91590.8799not reported
    PolicyMem (Specialist) 0.5B0.91320.8727not reported
    WildGuard 7B0.90040.8633not reported
    Nemotron-Safety-Reasoning 4B0.89530.8356not reported
    NeMo Guardrails0.86870.8191not reported
    Qwen2.5-72B0.81350.8127not reported
    Qwen3-8Bnot reportednot reported0.5872
    • Table 1 has 18 rows in total; the remaining baselines are omitted here; the worst-performing baseline for detection is A-Mem (average Unsafe-F1 0.5066), and Mem0 is lower at 0.4831 (Safe-F1 0.6741). Attribution mAP is single-label for WGM/Bin and multi-label for BT/Aeg/SRL, and PolicyMem is higher than the Qwen prompt baseline in every row.
    • The authors state that 3B Specialist improves average Safe-F1 and Unsafe-F1 by 2.6% and 2.8% respectively over the strongest baseline; the gap between Co-Trained and Specialist is within 1%.
    • The authors state that compared with the strongest retrieval/memory baseline, 3B Specialist has 28.1% higher average Safe-F1 and 32.7% higher Unsafe-F1, and argue that general retrieval memory is insufficient for policy evaluation.

    Safe rewriting

    • Setup: The rewriter is trained only on subsets of BeaverTails and WildGuardMix; the main comparison is single-round rewriting (no recheck retries), scored by two reviewers on five benchmarks (Figure 3, Table 4).
    • Results (Table 4, average over five benchmarks): PolicyMem supervised (Qwen2.5-3B) Safety 3.98, Information 3.50, Helpfulness 2.84, Overall 0.7677; GPT-4o teacher version Overall 0.6994, Qwen3-8B 0.6927, Qwen2.5-3B 0.3781. The Figure 3 legend labels the GPT-4o teacher cost as $260 and PolicyMem supervised as $0.
    • Authors' interpretation: The authors state that the Overall improvement is not merely due to more aggressive content deletion, because information preservation is close to the strongest baseline; it still performs well on unseen Aegis 2.0, BingoGuard and SafeRLHF, indicating that rewriting transfers.

    New policy integration and generalization

    • Sequential integration (Figure 4-(a)): memory is expanded in the order BT→WGM→Aeg→Bin→SRL (from 14 to 77 slots); after the final update, the average Unsafe-F1 of the first four taxonomies decreases by only 1.6% compared with when each was integrated, which the authors describe as limited forgetting.
    • Few-shot acquisition (Figure 4-(b), integrating Aegis 2.0): at K=0 (slot insertion only, no labeled samples), detection already reaches 92% of the jointly trained reference; attribution starts at 0.271 mAP and recovers to 93% of joint training with 50 samples per policy. The authors believe slots provide a zero-shot detection signal, and that a small amount of supervision mainly improves attribution.
    • Leave-one-out generalization (Figure 12): each taxonomy is trained on the other four with its policy slots removed; macro-average AUROC goes from 0.958 in-distribution to 0.930 held-out (BT 0.883, WGM 0.940, Aeg 0.877, Bin 0.994, SRL 0.959). The authors state that the max-energy coverage signal transfers across taxonomies.

    Other ablations and analyses

    • Geometric memory ablation (Appendix C.6): replacing subspace + projection reading with an MLP detector on the anchor lowers Co-Trained Unsafe-F1 from 0.8799 to 0.7765.
    • Reading stability (Figure 11): after shuffling the policy list, PolicyMem's top-1 attribution change rate (shuffle interference) is 0, versus 28.3% for the text-list reader and 5.5% for the per-policy isolated reader.
    • Rewrite-recheck loop (Figure 8): after the first rewrite round, 99.1% are judged safe by the frozen evaluator, cumulatively at least 99.9% within three rounds, and 0.1% trigger the refusal fallback; note that this is the evaluator's own judgment, not independent review.
    • Efficiency (Figure 9, Table 5): the 3B version takes 28 ms/example and the 0.5B version 19 ms/example; policy memory storage is 0.6 MB, versus 418–493 MB for retrieval/memory baselines.
    • Parameter sensitivity (Figure 10): within rs∈{4,8,16} and dg∈{128,256,512,1024}, Unsafe-F1 is roughly stable at 0.87–0.89, and drops at rs=32; the defaults are rs=8 and dg=256.
  5. What are some points that can be further explored?

    The paper does not specifically discuss limitations; the experiments cover five benchmarks, Qwen backbones, and LLM judging, and do not test adaptive attacks.

    Limitations and future directions noted by the authors

    • The paper does not specifically discuss limitations (there is no Limitations section, and the Conclusion and appendix notes do not list limitations or future directions).

    Scope of experiments

    • The evaluated methods are two PolicyMem variants, 0.5B and 3B, both with Qwen2.5-Instruct series backbones; the baselines cover general LLMs, programmable guardrails, learned guardrails, and memory methods, 14 in total (Table 1).
    • The evaluation benchmarks are BeaverTails, WildGuardMix, Aegis 2.0, BingoGuard, and SafeRLHF, five in total, with test set sizes of 813–16,419 (Table 3); the paper does not state the language and domain composition of the samples.
    • Rewriting quality is scored by two judges, OpenAI o3 and GPT-5.2, using a shared rubric (Appendix B.3.3); the paper does not report agreement between the judges and human judgment, nor does it conduct human evaluation.
    • The 99.1%/99.9% convergence figures for the rewriting-rechecking loop come from the frozen evaluator's self-judgment (Appendix C.4), not independent judging; the paper does not report the specific value of the rewriting round budget B.
    • All experiments are conducted on static samples from existing benchmarks; the paper does not evaluate jailbreak or adaptive attacks against this defense; the paper does not report the number of repetitions for the detection and attribution experiments.
  6. Summarize the main content of the paper

    PolicyMem externalizes policy memory with low-rank subspaces, unifying detection, attribution, rewriting, and rechecking; the authors report that average detection on five benchmarks is better than the listed baselines.

    PolicyMem is a closed-loop LLM governance method, addressing the problem that "policy knowledge must be both learnable and reusable across stages."

    • Problem: The authors argue that learned guardrails implicitly couple policies in parameters, making them hard to access and reuse separately, while programmable guardrails are explicit but rely on manual engineering; neither can support the closed loop of detection-attribution-rewriting-rechecking.
    • Method: Each policy description is compiled into a low-rank subspace in a shared geometric space, and case representations are projected onto each subspace to obtain policy evidence; the decision module reads only a permutation-invariant summary of the evidence, attribution takes the TopK energy slots, the rewriter corrects the response conditioned on the attributed policy text, and the same evaluator rechecks; the rewriter is trained with SFT and DPO on self-generated candidates filtered by a frozen evaluator, without an external teacher.
    • Detection: On five benchmarks, the 3B Specialist averages Safe-F1 0.9238 and Unsafe-F1 0.8874, which the authors claim is higher than all listed baselines (the strongest baseline, WildGuard, is 0.9004/0.8633, Table 1).
    • Attribution and rewriting: Attribution averages mAP 0.8632, higher than Qwen3-8B's 0.5872 (Table 2); rewriting Overall joint success rate is 0.7677, higher than the GPT-4o teacher version's 0.6994 (Table 4).
    • Integration and generalization: After sequentially integrating five taxonomies, the old set's average Unsafe-F1 drops by only 1.6%; zero-shot detection on a new taxonomy reaches 92% of joint training; leave-one-out macro-average AUROC is 0.930 (Figure 4, 12).
    • Authors' conclusion: The authors claim that explicit geometric policy memory unifies learnability and reusability, and supports deployment with 0.6 MB storage and 19–28 ms/example latency; the paper does not evaluate adaptive attacks, and rewriting quality depends on LLM judging.

Related papers

Show 2 more papers
Read originalarxiv.org