Toward Ultra-Long-Horizon Agentic Science: Cognitive Accumulation for Machine Learning Engineering

Xinyu Zhu, Yuzhu Cai, Zexi Liu, Bingyang Zheng, Cheng Wang, Rui Ye, Yuzhi Zhang, Linfeng Zhang, Weinan E, Siheng Chen, Yanfeng Wang

TL;DR

ML-Master 2.0 is an autonomous agent designed to tackle ultra-long-horizon machine learning engineering tasks without getting overwhelmed by data. By introducing Hierarchical Cognitive Caching (HCC)—a multi-tiered memory architecture inspired by computer systems—the agent distills raw execution logs into stable knowledge and cross-task wisdom. This approach achieves a state-of-the-art 56.44% medal rate on OpenAI’s MLE-Bench, significantly outperforming both open-source and proprietary baselines.

What Problem Does This Paper Address?

While Large Language Models (LLMs) excel at short-term reasoning, they struggle with "ultra-long-horizon" autonomy—tasks requiring strategic coherence and iterative troubleshooting over days or weeks.

In complex environments like Machine Learning Engineering (MLE), an agent generates massive amounts of raw data: code iterations, error messages, and verbose tool logs. If an agent naively crams all this history into its context window, it suffers from context saturation. The model becomes bogged down by low-level execution details, forgets its long-term experimental strategy, and ultimately fails to learn from its mistakes. The authors aim to solve this by shifting the context management paradigm from linear retention to structured "cognitive accumulation."

Methods

The core innovation is Hierarchical Cognitive Caching (HCC), which organizes an agent's context into three distinct layers based on temporal stability and reuse value:

  1. $\mathcal{L}_1$ Cache (Evolving Experience): The agent's short-term working memory. It holds high-fidelity, rapidly changing execution traces (the current research plan, active code patches, and raw terminal outputs) needed for immediate debugging.
  2. $\mathcal{L}_2$ Cache (Refined Knowledge): Mid-term strategic memory. Once an exploration phase completes, an LLM compresses the raw $\mathcal{L}_1$ trajectories into concise summaries, key judgments (e.g., "Feature X causes data leakage"), and insights, discarding the verbose logs.
  3. $\mathcal{L}_3$ Cache (Prior Wisdom): Long-term, task-agnostic memory. It stores transferable strategies distilled from completely solved tasks, such as robust model templates or stable hyperparameter choices, to warm-start future projects.
The ML-Master 2.0 Framework featuring Hierarchical Cognitive Caching (HCC)

Information moves dynamically between these layers via Context Migration protocols:

  • Prefetching: At the start of a task, the agent queries the $\mathcal{L}_3$ cache to seed its context with relevant historical wisdom.
  • Context Hit: The system pulls raw data from $\mathcal{L}_1$ if available; otherwise, it gracefully falls back to the compressed summaries in $\mathcal{L}_2$.
  • Context Promotion: LLM-based abstraction mechanisms periodically compress and promote data from $\mathcal{L}_1 \rightarrow \mathcal{L}_2$ (phase-level) and $\mathcal{L}_2 \rightarrow \mathcal{L}_3$ (task-level).

Datasets

The authors evaluated ML-Master 2.0 on OpenAI’s MLE-Bench, a benchmark containing 75 real-world Kaggle machine learning competitions that test end-to-end engineering capabilities. To quickly build up the agent's long-term $\mathcal{L}_3$ cache before evaluation, they utilized a warm-up dataset consisting of 407 historical Kaggle competitions (ensuring no overlap with MLE-Bench).

Key Insights and Ideas

  • Forgetting is a Feature: Long-horizon autonomy isn't achieved by building infinitely large context windows, but by structurally differentiating memory. Deleting raw terminal logs while preserving the rationale of a decision prevents cognitive overload.
  • Decoupling Strategy from Execution: By isolating immediate execution traces ($\mathcal{L}_1$) from mid-term insights ($\mathcal{L}_2$), the agent can maintain high-level strategic focus even during intense, multi-step debugging loops.
  • Effective Context Capping: In practice, the HCC architecture successfully capped peak context length from over 200k tokens down to approximately 70k tokens during complex tasks, proving that structured compression prevents context explosion.

Key Results

Evaluated under a strict 24-hour execution budget per task, ML-Master 2.0 achieved dominant results on MLE-Bench:

  • State-of-the-Art Performance: It achieved an overall average medal rate of 56.44%, marking a 92.7% relative improvement over the original ML-Master baseline.
  • Versatility Across Difficulties: Unlike other agents that drop off significantly in complex scenarios, ML-Master 2.0 maintained high performance across all task complexities: 75.76% in Low, 50.88% in Medium, and 42.22% in High difficulty tasks.
  • Human-Level Capability: The agent surpassed 50% of human participants in 63.1% of the tasks and maintained an exceptional valid submission rate of 95.6%.
Performance comparison of various agents on MLE-Bench across complexity levels.

Limitations and Future Work

  • Computational and Financial Cost: Running the full MLE-Bench benchmark is highly expensive. Due to these constraints, the comprehensive ablation studies were limited to a single representative run on a smaller subset ("MLE-Bench-Lite").
  • Inference Overhead for Promotion: The framework relies on advanced models (like DeepSeek with thinking capabilities) to perform context promotion. While used sparingly in this paper to save costs, optimizing the efficiency of this compression step remains a priority.
  • Domain Specificity: While machine learning engineering serves as an excellent computational proxy for scientific discovery, validating this hierarchical caching architecture in physical sciences (like automated chemistry or biology labs) is an open challenge.

Summary updated

Abstract

The advancement of artificial intelligence toward agentic science is currently bottlenecked by the challenge of ultra-long-horizon autonomy, the ability to sustain strategic coherence and iterative correction over experimental cycles spanning days or weeks. While Large Language Models (LLMs) have demonstrated prowess in short-horizon reasoning, they are easily overwhelmed by execution details in the high-dimensional, delayed-feedback environments of real-world research, failing to consolidate sparse feedback into coherent long-term guidance. Here, we present ML-Master 2.0, an autonomous agent that masters ultra-long-horizon machine learning engineering (MLE) which is a representative microcosm of scientific discovery. By reframing context management as a process of cognitive accumulation, our approach introduces Hierarchical Cognitive Caching (HCC), a multi-tiered architecture inspired by computer systems that enables the structural differentiation of experience over time. By dynamically distilling transient execution traces into stable knowledge and cross-task wisdom, HCC allows agents to decouple immediate execution from long-term experimental strategy, effectively overcoming the scaling limits of static context windows. In evaluations on OpenAI's MLE-Bench under 24-hour budgets, ML-Master 2.0 achieves a state-of-the-art medal rate of 56.44%. Our findings demonstrate that ultra-long-horizon autonomy provides a scalable blueprint for AI capable of autonomous exploration beyond human-precedent complexities.
BibTeX
@misc{zhu2026toward,
  author = {Xinyu Zhu and Yuzhu Cai and Zexi Liu and Bingyang Zheng and Cheng Wang and Rui Ye and Yuzhi Zhang and Linfeng Zhang and Weinan E and Siheng Chen and Yanfeng Wang},
  title = {{Toward Ultra-Long-Horizon Agentic Science: Cognitive Accumulation for Machine Learning Engineering}},
  year = {2026},
  eprint = {2601.10402},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.10402},
}
Figure