Skip to content

Eval bug: Devstral 2 over-constrained during tool call #17928

@aldehir

Description

@aldehir

Name and Version

ggml_cuda_init: GGML_CUDA_FORCE_MMQ: no
ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no
ggml_cuda_init: found 1 CUDA devices:
Device 0: NVIDIA GeForce RTX 3090, compute capability 8.6, VMM: yes
version: 7356 (34ce48d)
built with MSVC 19.44.35221.0 for Windows AMD64

Operating systems

Windows

GGML backends

CUDA

Hardware

NVIDIA RTX 3090

Models

Devstral-2-24B-2512 and likely the other recent Mistral models

Problem description & steps to reproduce

Devstral 2 does not produce valid JSON, by design. For strings it only escapes double quotes \" and nothing else. Example:

"content": "regex = r'\'[^\"]\'"

Note the escaped \' to produce valid code and the escaped \" to not match the closing double quote of the "JSON" string.

The json-schema-to-grammar implementation will constrain it to escape backslashes, so \' => \\' and in turn degrades model output quality. Occasionally leading to an infinite generation of \\\\\\\\\\....

First Bad Commit

No response

Relevant log output

# Added logs to common/sampling.cpp
[35454] Grammar accepted token 17931: \"
[35454] Grammar accepted token 17743: |\
[35454] Grammar rejected token 1039, resampling: '

# Properly escapes \" but not ', should be \\' to be valid JSON

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions