Outlines
Python library for structured LLM outputs via constrained decoding.
Bookmark
Bookmarks are kept in your free account, so you can find this page again on any device.
Sign in to bookmarkWhat it is
Outlines is an Apache 2.0 Python library from .txt that guarantees model outputs match a JSON Schema, Pydantic model, regular expression or context-free grammar. It enforces structure during token sampling via finite-state machines rather than retrying invalid responses after generation. It works across local model backends such as llama.cpp, vLLM and Transformers as well as hosted provider APIs, making it useful when downstream code requires strictly valid types.
Best for
Local or open-weight models needing schema-valid JSON without retries.
Skills it helps with
Related tools
LLM
CLI and Python library for prompting many models.
MLX LM
Runs and fine-tunes LLMs on Apple silicon with MLX.
SGLang
High-performance serving engine for LLMs and multimodal models with fast prefix caching.
Transformers
Hugging Face's library of open model definitions.
vLLM
High-throughput inference and serving engine for LLMs with an OpenAI-compatible server.
DeepSeek
Chat app and API for DeepSeek's open-weight models.