不训练模型,直接分析内部激活值来检测政策违规,快速高效。
Training-Free Policy Violation Detection via Activation-Space Whitening in LLMs
- 基于大模型激活空间的分布差异,无需训练即可识别违规内容。
- 在多个基准上达到最高86.0% F1,显著优于微调和LLM自判方法。
- 仅需政策文本和少量示例,适合对延迟敏感的生产环境使用。
随着大语言模型在法律、金融、医疗等敏感领域广泛应用,确保其符合组织内部政策日益重要。现有内容审核框架多局限于安全范畴,难以捕捉细微的组织政策。尽管采用大模型作为裁判或微调的方法具有灵活性,但带来显著延迟与训练成本。为此,本文将政策违规检测建模为模型激活空间中的分布外(OOD)问题。提出一种无需训练的方法,直接利用大模型内部表示,基于先前研究中决策相关信息存在于激活中的发现,借鉴白化技术,从归一化后的隐藏层激活中直接计算违规得分。该方法仅需政策文本和少量示例样本,轻量且易于部署。在多个大模型和挑战性政策基准上进行广泛评估,最高达86.0% F1,优于微调及大模型自判基线,同时计算开销大幅降低。代码已公开于:https://github.com/FujitsuResearch/LLM-policy-violation-detection。
原文摘要 · Abstract (English)
As organizations increasingly deploy LLMs in sensitive domains such as legal, financial, and medical settings, ensuring alignment with internal organizational policies has become a priority. Existing content moderation frameworks remain largely confined to the safety domain and lack the robustness to capture nuanced organizational policies. LLM-as-a-judge and fine-tuning approaches, though flexible, introduce significant latency and training cost. To address these limitations, we frame policy violation detection as an out-of-distribution (OOD) problem in the model's activation space. We propose a training-free method that operates directly on the LLM internal representations, leveraging prior evidence that decision-relevant information is encoded within them. Inspired by whitening techniques, we derive policy-violation scores directly from normalized representations of LLM hidden activations. Our method requires only the policy text and a small number of illustrative samples, making it lightweight and easily deployable. We extensively evaluate our method across multiple LLMs and challenging policy benchmarks. It achieves up to 86.0% F1, outperforming both fine-tuned and LLM-as-a-judge baselines while requiring substantially less computation. Our code is publicly available at: https://github.com/FujitsuResearch/LLM-policy-violation-detection
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。