arXiv:2608.29622cs.MAAug 2026

Manuscript Offprint

arXiv:2608.29622

AgenticRag-R1: Agentic Reinforcement Learning with Stack Memory for Multi-Step Reasoning, Retrieval and Memorizing

Xinke Jiang, Yue Fang, Zhibang Yang, Jiaran Gao, Zhixin Zhang, Tao Feng, Rihong Qiu, Wentao Zhang, Hongxin Ding, Ruizhe Zhang, Yongxin Xu, Yuheng Huang, Xu Chu, Junfeng Zhao, Yasha Wang

Xinke Jiang 1,2,3,∗^{1,2,3,*}, Yue Fang 1,2,3,∗^{1,2,3,*}, Zhibang Yang 1,2,3,∗^{1,2,3,*}, Jiaran Gao 1,2,3,∗^{1,2,3,*}, Zhixin Zhang 1,2,3,∗^{1,2,3,*}, Tao Feng 1^{1}, Rihong Qiu 1,2,3^{1,2,3}, Wentao Zhang 1^{1}, Hongxin Ding 1,2^{1,2}, Ruizhe Zhang 1,2,3^{1,2,3}, Yongxin Xu 1,3^{1,3}, Yuheng Huang 4^{4}, Xu Chu 2,3,5,†^{2,3,5,\dagger}, Junfeng Zhao 2,3,†^{2,3,\dagger}, Yasha Wang 1,6,†^{1,6,\dagger}

1^{1}National Engineering Research Center of Software Engineering, Peking University, Beijing, China

2^{2}School of Computer Science, Peking University, Beijing, China

3^{3}Key Laboratory of High Confidence Software Technologies, Ministry of Education, Beijing, China

4^{4}GRG Banking Equipment Co., Ltd., Guangzhou, China

5^{5}Center on Frontiers of Computing Studies, Peking University, Beijing, China

6^{6}Peking University Information Technology Institute (Tianjin Binhai), Tianjin, China

∗^{*}Equal contribution †\daggerCorresponding authors

{xinkejiang, yangzb}@stu.pku.edu.cn; {chu_xu, zhaojf, wangyasha}@pku.edu.cn

Abstract

Retrieval-Augmented Generation (RAG) improves the factuality of large language models (LLMs), yet existing RAG systems often struggle with complex, multi-step reasoning that requires adaptive retrieval and continuous revision of intermediate contexts. Recent reinforcement learning (RL)-based agentic RAG methods partially alleviate this issue, but typically rely on coarse-grained action spaces and trajectory-level rewards, resulting in weak reward assignment and a bias toward short-horizon, stereotyped reasoning template. To address, we propose AGENTICRAG-R1, a RL framework that deeply integrates reasoning, retrieval, and memory via a memory stack and fine-grained action space, supported by hierarchical action-aware rewards and an information-aware trajectory rejection strategy to enable effective long-horizon learning. Experiments across a diverse set of multi-hop, open-domain, and agentic reasoning benchmarks, spanning multiple backbone model sizes, demonstrate that AGENTICRAG-R1 consistently outperforms strong baselines. Moreover, AGENTICRAG-R1 learns more robust, interpretable, and memory-aware reasoning behaviors, highlighting the effect of fine-grained action modeling and information-aware optimization for long-horizon reasoning. Our code is anonymous available at https://github.com/jiangxinke/Harness-RL/tree/AgenticRAG-R1-Whitebox.

1 Introduction

Large Language Models (LLMs) have achieved impressive performance across a broad range of natural language processing tasks (Kaplan et al., 2020; Yang et al., 2024b; Guo et al., 2025; Vu

Figure

Figure 1: Conventional Agentic vs AGENTICRAG-R1 for multi-step reasoning and retrieval. Conventional methods adopt coarse-grained, append-only memory and shallow retrieval, leading to error accumulation and short-horizon. AGENTICRAG-R1 employs fine-grained, reversible memory actions and information-aware rollout selection, for robust long-horizon reasoning.

et al., 2024; Chang et al., 2024). However, despite their strengths, LLMs still remain prone to factual errors (Ji et al., 2023a; Cao et al., 2020; Ji et al., 2023b; Jiang et al., 2024b), outdated knowledge (He et al., 2022) and limited domain-specific expertise (Kandpal et al., 2023), making Retrieval-Augmented Generation (RAG) (Edge et al., 2024; Asai et al., 2024; Yang et al., 2024c) a promising solution by enabling access to external knowledge for improved accuracy and adaptability.

In contrast, many real-world decision-making tasks are inherently complicated (Gao et al., 2025), requiring models to decompose problems into multiple interdependent steps rather than relying on one-off reasoning or single-step retrieval (Shao et al., 2023; Press et al., 2022). Such settings demand not only access to external knowledge, but also the ability to dynamically decide when and what to retrieve as the reasoning process unfolds (Lee et al., 2024; Jeong et al., 2024). Crucially, retrieved information could be continuously integrated into the model's evolving internal state, influencing subsequent reasoning and decision making. This tight coupling between reasoning and retrieval makes their deep integration a critical yet underexplored challenge.

Early attempts to integrate reasoning and retrieval primarily relied on manually crafted prompting strategies (Press et al., 2022; Shao et al., 2023; Trivedi et al., 2023; Jiang et al., 2024a; Li et al., 2025), and were later extended through Supervised Fine-Tuning (SFT) to better coordinate their interaction (Wang et al., 2025b). While effective in specific settings, these approaches depend heavily on heuristic design and often overfit to fixed reasoning patterns, without intrinsically improving the model's ability to jointly reason and retrieve (Chu et al., 2025a). More recently, Reinforcement Learning (RL) has emerged as a promising paradigm for enhancing complex reasoning, as demonstrated by OpenAI O1 (OpenAI, 2025) and DeepSeek-R1 (Guo et al., 2025). Motivated by this success, several studies have begun to apply RL to retrieval-augmented settings, training models to invoke external retrieval tools during reasoning (Jin et al., 2025; Dong et al., 2025a,b; Zhou et al., 2025; Liu et al., 2026). As illustrated in Figure 1, most existing RL-based RAG rely on coarse-grained action modeling, treating retrieval as a single or shallow action, which limits fine-grained control over complex tasks and biases policy learning toward short-horizon, easily reproducible reasoning templates than long-horizon retrieval and reasoning, posing two challenges:

① Challenge 1. How to expose fine-grained, memory-aware action-making and reward allocation in multi-step reasoning and retrieval. Deep integration of reasoning and retrieval requires LLMs not only to acquire external information, but also to continuously manage and revise intermediate content memory under noisy and uncertain conditions. In multi-step reasoning, both external retrieval and internal inference inevitably introduce noise: retrieved documents may be irrelevant or misleading (Yao et al., 2022b; Shinn et al., 2023; Liu et al., 2023), while intermediate reasoning steps may contain logical errors or overconfident assumptions (Jiang et al., 2024a; Xiong et al., 2024; Hao et al., 2023). If such noisy intermediate conclusions are written into context memory without the ability to be inspected, revised, or discarded, they tend to propagate and amplify over steps, effectively corrupting the agent's internal decision state (Ning et al., 2025; Hoscilowicz et al., 2024; Lai et al., 2024). However, most existing RL-based agentic methods adopt a highly coarse-grained action formulation, collapsing the entire reasoning and retrieval processes into a single latent and memory-appending <think> and <search> action template (Dong et al., 2025a,b; Zhou et al., 2025), which are then stored as irreversible content. This limitation is further exacerbated by reward design, where outcome rewards are evaluated only on final correctness, overlooking the contributions of intermediate actions throughout the trajectory (Shao et al., 2024; Jin et al., 2025). Without fine-grained, memory-aware action and reward signals, RL suffers from weak reward assignment and is biased toward shallow, template-like strategies.

② Challenge 2. How to expose reinforcement learning to sufficiently diverse and high-information reasoning and retrieval rollouts. Even with fine-grained action spaces and memory-aware reward mechanisms, RL may still fail to learn robust long-horizon reasoning if the training distribution is dominated by low information trajectories. Most multi-hop and retrieval-augmented tasks are simple—requiring only a single retrieval step or shallow reasoning—so these short-horizon trajectories often yield higher immediate rewards than more complex, long-horizon ones (Gao et al., 2025; Zhou et al., 2025). As a result, RL tends to overfit to low-information, trivially rewarding trajectories, rarely exercising actions such as revising, summarizing, or planning, and under-optimizing the long-horizon combinations of cognitive actions (Wang et al., 2025c).

To address the above challenges, we propose AGENTICRAG-R1, a reinforcement learning framework that achieves deep integration of reasoning, retrieval and memorizing through fine-grained action modeling and action-aligned reward mechanisms. ① For C1, we design a structured multi-action space together with a stack-based memory which represents the agent's internal state across multi-step reasoning. The memory stack allows intermediate actions to be selectively pushed, revised, or popped, enabling the agent to inspect and correct noisy information accumulated during reasoning and retrieval. Specifically, our framework supports distinct cognitive actions such as <think>, <search>, and <plan>, as well as memory-oriented actions such as <summary> and <backtrack>, which operate over the memory stack to refine or retract intermediate actions. This action design is further complemented by an action-aware reward attribution mechanism that assigns process rewards to each actions, providing fine-grained reward supervision. ② For C2, we introduce a dynamic training trajectories rejection strategy that rejects low-information trajectories and prioritizes high-reward rollouts while up-weighting inputs whose rollouts exhibit meaningful dispersion. Inspired by rejection sampling (Liu et al.; Xiong et al., 2025), we define a cross-batch, information-awareness metric (Upper Confidence Bound-like) (Russo and Roy, 2014; Russo and Van Roy, 2013) that evaluates each trajectory based on both its rollout reward and the sample variance. This approach ensures trajectories eliciting diverse reasoning behaviors and requiring multi-step, long-horizon decision-making receive higher priority during training. In summary, our main contributions are as follows:

• We first formalize the agentic reinforcement learning process within a search-and-memory environment, and introduce a fine-grained, memory-aware action space together with action-aware process-level rewards. This design enables explicit supervision of heterogeneous cognitive actions and effectively mitigates error accumulation in the agent’s memory (C1).

• We introduce a dynamic, information-aware trajectories rejection strategy that filters low-information trajectories and prioritizes challenging, long-horizon samples with high behavioral variance, ensuring RL effectively explores and optimizes complex, multi-step reasoning strategies (C2).

• We evaluate AGENTICRAG-R1 on multiple multi-hop and RAG benchmarks, demonstrating improved reasoning performance, generalization, and applicability to complex downstream tasks, i.e., report generation.