CoReMem: Cost-Internalizing Memory for Successive Coding Tasks with Prospective Valuation
AuthorsPeiwen Li, Harshit Verma, Sophia Zhou, Haiwen Wang, Ngoc Bui, Heng Chang, Fei Fei, David van Dijk, Rex Ying
AffiliationsYale University · Tsinghua University · Goodvision AI*Equal contribution. Correspondence:peiwen.li@yale.edu
CoReMem helps coding agents carry forward useful repository knowledge while accounting for the cost of writing and using memory.
Key results
Successive coding-task chains in the benchmark.
CoReMem resolution rate, up from 21.0% with no memory and the untrained actor.
Fewer steps for CoReMem on Qwen3.8-27B-FP8 versus the untrained actor without memory.
Fewer total tokens, including memory-module calls, on Qwen3.8-27B-FP8 versus the untrained actor without memory.
Average gain over no memory across three open-weight actor models.
Share of original text retained while preserving the full median step saving on linked boundaries.
What the paper found
CoReMem targets coding agents that solve successive tasks in a repository whose code state carries forward, while future tasks are unknown. On ChainSWE, a benchmark of 100 task chains, it uses paired runs on the next task to identify which parts of an earlier session save effort, then builds compact memory around actionable anchors: repository locations and executable checks. It also adapts the actor with on-policy rollouts using its own memory, no memory, and deliberately misplaced memory; a provenance gate directs memory-value credit only to steps that use memory-supplied anchors. On the Qwen3.8-27B-FP8 actor, CoReMem raises resolution from 21.0% to 25.7%, while reducing steps by 17% and total cache-aware tokens by 11% versus the untrained actor without memory. Across three open-weight actors, it improves resolution per total token by an average of 41%; the selected memory retains the full median step saving with just 6% of the original text. Evaluations also include Gemma-4-31B and API models GPT-5.6 Luna, Claude Opus 5.5, and DeepSeek-V4-Flash, though post-training is reported for the open-weight actors.
Original abstract
Coding agents tackle successive tasks on an evolving repository, carrying forward edits and writing memory before the next task is known. Selecting memory for unknown next tasks requires balancing future usefulness against the costs of writing and reading it. The actor must also decide when acting on available memory saves effort as the task unfolds. We introduce Coding-Repository Memory (CoReMem), a cost-internalizing framework that guides memory design and actor adaptation through measured memory value on the next task. Prospective segment valuation compares runs of the next task with and without individual trajectory segments from the same inherited repository state, guiding a compact memory built around anchors: repository locations and executable checks. Actor adaptation estimates on-policy memory value within rollout groups with and without memory, using a reward that prioritizes resolution and penalizes step count in successful runs. Provenance-gated value credit assigns the additional value term to steps identified as using memory-supplied anchors, while every step retains outcome credit. On ChainSWE, CoReMem raises the 27B actor's resolve rate from 21.0% to 25.7%, with 17% fewer steps and 11% fewer total cache-aware tokens, including memory-module calls, relative to the untrained actor model without memory.
Read the original paperMore in Code Generation
Browse all 52 papers →CompoundingKernel: Self-Improving from Zero to First
Qian Qu, Hongyang Wang, Wenbo Chen, Yichuan Li, Jingguo Liu, Xian Li, Xuan Wang, Ruochen Wen, Leo Fan, Yiming Yan, Zheshen Wang, Benoit Dumoulin
CompoundingKernel uses parallel agents and an archive of successful attempts to discover fast, correct GPU kernels.
From Repositories to Training Environments: Scaling Long-Horizon Coding Agents with Environment Evolution Loop
Yang Tian, Tianyu Zheng, Xiyuan Yang, Yaxin Du, Chengran Yang, Bo Zhao, Jian Yang, Bryan Dai
RepoFactory turns real software repositories into training environments and iteratively improves them to help coding agents tackle longer, more realistic projects.
Ask, Don't Equip: Question-Driven Coding Agents for Deep Kernel Optimization
Gabriele Oliaro, Jaeseong Lee, Zhaoyuan Su, Sreeram Vennam, Zhihao Jia, Samyam Rajbhandari
KernelSeek shows how asking an AI coding agent the right question can help it build faster GPU kernels without handing it the answer.