NTH

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

November 20, 2026 2 min read
Watch on YouTube
The one-line take

CoReMem helps coding agents carry forward useful repository knowledge while accounting for the cost of writing and using memory.

Key results

100
ChainSWE task chains

Successive coding-task chains in the benchmark.

25.7%
Qwen3.8-27B-FP8 resolve rate

CoReMem resolution rate, up from 21.0% with no memory and the untrained actor.

17%
Step reduction

Fewer steps for CoReMem on Qwen3.8-27B-FP8 versus the untrained actor without memory.

11%
Total cache-aware token reduction

Fewer total tokens, including memory-module calls, on Qwen3.8-27B-FP8 versus the untrained actor without memory.

41%
Average resolve-per-total-token improvement

Average gain over no memory across three open-weight actor models.

6%
Memory text retained

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 paper

More in Code Generation

Browse all 52 papers →
01Code Generation

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.

Read analysis