Outlines is an open-source Python library from .txt that makes a language model's output follow a set structure, such as a JSON schema or a regular expression, while it is being generated.
In plain words
Model output is unpredictable, so a request for JSON can come back broken. Outlines constrains generation itself: at each step it only allows tokens that keep the output valid. Its authors showed this can be done efficiently by treating the target format as a finite-state machine and building an index over the model's vocabulary, adding little overhead.
A quick example
Imagine a support app that needs each message turned into a customer record with a name, an issue and an urgency of high, medium or low. With Outlines, the model can only produce text that matches that structure, so the app always gets a valid record to store.
Where you'll meet it
- Guaranteed JSON output from open models.
- Classification into a fixed set of labels.
Related
Sources
- DocsOutlines documentation, .txt (dottxt) · read 29 Sept 2026
- PaperEfficient Guided Generation for Large Language Models, Willard and Louf (arXiv) · read 29 Sept 2026
Checked by WhatIsAI against the sources above · 29 Sept 2026. Spotted an error? Report it.