Since their inception, programming languages have trended towards greater readability and lower barriers for programmers. Following this trend, natural language can be a promising type of programming language that provides great flexibility and usability and helps towards the democracy of programming. However, the inherent vagueness, ambiguity, and verbosity of natural language pose significant challenges in developing an interpreter that can accurately understand the programming logic and execute instructions written in natural language. Fortunately, recent advancements in Large Language Models (LLMs) have demonstrated remarkable proficiency in interpreting complex natural language. Inspired by this, we develop a novel system for Code Representation and Execution (CoRE), which employs LLM as interpreter to interpret and execute natural language instructions. The proposed system unifies natural language programming, pseudo-code programming, and flow programming under the same representation for constructing language agents, while LLM serves as the interpreter to interpret and execute the agent programs. In this paper, we begin with defining the programming syntax that structures natural language instructions logically. During the execution, we incorporate external memory to minimize redundancy. Furthermore, we equip the designed interpreter with the capability to invoke external tools, compensating for the limitations of LLM in specialized domains or when accessing real-time information. This work is open-source at https://github.com/agiresearch/CoRE, https://github.com/agiresearch/OpenAGI, and https://github.com/agiresearch/AIOS.
翻译:自诞生以来,编程语言一直朝着提升可读性、降低程序员门槛的方向发展。顺应这一趋势,自然语言有望成为一种极具灵活性和可用性的编程语言,助力实现编程民主化。然而,自然语言固有的模糊性、歧义性和冗长性,对开发能够准确理解编程逻辑并执行自然语言指令的解释器构成了重大挑战。幸运的是,近期大语言模型(LLMs)的发展已展现出其在解析复杂自然语言方面的卓越能力。受此启发,我们开发了一种新颖的代码表示与执行系统,该系统采用LLM作为解释器来解析并执行自然语言指令。所提出的系统将自然语言编程、伪代码编程和流程编程统一于同一表示框架下,用于构建语言智能体,而LLM则充当解释器来解析并执行这些智能体程序。本文首先定义了能够逻辑化组织自然语言指令的编程语法。在执行过程中,我们引入外部记忆以最小化冗余。此外,我们为设计的解释器赋予了调用外部工具的能力,以弥补LLM在特定领域或需要获取实时信息时的局限性。本工作已在 https://github.com/agiresearch/CoRE、https://github.com/agiresearch/OpenAGI 和 https://github.com/agiresearch/AIOS 开源。