Reproduce “Adaptive Critical Token-Aware Retrieval for Repository-Level Code Generation” on OpenResearch

Run Claude Code, Codex or any coding agent as a research agent: literature, hypotheses and experiments on your laptop, cluster or cloud GPUs.

Universal app for Apple silicon and Intel. Requires macOS 11 or later.

About this paper

Kefeng Duan, Dewu Zheng, Yanlin Wang, Terry Yue Zhuo, Mingwei Liu, Jianxing Yu, Jiachi Chen, Ensheng Shi and 3 more

ACTOR, an adaptive retrieval-augmented generation framework for repository-level code generation, identifies "critical tokens" during inference and dynamically retrieves targeted context to mitigate errors. This approach improved Pass@5 scores by 8.4% on RepoExec and 15.4% on CoderEval for CodeLlama-7B, enhancing the reliability of LLM-generated code within complex repositories.

Key insights

  • Errors in LLM-generated code often originate from a small percentage of "critical tokens" whose correctness is decisive for the final output, rather than being uniformly distributed.
  • Dynamically providing fine-grained, targeted context precisely when and where critical tokens are generated can effectively mitigate error propagation and significantly improve the functional correctness of generated code.
  • Critical tokens exhibit significant syntactic diversity and are not easily captured by static rules, requiring a flexible, inference-time assessment based on multiple signals (mismatch, uncertainty, attention influence).

Summary by alphaXiv.

Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.