Skip to content

fix(diffusion_gemma): demote tool-parser markers from special tokens at load #778

Closed

Description

@inureyes

Summary

DiffusionGemma checkpoints can register the tool-parsing markers <|tool_call>, <tool_call|>, <|"|>, <|channel>, <channel|> as special added tokens in the tokenizer. When they are special, they encode atomically instead of as the multi-token text the model was trained on, and decoding with skip-special-tokens strips them, so the server tool-call parser (src/server/tool_calls/parser.rs) never sees the markers. Demote these five markers to non-special at DiffusionGemma tokenizer load.

Implementation plan

  1. Verify the premise first on the actual checkpoint: inspect tokenizer.json / tokenizer_config.json (added_tokens_decoder) of the published DiffusionGemma checkpoint and confirm the five markers are flagged special. If they are not, close this issue with a comment stating the finding.
  2. If confirmed: in the tokenizer load path (src/tokenizer/mod.rs, special-token registration around lines 37-44 and 358-363), add a model-scoped demotion hook applied for the diffusion_gemma family: keep the tokens registered as added tokens (so they do not split during encode) but clear their special flag (so decode retains them).
  3. Watch the interaction with the reasoning-channel detection in src/tokenizer/thinking.rs (the <|channel> / <channel|> pair): thinking extraction must keep working after demotion; add a test covering it.
  4. Tests: encode/decode round-trip keeps the markers; skip-special decode retains them; a tool-call parse over a synthetic diffusion output containing <|tool_call> markup succeeds.

Acceptance criteria

  • The premise check is documented in the issue or PR.
  • Tool-augmented generation on DiffusionGemma parses tool calls; thinking-extraction regression tests pass.

Effort: low.

Activity

  1. added
    status:ready
    type:bug
    priority:low
    status:in-progress
    status:review
    status:done
    and removed
    status:ready
    status:in-progress
    status:review
    on Jul 13, 2026
  2. added a commit that references this issue on Jul 30, 2026
    622e808
  3. self-assigned this
    on Aug 31, 2026
  4. added a commit that references this issue on Oct 27, 2026
    99e4184
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority:lowstatus:donetype:bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions