Skip to content

[UT for RL] Add UT to cover release/resume memory case for moe model#8803

Merged
zhaochenyang20 merged 3 commits intosgl-project:mainfrom
ryang-max:rl_moe_ut
Sep 10, 2025
Merged

[UT for RL] Add UT to cover release/resume memory case for moe model#8803
zhaochenyang20 merged 3 commits intosgl-project:mainfrom
ryang-max:rl_moe_ut

Conversation

@ryang-max
Copy link
Copy Markdown
Contributor

@ryang-max ryang-max commented Aug 5, 2025

Motivation

Add unit test for MOE model release memory - resume memory - update weights workflow, to avoid break change that may have effect on RL workflow.

Modifications

Add a unit test case

Accuracy Test

Benchmark & Profiling

Checklist

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @ryang-max, 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!

I've added a new unit test to cover the critical workflow of releasing, resuming, and updating memory for Mixture-of-Experts (MoE) models. This change aims to prevent potential breaking changes that could impact reinforcement learning (RL) workflows, where such memory management and model update operations are common. The new test ensures that these complex memory operations function correctly and that model weights can be updated seamlessly after memory adjustments.

Highlights

  • New Unit Test for MoE Memory Management: I've introduced a new unit test, test_moe_model_release_and_resume, specifically designed to validate the memory release, memory resume, and weight update workflow for Mixture-of-Experts (MoE) models. This test is critical for ensuring the stability and correctness of memory management operations in MoE models, especially in scenarios like reinforcement learning (RL) where dynamic model updates might occur.
  • Refactoring of MoE Model Test Constants: To support the new MoE model tests, I've refactored the test utility constants by renaming DEFAULT_SMALL_MOE_MODEL_NAME_FOR_TEST to DEFAULT_SMALL_MOE_MODEL_NAME_FOR_TEST_BASE and adding DEFAULT_SMALL_MOE_MODEL_NAME_FOR_TEST_CHAT. This provides clearer distinctions between base and chat-tuned MoE models used in testing.
  • Enhanced Engine Setup for Expert Parallelism: I've updated the _setup_engine method in test_release_memory_occupation.py to accept an ep_size parameter. This allows for explicit configuration of expert parallel size during engine initialization, which is essential for properly testing MoE models in distributed or parallel environments.
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

  1. 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.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a unit test to cover the memory release and resume workflow for MoE models, which is important for reinforcement learning use cases. The changes are well-structured, introducing new test parameters and a dedicated test case for MoE models. I have one suggestion to improve code consistency by using an existing helper function for engine setup.

Comment thread test/srt/test_release_memory_occupation.py
Copy link
Copy Markdown
Collaborator

@zhuzilin zhuzilin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@zhaochenyang20 zhaochenyang20 merged commit dccf52f into sgl-project:main Sep 10, 2025
71 of 75 checks passed
@ShangmingCai ShangmingCai mentioned this pull request Sep 23, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants