You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[sglang] Fix tool format and response position ids padding in AsyncSGLangRollout (#1475)
### Checklist Before Starting
- [x] Search for similar PR(s).
### What does this PR do?
> Add one-line overview of what this PR aims to achieve or accomplish.
Resolved the tool formatting issue: Previously, arguments were stored as
strings, causing iterative addition of `\\` due to multiple calls to
`json.dumps`.
Fixed the `response_position_ids` mismatch between `generate_sequences`
and `generate_sequences_with_tools`: In the earlier implementation,
`generate_sequences_with_tools` used zero padding for positions where
`attention mask == 0`, which resulted in NaN values during the training
phase.
### Specific Changes
> List the specific changes.
- Introduced a new schema, `OpenAIFunctionCallSchema`, to store
converted tool calls.
- Updated the `AsyncSGLangRollout` tool to skip non-dict type arguments
instead of handling any string at the arguments position.
- Aligned `response_position_ids` in `generate_sequences_with_tools`
with the behavior of `generate_sequences`.
- Enhanced tool descriptions to prevent misleading parse errors, as
returning 0.0 caused the model to incorrectly modify answers.
### API
> Demonstrate how the API changes if any.
- Revise the `execute` interface of the tool to directly accept
`dict[str, Any]` instead of a JSON string.
### Usage Example
> Provide usage example(s) for easier usage.
```python
# Add code snippet or script demonstrating how to use this
```
### 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, evaluatuion results, etc.
### Additional Info.
- **Issue Number**: Fixes issue # or discussion # if any.
- **Training**: [Note which backend this PR will affect: FSDP, Megatron,
both, or none]
- **Inference**: [Note which backend this PR will affect: vLLM, SGLang,
both, or none]
### Checklist Before Submitting
- [x] Read the [Contribute
Guide](https://github.com/volcengine/verl?tab=readme-ov-file#contribution-guide).
- [x] Apply [pre-commit
checks](https://github.com/volcengine/verl?tab=readme-ov-file#code-linting-and-formatting).
- [x] Add `[BREAKING]` to the PR title if it breaks any API.
- [ ] Update the documentation about your changes in the
[docs](https://github.com/volcengine/verl/tree/main/docs).
- [ ] Add CI test(s) if neccessary.
Copy file name to clipboardExpand all lines: examples/sglang_multiturn/config/tool_config/gsm8k_tool_config.yaml
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ tools:
5
5
type: "function"
6
6
function:
7
7
name: "calc_gsm8k_reward"
8
-
description: "A tool for calculating the reward of gsm8k. (1.0 if your answer is correct, 0.0 if your answer is incorrect)"
8
+
description: "A tool for calculating the reward of gsm8k. (1.0 if parsed answer is correct, 0.0 if parsed answer is incorrect or not correctly parsed)"
0 commit comments