Keywords: natural language programming, large language model, programming languages
TL;DR: We present a novel programming abstraction, shared program state, that enables programmers to use natural language prompts to to directly write program variables, compute with objects, and implement control flow in programs.
Abstract: The rise of large language models (LLMs) has introduced a new type of programs: Natural language programs. By writing prompts directing LLMs to perform natural language processing, code generation, reasoning, etc., LLM users are writing code in natural language for the LLM to execute.
An emerging trend of active research enables interoperability between natural language and formal languages such as Python.
We present a novel programming abstraction: Shared program state.
Shared program state removes the work of enabling interoperability between natural code---natural language prompts---and the program state from the programmer.
With shared program state, programmers can write natural code that directly write program variables, compute with objects, and implement control flow in the program.
We present a template for designing natural function interfaces to extend system support for natural code.
We specified shared program state as a natural function interface and implemented it as the Nightjar programming system.
Nightjar enables programmers to write executable Python programs containing natural code using the shared program state abstraction.
Our evaluation shows that programs with shared program state achieves the same program accuracy as manually written implementations by programmers (66-75%), while decreasing the lines of code by 23.8% to 82.1%.
Supplementary Material: zip
Primary Area: neurosymbolic & hybrid AI systems (physics-informed, logic & formal reasoning, etc.)
Submission Number: 19430
Loading