Learning and Enforcing Context-Sensitive Control for LLMs
Albinhassan, M., Madhyastha, P.
ORCID: 0000-0002-4438-8161, Law, M. & Russo, A. (2025).
Learning and Enforcing Context-Sensitive Control for LLMs.
In:
Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 4: Student Research Workshop).
Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 4: Student Research Workshop), Jul 2025 - Jul 2025, Vienna, Austria.
doi: 10.18653/v1/2025.acl-srw.59
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 context-sensitive grammar learning with LLM generation, eliminating manual specification while maintaining generation validity.
| Publication Type: | Conference or Workshop Item (Paper) |
|---|---|
| Additional Information: | ©2025 Association for Computational Linguistics. This article is licensed on a Creative Commons Attribution 4.0 International License. |
| Departments: | School of Science & Technology School of Science & Technology > Department of Computer Science |
| SWORD Depositor: |
Available under License Creative Commons: Attribution 3.0.
Download (340kB) | Preview
Export
Downloads
Downloads per month over past year
Metadata
Metadata