Outlines, from the team at .txt (dottxt), is a library for structured generation: it constrains a model so its output is guaranteed to match a regular expression, a JSON Schema, or a context-free grammar. It does this by compiling the target into a finite-state machine and masking the next-token distribution at each step so only tokens that keep the output valid can be sampled. The approach is the one described in Willard and Louf's 2023 paper on efficient guided generation. Among the structured-output libraries, Outlines is the most research-anchored and one of the most widely integrated. It is used as a constrained-decoding backend inside open serving engines rather than only as a standalone tool, which puts it next to XGrammar and llguidance as one of the engines doing the actual token masking. Instructor and Guidance sit a layer above, oriented around developer ergonomics, while Outlines is closer to the mechanism. It matters for open-source AI because schema-conforming output is what makes open models usable as reliable components in code, rather than as chat boxes whose output has to be defensively parsed. Production teams reach for it when extraction, classification, or function-call arguments must be valid every time.
The Stack · Runtime · Open source
Outlines
Structured-output library using finite-state-machine guided decoding to force model output to match a regex, JSON Schema, or grammar.
Sources
- Outlines on GitHub https://github.com/dottxt-ai/outlines
- Efficient Guided Generation for Large Language Models (Willard and Louf, 2023) https://arxiv.org/abs/2307.09702
Want a follow-up? Ask the chat about Outlines in context. It will compare to siblings at the same layer and ground every claim in the wiki.
Other projects at the Runtime layer
12 siblings · ordered open first
- vLLM Open source
Dominant open production inference engine; PagedAttention and continuous batching; NVIDIA / AMD / Intel / TPU support.
- SGLang Open source
RadixAttention plus structured generation; from the LMSYS team; gains for shared-prefix and agent workloads.
- llama.cpp Open source
Georgi Gerganov's local-first inference engine; defines the GGUF format; the on-device standard.
- Ollama Open source
Local model runner; Docker-style UX over llama.cpp; the easiest way to run open weights on your machine.
- Text Generation Inference (TGI) Open source
HuggingFace's production inference server; maintenance mode in 2026 as vLLM became the standard.
- MLC-LLM Open source
Cross-platform compilation (TVM-based); the 'LLM in your browser' or 'on your phone' standard.
- XGrammar Open source
Fast grammar-based constrained-decoding engine, used as a structured-output backend by several open serving engines.
- llguidance Open source
Low-level Rust constrained-decoding engine that enforces grammars and JSON Schema at high throughput; powers Guidance.
- Guidance Open source
A programming model for constrained generation that interleaves control flow with model calls and enforces regex, grammars, and JSON Schema.
- Instructor Open source
Library for getting Pydantic-typed structured output from LLMs across many providers, built on function calling and JSON mode with automatic retries.
- LM Format Enforcer Open source
Token-filtering library that enforces a JSON Schema or regex during generation; integrates with Transformers, vLLM, and llama.cpp.
- TensorRT-LLM Source available
NVIDIA's closed-runtime counterpart; fastest on NVIDIA hardware; depends on closed CUDA kernels and the proprietary TensorRT compiler.