-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
bugSomething isn't workingSomething isn't workingkeep-openPrevents stale label being appliedPrevents stale label being appliedstaleOver 90 days of inactivityOver 90 days of inactivitystructured-output
Description
🐛 Describe the bug
As of v0.6.5, we use xgrammar as the default backend for structured output. However, not all ways of expressing output requirements are supported. This issue is for tracking the list of known cases needed to be resolved for making xgrammar the default in all cases.
Fallback cases can be found here:
vllm/vllm/model_executor/guided_decoding/__init__.py
Lines 40 to 76 in d06e824
if guided_params.backend == "xgrammar": | |
# xgrammar only has x86 wheels for linux, fallback to outlines | |
from vllm.platforms import current_platform | |
if current_platform.get_cpu_architecture() is not CpuArchEnum.X86: | |
logger.warning("xgrammar is only supported on x86 CPUs. " | |
"Falling back to use outlines instead.") | |
guided_params.backend = "outlines" | |
# xgrammar doesn't support regex or choice, fallback to outlines | |
if guided_params.regex is not None or guided_params.choice is not None: | |
logger.warning( | |
"xgrammar only supports json or grammar guided decoding. " | |
"Falling back to use outlines instead.") | |
guided_params.backend = "outlines" | |
# xgrammar doesn't support some JSON schema features | |
elif (guided_params.json is not None | |
and has_xgrammar_unsupported_json_features(guided_params.json)): | |
logger.warning( | |
"xgrammar does not support advanced JSON schema features like " | |
"patterns or numeric ranges. " | |
"Falling back to use outlines instead.") | |
guided_params.backend = "outlines" | |
# xgrammar only supports GBNF grammars, so we must convert Lark. | |
# We must check if the grammar is likely Lark and if that | |
# grammar is convertible to GBNF | |
elif (guided_params.grammar is not None | |
and grammar_is_likely_lark(guided_params.grammar)): | |
try: | |
convert_lark_to_gbnf(guided_params.grammar) | |
except Exception: | |
logger.warning( | |
"xgrammar does not support Lark grammars and the " | |
"grammar failed to convert to GBNF. " | |
"Falling back to use outlines instead.") | |
guided_params.backend = "outlines" |
- non-x86 architectures
- regex
- choice \
- jsonschema support is incomplete
- lark grammars
thies1006, Ubospica and saattrupdan
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingkeep-openPrevents stale label being appliedPrevents stale label being appliedstaleOver 90 days of inactivityOver 90 days of inactivitystructured-output
Type
Projects
Status
No status