Module 2 · Smaller, faster, still correct · Lesson 7
Structured outputs and tool calls
The server can mask every token that would break your schema or grammar, which guarantees a parse but not a correct answer; tool calling on an open model is the same machinery plus a parser for the model's call format.
By the end of this lesson you can
- Explain token-level constrained decoding, from a regex compiled to a finite-state machine to a JSON schema run by a pushdown automaton, including the token-terminal mismatch and how vocabulary indexing resolves it
- Request JSON schema, regex, choice and grammar constraints from vLLM, SGLang and llama.cpp, and choose a backend
- Serve tool calling from an open model with a tool-call parser, and use auto, required and named tool choice
- Measure the quality effect of constraints with your evals instead of assuming it, and keep the schema in the prompt as well
- Compare hosted structured outputs with what you own when the mask runs on your server
