菜单

关于 🐙 GitHub
arXiv 提交日期: 2026-05-11
📄 Abstract - NCO: A Versatile Plug-in for Handling Negative Constraints in Decoding

Controlling Large Language Models (LLMs) to prevent the generation of undesirable content, such as profanity and personally identifiable information (PII), has become increasingly critical. While earlier approaches relied on post-processing or resampling, recent research has shifted towards constrained decoding methods that control outputs during generation to mitigate high computational costs and quality degradation. However, preventing multiple forbidden hard constraints or regex constraints from appearing anywhere in the output is computationally challenging. A straightforward solution is to convert these constraints into a single automaton that tracks all forbidden patterns during decoding, but this often becomes impractically large. Standard regex engines also do not readily support the operations needed to build such a constraint, such as complement and intersection. In order to address these limitations, we propose NCO, a decoding strategy that performs online pattern matching over finite hard constraints and regex constraints, reducing computational overhead without inducing state explosion. NCO is fully compatible with standard inference strategies, including various sampling methods and beam search, while also supporting soft masking for probabilistic suppression. We empirically demonstrate its effectiveness across practical tasks, including PII and profanity suppression. Our implementation is available at this https URL .

顶级标签: llm
详细标签: constrained decoding regex constraints profanity suppression pii suppression 或 搜索:

NCO:一种用于在解码过程中处理负面约束的多功能插件 / NCO: A Versatile Plug-in for Handling Negative Constraints in Decoding


1️⃣ 一句话总结

本文提出了一种名为NCO的解码策略插件,它能在不造成计算状态爆炸的前提下,实时监测并阻止大语言模型在生成过程中输出多种禁止内容(如脏话或个人信息),从而高效且兼容地实现负面约束控制。

源自 arXiv: 2605.10065