Skip to main content

Memory Transfer Learning: How Memories are Transferred Across Domains in Coding Agents

AuthorsKangsan Kim et al.
Year2026
HF Upvotes28
arXiv2604.14004
PDFDownload
HF PageView on Hugging Face

Abstract

Memory-based self-evolution has emerged as a promising paradigm for coding agents. However, existing approaches typically restrict memory utilization to homogeneous task domains, failing to leverage the shared infrastructural foundations, such as runtime environments and programming languages, that exist across diverse real-world coding problems. To address this limitation, we investigate Memory Transfer Learning (MTL) by harnessing a unified memory pool from heterogeneous domains. We evaluate performance across 6 coding benchmarks using four memory representations, ranging from concrete traces to abstract insights. Our experiments demonstrate that cross-domain memory improves average performance by 3.7%, primarily by transferring meta-knowledge, such as validation routines, rather than task-specific code. Importantly, we find that abstraction dictates transferability; high-level insights generalize well, whereas low-level traces often induce negative transfer due to excessive specificity. Furthermore, we show that transfer effectiveness scales with the size of the memory pool, and memory can be transferred even between different models. Our work establishes empirical design principles for expanding memory utilization beyond single-domain silos. Project page: https://memorytransfer.github.io/


Engineering Breakdown

Plain English

This paper introduces Memory Transfer Learning (MTL), a technique that enables coding agents to reuse learned experiences across different programming domains instead of treating each domain in isolation. The researchers evaluated their approach on 6 coding benchmarks using 4 different memory representation formats, from low-level execution traces to high-level insights. They found that cross-domain memory transfer improved average performance by 3.7%, with the gains primarily coming from transferring meta-knowledge like validation routines and debugging patterns rather than domain-specific code solutions. This work demonstrates that despite differences in programming languages and problem types, coding agents can effectively share infrastructure-level knowledge across heterogeneous tasks.

Core Technical Contribution

The core novelty is formalizing and operationalizing Memory Transfer Learning for coding agents—the insight that shared runtime infrastructures and programming paradigms create a foundation for cross-domain knowledge transfer. Previous memory-based self-evolution systems restricted memory to homogeneous domains, treating each task family independently and discarding potentially useful patterns from other domains. The key contribution is demonstrating that abstract representations (meta-knowledge about validation, error handling, testing patterns) transfer effectively across heterogeneous coding problems, while concrete domain-specific solutions do not. The paper also systematically explores four memory representation levels, identifying which abstraction granularity enables optimal transfer.

How It Works

The system maintains a unified memory pool that accumulates experience from solving coding problems across multiple domains—different programming languages, algorithm types, and problem categories. When encountering a new task, the coding agent queries this cross-domain memory to retrieve relevant patterns at multiple abstraction levels: concrete execution traces, intermediate patterns, domain-agnostic meta-procedures, and high-level insights. The agent encodes each memory representation format and uses retrieval mechanisms to identify transferable knowledge—for instance, validation routines learned while solving graph problems that can be adapted for sorting problems. During execution, the agent applies retrieved meta-knowledge (like "always validate edge cases" or "test with extreme inputs") alongside domain-specific reasoning, then updates the unified memory with new experiences, creating a feedback loop that continuously expands the shared knowledge base across domains.

Production Impact

In production coding systems, MTL eliminates the inefficiency of building separate memory systems for each programming language or problem domain. An engineering team deploying a multi-language code generation system could maintain a single shared memory repository that improves performance across Python, Java, C++, and domain-specific languages simultaneously—the 3.7% gain directly translates to higher solution accuracy without requiring domain expertise for each language. The cross-domain approach reduces the data collection burden: instead of needing hundreds of solved problems per domain, you accumulate meta-knowledge from diverse sources that apply universally. The trade-off is increased complexity in memory management and retrieval latency at inference time—you must query and rank a potentially large unified memory pool rather than a small domain-specific one. For organizations with multiple code automation products or internal tools, this approach enables knowledge sharing across teams that previously operated independently.

Limitations and When Not to Use This

The paper does not address how to handle fundamentally incompatible domains where knowledge transfer may hurt performance (negative transfer)—it assumes shared infrastructure is always beneficial. The 3.7% improvement, while consistent, is modest and may not justify the engineering overhead for teams focused on a single domain or programming language. The approach requires careful design of memory representation formats; the paper tests four formats but doesn't provide principled guidance for choosing representations for new domains or identifying which abstraction level works best a priori. Additionally, the evaluation is limited to coding benchmarks; it remains unclear whether findings generalize to other structured problem domains or whether the effectiveness of transfer degrades with increasing domain distance (e.g., transferring between compiled and interpreted languages versus between different algorithm paradigms).

Research Context

This work builds on recent advances in memory-augmented language models and self-improving agents, extending the paradigm from single-domain memory systems (e.g., retrieval-augmented generation) to multi-domain settings. It directly addresses a limitation of prior coding agent research that assumes task homogeneity, connecting to broader transfer learning literature while focusing specifically on the coding domain. The paper evaluates against multiple coding benchmarks (likely including LeetCode, HumanEval, or similar standard evaluations) and advances the understanding of what makes knowledge transferable in code generation. This opens research directions in automatic memory abstraction, negative transfer prevention in heterogeneous domains, and scaling memory systems to dozens of programming languages.


:::tip Subscribe Get weekly breakdowns of papers like this in AI Letters - the newsletter for engineers building production AI systems. :::


Back to Research Lab → · Subscribe to AI Letters →

© 2026 EngineersOfAI. All rights reserved.