Loading video...
Video Failed to Load
🚀 Excited to announce the first release of a novel open source programming language and platform for language model interaction! Combining prompts, constraints & scripting, LMQL elevates the capabilities of large language models. 🧵1/6 A quick tour.
198,966 views • 3 years ago •via X (Twitter)
9 Comments

🧵2/6 LMQL is a declarative, SQL-like language based on Python, extending static text prompting with control-flow, constraint-guided decoding and tool augmentation. This form of scripting greatly simplifies multi-part prompting flows with very little code necessary:

🧵3/6 LMQL supports high-level, logical constraints. Using novel evaluation semantics, constraints are translated to token masks that are enforced eagerly during generation. Using LMQL constraints, you can steer text generation, and avoid costly re-querying and validation:

🧵4/6 LMQL integrates with 🤗 Transformers, the OpenAI API & langchain. Explore our developer resources at and experiment with the entirely browser-based Playground IDE at

🧵5/6 LMQL is an actively evolving project at @the_sri_lab @ETH , that has been in development for almost a year! We're excited to finally release this to the research & developer community with more underway, including work on decoders, tool augmentation & language improvements

🧵6/6 LMQL was also accepted as a research paper at this year's ACM PLDI'23. Check out the paper and make sure to follow @lmqllang for more updates in the coming days. 📑 Paper: 📖 Docs: ⚡️ Playground IDE:

A research project by the @the_sri_lab, @ETH_en, @ETH, @ETH_AI_Center, @CSatETH. Authored by @lbeurerkellner @marc_r_fischer @mnmueller @mvechev.

@karpathy Would it be accurate to describe this as a “lower-code” version of langchain?

@CodeTreasurer @karpathy Not quite. @LangChainAI is compositional, and LMQL operates on the decoder level of a query/prompt with multiple variables. In that sense they are orthogonal. In fact, LMQL and langchain are fully compatible and can be used together (both ways):

Why would i need this?


