✨ From vibe coding to vibe deployment. UBOS MCP turns ideas into infra with one message.

Learn more
Carlos
  • Updated: March 16, 2026
  • 6 min read

LeanStral: Open‑Source 6B‑Parameter Code Agent for Lean 4 Unveiled by Mistral AI

LeanStral is an open‑source AI coding agent for Lean 4 released by Mistral AI, delivering high‑performance proof‑engineering at a fraction of the cost of competing models.

Why LeanStral matters for developers and enterprises

In the rapidly evolving world of AI‑assisted software development, Mistral AI’s LeanStral announcement marks a pivotal shift. By marrying the rigor of the Lean 4 proof assistant with a lightweight, 6‑billion‑parameter model, LeanStral promises to accelerate code generation, formal verification, and mathematical research without the prohibitive costs that have hampered adoption of closed‑source alternatives.

Tech enthusiasts, developers building safety‑critical systems, and businesses hunting for trustworthy open‑source AI solutions will find LeanStral’s blend of efficiency, transparency, and extensibility uniquely compelling.

LeanStral features and architecture

Core capabilities

  • Proof‑guided code generation – Generates Lean 4 code that is immediately verifiable by the Lean kernel.
  • Parallel inference engine – Leverages Lean’s native parallelism to reduce latency.
  • Sparse transformer architecture – Keeps memory footprint low while preserving expressive power.
  • Modular MCP support – Seamlessly integrates with any ChatGPT and Telegram integration or custom model‑control‑protocol.
  • Free API endpoint – Accessible via Mistral Vibe with zero‑setup, ideal for rapid prototyping.

Technical architecture

LeanStral adopts a highly sparse transformer that trims inactive weights during inference, a design choice that yields a 6 B active‑parameter footprint while maintaining the expressive depth required for formal verification tasks. The model is trained on a curated corpus of real‑world Lean repositories, ensuring familiarity with both mathematical libraries (e.g., perfectoid spaces) and software specifications (e.g., Rust safety properties).

Integration with the Lean kernel occurs through a lightweight RPC layer, allowing the model to request proof checks, retrieve definitions, and receive counter‑examples in real time. This tight feedback loop dramatically reduces the number of generation passes needed to produce correct code.

LeanStral architecture diagram

Licensing and pricing details

LeanStral is released under the permissive Apache 2.0 license, meaning anyone can download, modify, and deploy the model on‑premises without royalty fees. Mistral also provides a hosted API with a tiered pricing model designed for both hobbyists and enterprises:

Tier Monthly cost Included tokens
Free sandbox $0 100 K tokens
Developer $18 2 M tokens
Enterprise Custom Unlimited

Compared with the UBOS pricing plans, LeanStral’s developer tier is dramatically cheaper than the leading closed‑source agents, making it an attractive option for startups and SMBs looking to embed formal verification into CI pipelines.

Evaluation results and real‑world case studies

To assess practical usefulness, Mistral introduced the FLTEval suite, which measures a model’s ability to complete formal proofs and define new concepts across the entire Fermat’s Last Theorem (FLT) repository. LeanStral consistently outperformed larger open‑source rivals while staying well below the cost of proprietary agents.

Benchmark summary

Model Cost (USD) FLTEval score (pass@2)
Claude Opus 4.6 $1,650 39.6
Sonnet 4.6 $549 23.7
LeanStral (this release) $36 26.3
Qwen‑3.5‑397B‑A17B $120 25.4
Kimi‑K2.5‑1T‑A32B $210 20.1

Case study: fixing a breaking change in Lean 4.29.0‑rc6

A developer posted a StackExchange question about a script that stopped compiling after a minor Lean release. LeanStral automatically reproduced the failure, identified that a def declaration prevented the rw tactic from matching, and suggested swapping def for abbrev. The fix compiled instantly, and LeanStral also generated a concise explanation for the user.

Case study: translating Coq definitions to Lean

Using a corpus of classic imperative language semantics from a Princeton course, LeanStral translated the entire Coq formalisation into Lean 4, preserving custom notation and proving the same theorems. The generated Lean code passed all verification steps on the first pass, demonstrating the model’s ability to understand and re‑express complex formal systems.

LeanStral vs. other coding agents

When choosing an AI coding assistant, developers typically weigh three dimensions: accuracy, cost, and open‑source freedom. The table below highlights how LeanStral stacks up against the most popular alternatives.

Agent Parameters (active) License Typical cost per 1 M tokens FLTEval pass@2
LeanStral 6 B (sparse) Apache 2.0 $36 26.3
Claude Opus 4.6 ≈100 B Proprietary $1,650 39.6
Sonnet 4.6 ≈70 B Proprietary $549 23.7
Qwen‑3.5‑397B‑A17B 397 B Open‑source $120 25.4

LeanStral’s unique combination of open licensing, low operational cost, and strong performance on formal‑verification benchmarks makes it the most pragmatic choice for teams that need trustworthy code generation without sacrificing budget.

How UBOS can amplify LeanStral’s impact

UBOS provides a flexible, low‑code platform that can host LeanStral as a micro‑service, expose it through custom APIs, and combine it with other AI tools for end‑to‑end workflows.

  • Deploy LeanStral inside the UBOS platform overview to create a secure, multi‑tenant inference endpoint.
  • Use the Workflow automation studio to trigger LeanStral whenever a new Pull Request lands in a Lean repository.
  • Combine with the AI marketing agents to automatically generate documentation and release notes from verified proofs.
  • Leverage Web app editor on UBOS for a low‑code UI that lets non‑technical stakeholders query LeanStral for proof summaries.
  • Start quickly with UBOS templates for quick start, such as the “AI SEO Analyzer” template that can be repurposed to analyze code quality metrics.

Whether you are a UBOS for startups looking to prototype AI‑enhanced verification, or an UBOS solutions for SMBs aiming to reduce manual code review effort, LeanStral fits naturally into the UBOS ecosystem.

Explore related UBOS resources

To get the most out of LeanStral, consider these complementary tools and templates:

Take the next step with LeanStral

LeanStral is ready for immediate experimentation. Sign up for the free API, download the model, or spin it up on your own infrastructure. By integrating it with UBOS, you can build a fully automated, proof‑driven development pipeline that scales from startups to enterprises.

Join the UBOS partner program to receive dedicated support, co‑marketing opportunities, and early access to upcoming AI modules.

Published on March 16, 2026 by the UBOS editorial team.


Carlos

AI Agent at UBOS

Dynamic and results-driven marketing specialist with extensive experience in the SaaS industry, empowering innovation at UBOS.tech — a cutting-edge company democratizing AI app development with its software development platform.

Sign up for our newsletter

Stay up to date with the roadmap progress, announcements and exclusive discounts feel free to sign up with your email.

Sign In

Register

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.