Downloads · 30 days
59
11% of all-time downloads
richardyoung/bfs-prover-v2-32b
bfs-prover-v2-32b is a text generation model from richardyoung. Use it when you need the model to write or continue text. It is set up for llama.cpp. The card lists the license as apache-2.0.
Downloads · 30 days
59
11% of all-time downloads
All-time downloads
519
Public
Repo size
70 GB
Likes
0
Public
Click a slice to open those files.
.gguf70 GB · 100%
From the Hugging Face model README
Original Model | Ollama Registry | llama.cpp
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!
Pull and run directly from the Ollama registry:
# Recommended: Q5_K_M (best balance)
ollama run richardyoung/bfs-prover-v2-32b:Q5_K_M
# Other variants
ollama run richardyoung/bfs-prover-v2-32b:Q6_K # Highest quality
ollama run richardyoung/bfs-prover-v2-32b:Q4_K_M # Faster, smaller
That's it! Start proving theorems! 🎉
Download this repo and build locally:
# Clone or download the modelfiles
ollama create bfs-prover-v2-q5 -f modelfiles/bfs-prover-v2-32b--Q5_K_M.Modelfile
ollama run bfs-prover-v2-q5
Use with llama.cpp directly:
# Download the GGUF file (replace variant as needed)
huggingface-cli download richardyoung/bfs-prover-v2-32b BFS-Prover-V2-32B-Q5_K_M.gguf --local-dir ./
# Run with llama.cpp
./llama-cli -m BFS-Prover-V2-32B-Q5_K_M.gguf -p "theorem add_comm (a b : Nat) : a + b = b + a :::"
| 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.
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 | 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 |
ollama run richardyoung/bfs-prover-v2-32b:Q5_K_M "theorem add_comm (a b : Nat) : a + b = b + a :::"
ollama run richardyoung/bfs-prover-v2-32b:Q5_K_M "∀ n : Nat, n + 0 = n :::"
ollama run richardyoung/bfs-prover-v2-32b:Q5_K_M
>>> theorem zero_add (n : Nat) : 0 + n = n :::
>>> lemma succ_eq_add_one (n : Nat) : Nat.succ n = n + 1 :::
import requests
import json
def prove_lean4(theorem_statement):
response = requests.post('http://localhost:11434/api/generate',
json={
'model': 'richardyoung/bfs-prover-v2-32b:Q5_K_M',
'prompt': f'{theorem_statement} :::',
'stream': False
})
return response.json()['response']
# Example
proof = prove_lean4("theorem add_zero (n : Nat) : n + 0 = n")
print(proof)
The model excels at:
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.
</details># Create with custom parameters
ollama create my-bfs-prover -f modelfiles/bfs-prover-v2-32b--Q5_K_M.Modelfile
# Edit the Modelfile to add:
PARAMETER temperature 0.2
PARAMETER top_p 0.95
PARAMETER num_ctx 131072
</details>
You can modify the included Modelfiles to customize behavior:
FROM ./BFS-Prover-V2-32B-Q5_K_M.gguf
# Lean4-specific prompt template (appends ::: to user messages)
TEMPLATE """{{- range $i, $m := .Messages }}{{- if eq $m.Role "user" }}{{ $m.Content }}:::{{ end }}{{- if eq $m.Role "assistant" }}{{ $m.Content }}{{ end }}{{- end }}"""
# System prompt
SYSTEM You are a formal mathematics expert specializing in Lean4 theorem proving. Generate valid, well-structured proofs.
# Parameters
PARAMETER temperature 0.2
PARAMETER num_ctx 131072
Then build:
ollama create my-custom-prover -f custom.Modelfile
Apache 2.0 - Same as the original model. Free for commercial use!
If you use this model in your research, please cite:
@misc{bfs-prover-v2-2024,
title={BFS-Prover-V2: Formal Mathematical Proof Generation},
author={ByteDance-Seed Team},
year={2024},
url={https://huggingface.co/ByteDance-Seed/BFS-Prover-V2-32B}
}
Use with Lean4 VSCode extension for interactive proving:
-- Use the model to suggest proof tactics
theorem my_theorem : ∀ n : Nat, n + 0 = n := by
-- Query model for tactics
sorry
Run as an OpenAI-compatible API:
ollama serve
# Then use the API at http://localhost:11434
Process multiple theorems:
for theorem in theorems.txt; do
ollama run richardyoung/bfs-prover-v2-32b:Q5_K_M "$theorem :::" >> proofs.txt
done
Break complex proofs into steps:
# Step 1: Generate high-level strategy
ollama run richardyoung/bfs-prover-v2-32b:Q5_K_M "Outline proof strategy for: theorem_statement :::"
# Step 2: Generate detailed proof
ollama run richardyoung/bfs-prover-v2-32b:Q5_K_M "Complete proof: theorem_statement :::"
</details>
Built & maintained by Richard Young · DeepNeuro If you find this useful, please ⭐ star the repo and share with other mathematicians!
Format: GGUF | Runtime: Ollama / llama.cpp | Created: October 2025
</div>BFS-Prover-V2 is a 32B model specialized for formal theorem proving in Lean4:
| Quantization | Model Size | VRAM Required | Quality |
|---|---|---|---|
| Q3_K_M | ~15 GB | 18 GB | Good |
| Q4_K_M | ~19 GB | 24 GB | Very Good - recommended |
| Q5_K_M | ~23 GB | 28 GB | Excellent |
| Q6_K | ~27 GB | 32 GB | Near original |
| Q8_0 | ~35 GB | 40 GB | Original quality |
| Hardware | Recommended Quantization |
|---|---|
| RTX 4090 (24GB) | Q4_K_M |
| RTX 3090 (24GB) | Q4_K_M |
| A100 (40GB) | Q8_0 |
| Mac M2 Ultra (192GB) | Q8_0 |
This model excels at: