你的下一个 DSL 作者是语言模型:用类型化领域接地消除语法幻觉
原标题:Article: Your Next DSL Author Is a Language Model
AI 摘要
文章提出「类型化领域接地」(Typed Domain Grounding, TDG)方法,认为大模型在领域特定语言(DSL)上的幻觉本质是训练数据频率问题而非知识问题。TDG 将领域嵌入训练数据丰富的主语言中作为类型化内部 DSL,使领域错误表现为编译器类型错误而非静默失败。在 Claude Sonnet 5 的五十任务基准中,该方法比两种宽松的外部 DSL 获得更高的结构保真度和更低的幻觉率,尽管首次编译通过率更低;GPT-4o 也呈现相同模式,但并非所有被测模型都如此。作者指出该方法有局限与成本,建议语言设计者将其作为新 DSL 的默认考量。
正文节选
Key Takeaways - Large language model (LLM) hallucination on a domain-specific language is fundamentally a training data-frequency problem, not a knowledge problem. Models write mainstream languages reliably because those languages are dense in their training corpus and invent syntax for anything sparse or newly designed. - Retrieval-augmented generation (RAG) grounds the facts in a model's response, but does nothing for the notation used to express them, because a model can have perfectly accura