Persistent Cross-Attempt State Optimization for Repository-Level Code Generation

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Pan, Ruwei, Wang, Jiangshuai, Zhang, Qisheng, Zhu, Yueheng, Wu, Linhao, Yang, Zixiong, Zhang, Yakun, Zhang, Lu, Zhang, Hongyu
Format: Preprint
Published: 2026
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866908936754429952
author Pan, Ruwei
Wang, Jiangshuai
Zhang, Qisheng
Zhu, Yueheng
Wu, Linhao
Yang, Zixiong
Zhang, Yakun
Zhang, Lu
Zhang, Hongyu
author_facet Pan, Ruwei
Wang, Jiangshuai
Zhang, Qisheng
Zhu, Yueheng
Wu, Linhao
Yang, Zixiong
Zhang, Yakun
Zhang, Lu
Zhang, Hongyu
contents 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. LiveCoder maintains persistent task-specific state from prior attempts to guide subsequent generation. This state includes success knowledge, which captures reusable signals from previously strong repositories, failure knowledge, which records unsuccessful outcomes and their diagnostic signals, and a historical-best repository, which preserves the strongest result found so far and prevents regression. These components collectively transform repeated repository generation into a persistent, knowledge-driven optimization process. We evaluate LiveCoder using four frontier LLMs on two representative repository-level code generation benchmarks. Extensive experimental results demonstrate the effectiveness and efficiency of LiveCoder, improving the functional score by up to 22.94 percentage points, increasing repository reuse to 81.58%, and reducing cost by up to 53.63% on RAL-Bench while maintaining broadly stable non-functional quality.
format Preprint
id arxiv_https___arxiv_org_abs_2604_03632
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Persistent Cross-Attempt State Optimization for Repository-Level Code Generation
Pan, Ruwei
Wang, Jiangshuai
Zhang, Qisheng
Zhu, Yueheng
Wu, Linhao
Yang, Zixiong
Zhang, Yakun
Zhang, Lu
Zhang, Hongyu
Software Engineering
Artificial Intelligence
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. LiveCoder maintains persistent task-specific state from prior attempts to guide subsequent generation. This state includes success knowledge, which captures reusable signals from previously strong repositories, failure knowledge, which records unsuccessful outcomes and their diagnostic signals, and a historical-best repository, which preserves the strongest result found so far and prevents regression. These components collectively transform repeated repository generation into a persistent, knowledge-driven optimization process. We evaluate LiveCoder using four frontier LLMs on two representative repository-level code generation benchmarks. Extensive experimental results demonstrate the effectiveness and efficiency of LiveCoder, improving the functional score by up to 22.94 percentage points, increasing repository reuse to 81.58%, and reducing cost by up to 53.63% on RAL-Bench while maintaining broadly stable non-functional quality.
title Persistent Cross-Attempt State Optimization for Repository-Level Code Generation
topic Software Engineering
Artificial Intelligence
url https://arxiv.org/abs/2604.03632