[example] Alfworld with General Multi-Step Workflow#169
[example] Alfworld with General Multi-Step Workflow#169hiyuchang merged 9 commits intoagentscope-ai:mainfrom
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @hiyuchang, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces a significant update to the Alfworld example, migrating it to a more generalized multi-step workflow architecture. This involves creating a new workflow class that leverages a common reward propagation mechanism, alongside new configuration files to support this setup. Additionally, it includes temporary, explicit modifications to batch size calculations to accommodate current framework limitations, with a clear intent for future refinement.
Highlights
- New Alfworld Workflow Implementation: Introduced
AlfworldWorkflowV2, a new version of the Alfworld workflow that inherits fromRewardPropagationWorkflow. This refactors the environment interaction to a more general, step-wise multi-turn approach, managing environment state, model responses, and reward calculation within the workflow. - Dedicated Example and Configuration: Added a new example directory (
examples/grpo_alfworld_general_multi_step) complete with aREADME.mdand new configuration files (alfworld.yaml,train_alfworld.yaml). These files are set up to use the newalfworld_workflow_v2and demonstrate its integration into the training pipeline. - Temporary Batch Size Adjustments: Implemented temporary, hardcoded adjustments to several batch sizes (
read_batch_size,train_batch_size,ppo_mini_batch_size) by multiplying them by 30 intrinity/common/config.pyandtrinity/common/verl_config.py. These changes are accompanied by warning messages, indicating they are invasive and will be addressed in a future framework update. - Enhanced Workflow Metrics: Modified the
RewardPropagationWorkflowto recordactual_env_stepswithin the experience metrics. This provides more granular data on the number of steps taken in the environment during each episode.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request introduces a new example for Alfworld using a general multi-step workflow, which is a great addition. The new AlfworldWorkflowV2 is well-structured and leverages the RewardPropagationWorkflow.
My main feedback revolves around several hardcoded values, particularly the multiplier 30 used for batch size calculations in the core configuration files. As noted in the new README, this is a temporary solution, but it's critical to address this to maintain the framework's generality. I've provided suggestions to make these values configurable by reading max_env_steps from the workflow's arguments.
Additionally, I've pointed out a few smaller issues in the new workflow implementation, such as other hardcoded values and an unused variable, to improve code quality and maintainability.
There was a problem hiding this comment.
Pull Request Overview
This PR introduces general multi-step workflow support for ALFWorld with Trinity-RFT framework, enabling step-wise training on environment interaction tasks. It refactors the existing ALFWorld workflow to use the RewardPropagationWorkflow base class and includes comprehensive documentation and examples.
- Added
StepWiseAlfworldWorkflowthat inherits fromRewardPropagationWorkflowfor step-wise environment interactions - Enhanced base workflow classes with optional OpenAI client usage configuration
- Added comprehensive documentation and example configurations for general multi-step training
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| trinity/common/workflows/step_wise_workflow.py | Added optional OpenAI client configuration and experience metrics tracking |
| trinity/common/workflows/envs/alfworld/alfworld_workflow.py | Implemented new StepWiseAlfworldWorkflow using RewardPropagationWorkflow base class |
| trinity/common/workflows/init.py | Exported the new StepWiseAlfworldWorkflow class |
| trinity/common/verl_config.py | Fixed comment typo and synchronized train_batch_size configuration |
| examples/grpo_alfworld_general_multi_step/ | Added complete example configuration and documentation for multi-step ALFWorld training |
| docs/sphinx_doc/source/tutorial/ | Added comprehensive tutorials for general multi-step workflows and ReAct agents |
| README.md / README_zh.md | Updated with links to new multi-step workflow tutorials |
|
/unittest-module-common |
Summary
Tests
Github Test Reporter by CTRF 💚 |
Description
[Please describe the background, purpose, changes made, and how to test this PR]
Checklist
Please check the following items before code is ready to be reviewed.