Answers for LLM inference engineers

vLLM structured output: which backend runs your JSON schema, and why it is slow

A vLLM server runs one structured output backend. With the default, auto, vLLM picks a backend for each JSON schema (xgrammar, unless the schema has a keyword xgrammar is known to mishandle; then guidance, or outlines for patternProperties), but the engine creates only one backend: the one picked for the first structured-output request after startup. In v0.33.0 and v0.34.0, a later request whose schema resolves to a different backend is rejected (“only supports one backend per engine”). Up to v0.32.0 it is accepted and compiled by the first backend, which can drop a keyword without an error. In v0.32.0 to v0.34.0 with llguidance 1.7.6, some keywords that send a schema off xgrammar (uniqueItems, contains, an unknown format, propertyNames) are refused by guidance as well, so the request is rejected. In production, set --structured-outputs-config.backend to xgrammar or guidance. Most “guided decoding is slow” reports come down to one of four causes: compiling a new schema, landing on the fallback backend, the model padding the JSON with whitespace until max_tokens, or a request that is not constrained at all because it still sends guided_json, which vLLM removed in v0.12.0. The checker below tells you which backend your schema gets; the script measures the other three on your own server.

Published 2026-11-11 · Updated 2026-12-05 · vLLM v0.8.5 to v0.34.0 (46 releases; the dates in the version list are PyPI upload dates) · read from vLLM's source at each release tag; the checker's rules were compared with vLLM's own code on 3,000 generated schemas for every release up to v0.33.0, with no differences; in v0.34.0 the functions that choose and validate the backend are the same code as in v0.33.0 (compared as syntax trees) and the backend libraries are pinned to the same versions · speed was not measured for this page

Corrected on 2026-12-05: an earlier version said that in auto mode two schemas on the same server can run on two different backends. No release up to v0.34.0 does that (see one backend per server). It also said that uniqueItems, contains, unknown formats and propertyNames with properties fall back to guidance (in v0.32.0 to v0.34.0 with llguidance 1.7.6 the request is rejected), that lm-format-enforcer still works in v0.34.0 (its backend fails to start with ImportError), and that disable_any_whitespace can be set per request (v0.34.0 ignores the request field). The dates in the version list are PyPI upload dates; the Limitations section wrongly called them tag commit dates. The checker and sotime.py (now 1.1) were changed to match. These points were checked by running vLLM 0.34.0's own validation and engine-side structured-output code on CPU (xgrammar 0.2.8, llguidance 1.7.6, outlines_core 0.2.14, a tokenizer with the Qwen2 vocabulary), and v0.32.0 and v0.35.0rc1 the same way from their tag sources; they were not checked against a live server or a GPU.

Which backend will vLLM use for my schema?

Paste a JSON schema, or a whole request body (response_format, structured_outputs or the old guided_json are all read).

Runs in your browser; nothing is sent anywhere. Your vLLM version: vllm --version or pip show vllm. This applies to --structured-outputs-config.backend auto, the default. If you set a backend explicitly, that backend is used for every request, and a schema it cannot take is rejected. “Rejected” on this page means vLLM's request validation raises VLLMValidationError, which vLLM classes as a client (4xx) error; the HTTP status itself was not checked on a live server.

Can one vLLM server use xgrammar for one schema and guidance for another?

No, not in any release up to v0.34.0. The engine creates one backend, for the first structured-output request it receives, and keeps it until restart. What happens to a later request whose schema auto sends elsewhere depends on the version:

vLLMBackends in the engineLater request resolved to a different backend
v0.8.5 – v0.32.0One, chosen by the first requestAccepted without an error and compiled by the first backend. A keyword that backend cannot enforce is dropped: with xgrammar first, a string with pattern and maxLength lost its maxLength, with only a warning line on stderr.
v0.33.0 – v0.34.0One, chosen by the first requestRejected: Structured output processing only supports one backend per engine. The engine is already using 'guidance', but this request resolved to 'xgrammar'.
v0.35.0rc1 (pre-release)One per backend type, created as neededAccepted, on the backend it resolved to

The v0.33.0–v0.34.0 case means that a server whose first request happened to need guidance rejects ordinary schemas until it is restarted, and the behaviour can change from one restart to the next. Setting --structured-outputs-config.backend xgrammar (or guidance) removes the dependence on request order: every request goes to that backend, and a schema it cannot take is rejected instead of being sent elsewhere.

How this was checked: vLLM's StructuredOutputManager was given requests that had passed vLLM's own validation, in the orders xgrammar → guidance → xgrammar, guidance → xgrammar → guidance, xgrammar → outlines and outlines → xgrammar, on CPU with no model loaded. Run for v0.34.0 (wheel) and for the v0.32.0 and v0.35.0rc1 tag sources; v0.33.0 and releases before v0.32.0 were read from source only. The error was added in vLLM commit 88077b746 (PR #49625).

Which JSON Schema keywords send a schema off xgrammar?

In auto mode, vLLM runs a pre-check on every schema before handing it to xgrammar. If any node in the schema matches a row marked “falls back” for your version, the request goes to guidance (or outlines, see the next table). “Rejected” means guidance refuses it too, so the request fails. The check walks the whole schema, including $defs, anyOf branches and array items, so one keyword deep inside is enough.

Keyword in the schema (anywhere, at any depth) v0.8.5 v0.9.0 – v0.11.0 v0.11.1 – v0.12.x v0.13.0 – v0.28.x v0.29.0 v0.30.0 – v0.31.0 v0.32.0 – v0.34.0
multipleOf on a number or integerfalls backfalls backfalls backfalls backfalls backfalls backfalls back
uniqueItems, contains, minContains or maxContains on an array xgrammar #968falls backfalls backfalls backfalls backfalls backfalls backrejected
minItems or maxItems on an arrayfalls backxgrammarxgrammarxgrammarxgrammarxgrammarxgrammar
format on a string, one of xgrammar's 14 formats (email, date, time, date-time, duration, ipv4, ipv6, hostname, uuid, uri, uri-reference, uri-template, json-pointer, relative-json-pointer)falls backfalls backxgrammarxgrammarxgrammarxgrammarxgrammar
format on a string, any other value (for example color) xgrammar #967falls backfalls backfalls backfalls backfalls backfalls backrejected
pattern or format together with minLength or maxLength on a string xgrammar #966xgrammarxgrammarxgrammarxgrammarfalls backfalls backfalls back
minProperties or maxProperties on an objectfalls backfalls backfalls backxgrammarxgrammarxgrammarxgrammar
propertyNames on an object with no propertiesfalls backfalls backfalls backfalls backfalls backxgrammarxgrammar
propertyNames together with properties xgrammar #958falls backfalls backfalls backfalls backfalls backfalls backrejected
propertyNames together with an additionalProperties schemafalls backfalls backfalls backfalls backfalls backfalls backxgrammar
patternProperties with one pattern and no propertiesfalls backfalls backfalls backfalls backfalls backxgrammarxgrammar
patternProperties together with properties, or with two or more patterns xgrammar #964falls backfalls backfalls backfalls backfalls backfalls backfalls back
allOf with two or more branches xgrammar #937xgrammarxgrammarxgrammarxgrammarxgrammarxgrammarfalls back

Rows describe vLLM's pre-check (has_xgrammar_unsupported_json_features in vllm/v1/structured_output/backend_xgrammar.py). Before v0.31.0 the check only looked at nodes whose type is a single string, so a keyword under "type": ["string", "null"] did not trigger it; from v0.31.0 it does. After the pre-check, xgrammar compiles the schema; a schema it fails to compile also falls back, and that step is not in this table. Links point to the xgrammar issue vLLM cites for the rule. “Rejected” in the v0.32.0–v0.34.0 column was checked by running v0.34.0's validation code with llguidance 1.7.6 (v0.32.0 and v0.33.0 have the same auto branch and guidance validation in their source), the newest version vLLM's pin (>=1.7.0,<1.8.0) allows: guidance answers Unimplemented keys: ["uniqueItems"] (likewise for contains, minContains, maxContains and propertyNames) or Unknown format: color. Every format outside xgrammar's 14 that was tried (color, regex, idn-email, idn-hostname, iri, iri-reference) was refused. A schema that also has patternProperties goes to outlines instead and is accepted. Older releases use older llguidance versions; whether guidance accepts these keywords there was not checked, so those columns still say “falls back”.

Where does auto go when xgrammar is rejected?

Usually to guidance. It goes to outlines instead when the schema contains patternProperties or the model uses an older, non-Tekken Mistral tokenizer, and from v0.32.0 the request fails with HTTP 400 if guidance cannot use the tokenizer.

vLLMWhat auto does after xgrammar is rejected
v0.8.4 – v0.11.xUses guidance. (auto became the default for the V1 engine in v0.8.4; before that the default was xgrammar.)
v0.12.0 – v0.13.xUses outlines if the model uses a Mistral tokenizer; otherwise guidance.
v0.14.0 – v0.19.xUses outlines if the tokenizer is a Mistral tokenizer or the schema contains patternProperties anywhere; otherwise guidance.
v0.20.0 – v0.30.xSame, but only non-Tekken Mistral tokenizers go to outlines; Tekken ones use guidance.
v0.31.0Adds: a Lark grammar request (not a JSON schema) with a Tekken Mistral tokenizer goes straight to guidance.
v0.32.0 – v0.34.0Adds: if xgrammar is rejected and the tokenizer is not one guidance supports (fast Hugging Face or Tekken), the request fails with HTTP 400 instead of being tried on guidance. With llguidance 1.7.6, guidance also refuses uniqueItems, contains, minContains, maxContains, propertyNames and formats outside xgrammar's list, so those requests are rejected (see the keyword table). v0.33.0 marks lm-format-enforcer deprecated; vLLM says it will be removed in v0.35.0.

The server log does not say which backend a request ended up on. The checker above repeats vLLM's decision for JSON schemas. Remember that the decision only names a backend; the engine still uses the backend of the first request (see one backend per server).

Which request fields work in which vLLM version?

Send the schema in response_format with "type": "json_schema"; that works in every version. The old guided_json field stopped working in v0.12.0 and is ignored without an error.

vLLMRequestServer flag
up to v0.10.xguided_json, guided_regex, guided_choice, guided_grammar in the body (extra_body in the OpenAI client), or response_format--guided-decoding-backend
v0.11.0 – v0.11.xNew structured_outputs object (json, regex, choice, grammar, ...). guided_* still work but are deprecated.--structured-outputs-config.backend (old flag deprecated)
v0.12.0 – v0.29.xguided_* removed. They are ignored and the output is unconstrained; the log only says that some fields “were present in the request but ignored”.--structured-outputs-config.backend
v0.30.0 – v0.34.0Same, but the log now names the removed guided_* field and says the output will not be constrained.--structured-outputs-config.backend

response_format with "type": "json_schema" works in every version on this page and on other OpenAI-compatible servers, so it is the safest way to send a schema. structured_outputs also has a disable_any_whitespace field, but in v0.34.0 the backends never read it: only the server setting --structured-outputs-config.disable_any_whitespace has an effect. With the server setting off and the request field on, a JSON value with 40 newlines after { was still accepted by both xgrammar and guidance (checked on CPU; the request was not sent over HTTP).

How do I measure what structured output costs on my server?

sotime.py sends the same prompt three ways (a fourth, compact, is optional) and compares time to first token, time per token, output length and whether the output matches the schema. It needs only Python 3.8+ and works with any OpenAI-compatible endpoint (vLLM, SGLang, llama.cpp server).

curl -O https://erimaki-kobo.github.io/en/vllm-structured-output-backend-cost/sotime.py
python sotime.py --base-url http://localhost:8000/v1 --model Qwen/Qwen3-8B --no-think
python sotime.py --base-url http://localhost:8000/v1 --model Qwen/Qwen3-8B --schema my_schema.json -n 10
free
No constraint. The baseline for speed and length; it also shows how often the model already follows the schema on its own.
warm
The same schema every time via response_format. The first request is reported separately because it pays grammar compilation; the rest show the cached cost.
cold
A schema that differs on every request (a random description), so no grammar cache helps. This is your cost if every request brings its own schema, as with tool calling or per-user forms.
compact
Not run by default. Sends the same schema with disable_any_whitespace in the request, which vLLM up to v0.34.0 ignores (see above). To measure whitespace, start vLLM with --structured-outputs-config.disable_any_whitespace true and compare --label runs instead.

Built-in schemas: flat (a small record), nested (an invoice with an array of objects, an enum and a pattern) and fallback, which uses pattern with maxLength and multipleOf, so auto resolves it to guidance. (Version 1.0 used uniqueItems here, which v0.32.0–v0.34.0 with llguidance 1.7.6 reject.) Because a server keeps the backend of its first request, do not mix fallback with flat or nested on one auto server: on v0.33.0–v0.34.0 the second group is rejected, and on older releases it runs on the first group's backend. Run fallback on a server started with --structured-outputs-config.backend guidance.

To compare backends directly, start vLLM twice and label the runs:

vllm serve Qwen/Qwen3-8B --structured-outputs-config.backend xgrammar
python sotime.py --base-url http://localhost:8000/v1 --model Qwen/Qwen3-8B --label xgrammar --json xg.json
vllm serve Qwen/Qwen3-8B --structured-outputs-config.backend guidance
python sotime.py --base-url http://localhost:8000/v1 --model Qwen/Qwen3-8B --label guidance --json gd.json

Exit codes: 0 constrained output looked fine; 1 the constraint was not applied or outputs broke the schema; 3 runaway whitespace; 2 could not run. Requests go one at a time by default so that TTFT shows compilation rather than queueing; add --concurrency to measure under load.

What does each finding mean, and what fixes it?

What the script showsCauseFix
warm 1st and cold TTFT far above warm medianGrammar compilation for a schema the server has not seenReuse schemas so the cache hits. If schemas change per request, compare the cold numbers under xgrammar and guidance and pin the faster one.
Your schema is slower on one server than on anotherThe servers use different backends (with auto, the backend of each server's first request)Check the schema above and set the backend explicitly. Removing or rewriting a keyword (for example dropping multipleOf and checking it in your code) keeps the schema on xgrammar.
“RUNAWAY WHITESPACE”: outputs hit max_tokens, mostly spaces and newlinesThe grammar allows whitespace between JSON tokens and the model keeps choosing itStart the server with --structured-outputs-config.disable_any_whitespace true (xgrammar and guidance only; the request field is ignored up to v0.34.0). Also lower max_tokens so a bad run fails fast.
Some requests fail with “only supports one backend per engine”v0.33.0–v0.34.0 in auto mode: the first request fixed the engine's backend and this schema resolves to anotherSet --structured-outputs-config.backend explicitly.
“CONSTRAINT NOT APPLIED”: constrained outputs are proseThe server ignored the schema: guided_json on v0.12.0+, a proxy that drops response_format, or an engine without JSON-schema supportSend response_format json_schema; check the server log for “ignored”.
“SCHEMA MISMATCH”: JSON, but it breaks the schemaThe backend in use does not enforce some keywordCheck which backend the schema lands on; validate in your code for keywords the backend skips.
Constrained ITL clearly above free ITLPer-token mask computation on the CPUCompare backends with --label runs; measure under your real --concurrency.

Which xgrammar and llguidance versions does each vLLM release use?

From requirements/common.txt at each release tag. A range means vLLM accepts any version in it; the one you get depends on when you installed.

vLLMxgrammarllguidance (guidance)outlines_corelm-format-enforcer
v0.32.0 – v0.34.00.2.8>=1.7.0,<1.8.00.2.140.11.3
v0.31.00.2.7>=1.7.0,<1.8.00.2.140.11.3
v0.24.0 – v0.30.0>=0.2.1,<1.0.0>=1.7.0,<1.8.00.2.140.11.3
v0.22.0 – v0.23.0>=0.2.0,<1.0.0>=1.7.0,<1.8.00.2.140.11.3
v0.21.0>=0.2.0,<1.0.0>=1.3.0,<1.4.00.2.140.11.3
v0.20.0 – v0.20.2>=0.1.32,<1.0.0>=1.3.0,<1.4.00.2.140.11.3
v0.18.0 – v0.19.1>=0.1.32,<1.0.0>=1.3.0,<1.4.00.2.110.11.3
v0.14.0 – v0.17.10.1.29>=1.3.0,<1.4.00.2.110.11.3
v0.12.0 – v0.13.00.1.27>=1.3.0,<1.4.00.2.110.11.3
v0.11.1 – v0.11.20.1.25>=1.3.0,<1.4.00.2.110.11.3
v0.11.00.1.25>=0.7.11,<0.8.00.2.110.11.3
v0.10.20.1.23>=0.7.11,<0.8.00.2.110.11.3
v0.10.0 – v0.10.1.10.1.21>=0.7.11,<0.8.00.2.10>=0.10.11,<0.11
v0.9.0 – v0.9.20.1.19>=0.7.11,<0.8.0–>=0.10.11,<0.11
v0.8.5 – v0.8.5.post10.1.18>=0.7.9,<0.8.0–>=0.10.11,<0.11

FAQ

Can I choose xgrammar or guidance per request in vLLM?
No. A server uses one backend. With --structured-outputs-config.backend set, it is that backend. With the default, auto, it is the backend picked for the first structured-output request after startup; in v0.33.0 and v0.34.0 a later request that auto sends to another backend is rejected with "only supports one backend per engine", and up to v0.32.0 it is compiled by the first backend instead. To compare backends, start the server once per backend and run the same requests against each.
Why is guided decoding slow in vLLM?
Usually one of four things: the first request with a new schema pays grammar compilation; the schema uses a keyword that sends auto mode from xgrammar to guidance or outlines; the model emits whitespace between JSON tokens until max_tokens; or the constraint is not applied at all because the request still uses guided_json, which vLLM removed in v0.12.0. The script on this page reports which of these you have.
Does vLLM still accept guided_json?
Not since v0.12.0. guided_json, guided_regex, guided_choice, guided_grammar, guided_decoding_backend and guided_whitespace_pattern were deprecated in v0.11.0 and removed in v0.12.0. The server ignores them and returns unconstrained text. Use response_format with type json_schema, or structured_outputs with json.
Which JSON Schema keywords make vLLM fall back from xgrammar?
In vLLM v0.32.0 and later: multipleOf on numbers; uniqueItems, contains, minContains or maxContains on arrays; a string format outside xgrammar's 14 formats; pattern or format together with minLength or maxLength; propertyNames together with properties or patternProperties; patternProperties together with properties or with two or more patterns; and allOf with two or more branches. With llguidance 1.7.6, guidance refuses uniqueItems, contains, minContains, maxContains, propertyNames and formats outside xgrammar's list, so in v0.32.0 to v0.34.0 those requests are rejected rather than falling back (unless the schema also has patternProperties, which sends it to outlines). The table on this page gives each version.
How do I stop the model from generating endless whitespace in JSON mode?
Start the server with --structured-outputs-config.disable_any_whitespace true. It works with the xgrammar and guidance backends. The disable_any_whitespace field inside a request's structured_outputs is accepted but ignored in v0.34.0. Also keep max_tokens low so a run that pads with whitespace stops early.
Is lm-format-enforcer still supported in vLLM?
Not in v0.34.0 with the pinned lm-format-enforcer 0.11.3: the backend logs a deprecation warning and then fails to start with ImportError, because lm-format-enforcer imports vllm.transformers_utils.tokenizer, a module vLLM no longer has. v0.35.0rc1 removes the backend. Use xgrammar or guidance.

Limitations

Related: vLLM batch invariance: what still breaks determinism · How much logprob difference between engines is normal · vLLM compatibility matrix: PyTorch, CUDA and driver

Sources