Skip to content

expert parallelism config in base rollout#1099

Open
khatwanimohit wants to merge 1 commit intomainfrom
mohit/dev
Open

expert parallelism config in base rollout#1099
khatwanimohit wants to merge 1 commit intomainfrom
mohit/dev

Conversation

@khatwanimohit
Copy link
Collaborator

@khatwanimohit khatwanimohit commented Feb 13, 2026

  • Add expert parallelism support for vLLM rollout: Introduces expert_parallel_size and enable_expert_parallelism configuration options across VllmConfig, RolloutConfig, and VllmRollout, enabling
    expert-parallel sharding for Mixture-of-Experts (MoE) models.
  • Update device partitioning logic to account for expert parallelism: Tensor parallel and data parallel size calculations now divide by expert_parallel_size, ensuring correct device allocation when
    expert parallelism is enabled.
  • Pass expert parallelism config into vLLM sharding strategy: When enable_expert_parallelism is set, the expert_parallelism size is included in the sharding strategy passed to vLLM's
    additional_config.
  • Add stop strings support for vLLM sampling: Introduces stop_strings config option (rollout_vllm_stop_strings) that allows specifying custom stop strings for generation, with automatic detokenization
    enabled when stop strings are set

Checklist

  • I have added all the necessary unit tests for my change.
  • I have verified that my change does not break existing code and all unit tests pass.
  • I have added all appropriate doc-strings/documentation.
  • My PR is based on the latest changes of the main branch (if unsure, rebase the code).
  • I have signed the Contributor License Agreement.
  • I have followed Contribution Guidelines.

@gemini-code-assist
Copy link

Summary of Changes

Hello @khatwanimohit, 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 significantly enhances the vLLM integration by introducing comprehensive support for expert parallelism, which is vital for efficiently deploying Mixture-of-Experts models. Additionally, it adds a new feature for controlling text generation by allowing users to define custom stop strings. These changes provide greater flexibility and control over vLLM deployments within the system.

Highlights

  • Expert Parallelism Support: Introduced expert_parallel_size and enable_expert_parallelism configuration options across VllmConfig, RolloutConfig, and VllmRollout to enable expert-parallel sharding for Mixture-of-Experts (MoE) models.
  • Updated Device Partitioning Logic: Modified tensor parallel and data parallel size calculations to divide by expert_parallel_size, ensuring correct device allocation when expert parallelism is enabled.
  • vLLM Sharding Strategy Integration: Passed the expert_parallelism size into vLLM's additional_config sharding strategy when enable_expert_parallelism is set.
  • Stop Strings Support for vLLM Sampling: Added a stop_strings configuration option (rollout_vllm_stop_strings) that allows specifying custom stop strings for generation, with automatic detokenization enabled.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • tunix/generate/vllm_sampler.py
    • Added stop_strings, expert_parallel_size, and enable_expert_parallelism fields to VllmConfig.
    • Updated the _vllm_config method to incorporate expert_parallel_size into tensor and data parallel size calculations.
    • Modified the sharding strategy passed to vLLM to include expert_parallelism when enabled.
    • Implemented logic in the __call__ method to use stop_strings for sampling and enable detokenization.
  • tunix/rl/rollout/base_rollout.py
    • Added expert_parallel_size to RolloutConfig.
    • Introduced rollout_vllm_stop_strings and rollout_vllm_enable_expert_parallelism to RolloutConfig.
  • tunix/rl/rollout/vllm_rollout.py
    • Modified the __init__ method to pass the new stop_strings, expert_parallel_size, and enable_expert_parallelism configurations from RolloutConfig to VllmConfig.
Activity
  • No human activity has been recorded for this pull request yet.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

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

@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 introduces support for expert parallelism and custom stop strings in the vLLM-based rollout, which is a great enhancement for handling Mixture-of-Experts models and controlling generation. The changes are well-structured, adding new configuration options to RolloutConfig and VllmConfig and correctly plumbing them through to the vLLM sampler.

My main feedback is to add validation for the new parallelism configurations in vllm_sampler.py to prevent potential runtime errors from misconfiguration and to ensure that the parallelism settings are consistent with the available hardware. I've added a specific comment with a code suggestion to address this.

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.

1 participant