Loading...
Discovering amazing AI tools

Python library that enforces exact structured outputs from LLM completions by masking logits to match regex patterns.
Python library that enforces exact structured outputs from LLM completions by masking logits to match regex patterns.
ReLLM is an open-source Python library that produces exact, pattern-constrained outputs from language models by filtering non-matching tokens before generation. For each candidate token at generation time, ReLLM tests potential continuations against a partial regular expression and masks logits for completions that would violate the pattern, steering the model to only produce conforming tokens. This enables reliable extraction of structured data (e.g., JSON arrays, fixed formats) from LLMs and can integrate with inference pipelines or be used via third-party hosted Regex Completion APIs referenced in the project.
