Skip to content

Conversation

@nightflight-dk
Copy link
Contributor

@nightflight-dk nightflight-dk commented Dec 29, 2025

This PR modernizes the backend's handling of structured outputs and introduces strict runtime validation to protect the vLLM engine from malformed requests. It migrates from the deprecated GuidedDecodingParams to StructuredOutputsParams, ensuring compatibility with recent vLLM versions (0.13.0+) while maintaining support for legacy clients.

Key Goals:

  • Protect the Engine: Fail fast on invalid regex or grammar constraints before they reach the engine, preventing potential crashes or wasted compute.
  • Future-Proofing: Align with vLLM's move to StructuredOutputsParams.

Changes:

  • Migration & Compatibility:
    • Replaced GuidedDecodingParams with StructuredOutputsParams.
    • Implemented automatic mapping of legacy guided_decoding parameters to structured_outputs, ensuring seamless operation across vLLM versions (tested on 0.11.2 and 0.13.0).
  • Early Runtime Validation:
    • Regex: Pre-validates patterns using interegular to ensure compilability.
    • Grammar: Validates EBNF grammars using xgrammar to catch syntax errors immediately.
    • Type Safety: Enforces strict type checking for choice, json, and whitespace_pattern fields.
  • Cleanup: Handles the removal of the deprecated backend parameter.

Testing:

  • Verified backward compatibility with guided_decoding requests on vLLM 0.11.2 and 0.13.0.
  • Confirmed that invalid regex and grammar inputs trigger immediate ValueError responses.
  • Validated correct parameter mapping to the vLLM

@nightflight-dk
Copy link
Contributor Author

nightflight-dk commented Jan 9, 2026

@yinggeh @mc-nv pls review

@nightflight-dk nightflight-dk changed the title Enhanced guided decoding params validation and migration to StructuredOutputsParams feat: enhanced guided decoding params validation and migration to StructuredOutputsParams Jan 10, 2026
@yinggeh
Copy link
Contributor

yinggeh commented Jan 12, 2026

@yinggeh @mc-nv pls review

We will take a look. Thanks @nightflight-dk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants