Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,94 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# BFS-Prover
|
2 |
+
|
3 |
+
BFS-Prover is a scalable automatic theorem prover that leverages Best-First Tree Search (BFS) to navigate proof search spaces efficiently. This model achieves state-of-the-art performance on the MiniF2F test benchmark with a score of 72.95%, demonstrating that properly scaled BFS can match or exceed the performance of more complex search methods.
|
4 |
+
|
5 |
+
## Model Details
|
6 |
+
|
7 |
+
- **Architecture**: Based on Qwen2.5-Math-7B
|
8 |
+
- **Task**: Automatic theorem proving in Lean4
|
9 |
+
- **Training**: Trained through expert iteration with SFT and DPO
|
10 |
+
- **License**: apache-2.0
|
11 |
+
- **Framework**: LeanDojo for Lean4 integration
|
12 |
+
|
13 |
+
## Key Features
|
14 |
+
|
15 |
+
1. **Expert Iteration with Self-Filtering**
|
16 |
+
- Strategic filtering of problems solvable by beam search
|
17 |
+
- Progressive focusing on harder theorems
|
18 |
+
- Continuous policy improvement through iterative training
|
19 |
+
|
20 |
+
2. **Direct Preference Optimization (DPO)**
|
21 |
+
- Leverages compiler feedback for policy refinement
|
22 |
+
- Uses positive and negative tactic pairs for learning
|
23 |
+
- Improves sampling efficiency during proof search
|
24 |
+
|
25 |
+
3. **Length-Normalized BFS**
|
26 |
+
- Incorporates path length normalization
|
27 |
+
- Enables effective exploration of deeper proof paths
|
28 |
+
- Balances between shallow and deep reasoning
|
29 |
+
|
30 |
+
## Performance
|
31 |
+
|
32 |
+
- **MiniF2F Test Score**: 72.95% (accumulative)
|
33 |
+
- **Single Run Score**: 70.83% ± 0.89%
|
34 |
+
- **Search Configuration**:
|
35 |
+
- Temperature: 1.1
|
36 |
+
- Expansion width: 2
|
37 |
+
- Length normalization factor: 0.5
|
38 |
+
|
39 |
+
## Usage
|
40 |
+
|
41 |
+
```python
|
42 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
43 |
+
|
44 |
+
# Load tokenizer and model
|
45 |
+
model_name = "bytedance-research/BFS-Prover"
|
46 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
47 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
48 |
+
|
49 |
+
# For memory-efficient loading
|
50 |
+
model = AutoModelForCausalLM.from_pretrained(
|
51 |
+
model_name,
|
52 |
+
device_map="auto", # Automatic device mapping
|
53 |
+
load_in_8bit=True # Or load_in_4bit=True for more memory savings
|
54 |
+
)
|
55 |
+
```
|
56 |
+
|
57 |
+
## Required Environment
|
58 |
+
|
59 |
+
- Python 3.8+
|
60 |
+
- Lean4
|
61 |
+
- LeanDojo
|
62 |
+
- transformers
|
63 |
+
- torch
|
64 |
+
|
65 |
+
## Limitations
|
66 |
+
|
67 |
+
- Based on a 7B parameter model, which may limit capture of complex mathematical patterns
|
68 |
+
- Context window constraints may affect handling of extensive proof states
|
69 |
+
- Trade-off between model size and inference speed in tree search
|
70 |
+
|
71 |
+
## Citation
|
72 |
+
|
73 |
+
```bibtex
|
74 |
+
@article{bfs-prover2024,
|
75 |
+
title={BFS-Prover: Scalable Best-First Tree Search for LLM-based Automatic Theorem Proving},
|
76 |
+
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},
|
77 |
+
year={2024}
|
78 |
+
}
|
79 |
+
```
|
80 |
+
|
81 |
+
## Contributors
|
82 |
+
|
83 |
+
Key Contributors:
|
84 |
+
- Ran Xin (Seed Foundation Code, ByteDance)
|
85 |
+
- Chenguang Xi (Seed Foundation Code, ByteDance)
|
86 |
+
- Jie Yang (Applied Machine Learning, ByteDance)
|
87 |
+
- Feng Chen (Stanford University)
|
88 |
+
|
89 |
+
Additional Contributors:
|
90 |
+
- Hang Wu (Applied Machine Learning, ByteDance)
|
91 |
+
- Xia Xiao (Seed Foundation Code, ByteDance)
|
92 |
+
- Yifan Sun (Seed Foundation Code, ByteDance)
|
93 |
+
- Shen Zheng (Seed Foundation Code, ByteDance)
|
94 |
+
- Kai Shen (Seed Foundation Code, ByteDance)
|