Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
---
|
| 3 |
+
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
datasets:
|
| 6 |
+
- internlm/Lean-Workbook
|
| 7 |
+
- internlm/Lean-Github
|
| 8 |
+
- AI-MO/NuminaMath-CoT
|
| 9 |
+
language:
|
| 10 |
+
- en
|
| 11 |
+
base_model:
|
| 12 |
+
- Qwen/Qwen2.5-Math-7B
|
| 13 |
+
pipeline_tag: text-generation
|
| 14 |
+
library_name: transformers
|
| 15 |
+
tags:
|
| 16 |
+
- lean4
|
| 17 |
+
- theorem-proving
|
| 18 |
+
- formal-mathematics
|
| 19 |
+
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
[](https://hf.co/QuantFactory)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
# QuantFactory/BFS-Prover-GGUF
|
| 26 |
+
This is quantized version of [bytedance-research/BFS-Prover](https://huggingface.co/bytedance-research/BFS-Prover) created using llama.cpp
|
| 27 |
+
|
| 28 |
+
# Original Model Card
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
<div align="center">
|
| 32 |
+
<h1 style="font-size: 2.0em;">π BFS-Prover: Scalable Best-First Tree Search for LLM-based Automatic Theorem Proving</h1>
|
| 33 |
+
<div style="display: flex; justify-content: center; gap: 8px; flex-wrap: wrap;">
|
| 34 |
+
<a href="https://arxiv.org/abs/2502.03438"><img src="https://img.shields.io/badge/arXiv-2502.03438-b31b1b.svg" alt="arXiv"></a>
|
| 35 |
+
<a href="https://choosealicense.com/licenses/apache-2.0/"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License: Apache 2.0"></a>
|
| 36 |
+
<a href="https://github.com/leanprover-community/mathlib4"><img src="https://img.shields.io/badge/Lean-4-orange" alt="Lean 4"></a>
|
| 37 |
+
</div>
|
| 38 |
+
<h2>State-of-the-art tactic generation model in Lean4</h2>
|
| 39 |
+
</div>
|
| 40 |
+
|
| 41 |
+
This repository contains the latest tactic generator model checkpoint from BFS-Prover, a state-of-the-art theorem proving system in Lean4. While the full BFS-Prover system integrates multiple components for scalable theorem proving, we are releasing the core tactic generation model here. Given a proof state in Lean4, the model generates a tactic that transforms the current proof state into a new state, progressively working towards completing the proof.
|
| 42 |
+
|
| 43 |
+
**π Paper: [BFS-Prover: Scalable Best-First Tree Search for LLM-based Automatic Theorem Proving](https://arxiv.org/abs/2502.03438)**
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
## β¨ Model Details
|
| 47 |
+
|
| 48 |
+
- Base Model: Qwen2.5-Math-7B
|
| 49 |
+
- Training Approach:
|
| 50 |
+
- Supervised Fine-Tuning (SFT) on state-tactic pairs
|
| 51 |
+
- Direct Preference Optimization (DPO) using compiler feedback
|
| 52 |
+
- Training Data Sources:
|
| 53 |
+
- Mathlib (via LeanDojo)
|
| 54 |
+
- Lean-Github repositories
|
| 55 |
+
- Lean-Workbook
|
| 56 |
+
- Autoformalized NuminaMath-CoT dataset
|
| 57 |
+
|
| 58 |
+
## π Performance
|
| 59 |
+
BFS-Prover achieves state-of-the-art performance on the MiniF2F test benchmark. Here's a detailed comparison:
|
| 60 |
+
|
| 61 |
+
### π MiniF2F Test Benchmark Results
|
| 62 |
+
|
| 63 |
+
| Prover System | Search Method | Critic Model | Tactic Budget | Score |
|
| 64 |
+
|---------------|---------------|--------------|---------------|--------|
|
| 65 |
+
| BFS-Prover | BFS | No | Accumulative | **72.95%** |
|
| 66 |
+
| BFS-Prover | BFS | No | 2048Γ2Γ600 | **70.83% Β± 0.89%** |
|
| 67 |
+
| HunyuanProver | BFS | Yes | 600Γ8Γ400 | 68.4% |
|
| 68 |
+
| InternLM2.5-StepProver | BFS | Yes | 256Γ32Γ600 | 65.9% |
|
| 69 |
+
| DeepSeek-Prover-V1.5 | MCTS | No | 32Γ16Γ400 | 63.5% |
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
### π Key Advantages
|
| 73 |
+
- β
Achieves better performance without requiring a critic model (value function)
|
| 74 |
+
- β
Combined with simpler search method (BFS) rather than MCTS
|
| 75 |
+
|
| 76 |
+
## βοΈ Usage
|
| 77 |
+
- The model expects Lean4 tactic states in the format `"{state}:::"`
|
| 78 |
+
- `:::` serves as a special indicator to signal the model to generate a tactic for the given state.
|
| 79 |
+
- The model will echo back the input state followed by the generated tactic.
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
```python
|
| 83 |
+
# Example code for loading and using the tactic generator model
|
| 84 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 85 |
+
|
| 86 |
+
model = AutoModelForCausalLM.from_pretrained("bytedance-research/BFS-Prover")
|
| 87 |
+
tokenizer = AutoTokenizer.from_pretrained("bytedance-research/BFS-Prover")
|
| 88 |
+
state = "h : x = y + 2 β’ x - 1 = y + 1"
|
| 89 |
+
sep = ":::"
|
| 90 |
+
prompt = state + sep # Creates "h : x = y + 2 β’ x - 1 = y + 1:::"
|
| 91 |
+
|
| 92 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 93 |
+
outputs = model.generate(**inputs)
|
| 94 |
+
tactic = tokenizer.decode(outputs[0], skip_special_tokens=True).split(sep)[1]
|
| 95 |
+
print(tactic)
|
| 96 |
+
|
| 97 |
+
# Complete example:
|
| 98 |
+
# Input state: "h : x = y + 2 β’ x - 1 = y + 1"
|
| 99 |
+
# Full prompt: "h : x = y + 2 β’ x - 1 = y + 1:::"
|
| 100 |
+
# Model output: "h : x = y + 2 β’ x - 1 = y + 1:::simp [h]"
|
| 101 |
+
# Final tactic: "simp [h]"
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
## π Citation
|
| 105 |
+
|
| 106 |
+
If you use this model in your research, please cite our paper:
|
| 107 |
+
|
| 108 |
+
```bibtex
|
| 109 |
+
@article{xin2025bfs,
|
| 110 |
+
title={BFS-Prover: Scalable Best-First Tree Search for LLM-based Automatic Theorem Proving},
|
| 111 |
+
author={Xin, Ran and Xi, Chenguang and Yang, Jie and Chen, Feng and Wu, Hang and Xiao, Xia and Sun, Yifan and Zheng, Shen and Shen, Kai},
|
| 112 |
+
journal={arXiv preprint arXiv:2502.03438},
|
| 113 |
+
year={2025}
|
| 114 |
+
}
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
## π License
|
| 118 |
+
|
| 119 |
+
https://choosealicense.com/licenses/apache-2.0/
|
| 120 |
+
|
| 121 |
+
## π§ Contact
|
| 122 |
+
|
| 123 |
+
For questions and feedback about the tactic generator model, please contact:
|
| 124 |
+
- Ran Xin (ran.xin@bytedance.com)
|
| 125 |
+
- Kai Shen (shen.kai@bytedance.com)
|