Ensuring both syntactic and semantic correctness in Large Language Model (LLM) outputs remains a significant challenge, despite being critical for real-world deployment. In this paper, we introduce $\texttt{SEM-CTRL}$, a unified approach that allows for enforcing rich context-sensitive constraints, and task and instance specific semantics directly on the LLM decoder. Our approach integrates token-level MCTS which is guided by specific syntactic and semantic constraints. The constraints over desired outputs are expressed using Answer Set Grammars, which is a logic-based formalism that generalizes context sensitive grammars while incorporating background knowledge to represent task-specific semantics. We show that our approach helps guarantee valid completions for any off-the-shelf LLM without the need for fine-tuning. We evaluate $\texttt{SEM-CTRL}$ on a range of tasks, including synthetic grammar synthesis, combinatorial reasoning, JSON parsing, and planning. Our experimental results demonstrate that $\texttt{SEM-CTRL}$ allows even small pre-trained LLMs to efficiently outperform larger variants and state-of-the-art reasoning models (e.g., $\textit{o4-mini}$) while simultaneously guaranteeing semantic validity.


翻译:确保大型语言模型(LLM)输出在语法和语义上的正确性仍是重大挑战,尽管这对实际部署至关重要。本文提出统一方法 $\texttt{SEM-CTRL}$,可直接在LLM解码器中施加丰富的上下文敏感约束、任务及实例特定语义。该方法整合了由特定语法和语义约束引导的标记级蒙特卡洛树搜索(MCTS)。对期望输出的约束通过答案集语法(Answer Set Grammars)表达,这是一种基于逻辑的形式化方法,在泛化上下文敏感语法的同时融入背景知识以表示任务特定语义。我们表明,该方法有助于保证任何现成LLM生成有效补全结果,且无需微调。我们在包括合成语法生成、组合推理、JSON解析和规划在内的多项任务上评估了 $\texttt{SEM-CTRL}$。实验结果表明,$\texttt{SEM-CTRL}$ 能使小型预训练LLM在保证语义有效性的同时,高效超越更大规模变体及最先进的推理模型(如 $\textit{o4-mini}$)。

0
下载
关闭预览

相关内容

SEM 是 Search Engine Marketing 的缩写,中文意思是搜索引擎营销。SEM 是一种新的网络营销形式。SEM 所做的就是全面而有效的利用搜索引擎来进行网络营销和推广。SEM 追求最高的性价比,以最小的投入,获最大的来自搜索引擎的访问量,并产生商业价值。
使用多模态语言模型生成图像
专知会员服务
32+阅读 · 2023年8月23日
【ICML2023】基于自然语言指令的受控文本生成
专知会员服务
29+阅读 · 2023年4月28日
干货|当深度学习遇见自动文本摘要,seq2seq+attention
机器学习算法与Python学习
10+阅读 · 2018年5月28日
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
最新内容
以色列-美国-伊朗战争中的无人机:关键要点
专知会员服务
1+阅读 · 38分钟前
《Palantir任务保障性软件安全标准(MA-S2)》
专知会员服务
3+阅读 · 53分钟前
基于声学的无人机检测技术综述
专知会员服务
3+阅读 · 今天13:37
《当代混合战争分析框架:俄乌战争经验教训》
专知会员服务
3+阅读 · 今天13:11
战略前沿人工智能的再思考(中文)
专知会员服务
7+阅读 · 5月29日
《量化地基防空系统间接效应的博弈论方法》
专知会员服务
5+阅读 · 5月29日
“史诗怒火行动”中美军损失的作战飞机
专知会员服务
6+阅读 · 5月29日
ICML 2026 | 理解上下文持续学习中的泛化与遗忘
专知会员服务
5+阅读 · 5月28日
相关VIP内容
使用多模态语言模型生成图像
专知会员服务
32+阅读 · 2023年8月23日
【ICML2023】基于自然语言指令的受控文本生成
专知会员服务
29+阅读 · 2023年4月28日
相关基金
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员