# Constraint Retrieval Is Not Constraint Enforcement in Large Language Models

*Yongkang Yang, Xiankun Lin, Lixin Liu, Ziyan Liu, Xilin Xia, Zhiwei Zhuang, Zhezheng Hao, Wence Ji*

[NeurIPS page](https://neurips.cc/virtual/2026/poster/155108) · [Open on the map](../papers.html#p155108)

Category: [LLM Agents, Evals & Benchmarks](../pcat/17.md) › [LLM Persona and Emotion Steering](../pgroup/592.md) · Type: empirical study · Keywords: constraint retrieval, constraint enforcement, language model safety, token-level compliance, mechanistic analysis

## Summary
The paper shows that language models can retrieve constraints but often fail to enforce them at the token level, revealing a gap between retrieval and enforcement.

## Explained to a 5-year-old
When we ask a big computer program to follow a rule, it can remember the rule but still break it while writing something. The program looks at the rule but sometimes still picks the wrong word. This means just remembering a rule is not enough; we need a special way to stop it from breaking the rule. The researchers looked at many different computer programs and found this happens often. They suggest we need new tools to make sure the program follows the rules all the way.

## Explained to a 5-year-old, longer
Imagine you tell a robot friend a rule, like 'don’t say the word bad.' The robot can remember that rule when you ask it a question. But when it starts writing its answer, it might still use the word bad because it thinks that word is the best choice. This shows that remembering a rule is different from actually following it while making choices. The scientists studied several robot friends of different sizes and found that this problem happens a lot. They saw that when there is another possible answer, the robot often follows the rule, but when the wrong word looks most natural, it ignores the rule. They also looked inside the robot to see how it pays attention to the rule and why it sometimes makes it stronger instead of weaker. They tried simple tricks to stop the robot from saying the bad word, but those tricks only fixed the surface mistake, not the deeper understanding. The study tells us that we need new ways to make robots truly obey rules, not just remember them. This is important because we want robot conversations to be safe and helpful. The results suggest that future designs should include special mechanisms that can veto wrong choices. By doing this, we can build more reliable AI assistants that keep us safe.

## For a technical reader
The paper empirically demonstrates that language models can retrieve constraints but often fail to enforce them during token generation. Across multiple model sizes, token-level prohibitions break when the prohibited token has the highest local logit, even though retrieval heads still attend to the constraint. Simple decoding interventions can suppress surface violations but do not guarantee semantic compliance. The authors conclude that separate enforcement mechanisms are needed beyond prompting to achieve reliable safety.

## Problem
Language models may remember a constraint from context yet still generate text that violates it, indicating that retrieval alone does not guarantee compliance.

## Method
The authors conduct an empirical analysis across five model families, evaluate retrieval versus enforcement behavior, perform mechanistic analyses of attention heads, and test decoding-time interventions.

## Results
Token-level prohibitions often fail when the prohibited token is locally dominant, while constraints with alternative plans are generally followed; decoding-time interventions can remove surface violations but deeper verification remains needed.

## Contributions
The work demonstrates that constraint retrieval and enforcement are distinct capabilities, identifies the failure mode of token-level prohibitions, and shows that simple decoding interventions are insufficient for full compliance.

## Practical relevance
The findings highlight the need for explicit enforcement mechanisms in deployed language models to ensure safety and reliable rule compliance.

This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. [Suggest a correction](../feedback/?on=p/155108)
