Table of Contents
Fetching ...

TALM: Dynamic Tree-Structured Multi-Agent Framework with Long-Term Memory for Scalable Code Generation

Ming-Tung Shen, Yuh-Jzer Joung

TL;DR

TALM tackles the challenge of scalable, reliable code generation by introducing a dynamic tree-structured multi-agent framework with localized re-reasoning and a long-term memory module. The framework enables flexible task decomposition, subtree-level error correction, and knowledge reuse via a vector-store memory, reducing recomputation while supporting continual improvement. Empirical results on HumanEval, BigCodeBench, and ClassEval show TALM achieves strong Pass@1 performance and improved token efficiency compared to prompting baselines and MapCoder, with memory providing greater benefits on longer-horizon tasks. These findings demonstrate TALM’s potential as a robust, scalable paradigm for autonomous, self-improving code-generation agents in real-world software engineering tasks.

Abstract

Agentic code generation requires large language models (LLMs) capable of complex context management and multi-step reasoning. Prior multi-agent frameworks attempt to address these challenges through collaboration, yet they often suffer from rigid workflows and high reasoning recovery costs. To overcome these limitations, we propose TALM (Tree-Structured Multi-Agent Framework with Long-Term Memory), a dynamic framework that integrates structured task decomposition, localized re-reasoning, and long-term memory mechanisms. TALM employs an extensible tree-based collaboration structure. The parent-child relationships, when combined with a divide-and-conquer strategy, enhance reasoning flexibility and enable efficient error correction across diverse task scopes. Furthermore, a long-term memory module enables semantic querying and integration of prior knowledge, supporting implicit self-improvement through experience reuse. Experimental results on HumanEval, BigCodeBench, and ClassEval benchmarks demonstrate that TALM consistently delivers strong reasoning performance and high token efficiency, highlighting its robustness and practical utility in complex code generation tasks.

TALM: Dynamic Tree-Structured Multi-Agent Framework with Long-Term Memory for Scalable Code Generation

TL;DR

TALM tackles the challenge of scalable, reliable code generation by introducing a dynamic tree-structured multi-agent framework with localized re-reasoning and a long-term memory module. The framework enables flexible task decomposition, subtree-level error correction, and knowledge reuse via a vector-store memory, reducing recomputation while supporting continual improvement. Empirical results on HumanEval, BigCodeBench, and ClassEval show TALM achieves strong Pass@1 performance and improved token efficiency compared to prompting baselines and MapCoder, with memory providing greater benefits on longer-horizon tasks. These findings demonstrate TALM’s potential as a robust, scalable paradigm for autonomous, self-improving code-generation agents in real-world software engineering tasks.

Abstract

Agentic code generation requires large language models (LLMs) capable of complex context management and multi-step reasoning. Prior multi-agent frameworks attempt to address these challenges through collaboration, yet they often suffer from rigid workflows and high reasoning recovery costs. To overcome these limitations, we propose TALM (Tree-Structured Multi-Agent Framework with Long-Term Memory), a dynamic framework that integrates structured task decomposition, localized re-reasoning, and long-term memory mechanisms. TALM employs an extensible tree-based collaboration structure. The parent-child relationships, when combined with a divide-and-conquer strategy, enhance reasoning flexibility and enable efficient error correction across diverse task scopes. Furthermore, a long-term memory module enables semantic querying and integration of prior knowledge, supporting implicit self-improvement through experience reuse. Experimental results on HumanEval, BigCodeBench, and ClassEval benchmarks demonstrate that TALM consistently delivers strong reasoning performance and high token efficiency, highlighting its robustness and practical utility in complex code generation tasks.
Paper Structure (23 sections, 5 figures, 4 tables, 1 algorithm)

This paper contains 23 sections, 5 figures, 4 tables, 1 algorithm.

Figures (5)

  • Figure 1: TALM workflow overview. The root agent decomposes the task into a tree of subtasks; child agents solve localized steps and return results upward.
  • Figure 2: Localized re-reasoning in TALM. Left: child-to-parent clarification when task specs are underspecified; Right: parent-initiated structure correction when decomposition is flawed.
  • Figure 3: Long-term memory mechanisms in TALM. The top part illustrates knowledge retrieval, where a new task is encoded and matched with similar past experiences in the vector database. The bottom part illustrates memory update, where validated outputs are stored and merged with existing records when overlap is detected.
  • Figure 4: Comparison of token consumption between TALM and MapCoder.
  • Figure 5: Effect of the long-term memory module over task sequence on ClassEval.