[Deprecation] Deprecate LM Format Enforcer structured outputs backend (#63423)

Signed-off-by: Woosuk Kwon <woosuk@inferact.ai>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: vllm-agent <claw@inferact.ai>
This commit is contained in:
authored and GitHub committed 2026-10-24 15:19:14 -07:00
1 parent 7050ef881f
commit 4e59165715
2 files changed
+35 -1

No files matched your search

+21
View File
@@ -17,6 +17,27 @@ available to generate structured outputs.
- `structural_tag` -> `{"structured_outputs": {"structural_tag": ...}}` or `StructuredOutputsParams(structural_tag=...)`
- `guided_decoding_backend` -> Remove this field from your request
## Migrating from LM Format Enforcer
!!! warning
The `lm-format-enforcer` structured outputs backend is deprecated starting
in v0.33.0. It remains usable with a warning in v0.33.0, will require an
explicit opt-in in v0.34.0, and will be removed in v0.35.0.
For online serving, replace
`--structured-outputs-config.backend lm-format-enforcer` with
`--structured-outputs-config.backend auto`, or remove the option to use the
default. For offline inference, replace
`structured_outputs_config={"backend": "lm-format-enforcer"}` with
`structured_outputs_config={"backend": "auto"}` when constructing `LLM`.
You can also explicitly select `xgrammar` or `guidance`.
Validate your existing JSON schemas, regex patterns, and generated outputs with
the replacement backend before migrating. Backend support and formatting can
differ: in particular, LM Format Enforcer uses Python-style regex syntax, while
XGrammar and Guidance use Rust-style regex syntax. Changing backends can change
which tokens are allowed and therefore the generated output.
## Online Serving (OpenAI API)
You can generate structured outputs using the OpenAI's [Completions](https://platform.openai.com/docs/api-reference/completions) and [Chat](https://platform.openai.com/docs/api-reference/chat) API.
+14 -1
View File
@@ -6,8 +6,11 @@ from typing import Any, Literal, Self
from pydantic import model_validator
from vllm.config.utils import config
from vllm.logger import init_logger
from vllm.utils.hashing import safe_hash
logger = init_logger(__name__)
StructuredOutputsBackend = Literal[
"auto", "xgrammar", "guidance", "outlines", "lm-format-enforcer"
]
@@ -21,7 +24,9 @@ class StructuredOutputsConfig:
"""Which engine will be used for structured outputs (e.g. JSON schema,
regex, etc) by default. With "auto", we will make opinionated choices
based on request contents and what the backend libraries currently support,
so the behavior is subject to change in each release."""
so the behavior is subject to change in each release.
The "lm-format-enforcer" backend is deprecated and will be removed in
v0.35.0. Use "auto", "xgrammar", or "guidance" instead."""
disable_any_whitespace: bool = False
"""If `True`, json output will always be compact without any whitespace.
If `False`, the model may generate whitespace between JSON fields,
@@ -69,4 +74,12 @@ class StructuredOutputsConfig:
"disable_additional_properties is only supported "
"for the guidance backend."
)
if self.backend == "lm-format-enforcer":
logger.warning_once(
"The lm-format-enforcer structured outputs backend is deprecated "
"and will be removed in v0.35.0. Use auto, xgrammar, or guidance "
"instead. See https://docs.vllm.ai/en/latest/features/"
"structured_outputs/#migrating-from-lm-format-enforcer "
"for migration guidance."
)
return self