Skip to content

qwen3_5_fixed.jinja #37

Description

@xuhang-2

Fix JSON serialization of scalar tool arguments in qwen3_5_fixed.jinja

Problem

The current Qwen3.5 template serializes non-container tool arguments with |string. As a result, native scalar values are rendered as Python literals:

None  -> None
True  -> True
False -> False

Valid JSON should use null, true, and false. This can produce malformed tool-call history whenever messages are fully rendered by the chat template. Pure TITO append-only rollout normally reuses the model's original token IDs, so its normal append path is not directly affected; history re-rendering, fallback/reset paths, non-TITO use, and SFT can be affected.

This is also described in vLLM issue #38885, and Qwen3.6 uses the corrected serialization.

Suggested fix

- args_value | tojson|safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string
+ args_value | string if args_value is string else args_value | tojson|safe

The same change should be applied to other copied Qwen3.5 templates that use this serializer, with a small test covering None, True, False, strings, lists, and mappings.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions