L2MAC: Large Language Model Automatic Computer for Extensive Code Generation

📄 arXiv: 2310.02003v6 📥 PDF

作者: Samuel Holt, Max Ruiz Luyten, Mihaela van der Schaar

分类: cs.SE, cs.AI, cs.LG, cs.PL

发布日期: 2023-10-02 (更新: 2025-06-27)

备注: Published in The Twelfth International Conference on Learning Representations (ICLR), 2024. Copyright 2023 by the author(s)


💡 一句话要点

提出L2MAC以解决长输出生成问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 大型语言模型 长输出生成 自动计算机 多代理系统 系统设计 文本生成 记忆增强

📋 核心要点

  1. 现有的增强记忆LLMs方法无法有效处理长输出生成任务,限制了其应用范围。
  2. L2MAC通过引入指令注册表和文件存储,构建了一个多代理系统,能够生成长且一致的输出。
  3. 实验结果显示,L2MAC在生成大型代码库和文本任务方面的性能显著优于现有方法。

📝 摘要(中文)

基于Transformer的大型语言模型(LLMs)受到固定上下文窗口的限制,影响其生成长且连贯输出的能力。尽管增强记忆的LLMs是一种有前景的解决方案,但现有方法无法处理长输出生成任务。本文提出L2MAC,这是第一个实用的基于LLM的通用存储程序自动计算机框架,旨在生成长且一致的输出。L2MAC的内存由指令注册表和文件存储两部分组成,能够有效管理上下文并确保与文件存储的有效交互。实验表明,L2MAC在生成系统设计任务的大型代码库方面表现出色,显著优于其他编码方法,并且适用于一般性的大规模文本任务。

🔬 方法详解

问题定义:本文旨在解决现有增强记忆LLMs在长输出生成中的局限性,尤其是固定上下文窗口导致的输出不连贯问题。现有方法通常只关注记忆的读取,无法有效演化记忆内容。

核心思路:L2MAC通过构建一个基于LLM的多代理系统,结合指令注册表和文件存储,来实现长输出的生成。每个指令由独立的LLM代理执行,控制单元管理上下文,确保与文件存储的有效交互。

技术框架:L2MAC的整体架构包括两个主要模块:指令注册表和文件存储。指令注册表存储用户任务的提示程序,文件存储则包含最终和中间输出。控制单元负责管理各个代理的上下文,确保指令的顺序执行和内存的有效读写。

关键创新:L2MAC的创新在于其将LLM与存储程序计算机架构相结合,形成一个通用的长输出生成框架。这种设计突破了传统LLMs的上下文限制,能够处理复杂的用户指定任务。

关键设计:在设计中,L2MAC的控制单元采用精确的记忆读写机制,确保指令的执行顺序和上下文的有效管理。此外,系统的参数设置和网络结构经过优化,以适应长输出生成的需求。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果表明,L2MAC在生成大型代码库方面达到了最先进的性能,相较于其他编码方法,其在实现复杂用户指定任务时的表现提升了显著的幅度,具体性能数据未详述。

🎯 应用场景

L2MAC的研究成果在多个领域具有广泛的应用潜力,包括软件开发、自动化文档生成和内容创作等。其能够生成长篇代码和文本的能力,能够大幅提升开发效率和创作质量,未来可能在智能编程助手和自动化写作工具中发挥重要作用。

📄 摘要(原文)

Transformer-based large language models (LLMs) are constrained by the fixed context window of the underlying transformer architecture, hindering their ability to produce long and coherent outputs. Memory-augmented LLMs are a promising solution, but current approaches cannot handle long output generation tasks since they (1) only focus on reading memory and reduce its evolution to the concatenation of new memories or (2) use very specialized memories that cannot adapt to other domains. This paper presents L2MAC, the first practical LLM-based general-purpose stored-program automatic computer (von Neumann architecture) framework, an LLM-based multi-agent system, for long and consistent output generation. Its memory has two components: the instruction registry, which is populated with a prompt program to solve the user-given task, and a file store, which will contain the final and intermediate outputs. Each instruction in turn is executed by a separate LLM agent, whose context is managed by a control unit capable of precise memory reading and writing to ensure effective interaction with the file store. These components enable L2MAC to generate extensive outputs, bypassing the constraints of the finite context window while producing outputs that fulfill a complex user-specified task. We empirically demonstrate that L2MAC achieves state-of-the-art performance in generating large codebases for system design tasks, significantly outperforming other coding methods in implementing the detailed user-specified task; we show that L2MAC works for general-purpose extensive text-based tasks, such as writing an entire book; and we provide valuable insights into L2MAC's performance improvement over existing methods.