LMQL: Language for constraint-guided LLM programming
Top 12.4% on sourcepulse
LMQL is a Python-based programming language designed for efficient and constraint-guided interaction with Large Language Models (LLMs). It allows developers to seamlessly integrate LLM calls within traditional Python code, offering fine-grained control over model output through a declarative constraint language and advanced decoding strategies.
How It Works
LMQL treats top-level strings as LLM queries, enabling direct integration of LLM interactions into Python programs. It supports features like multi-variable templates, conditional distributions, and data type constraints via logit masking. The language leverages speculative execution and tree-based caching for optimized runtime performance, supporting synchronous and asynchronous APIs for parallel query execution.
Quick Start & Requirements
pip install lmql
pip install lmql[hf]
Highlighted Details
Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
The bleeding-edge development version installed via pip install git+https://github.com/eth-sri/lmql
is not continuously tested and may be less stable. The non-GPU version only supports API-integrated models.
2 months ago
Inactive