outlines-core  by dottxt-ai

Faster structured generation for LLMs

Created 1 year ago
252 stars

Top 99.6% on SourcePulse

GitHubView on GitHub
Project Summary

Provides core functionality for structured text generation, addressing performance and portability challenges. It enables developers to build regular expressions from JSON schemas and construct efficient finite-state automata for mapping tokens, facilitating predictable and constrained output from language models. The library offers both a Rust core and Python bindings for broad integration.

How It Works

The core functionality is implemented in Rust, emphasizing performance and portability. It enables structured generation by first converting JSON schemas into regular expressions. These regex patterns are then combined with a Vocabulary (often derived from a pre-trained language model's tokenizer) to construct an Index. This Index represents a finite-state automaton (FSA), efficiently mapping tokens from the vocabulary to state transitions within the automaton. This FSA-driven approach allows for precise control over the generated output sequences.

Quick Start & Requirements

  • Install (library): Add outlines-core = "0.2.11" to Cargo.toml.
  • Install (binary): cargo install outlines-core.
  • Python Bindings: Requires building Rust extensions (e.g., make build-extension-debug).
  • Prerequisites: Rust toolchain for building/installing binaries/libraries. Python for bindings. LLM vocabulary (e.g., openai-community/gpt2) is used in examples, implying potential downloads.
  • MSRV: 1.85.0.
  • Documentation: docs.rs/outlines-core/0.2.11

Highlighted Details

  • Leverages a Rust core for high performance and portability in structured generation tasks.
  • Employs a finite-state automaton (FSA) derived from JSON schemas and language model vocabularies for efficient, constrained token generation.
  • Provides Python bindings, facilitating integration into existing Python-based machine learning workflows.
  • Includes a cargo install option for a command-line binary, alongside library integration via Cargo.

Maintenance & Community

  • Community: Discord channel available for discussion.
  • Contributors: Brandon T. Willard listed as owner.

Licensing & Compatibility

  • License: Apache-2.0.
  • Compatibility: Apache-2.0 is a permissive license, generally compatible with commercial and closed-source use.

Limitations & Caveats

No explicit limitations or caveats are detailed in the provided README content.

Health Check
Last Commit

4 months ago

Responsiveness

Inactive

Pull Requests (30d)
1
Issues (30d)
0
Star History
10 stars in the last 30 days

Explore Similar Projects

Starred by Tobi Lutke Tobi Lutke(Cofounder of Shopify), Eric Zhu Eric Zhu(Coauthor of AutoGen; Research Scientist at Microsoft Research), and
41 more.

guidance by guidance-ai

0.1%
21k
Guidance is a programming paradigm for steering LLMs
Created 2 years ago
Updated 1 day ago
Feedback? Help us improve.