When a software workflow depends on an open-weight model to run tools, the first sign of trouble is often a malformed handoff rather than a plainly wrong answer. A bad JSON payload can force retries, add confusing messages to the session, and make the assistant look less capable than the model actually is. For teams serving Kimi and DeepSeek, the important software question is whether the inference engine will prevent invalid tool calls. vLLM 0.31 exposes constrained decoding as a server-side flag, and enabling it can raise schema accuracy from the reported 92% under vLLM 0.28 to 100%.
The reported serving case shows that provider claims and model names are not enough. When Kimi K2.6 was served with vLLM 0.28, the expected tool call schema appeared only 92% of the time. That is 2 failures in every 25 attempts, and it is especially painful in multi-turn agent sessions where each failed call can leave unusable text in context.
In practical terms, a developer assistant, automation chain, or internal knowledge application may need an extra recovery turn whenever syntax breaks. The user sees repeated corrections, higher token use, and slower task completion. The fix is not simply “try again”; the deployment needs a way to make invalid tool calls less likely at the moment the model is generating them.
A tool-capable system needs two moves. First, the application tells the model which external functions exist. Second, it requires structured output so the engine can parse the chosen tool and its arguments.
The reported example uses OpenCode as the harness. When OpenCode connects to Kimi, it sends a JSON array of available tools. One sample tool is webfetch, which retrieves Web page content. That array is not just a list of names: it includes parameters, their types, and required fields. It references https://json-schema.org/draft/2020-12/schema, permits text, markdown, or html formats, defaults to markdown, and sets max 120 seconds for an optional timeout.
Before the model sees the schema, the inference engine wraps it in model-specific tokens so the prompt matches the format used during training. For Kimi, that can appear as system tool-declaration tokens around the array. Later, if the model emits a structured invocation such as functions.webfetch:0 with a JSON argument object, the server parses it into an assistant object with tool_calls. The harness, such as OpenCode, runs the tool and feeds the result back.
Letting a model generate tool calls and trusting its training is the simplest design. It works most of the time because modern models are good at structured patterns. But a small failure rate is not a benchmark trivia point in production software.
Failing calls add error text to the session, push the next response away from the user’s goal, and create retry cost. To make that risk measurable, Moonshot AI published the K2VV ToolCall benchmark. Providers can use it to check whether a serving path preserves the original quality, including syntactically valid tool calls.
The benchmark workload contains 2000 requests. It measures trigger similarity, comparing when the service emits a call with how Moonshot AI’s own service behaves, and schema accuracy, the share of generated calls that follow the schema and can be invoked successfully. If tool-call accuracy is 50%, half of the generated calls are malformed, a result that would be disruptive in almost any tool workflow.
Probabilistic token selection is the underlying reason. The model does not run a compiler; it picks likely tokens. That can bring in names or shapes learned elsewhere, such as search_web instead of web_search, or city_name instead of location, when the current harness expects different conventions.
Constrained decoding changes the sampling environment. The engine still lets the model choose among allowed tokens, but it blocks tokens that would make the tool call syntactically invalid. The allowed set is derived from the supplied schema, so generation is guided step by step rather than validated after the fact.
vLLM implements this behavior with structural tags from XGrammar. The relevant structure marks the boundaries of a valid call: where the tool call begins, where the name appears, where the index appears, where arguments begin, and where schema-constrained JSON must be produced.
Under that model, a valid path is Begin tool call → Tool name → Tool call index → Begin arguments → Schema-constrained JSON → End tool call. Invalid paths are prevented while tokens are generated. During the tool-call index phase, for example, integer tokens are permitted while incompatible tokens are masked. The figure below, reproduced from XGrammar’s article, visualizes that masking.

Image source: Dong, Yixin et al., XGrammar: Flexible and efficient structured generation engine for large language models., Proceedings of Machine Learning and Systems 7 (2025).
The result is a runtime guarantee for schema validity, not a claim that every answer is semantically better. The reported implementation also says the overhead is negligible because token masks are precomputed and applied efficiently on the GPU during generation.
| Dimension | Free generation | Constrained decoding |
|---|---|---|
| Goal | Generate likely tokens, then hope the tool parser accepts them. | Limit token choices to paths that can form a syntactically valid tool call. |
| Reported schema accuracy | Kimi K2.6 on vLLM 0.28: 92%, equal to 2 failures in every 25 attempts. | Can reach 100% for newer Kimi and DeepSeek models when enabled and verified. |
| User impact | Retries, context pollution, slower agent sessions. | More predictable handoffs for the harness. |
| Compatibility risk | Less direct risk for unsupported models. | Defaults and model-specific grammar work matter; some models need validation. |
Moonshot AI recommends turning constrained decoding on, and its own API behaves that way. The reported deployment history adds a caution: the feature was first added in a vLLM fork. After vLLM added the feature in v0.25, the team moved to the upstream implementation for Kimi and DeepSeek. Soon after, tool-call accuracy dropped back to 91%.
The investigation concluded that the upstream constrained-decoding implementation itself remained correct. The regression came from default behavior for requests that did not explicitly enable constrained decoding. Because vLLM is a model-agnostic serving engine, enabling this feature per model is not trivial, and the reported problems fall into three groups:
These issues explain why vLLM maintainers reported seeing problems with several models after constrained decoding was enabled and why leaving it disabled by default was the safer choice for a general-purpose engine. Later, vLLM added the --tool-strict-level flag so users can choose tool-call strictness for a deployment.
Ubicloud’s priority differs from a broad model-agnostic serving engine. The report says it focuses on serving Kimi and DeepSeek models with quality users expect from first-party providers. After enabling constrained decoding and re-running the K2VV ToolCall benchmark, it verified 100% tool-call schema accuracy across all served model versions, including Kimi K2.6 and DeepSeek V4 Flash, and deployed the change to production.
Q: Does constrained decoding give the model new permissions?
A: No. The reported mechanism guides token sampling so a tool call matches the schema. The external tool still executes only what the harness runs.
Q: Does it make the model understand better?
A: It does not replace model reasoning. It reduces syntactically invalid tool calls, which can otherwise make the assistant look worse than it is.
Q: Why did vLLM not leave it enabled for everyone?
A: Because the feature is model-specific and the reported problems include general model issues, grammar translation bugs, and feature interaction bugs. vLLM maintainers treated the safer default as disabled.
Q: What did the reported 92% to 100% change buy users?
A: Fewer malformed calls and less context pollution, assuming the served models pass validation. For software teams, the main benefit is predictable tool execution, not a different claim about model intelligence.