Memory-as-Action: DCPO Training Framework
November 19, 2025 ยท View on GitHub
Paper: Memory as Action: Autonomous Context Curation for Long-Horizon Agentic Tasks
A reinforcement learning training framework based on verl 0.5.0, implementing the Dynamic Context Policy Optimization (DCPO) algorithm for training agents that can autonomously manage context.
๐ Introduction
This project provides a complete training framework supporting:
- Autonomous context management by agents (via memory editing tools)
- DCPO algorithm for reinforcement learning training
- Multi-turn conversations and tool calling
- Distributed training (with Ray support)
โจ Core Features
- DCPO Training: Reinforcement learning algorithm supporting trajectory segmentation and advantage estimation
- Memory Management Tools: Agents can actively edit context through tool calls
- Multi-turn Conversations: Support for long-horizon multi-turn interactions
- Tool Integration: Built-in search tools and context pruning tools
๐๏ธ Project Structure
rl_train/
โโโ DCPO/ # DCPO related configs and scripts
โ โโโ config/ # Training configuration files
โ โ โโโ mem_agent_loop_config.yaml
โ โ โโโ mem_search_tool_config_single.yaml
โ โโโ data/ # Training and validation data
โ โโโ scripts/ # Training scripts
โ โ โโโ run_dcpo_7B.sh
โ โ โโโ run_dcpo_14B_single.sh
โ โ โโโ reward_service.sh
โ โโโ tool_service/ # Tool service implementations
โ โโโ search_search_services.py
โ โโโ search_tool_single.py
โโโ verl/ # Core training framework
โ โโโ experimental/
โ โ โโโ agent_loop/ # Agent loop implementations
โ โ โโโ mem_agent_loop.py # MemAct agent loop
โ โ โโโ agent_loop.py # Base agent loop
โ โ โโโ tool_parser.py # Tool parser
โ โโโ trainer/ # Trainers
โ โ โโโ main_ppo.py # PPO main training entry
โ โ โโโ ppo/
โ โ โโโ core_algos.py # Core algorithms (including DCPO)
โ โ โโโ ray_trainer.py # Ray distributed training
โ โโโ tools/ # Tool implementations
โ โ โโโ base_tool.py
โ โ โโโ search_tool.py
โ โโโ utils/ # Utility functions
โโโ cold_start/ # Cold start related
โโโ data/
โโโ scripts/
๐ Quick Start
Requirements
- verl 0.5.0
- Multi-GPU environment (recommended: 8x H100 or equivalent)
Installation
- Install verl 0.5.0
pip install verl==0.5.0
- Install additional dependencies
pip install shortuuid uuid
pip install numpy==1.26.4
Data
Data files should be placed in */data/ directories.
Training Configuration
-
Modify training scripts (e.g.,
DCPO/scripts/run_dcpo_7B.sh):- Set model path:
model_path=/path/to/your/model - Set data paths:
train_filesandtest_files - Set log directory:
logdir - Configure GPU count and other training parameters
- Set model path:
-
Configure tools (if needed): Edit
DCPO/config/mem_search_tool_config_single.yamlto configure tool service addresses and parameters
Running Training
Before RL training, you need to start the reward service and retrieval service in advance.
๐ Configuration
Training Script Parameters
Main configurations are set in training scripts, overriding defaults via Hydra:
python3 -m verl.trainer.main_ppo \
--config-path="$CONFIG_PATH" \
--config-name='mem_agent_loop_config' \
algorithm.adv_estimator=dcpo \ # Use DCPO algorithm
data.train_batch_size=128 \
data.max_prompt_length=4096 \ # Max prompt length
data.max_response_length=20480 \ # Max response length
actor_rollout_ref.rollout.multi_turn.max_assistant_turns=40 \
actor_rollout_ref.rollout.n=12 \ # Number of segments per prompt used for training
actor_rollout_ref.rollout.actual_n=8 \ # Number of trajectories generated per prompt
...
Configuration Files
DCPO/config/mem_agent_loop_config.yaml: Main training configurationDCPO/config/mem_search_tool_config_single.yaml: Tool configuration- Search tool: Configure retrieval service URL and parameters
- Context pruning tool: For managing conversation history
Key Parameters
algorithm.adv_estimator=dcpo: Must be set todcpoto use DCPO algorithmactor_rollout_ref.rollout.actual_n: DCPO sampling strategy, samplensegments fromactual_ntrajectories for trainingactor_rollout_ref.rollout.multi_turn.max_assistant_turns: Maximum conversation turnsactor_rollout_ref.rollout.multi_turn.tool_config_path: Tool configuration file path
๐ Related Resources
- verl: https://github.com/volcengine/verl (version 0.5.0)
- Training is based on verl's PPO framework, using DCPO as the advantage estimator
๐ Citation
If you use this project, please cite our paper:
@article{zhang2025memory,
title={Memory as Action: Autonomous Context Curation for Long-Horizon Agentic Tasks},
author={Zhang, Yuxiang and Shu, Jiangming and Ma, Ye and Lin, Xueyuan and Wu, Shangxi and Sang, Jitao},
journal={arXiv preprint arXiv:2510.12635},
year={2025}
}
๐ License
This project is licensed under the MIT License. See the LICENSE file for details.
๐ง Contact
For questions or suggestions, please contact us