WatChat:通过调试心智模型来解释令人困惑的程序
WatChat: Explaining perplexing programs by debugging mental models
AI总结:
本文提出 WatChat 框架,将用户对语言/API 的误解建模为反事实错误语义并用程序综合调试,从而解释程序困惑行为,在 JavaScript 与 Git 领域优于现有语言模型。
摘要:
通常,对程序意外行为的一个好解释是程序员代码中的缺陷。但有时,更好的解释是程序员对其正在使用的语言或 API 的心智模型中存在缺陷。我们的工具能否不再仅仅调试当前代码(“给程序员一条鱼”),而是直接调试我们的心智模型(“教程序员钓鱼”)?本文应用计算认知科学的最新思想,为实现这一目标提供了一个有原则的框架。给定关于程序的“为什么?”问题,我们会自动推断关于语言/API 的潜在误解,这些误解可能导致用户对程序行为感到惊讶,然后分析这些误解以提供对程序行为的解释。我们的核心思想是将误解形式化地表示为语言/API 的反事实(错误)语义,并可使用程序综合技术对其进行推断和调试。我们通过在两个领域构建解释系统来展示我们的框架 WatChat:JavaScript 类型强制转换和 Git 版本控制系统。我们通过将 WatChatJS 和 WatChatGit 的输出与这两个领域中实验收集的人工编写解释进行比较来评估它们:结果表明,WatChat 的解释展现出人工编写解释的关键特征,这与最先进语言模型的解释不同。
英文摘要:
Often, a good explanation for a program's unexpected behavior is a bug in the programmer's code. But sometimes, an even better explanation is a bug in the programmer's mental model of the language or API they are using. Instead of merely debugging our current code ("giving the programmer a fish"), what if our tools could directly debug our mental models ("teaching the programmer to fish")? In this paper, we apply recent ideas from computational cognitive science to offer a principled framework for doing exactly that. Given a "why?" question about a program, we automatically infer potential misconceptions about the language/API that might cause the user to be surprised by the program's behavior -- and then analyze those misconceptions to provide explanations of the program's behavior. Our key idea is to formally represent misconceptions as counterfactual (erroneous) semantics for the language/API, which can be inferred and debugged using program synthesis techniques. We demonstrate our framework, WatChat, by building systems for explanation in two domains: JavaScript type coercion, and the Git version control system. We evaluate WatChatJS and WatChatGit by comparing their outputs to experimentally-collected human-written explanations in these two domains: we show that WatChat's explanations exhibit key features of human-written explanation, unlike those of a state-of-the-art language model.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。