Skip to main content
QUICK REVIEW

[논문 리뷰] WatChat: Explaining perplexing programs by debugging mental models

Kartik Chandra, Collins, Katherine M.|arXiv (Cornell University)|2024. 03. 08.
Software Engineering ResearchComputer Science인용 수 3
한 줄 요약

WatChat는 JavaScript 프로그램의 예상치 못한 동작을 언어 의미론에 대한 사용자의 오해를 진단하고 수정함으로써 설명하는 시스템이다. 역방향 프로그램 합성 기법을 사용해 잘못된 정신 모델을 추론하고, 대조적이고 인과적이며 사회적으로 적절한 설명을 생성한다 — 예를 들어 `[] + []`가 빈 문자열을 반환하는 것과 같은 놀라운 동작을 설명하는 데 효과적임을 입증한다.

ABSTRACT

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.

연구 동기 및 목표

  • 프로그래밍 도구가 코드 버그가 아닌 언어 의미론에 대한 잘못된 정신 모델로 인해 발생하는 예상치 못한 동작을 설명할 수 있는 격차를 메우기 위해.
  • 사용자의 오해를 가정한 반사적 의미론으로 모델링함으로써 인간과 유사하고 도움이 되는 설명을 생성하는 시스템을 설계하기 위해.
  • 오해를 진단하기 위한 설명 생성과 교육적 예제 생성을 모두 지원하는 프레임워크를 만들기 위해.
  • 대조성, 선택성, 인과성, 사회적 맥락과 같은 인지과학 원리를 자동화된 설명 시스템에 통합하기 위해.
  • 프로그래밍 환경이 수동적인 디버거가 아니라 협업적이고 인지적 파art너로 기능할 수 있도록 하기 위해.

제안 방법

  • JavaScript의 의미론에 대한 오류 해석을 표현하는 반사적 의미론으로 사용자의 정신 모델을 모델링한다.
  • 역방향 프로그램 합성을 적용하여 예상치 못한 동작을 유도할 수 있는 타당한 오해(즉, '오해자')를 추론한다.
  • 이러한 반사적 의미론에 대한 버그를 식별하고 수정함으로써 설명을 생성하며, 대조적이고 선택적인 설명의 인지과학 원칙을 준수한다.
  • JavaScript 의미론의 형식적 명세와 기호 실행 엔진(Rosette)을 사용하여 2^32개의 잠재적 오해 공간을 밀리초 내에 효율적으로 탐색한다.
  • 설명 과정을 뒤집어, 특정 오해를 테스트하고 수정할 수 있는 진단용 예제 프로그램을 합성한다.
  • 사용자의 기대를 묻는 방식(예: '빈 배열을 기대하셨나요?')을 통해 맥락에 민감한 설명 생성을 구현함으로써 적응형 대화형 상호작용을 가능하게 한다.
Figure 1: System overview. Panel “A” shows WatChat’s model of how programmers come to ask “why?” questions. Panel “B” shows how an explainer reasons over the model in Panel “A” to find a good explanation.
Figure 1: System overview. Panel “A” shows WatChat’s model of how programmers come to ask “why?” questions. Panel “B” shows how an explainer reasons over the model in Panel “A” to find a good explanation.

실험 결과

연구 질문

  • RQ1프로그래밍 도구가 코드 수정이 아닌 사용자가 언어 의미론에 대해 가진 오해를 진단하고 수정함으로써 예상치 못한 동작을 어떻게 설명할 수 있는가?
  • RQ2대조성, 선택성, 인과성과 같은 인지과학 원리는 프로그래밍 환경에서 인간과 유사한 설명을 생성하는 데 어떻게 안내할 수 있는가?
  • RQ3프로그램 합성 기법을 뒤집어 프로그래밍 언어 동작에 대한 잘못된 정신 모델을 추론하고 디버깅할 수 있는가?
  • RQ4이러한 시스템이 특정 오해를 대상으로 하는 교육적으로 유용한 진단 예제를 얼마나 정밀하게 생성할 수 있는가?
  • RQ5설명 시스템은 사용자 기대와 배경에 맞게 어떻게 맥락에 민감하고 사회적으로 적응 가능한 방식으로 설계될 수 있는가?

주요 결과

  • WatChat는 타입 캐스팅과 배열에서 문자열으로의 변환에 대한 오해를 식별하고 수정함으로써 `[] + []`가 ""를 반환하는 놀라운 자바스크립트 동작을 추론하고 설명할 수 있다.
  • 시스템은 2^32개의 잠재적 정신 모델 공간을 밀리초 이내에 효율적으로 탐색하여 실시간 설명 생성이 가능하다.
  • WatChat가 생성한 설명은 대조적이고 선택적이며, 예상과 실제 동작 간의 핵심 차이점(예: 배열의 문자열화에서 괄호가 없는 것)에 집중한다.
  • 사용자의 기대를 묻는 방식으로 사용자 기대를 모델링함으로써 적응형 대화형 정신 모델 디버깅이 가능하다.
  • 이 프레임워크는 뒤집어져 특정 오해를 진단할 수 있는 고정밀도 교육적 예제를 생성할 수 있으며, 예를 들어 배열 연결 또는 문자열 변환에 대한 오해를 다룰 수 있다.
  • WatChat는 압도적인 LLM 기반 베이스라인(예: GPT-4)보다 대조적이고 인과적이며 사회적으로 적절한 설명을 생성함으로써 설명 품질에서 슈퍼어리어를 보였다. 이는 부정확하거나 너무 긴 단계별 추적을 피하고 있다.
Figure 2: WatChat’s user interface. The user enters an expression in a REPL, which offers a “WAT?” button alongside the output. When clicked, WatChat clarifies what the user expected, and offers an explanation. Panel “B” shows a case where multiple possible explanations were found. (The dialogs are
Figure 2: WatChat’s user interface. The user enters an expression in a REPL, which offers a “WAT?” button alongside the output. When clicked, WatChat clarifies what the user expected, and offers an explanation. Panel “B” shows a case where multiple possible explanations were found. (The dialogs are

이 논문 읽기

누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.

누빈트에서 이 논문 읽기

이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.