TL;DR
This paper presents a framework that automatically learns and enforces context-sensitive constraints in LLMs, improving generation validity without manual rule specification.
Contribution
It introduces a two-phase process for learning constraints from LLM interactions and demonstrates effective enforcement, even in small models, outperforming larger models.
Findings
Small LLMs (1B parameters) can learn and adhere to constraints perfectly.
The method outperforms larger models and state-of-the-art reasoning models.
First integration of context-sensitive grammar learning with LLM generation.
Abstract
Controlling the output of Large Language Models (LLMs) through context-sensitive constraints has emerged as a promising approach to overcome the limitations of Context-Free Grammars (CFGs) in guaranteeing generation validity. However, such constraints typically require manual specification -- a significant barrier demanding specialized expertise. We introduce a framework that automatically learns context-sensitive constraints from LLM interactions through a two-phase process: syntactic exploration to gather diverse outputs for constraint learning, followed by constraint exploitation to enforce these learned rules during generation. Experiments demonstrate that our method enables even small LLMs (1B parameters) to learn and generate with perfect constraint adherence, outperforming larger counterparts and state-of-the-art reasoning models. This work represents the first integration of…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
