Instructions to use kfdong/STP_model_Lean with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kfdong/STP_model_Lean with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kfdong/STP_model_Lean") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("kfdong/STP_model_Lean") model = AutoModelForCausalLM.from_pretrained("kfdong/STP_model_Lean", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kfdong/STP_model_Lean with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kfdong/STP_model_Lean" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kfdong/STP_model_Lean", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/kfdong/STP_model_Lean
- SGLang
How to use kfdong/STP_model_Lean with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "kfdong/STP_model_Lean" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kfdong/STP_model_Lean", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "kfdong/STP_model_Lean" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kfdong/STP_model_Lean", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use kfdong/STP_model_Lean with Docker Model Runner:
docker model run hf.co/kfdong/STP_model_Lean
| base_model: | |
| - deepseek-ai/DeepSeek-Prover-V1.5-SFT | |
| datasets: | |
| - kfdong/STP_Lean | |
| - internlm/Lean-Workbook | |
| license: mit | |
| pipeline_tag: text-generation | |
| library_name: transformers | |
| This is the final Self-play Theorem Prover model as described in the paper [https://arxiv.org/abs/2502.00212](https://arxiv.org/abs/2502.00212). The training and evalution code is avaliable [here](https://github.com/kfdong/STP/tree/main). | |
| ```tex | |
| @article{dong2025beyond, | |
| title={Beyond Limited Data: Self-play LLM Theorem Provers with Iterative Conjecturing and Proving}, | |
| author={Dong, Kefan and Ma, Tengyu}, | |
| journal={arXiv preprint arXiv:2502.00212}, | |
| year={2025} | |
| } | |
| ``` | |
| ## 1. Evaluation Results | |
| The table below compares the pass@3200 performance of STP (our model) and DeepSeek-Prover-V1.5 on miniF2F-test and ProofNet-test. | |
| <div align="center"> | |
| | | miniF2F-test | ProofNet-test | | |
| |--------|------------------|------------------| | |
| | **DeepSeek-Prover-V1.5-SFT** | 53.3% ± 0.5% | 21.0% ± 0.9% | | |
| | **DeepSeek-Prover-V1.5-RL** | 54.9% ± 0.7% | 22.0% ± 0.5% | | |
| | **STP** | **61.7% ± 0.6%** | **23.1% ± 0.5%** | | |
| </div> | |
| ## 2. Dataset | |
| We also release the dataset [here](https://huggingface.co/datasets/kfdong/STP_Lean), which contains: | |
| - Extracted examples from mathlib4, | |
| - Generated correct proofs of statements in LeanWorkbook, | |
| - Generated correct proofs of conjectures proposed by our model during self-play training. | |
| Our final model is finetuned from DeepSeek-Prover-V1.5-SFT with this dataset for 1 epoch. |