体验地址:Hugging Face 在线体验 推荐入口:Novita 平台直达链接(含邀请码)
DeepSeek-Prover-V2-671B 是 DeepSeek 团队于 2025 年4月30日发布的开源超大垂直领域语言模型,专为在 Lean 4 语言中进行数学定理的形式化证明(formal theorem proving)而打造。该模型是 DeepSeek-V3 架构的继承者,采用冷启动推理数据合成与强化学习相结合的训练策略,成功将非形式化数学推理与形式化证明能力融合为一体。
DeepSeek-Prover-V2 通过一个递归推理流程合成“冷启动数据”:
在冷启动数据的基础上,模型进一步经过强化学习微调:
数据集 | 表现 |
---|---|
MiniF2F-test | 88.9% 通过率 |
PutnamBench | 解出 49/658 道高难度数学题 |
这些结果表明 DeepSeek-Prover-V2-671B 在神经网络定理证明领域中达到了当前最先进水平。
团队同步发布了专用评测数据集 ProverBench,共计 325 道题,题目来源涵盖:
数学领域 | 题量 |
---|---|
数论 | 40 |
微积分 | 90 |
线性代数 | 50 |
高中竞赛题 | 15 |
抽象代数、实分析等 | 若干 |
模型名称 | 下载地址 |
---|---|
DeepSeek-Prover-V2-7B | Hugging Face |
DeepSeek-Prover-V2-671B | Hugging Face |
数据集名称 | 下载地址 |
---|---|
ProverBench | Hugging Face |
模型可直接接入 Hugging Face Transformers 框架进行使用,以下为 Lean 4 数学题自动证明示例(使用 7B 或 671B 均可):
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
torch.manual_seed(30)
model_id = "DeepSeek-Prover-V2-7B" # or DeepSeek-Prover-V2-671B
tokenizer = AutoTokenizer.from_pretrained(model_id)
formal_statement = """
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-- What is the positive difference between $120\%$ of 30 and $130\%$ of 20? Show that it is 10.-/
theorem mathd_algebra_10 : abs ((120 : ℝ) / 100 * 30 - 130 / 100 * 20) = 10 := by
sorry
""".strip()
prompt = """
Complete the following Lean 4 code:
```lean4
{}
/```
Before producing the Lean 4 code to formally prove the given theorem, provide a detailed proof plan outlining the main proof steps and strategies.
The plan should highlight key ideas, intermediate lemmas, and proof structures that will guide the construction of the final formal proof.
""".strip()
chat = [
{"role": "user", "content": prompt.format(formal_statement)},
]
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
inputs = tokenizer.apply_chat_template(chat, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
import time
start = time.time()
outputs = model.generate(inputs, max_new_tokens=8192)
print(tokenizer.batch_decode(outputs))
print(time.time() - start)
DeepSeek-Prover-V2-671B 是首个同时在 数学语言理解、链式推理与形式化构造 三方面取得全面突破的开源大模型。其精度、上下文理解能力和复杂任务适配性,已然跻身世界顶级 AI 推理系统之列。
推荐用途:大学级数学自动化解题系统、AI 辅助证明系统、Lean 4 数学研究平台、数学教育工具开发等。