Persistent Cross-Attempt State Optimization for Repository-Level Code Generation
Summary: arXiv:2604.03632v1 Announce Type: cross
Abstract
Large language models (LLMs) have achieved substantial progress in repository-level code generation. However, solving the same repository-level task often requires multiple attempts, while existing methods still optimize each attempt in isolation and do not preserve or reuse task-specific state across attempts. In this paper, we propose LiveCoder, a novel framework for repository-level code generation based on cross-attempt knowledge optimization.
Introduction
LiveCoder maintains persistent task-specific state from prior attempts to guide subsequent generation. This state includes:
- Success Knowledge: Captures reusable signals from previously strong repositories.
- Failure Knowledge: Records unsuccessful outcomes and their diagnostic signals.
- Historical-Best Repository: Preserves the strongest result found so far and prevents regression.
Methodology
These components collectively transform repeated repository generation into a persistent, knowledge-driven optimization process. By leveraging insights gained from previous attempts, LiveCoder enhances the efficiency of code generation tasks.
Evaluation
We evaluate LiveCoder using four frontier LLMs on two representative repository-level code generation benchmarks. The performance metrics are designed to assess both functional and non-functional qualities of the generated repositories.
Results
Extensive experimental results demonstrate the effectiveness and efficiency of LiveCoder. Key findings include:
- Improvement in functional score by up to 22.94 percentage points.
- Increased repository reuse to 81.58%.
- Reduction in cost by up to 53.63% on RAL-Bench.
- Maintaining broadly stable non-functional quality throughout the evaluation.
Conclusion
LiveCoder represents a significant advancement in the field of repository-level code generation by introducing a framework that optimizes across multiple attempts. By preserving and utilizing knowledge from prior attempts, it not only improves the efficiency and effectiveness of code generation but also sets a new standard for future research in this domain.
Future Work
Future research may explore the integration of additional data types and learning strategies to further enhance the capabilities of LiveCoder. Furthermore, refining the mechanisms for knowledge preservation and reuse could lead to even more robust performance in various coding tasks.
