ChatPaper.aiChatPaper

프롬프트와 프로그램 간 상태 공유

Sharing State Between Prompts and Programs

December 16, 2025
저자: Ellie Y. Cheng, Logan Weber, Tian Jin, Michael Carbin
cs.AI

초록

대규모 언어 모델(LLM)의 부상은 새로운 유형의 프로그래밍, 즉 자연어 프로그래밍을 등장시켰습니다. 사용자가 LLM에게 자연어 처리, 코드 생성, 추론 등을 수행하도록 지시하는 프롬프트를 작성함으로써, 사용자는 LLM이 실행할 자연어 코드를 자연어로 작성하고 있습니다. 최근 연구 동향은 이러한 자연어 코드와 Python과 같은 형식 언어 간의 상호 운용성을 가능하게 하는 데 주목하고 있습니다. 본 논문은 자연어 코드와 프로그램 상태 간의 상호 운용성을 가능하게 하는 데 필요한 수동 작업을 제거하는 새로운 프로그래밍 추상화인 공유 프로그램 상태를 제안합니다. 공유 프로그램 상태를 통해 프로그래머는 프로그램 변수를 직접 작성하고, 프로그램 객체로 계산하며, 프로그램 내에서 제어 흐름을 구현하는 자연어 코드를 작성할 수 있습니다. 또한 프로그래밍 시스템을 확장하여 자연어 코드를 지원하도록 하는 자연 함수 인터페이스 명세 스키마를 제시하고, 이 스키마를 활용하여 공유 프로그램 상태를 자연 함수 인터페이스로 규정합니다. 공유 프로그램 상태는 Nightjar 프로그래밍 시스템에 구현되었습니다. Nightjar를 사용하면 프로그래머는 Python 프로그램 상태를 공유하는 자연어 코드를 포함하는 Python 프로그램을 작성할 수 있습니다. 실험 결과, Nightjar 프로그램은 수동으로 작성된 구현보다 동등하거나 더 높은 작업 정확도(+4-19%)를 달성하면서도 코드 라인 수를 평균 39.6% 줄일 수 있음을 보여줍니다. Nightjar 사용의 단점은 런타임 오버헤드가 발생할 수 있다는 점입니다(수동 구현 대비 0.4-4.3배의 런타임).
English
The rise of large language models (LLMs) has introduced a new type of programming: natural language programming. By writing prompts that direct LLMs to perform natural language processing, code generation, reasoning, etc., users are writing code in natural language -- natural language code -- for the LLM to execute. An emerging area of research enables interoperability between natural language code and formal languages such as Python. We present a novel programming abstraction, shared program state, that removes the manual work required to enable interoperability between natural language code and program state. With shared program state, programmers can write natural code that directly writes program variables, computes with program objects, and implements control flow in the program. We present a schema for specifying natural function interfaces that extend programming systems to support natural code and leverage this schema to specify shared program state as a natural function interface. We implement shared program state in the Nightjar programming system. Nightjar enables programmers to write Python programs that contain natural code that shares the Python program state. We show that Nightjar programs achieve comparable or higher task accuracy than manually written implementations (+4-19%), while decreasing the lines of code by 39.6% on average. The tradeoff to using Nightjar is that it may incur runtime overhead (0.4-4.3x runtime of manual implementations).
PDF01December 20, 2025