Leanstral-TurboQuant-MLX-8bit

8-bit MLX weight-quantized Leanstral-2603 with TurboQuant KV-cache quantization for Lean 4 formal proof generation on Apple Silicon.

Leanstral is the first open-source AI agent purpose-built for Lean 4 formal proofs -- generating both executable code and machine-checkable mathematical proofs. This variant combines dual compression: 8-bit MLX weight quantization for reduced model size plus TurboQuant KV-cache quantization for efficient long-context inference.

Approximate model size: ~120 GB

Overview

This repository provides a dual-compressed configuration: MLX 8-bit weight quantization reduces the static memory footprint, while TurboQuant compresses the KV cache at runtime. Together, they enable running Leanstral on high-memory Apple Silicon machines.

Spec Value
Base model mistralai/Leanstral-2603
Architecture Mistral MoE (~119B parameters, 7 consolidated shards)
Weight quantization 8-bit (MLX)
KV-cache quantization TurboQuant
Weight memory ~120 GB
Runtime MLX (Apple Silicon)
License Apache 2.0
Use case Lean 4 formal verification, theorem proving, mathematical proofs

Quickstart

from mlx_lm import load, generate

model, tokenizer = load("majentik/Leanstral-TurboQuant-MLX-8bit")

prompt = "Prove that for all natural numbers n, n + 0 = n in Lean 4:"
response = generate(
    model,
    tokenizer,
    prompt=prompt,
    max_tokens=512,
)
print(response)

What is TurboQuant?

TurboQuant (arXiv: 2504.19874) is a KV-cache quantization method that compresses the key-value cache used during autoregressive generation. By quantizing the KV cache to lower precision, TurboQuant reduces memory consumption proportionally to context length. Combined with MLX 8-bit weight quantization, this dual compression approach makes it feasible to run Leanstral's ~119B parameter model on Apple Silicon hardware.

KV-Cache Quantization Comparison

Method Prefill Speed Decode Speed Memory Savings Reference
TurboQuant Baseline Baseline High arXiv: 2504.19874
RotorQuant 5.3x faster 28% faster High GitHub

Memory Estimates

Component Estimate
Model weights (8-bit) ~120 GB
KV-cache Reduced via TurboQuant
Recommended hardware Mac Studio M2/M3/M4 Ultra (192 GB+) or Mac Pro

Lean 4 Use Case

Leanstral excels at:

  • Formal verification -- generating machine-checkable proofs of mathematical theorems
  • Theorem proving -- interactive and automated proof search in Lean 4
  • Code generation -- writing verified Lean 4 programs with correctness guarantees
  • Proof repair -- fixing incomplete or broken proof scripts

See Also

Quant trade-off (MLX lane)

Bits Approx size Use case Recommendation
2-bit ~31 GB Aggressive quantization Very low-RAM Macs
3-bit ~43 GB Lossy but small Low-RAM Macs
4-bit ~50 GB Balanced default Recommended for most Macs
5-bit ~60 GB Higher fidelity Quality-sensitive
6-bit ~71 GB Approaching FP16 quality High-fidelity
8-bit ~90 GB Near-lossless reference Fidelity-critical work

(Current variant — 8bit — is bolded.)

Variants in this family

(Showing 8 sibling variants under majentik/leanstral-*. The current variant — TurboQuant-MLX-8bit — is bolded.)

Variant Runtime Approx size Use case
RotorQuant runtime modifier n/a KV-cache root (weight-agnostic)
RotorQuant-MLX-2bit mlx-lm card-only Apple Silicon, smallest
RotorQuant-MLX-4bit mlx-lm card-only Apple Silicon balanced
RotorQuant-MLX-8bit mlx-lm card-only Apple Silicon reference
TurboQuant runtime modifier n/a KV-cache root (weight-agnostic)
TurboQuant-MLX-2bit mlx-lm card-only Apple Silicon, smallest
TurboQuant-MLX-4bit mlx-lm card-only Apple Silicon balanced
TurboQuant-MLX-8bit mlx-lm card-only Apple Silicon reference
Downloads last month
96
Safetensors
Model size
34B params
Tensor type
BF16
·
U32
·
MLX
Hardware compatibility
Log In to add your hardware

8-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for majentik/Leanstral-TurboQuant-MLX-8bit

Quantized
(10)
this model

Paper for majentik/Leanstral-TurboQuant-MLX-8bit