Checklist
Motivation
When using JSON structured outputs, the generation can get stuck on endlessly repeating whitespace characters (#2216, #2414, #1438, dottxt-ai/outlines#691). For the outlines and llguidance backends, it is possible to avoid this issue by leveraging the constrained_json_whitespace_pattern server argument, but for xgrammar such parameter is ignored.
XGrammar supports a similar any_whitespace argument that, although less flexible, would at least allow to avoid the infinite loop issue in generation (mlc-ai/xgrammar#345). It would be useful for SGLang to expose such parameter as a server argument (something like disable-any-whitespace), especially considering that XGrammar is the default and recommended backend for constrained generation. Furthermore, I think it would be useful if the documentation mentioned that the constrained-json-whitespace-pattern is not supported for XGrammar.
I'm happy to open a small PR with these changes (which should be quite minimal, unless I'm missing something).
Related resources
vllm-project/vllm#15252
Checklist
Motivation
When using JSON structured outputs, the generation can get stuck on endlessly repeating whitespace characters (#2216, #2414, #1438, dottxt-ai/outlines#691). For the
outlinesandllguidancebackends, it is possible to avoid this issue by leveraging theconstrained_json_whitespace_patternserver argument, but forxgrammarsuch parameter is ignored.XGrammar supports a similar
any_whitespaceargument that, although less flexible, would at least allow to avoid the infinite loop issue in generation (mlc-ai/xgrammar#345). It would be useful for SGLang to expose such parameter as a server argument (something likedisable-any-whitespace), especially considering that XGrammar is the default and recommended backend for constrained generation. Furthermore, I think it would be useful if the documentation mentioned that theconstrained-json-whitespace-patternis not supported for XGrammar.I'm happy to open a small PR with these changes (which should be quite minimal, unless I'm missing something).
Related resources
vllm-project/vllm#15252