This is BFS-Prover-V2 32B, a specialized 32-billion parameter model fine-tuned for formal mathematical proof generation and theorem proving in Lean4. Quantized to GGUF format for efficient local inference with Ollama or llama.cpp!
🧮 Mathematical Reasoning - Deep understanding of mathematical concepts
📚 131K Context - Handle complex proof sequences and large mathematical contexts
⚡ Local Inference - Run entirely on your machine, no API calls
🔒 Privacy First - Your proofs never leave your computer
🎯 Multiple Quantizations - Choose your speed/quality trade-off
🚀 Ollama Ready - One command to start proving theorems
🔧 llama.cpp Compatible - Works with your favorite tools
🎯 Quick Start
Option 1: Ollama (Easiest!)
Pull and run directly from the Ollama registry:
bash
1# Recommended: Q5_K_M (best balance)2ollama run richardyoung/bfs-prover-v2-32b:Q5_K_M
34# Other variants5ollama run richardyoung/bfs-prover-v2-32b:Q6_K # Highest quality6ollama run richardyoung/bfs-prover-v2-32b:Q4_K_M # Faster, smaller
That's it! Start proving theorems! 🎉
Option 2: Build from Modelfile
Download this repo and build locally:
bash
1# Clone or download the modelfiles2ollama create bfs-prover-v2-q5 -f modelfiles/bfs-prover-v2-32b--Q5_K_M.Modelfile
3ollama run bfs-prover-v2-q5
Option 3: llama.cpp
Use with llama.cpp directly:
bash
1# Download the GGUF file (replace variant as needed)2huggingface-cli download richardyoung/bfs-prover-v2-32b BFS-Prover-V2-32B-Q5_K_M.gguf --local-dir ./
34# Run with llama.cpp5./llama-cli -m BFS-Prover-V2-32B-Q5_K_M.gguf -p "theorem add_comm (a b : Nat) : a + b = b + a :::"
💻 System Requirements
Component
Minimum
Recommended
RAM
24 GB
32 GB+
Storage
30 GB free
40+ GB free
CPU
Modern 8-core
16+ cores
GPU
Optional (CPU-only works!)
Metal/CUDA for acceleration
OS
macOS, Linux, Windows
Latest versions
💡 Tip: Larger quantizations (Q6_K) need more RAM but produce better proofs. Smaller ones (Q4_K_M) are faster but less precise.
🎨 Available Quantizations
Choose the right balance for your needs:
Quantization
Size
Quality
Speed
RAM Usage
Best For
Q6_K
27 GB
⭐⭐⭐⭐⭐
⭐⭐⭐
~32 GB
Production proofs, research
Q5_K_M (recommended)
23 GB
⭐⭐⭐⭐
⭐⭐⭐⭐
~28 GB
Daily use, best balance
Q4_K_M
19 GB
⭐⭐⭐
⭐⭐⭐⭐⭐
~24 GB
Quick iteration, constrained systems
Variant Details
Variant
Size
Context
Best For
Q6_K
27 GB
131K
Highest quality, complex proofs
Q5_K_M
23 GB
131K
Recommended for most users
Q4_K_M
19 GB
131K
Faster inference, lower memory
📚 Usage Examples
Theorem Proving
ollama run richardyoung/bfs-prover-v2-32b:Q5_K_M "theorem add_comm (a b : Nat) : a + b = b + a :::"
Proof State Completion
ollama run richardyoung/bfs-prover-v2-32b:Q5_K_M "∀ n : Nat, n + 0 = n :::"
Interactive Proving
bash
1ollama run richardyoung/bfs-prover-v2-32b:Q5_K_M
2>>> theorem zero_add (n : Nat):0 + n = n :::
3>>> lemma succ_eq_add_one (n : Nat): Nat.succ n = n + 1 :::
Mathematical Formalization - Translate informal math to formal statements
Tactic Generation - Suggest proof tactics for given goals
Proof Search - Explore proof spaces using BFS (Breadth-First Search)
Prompt Format
The model uses a special format where proof requests end with ::::
theorem add_comm (a b : Nat) : a + b = b + a :::
This signals the model to generate a formal proof for the given theorem statement.
⚡ Performance Tips
Getting the best results
Choose the right quantization - Q5_K_M is recommended for daily use
Use proper Lean4 syntax - Follow standard Lean4 theorem statement format
Include the ::: suffix - This is critical for the model to understand you want a proof
Set low temperature - Use 0.1-0.3 for precise, valid proofs
Provide context - Include relevant definitions or prior lemmas
GPU acceleration - Use Metal (Mac) or CUDA (NVIDIA) for faster inference
Large context - Take advantage of the 131K context for complex proofs
Example Ollama Configuration
bash
1# Create with custom parameters2ollama create my-bfs-prover -f modelfiles/bfs-prover-v2-32b--Q5_K_M.Modelfile
34# Edit the Modelfile to add:5PARAMETER temperature 0.26PARAMETER top_p 0.957PARAMETER num_ctx 131072
🔧 Building Custom Variants
You can modify the included Modelfiles to customize behavior:
dockerfile
1FROM ./BFS-Prover-V2-32B-Q5_K_M.gguf23# Lean4-specific prompt template (appends ::: to user messages)4TEMPLATE """{{- range $i, $m := .Messages }}{{- if eq $m.Role "user" }}{{ $m.Content }}:::{{ end }}{{- if eq $m.Role "assistant" }}{{ $m.Content }}{{ end }}{{- end }}"""
56# System prompt7SYSTEM You are a formal mathematics expert specializing in Lean4 theorem proving. Generate valid, well-structured proofs.
89# Parameters10PARAMETER temperature 0.2
11PARAMETER num_ctx 131072