Papers
Topics
Authors
Recent
2000 character limit reached

Self-Organized Agents: A LLM Multi-Agent Framework toward Ultra Large-Scale Code Generation and Optimization (2404.02183v1)

Published 2 Apr 2024 in cs.SE, cs.AI, cs.CL, cs.LG, and cs.MA

Abstract: Recent advancements in automatic code generation using LLM agent have brought us closer to the future of automated software development. However, existing single-agent approaches face limitations in generating and improving large-scale, complex codebases due to constraints in context length. To tackle this challenge, we propose Self-Organized multi-Agent framework (SoA), a novel multi-agent framework that enables the scalable and efficient generation and optimization of large-scale code. In SoA, self-organized agents operate independently to generate and modify code components while seamlessly collaborating to construct the overall codebase. A key feature of our framework is the automatic multiplication of agents based on problem complexity, allowing for dynamic scalability. This enables the overall code volume to be increased indefinitely according to the number of agents, while the amount of code managed by each agent remains constant. We evaluate SoA on the HumanEval benchmark and demonstrate that, compared to a single-agent system, each agent in SoA handles significantly less code, yet the overall generated code is substantially greater. Moreover, SoA surpasses the powerful single-agent baseline by 5% in terms of Pass@1 accuracy.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (27)
  1. Gemini: A family of highly capable multimodal models. CoRR, abs/2312.11805.
  2. W Ross Ashby. 1947. Principles of the self-organizing dynamic system. The Journal of general psychology, 37(2):125–128.
  3. Language models are few-shot learners. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual.
  4. Evaluating large language models trained on code. CoRR, abs/2107.03374.
  5. Self-collaboration code generation via chatgpt. CoRR, abs/2304.07590.
  6. Incoder: A generative model for code infilling and synthesis. In The Eleventh International Conference on Learning Representations, ICLR 2023, Kigali, Rwanda, May 1-5, 2023. OpenReview.net.
  7. Metagpt: Meta programming for multi-agent collaborative framework. CoRR, abs/2308.00352.
  8. Agentcoder: Multi-agent-based code generation with iterative testing and optimisation. CoRR, abs/2312.13010.
  9. Same task, more tokens: the impact of input length on the reasoning performance of large language models. CoRR, abs/2402.14848.
  10. Loogle: Can long-context language models understand long contexts? CoRR, abs/2311.04939.
  11. Starcoder: may the source be with you! CoRR, abs/2305.06161.
  12. Competition-level code generation with alphacode. CoRR, abs/2203.07814.
  13. Self-refine: Iterative refinement with self-feedback. In Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems 2023, NeurIPS 2023, New Orleans, LA, USA, December 10 - 16, 2023.
  14. Octopack: Instruction tuning code large language models. CoRR, abs/2308.07124.
  15. Skeleton-of-thought: Large language models can do parallel decoding. CoRR, abs/2307.15337.
  16. OpenAI. 2023. GPT-4 technical report. CoRR, abs/2303.08774.
  17. Communicative agents for software development. CoRR, abs/2307.07924.
  18. Toolformer: Language models can teach themselves to use tools. In Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems 2023, NeurIPS 2023, New Orleans, LA, USA, December 10 - 16, 2023.
  19. Zeroscrolls: A zero-shot benchmark for long text understanding. In Findings of the Association for Computational Linguistics: EMNLP 2023, Singapore, December 6-10, 2023, pages 7977–7989. Association for Computational Linguistics.
  20. Reflexion: language agents with verbal reinforcement learning. In Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems 2023, NeurIPS 2023, New Orleans, LA, USA, December 10 - 16, 2023.
  21. Llama 2: Open foundation and fine-tuned chat models. CoRR, abs/2307.09288.
  22. Chain-of-thought prompting elicits reasoning in large language models. In Advances in Neural Information Processing Systems 35: Annual Conference on Neural Information Processing Systems 2022, NeurIPS 2022, New Orleans, LA, USA, November 28 - December 9, 2022.
  23. Tree of thoughts: Deliberate problem solving with large language models. In Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems 2023, NeurIPS 2023, New Orleans, LA, USA, December 10 - 16, 2023.
  24. React: Synergizing reasoning and acting in language models. In The Eleventh International Conference on Learning Representations, ICLR 2023, Kigali, Rwanda, May 1-5, 2023. OpenReview.net.
  25. Self-edit: Fault-aware code editor for code generation. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), ACL 2023, Toronto, Canada, July 9-14, 2023, pages 769–787. Association for Computational Linguistics.
  26. LDB: A large language model debugger via verifying runtime execution step-by-step. CoRR, abs/2402.16906.
  27. Language agent tree search unifies reasoning acting and planning in language models. CoRR, abs/2310.04406.
Citations (20)

Summary

  • The paper introduces a multi-agent framework that scales code generation using distributed agents, achieving a 5% improvement in Pass@1 accuracy.
  • It employs a hierarchical structure where a Mother agent delegates tasks to Child agents, enabling parallel, efficient handling of complex codebases.
  • Experimental results show that the SoA framework outperforms single-agent systems, addressing context length limitations and enhancing automated code optimization.

Self-Organized Agents: A Framework for Large-Scale Code Generation and Optimization

Introduction

The recent progression in LLMs has substantially advanced automated code generation, yet significant limitations remain when dealing with voluminous, complex codebases using single-agent frameworks. This paper proposes the Self-Organized Agent (SoA) framework, a multi-agent approach designed to address these limitations by enabling scalable and efficient code generation and optimization.

In single-agent models, context length constraints introduce challenges in managing large codebases, ultimately impeding the ability to generate and optimize complex code efficiently. The SoA framework distributes tasks across multiple self-organized agents, each independently handling code generation and modification, thus allowing dynamic scalability based on problem complexity.

The authors evaluate the SoA framework using the HumanEval benchmark, showcasing its ability to produce significantly more code than a single-agent system with a 5% improvement in Pass@1 accuracy.

SoA Framework Overview

The SoA framework, illustrated in (Figure 1), addresses the limitations of single-agent systems by employing self-organization principles, which allow agents to operate independently yet coalesce their contributions efficiently. Figure 1

Figure 1: Comparative overview showing a single-agent system versus the distributed SoA multi-agent framework.

In contrast to a single-agent approach that is overwhelmed by increasing responsibilities as the codebase grows, the SoA paradigm optimally distributes tasks among agents. Each agent manages its portion of the codebase, facilitating efficient code generation and modification, even as complexity escalates. Additionally, agents can autonomously multiply based on the complexity of the problem.

Code Generation and Modification Methodology

The code generation process within SoA is depicted in (Figure 2). Child agents are responsible for implementing specific functions from docstrings provided by a central Mother agent, which coordinates higher-level task delegation. Figure 2

Figure 2: Code generation coordination between Mother and Child agents within the SoA framework.

In this hierarchical structure, the Mother agent generates a skeleton function and allocates subtasks to newly spawned agents, allowing parallel processing (Figure 3). This methodology enhances scalability by ensuring no single agent bears the burden of the entire codebase. Figure 3

Figure 3: Detail of state propagation and collaboration for code modification among agents.

Experimentation and Results

The evaluation against competitive models like Reflexion, AlphaCode, and Codex demonstrates SoA's superior scalability and efficiency. As outlined in (Figure 4), SoA achieves a 5% higher Pass@1 accuracy rate compared to the Reflexion agent, emphasizing its robust performance in generating functional and extensive code. Figure 4

Figure 4: Comparative analysis of code generation volumes between SoA and Reflexion frameworks.

Implications and Future Work

The implications of the SoA framework are significant for advancing automated software development. Its multi-agent strategy could ease the complexity in developing large-scale applications and handling intricate code dependencies.

Looking ahead, further optimization of communication and synergy among agents can enhance SoA's adaptability for even larger and more complex projects. Additionally, integration of even more advanced LLMs could provide further improvements in code quality and development speed.

Conclusion

This paper presents the SoA framework as a robust alternative to single-agent systems for large-scale code generation. By leveraging the collective capability of self-organized agents, the framework overcomes existing scalability barriers, achieving higher performance and efficiency, making it a compelling approach for evolving automated programming tasks.

The potential of SoA lies in its dynamic scalability and efficient task allocation among agents, presenting opportunities for future research to further push the boundaries of automated software development.

Whiteboard

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.

Tweets

Sign up for free to view the 3 tweets with 23 likes about this paper.