Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

SwordFaith
Copy link
Collaborator

@SwordFaith SwordFaith commented Jun 24, 2025

What does this PR do?

Add concise overview of what this PR aims to achieve or accomplish. Reference related GitHub issues and PRs that help with the review.

This PR implements multi-interaction support in SGLangRollout, enabling sample-level interaction selection similar to the existing tools system. The implementation includes a new interaction registry system that allows multiple named
interactions to be configured and used within a single rollout instance. #1630

Core Implementation

  • New Interaction Registry System: Created verl/interactions/utils/interaction_registry.py with functions to dynamically load and manage multiple interaction instances from configuration files
  • Enhanced SGLangRollout:
    • Replaced single interaction attribute with interaction_map: dict[str, BaseInteraction]
    • Updated _initialize_interactions() method to support multiple interactions via registry
    • Modified interaction selection logic to use interaction_kwargs.name for sample-level binding
  • Configuration Updates: Added name field support in interaction config format with automatic name generation fallback

Data Processing

  • Updated GSM8K Preprocessing: Modified examples/data_preprocess/gsm8k_multiturn_w_interaction.py to inject name field in interaction_kwargs
  • Enhanced Configuration: Updated examples/sglang_multiturn/config/interaction_config/gsm8k_interaction_config.yaml with explicit name field

Testing & Quality

  • Comprehensive Test Suite: Added tests/interactions/test_interaction_registry.py with full coverage of registry functionality
  • Integration Tests: Created tests/workers/rollout/test_sglang_multi_interaction.py for multi-interaction scenarios
  • Updated Existing Tests: Modified existing interaction tests to support new name attribute and configuration format
  • Error Handling: Added validation for duplicate names, missing interactions, and edge cases

Backward Compatibility

  • Graceful Degradation: When no interaction config is provided, system works without interactions (empty interaction_map)
  • Default Name Handling: Falls back to "gsm8k" when no name is specified in interaction_kwargs
  • Existing API Preservation: All existing interaction functionality remains unchanged

Key Features

  1. Sample-Level Selection: Each sample can specify which interaction to use via interaction_kwargs.name
  2. Registry Pattern: Similar architecture to existing tools system for consistency
  3. Automatic Naming: Intelligent name generation from class names (e.g., Gsm8kInteraction → gsm8k)
  4. Duplicate Prevention: Runtime validation prevents naming conflicts
  5. Flexible Configuration: Supports both explicit names and automatic derivation

Checklist Before Starting

  • Search for similar PRs. Paste at least one query link here: ...
  • Format the PR title as [{modules}] {type}: {description} (This will be checked by the CI)
    • {modules} include fsdp, megatron, sglang, vllm, rollout, trainer, ci, training_utils, recipe, hardware, deployment, ray, worker, single_controller, misc, perf, model, algo, env, tool, ckpt, doc, data
    • If this PR involves multiple modules, separate them with , like [megatron, fsdp, doc]
    • {type} is in feat, fix, refactor, chore, test
    • If this PR breaks any API (CLI arguments, config, function signature, etc.), add [BREAKING] to the beginning of the title.
    • Example: [BREAKING][fsdp, megatron] feat: dynamic batching

Test

For changes that can not be tested by CI (e.g., algorithm implementation, new model support), validate by experiment(s) and show results like training curve plots, evaluation results, etc.

  • Unit tests for interaction registry functionality
  • Integration tests for multi-interaction rollout scenarios
  • Backward compatibility tests for existing single-interaction workflows
  • Error handling tests for edge cases and invalid configurations
  • Updated existing GSM8K interaction tests

API and Usage Example

Demonstrate how the API changes if any, and provide usage example(s) if possible.

Configuration (interaction_config.yaml):
interaction:
- name: "gsm8k"
class_name: "verl.interactions.gsm8k_interaction.Gsm8kInteraction"
config: {}
- name: "custom_solver"
class_name: "custom.interactions.CustomInteraction"
config: {"solver_type": "advanced"}

Data Sample:

  {
      "interaction_kwargs": {
          "name": "gsm8k",
          "query": "What is 2+2?",
          "ground_truth": "4"
      }
  }

High-Level Design

Demonstrate the high-level design if this PR is complex.

Specific Changes

List the specific changes.

Checklist Before Submitting

Important

Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR for review.

@SwordFaith SwordFaith changed the title [sglang][interaction] Add multi-interaction registry support and testing [sglang] feat: Add multi-interaction registry support and testing Jun 24, 2025
logger.setLevel(os.getenv("VERL_LOGGING_LEVEL", "WARN"))


def get_interaction_class(cls_name):
Copy link
Collaborator

Choose a reason for hiding this comment

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

可以复用已有的 verl/tools/utils/tool_registry.py::get_tool_class 函数

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

interaction and tool are different concepts. Interactions are playing user role which used in partial exposure/collaborative task, reflection task and workflow node training task.

return interaction_cls


def initialize_interactions_from_config(interaction_config_file):
Copy link
Collaborator

Choose a reason for hiding this comment

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

跟已有的 verl/tools/utils/tool_registry.py::initialize_tools_from_config 也有重复,能不能重构下已有的那个函数,让mcp也使用map的新格式?

if _req.interaction_kwargs:
if _req.interaction_kwargs and self.interaction_map:
interaction_kwargs = _req.interaction_kwargs
await self.interaction.start_interaction(_req.request_id, **interaction_kwargs)
Copy link
Collaborator

Choose a reason for hiding this comment

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

跟上面的代码也是重复的,可以合并成 get_ interaction 方法

@chenhaiq chenhaiq merged commit b816d17 into volcengine:main Jun 27, 2025
37 of 40 checks passed
oseyosey pushed a commit to oseyosey/verl that referenced this pull request Jul 28, 2025
…lcengine#2184)

### What does this PR do?

> Add **concise** overview of what this PR aims to achieve or
accomplish. Reference related GitHub issues and PRs that help with the
review.

This PR implements multi-interaction support in SGLangRollout, enabling
sample-level interaction selection similar to the existing tools system.
The implementation includes a new interaction registry system that
allows multiple named
interactions to be configured and used within a single rollout instance.
volcengine#1630

Core Implementation

- New Interaction Registry System: Created
verl/interactions/utils/interaction_registry.py with functions to
dynamically load and manage multiple interaction instances from
configuration files
  - Enhanced SGLangRollout:
- Replaced single interaction attribute with interaction_map: dict[str,
BaseInteraction]
- Updated _initialize_interactions() method to support multiple
interactions via registry
- Modified interaction selection logic to use interaction_kwargs.name
for sample-level binding
- Configuration Updates: Added name field support in interaction config
format with automatic name generation fallback

  Data Processing

- Updated GSM8K Preprocessing: Modified
examples/data_preprocess/gsm8k_multiturn_w_interaction.py to inject name
field in interaction_kwargs
- Enhanced Configuration: Updated
examples/sglang_multiturn/config/interaction_config/gsm8k_interaction_config.yaml
with explicit name field

  Testing & Quality

- Comprehensive Test Suite: Added
tests/interactions/test_interaction_registry.py with full coverage of
registry functionality
- Integration Tests: Created
tests/workers/rollout/test_sglang_multi_interaction.py for
multi-interaction scenarios
- Updated Existing Tests: Modified existing interaction tests to support
new name attribute and configuration format
- Error Handling: Added validation for duplicate names, missing
interactions, and edge cases

  Backward Compatibility

- Graceful Degradation: When no interaction config is provided, system
works without interactions (empty interaction_map)
- Default Name Handling: Falls back to "gsm8k" when no name is specified
in interaction_kwargs
- Existing API Preservation: All existing interaction functionality
remains unchanged

 Key Features

1. Sample-Level Selection: Each sample can specify which interaction to
use via interaction_kwargs.name
2. Registry Pattern: Similar architecture to existing tools system for
consistency
3. Automatic Naming: Intelligent name generation from class names (e.g.,
Gsm8kInteraction → gsm8k)
  4. Duplicate Prevention: Runtime validation prevents naming conflicts
5. Flexible Configuration: Supports both explicit names and automatic
derivation
Juniper1021 pushed a commit to Juniper1021/verl that referenced this pull request Aug 7, 2025
…lcengine#2184)

### What does this PR do?

> Add **concise** overview of what this PR aims to achieve or
accomplish. Reference related GitHub issues and PRs that help with the
review.

This PR implements multi-interaction support in SGLangRollout, enabling
sample-level interaction selection similar to the existing tools system.
The implementation includes a new interaction registry system that
allows multiple named
interactions to be configured and used within a single rollout instance.
volcengine#1630

Core Implementation

- New Interaction Registry System: Created
verl/interactions/utils/interaction_registry.py with functions to
dynamically load and manage multiple interaction instances from
configuration files
  - Enhanced SGLangRollout:
- Replaced single interaction attribute with interaction_map: dict[str,
BaseInteraction]
- Updated _initialize_interactions() method to support multiple
interactions via registry
- Modified interaction selection logic to use interaction_kwargs.name
for sample-level binding
- Configuration Updates: Added name field support in interaction config
format with automatic name generation fallback

  Data Processing

- Updated GSM8K Preprocessing: Modified
examples/data_preprocess/gsm8k_multiturn_w_interaction.py to inject name
field in interaction_kwargs
- Enhanced Configuration: Updated
examples/sglang_multiturn/config/interaction_config/gsm8k_interaction_config.yaml
with explicit name field

  Testing & Quality

- Comprehensive Test Suite: Added
tests/interactions/test_interaction_registry.py with full coverage of
registry functionality
- Integration Tests: Created
tests/workers/rollout/test_sglang_multi_interaction.py for
multi-interaction scenarios
- Updated Existing Tests: Modified existing interaction tests to support
new name attribute and configuration format
- Error Handling: Added validation for duplicate names, missing
interactions, and edge cases

  Backward Compatibility

- Graceful Degradation: When no interaction config is provided, system
works without interactions (empty interaction_map)
- Default Name Handling: Falls back to "gsm8k" when no name is specified
in interaction_kwargs
- Existing API Preservation: All existing interaction functionality
remains unchanged

 Key Features

1. Sample-Level Selection: Each sample can specify which interaction to
use via interaction_kwargs.name
2. Registry Pattern: Similar architecture to existing tools system for
consistency
3. Automatic Naming: Intelligent name generation from class names (e.g.,
Gsm8kInteraction → gsm8k)
  4. Duplicate Prevention: Runtime validation prevents naming conflicts
5. Flexible Configuration: Supports both explicit names and automatic
derivation
whatadayG pushed a commit to whatadayG/verl that referenced this pull request Sep 5, 2025
…lcengine#2184)

### What does this PR do?

> Add **concise** overview of what this PR aims to achieve or
accomplish. Reference related GitHub issues and PRs that help with the
review.

This PR implements multi-interaction support in SGLangRollout, enabling
sample-level interaction selection similar to the existing tools system.
The implementation includes a new interaction registry system that
allows multiple named
interactions to be configured and used within a single rollout instance.
volcengine#1630

Core Implementation

- New Interaction Registry System: Created
verl/interactions/utils/interaction_registry.py with functions to
dynamically load and manage multiple interaction instances from
configuration files
  - Enhanced SGLangRollout:
- Replaced single interaction attribute with interaction_map: dict[str,
BaseInteraction]
- Updated _initialize_interactions() method to support multiple
interactions via registry
- Modified interaction selection logic to use interaction_kwargs.name
for sample-level binding
- Configuration Updates: Added name field support in interaction config
format with automatic name generation fallback

  Data Processing

- Updated GSM8K Preprocessing: Modified
examples/data_preprocess/gsm8k_multiturn_w_interaction.py to inject name
field in interaction_kwargs
- Enhanced Configuration: Updated
examples/sglang_multiturn/config/interaction_config/gsm8k_interaction_config.yaml
with explicit name field

  Testing & Quality

- Comprehensive Test Suite: Added
tests/interactions/test_interaction_registry.py with full coverage of
registry functionality
- Integration Tests: Created
tests/workers/rollout/test_sglang_multi_interaction.py for
multi-interaction scenarios
- Updated Existing Tests: Modified existing interaction tests to support
new name attribute and configuration format
- Error Handling: Added validation for duplicate names, missing
interactions, and edge cases

  Backward Compatibility

- Graceful Degradation: When no interaction config is provided, system
works without interactions (empty interaction_map)
- Default Name Handling: Falls back to "gsm8k" when no name is specified
in interaction_kwargs
- Existing API Preservation: All existing interaction functionality
remains unchanged

 Key Features

1. Sample-Level Selection: Each sample can specify which interaction to
use via interaction_kwargs.name
2. Registry Pattern: Similar architecture to existing tools system for
consistency
3. Automatic Naming: Intelligent name generation from class names (e.g.,
Gsm8kInteraction → gsm8k)
  4. Duplicate Prevention: Runtime validation prevents naming conflicts
5. Flexible Configuration: Supports both explicit names and automatic
derivation
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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.