跳到正文
arXiv cs.AI· Boqi Chen, Aren A. Babikian, Jos\'e Antonio Hern\'andez L\'opez·· 13 小时前AI 评分31

MeMoDecode:用元模型引导 LLM 解码,保证 DSL 生成一致性

Metamodel-Guided LLM Decoding for Consistent DSL Generation

AI 导读

MeMoDecode 是一个在解码阶段同时约束 DSL 具体语法、抽象语法与良构性约束的框架,每当 LLM 生成完整的元模型概念时,就将输出增量映射为部分模型并验证其能否补全为一致实例。在 4 种 DSL 和 6 个 0.6B 至 70B 参数的开源模型上,其一致性平均比无约束解码高 23%、比语法约束解码高 8%,同时提升基准表现且运行时开销有限。

正文 · 原文

View PDF HTML (experimental)

Abstract:Large language models (LLMs) are increasingly used to generate software engineering artifacts written in domain-specific languages (DSLs). Correct DSL instances usually must comply with not only the concrete syntax but also the abstract syntax defined by a metamodel augmented with semantic well-formedness constraints. Existing constrained decoding approaches typically guarantee compliance only with concrete syntax or with a limited set of semantic constraints expressed over the generated text, making metamodel-level constraint consistency difficult to enforce during generation. We present MeMoDecode: a decoding framework that enforces a DSL's concrete syntax, abstract syntax, and well-formedness constraints jointly. Specifically, whenever the LLM generates a complete metamodel concept, MeMoDecode incrementally maps the current output to a partial model and verifies whether it can still be completed into a consistent instance. We combine MeMoDecode with a simple retry mechanism that resumes decoding from the most recent completable snapshot whenever an inconsistency is detected. Under a sound backend verifier, MeMoDecode never performs worse than grammar-constrained decoding on alignment metrics satisfying natural assumptions. Across four DSLs and six open-weight LLMs ranging from 0.6B to 70B parameters, MeMoDecode achieves the highest consistency, improving consistency by 23% on average over unconstrained decoding and by 8% on average over grammar-constrained decoding. It also improves benchmark performance while incurring only modest runtime overhead. These results show that metamodel-guided decoding is an effective approach for enforcing DSL consistency during decoding across diverse DSLs and LLM scales.
Comments: 12 pages, 5 figures
Subjects: Software Engineering (cs.SE); Artificial Intelligence (cs.AI)
Cite as: arXiv:2610.29749 [cs.SE]
  (or arXiv:2610.29749v1 [cs.SE] for this version)
  https://doi.org/10.48550/arXiv.2610.29749

arXiv-issued DOI via DataCite (pending registration)

Submission history

From: Boqi Chen [view email]
[v1] Wed, 21 Oct 2026 13:49:08 UTC (662 KB)

来源:arXiv cs.AI · arxiv.org