从「会做题」到「拿金牌」 拆解 Gemini 2.5 Pro 的 IMO 2025 级 prompt 工程

副标题:一份可复制的数学奥赛级 LLM 调优说明书


1. 为什么这篇论文值得所有 prompt 工程师细读?

Google DeepMind 在 2025-07-22 上传的 arXiv:2507.15855v2 做了一个大胆宣言:Gemini 2.5 Pro 仅凭 5 道 IMO 2025 题就达到了金牌水平
真正引人注目的是:

  • 没有用任何外部工具(不调用 Lean、不跑 Python、不联网);
  • 只用了 2 个固定 prompt + 1 个自我验证循环;
  • 在「数据污染」几乎为零的前提下完成。

论文把「大模型如何解世界级难题」拆成了一部可复现的说明书。下面,我们把这部说明书翻译成 prompt 工程师的日常语言。


2. 全局架构:一条「自我对抗」的解证流水线

官方流程图只有 6 步,但精髓可以浓缩成 「生成 → 反思 → 验证 → 再生成」 的螺旋。
每一步的 prompt 设计都极其克制,却直击痛点:

阶段 角色 目标 关键约束
Step 1 Solver 先给出「可能正确」的草稿 不许猜答案,必须给出可检验的推理链
Step 2 Critic 把草稿变成「可改进对象」 用显式 bug report 打回
Step 3 Verifier 像 IMO 阅卷人那样逐行批改 只报问题,不替考生改
Step 4 Reviewer 过滤假阳性 人工/模型二次确认 bug 是否真 bug
Step 5 Reviser 精准打补丁 必须引用 bug report 里的编号
Step 6 Gatekeeper 5 次独立验证全过才放行 用 majority voting 防漏网之鱼

3. Prompt 显微镜:两个文本块如何撑起整套系统?

3.1 Step 1 Prompt——「先别急着给答案」

###Core Instructions###
**Rigor is Paramount:** …  
**Honesty About Completeness:** If you cannot find a complete proof,  
请只提交「**可被独立验证的重大中间结论**」……  
**Use TeX for All Mathematics:** …

技巧拆解:

  1. 负面指令比正面指令多:模型最怕「幻觉式证明」,作者用 3 次否定句(do not guess / not allowed / must not)先给红线。
  2. 「重大中间结论」模板——直接给出 4 个可勾选的结果类型(key lemma / case finished / bound proved / construction shown),让模型在卡壳时也能输出「能被验证」的东西,避免胡编。
  3. 强制 LaTeX:减少自然语言的歧义,方便后续 verifier 用正则提取公式。

3.2 Verification Prompt——「像阅卷人一样挑刺」

You are … an IMO grader.  
Your sole task is to find and report all issues …  
Do NOT attempt to correct …  

技巧拆解:

  1. 角色扮演 + 单一职责:一句 「You are an IMO grader」 把模型从「解题者」切换到「阅卷人」,大幅减少越俎代庖。
  2. 错误分级体系
    • Critical Error(逻辑链断裂、计算错误)
    • Justification Gap(缺理由但结论可能对)
      把「致命伤」和「可补洞」区分开,后续循环就知道该重写还是该补细节。
  3. 引用原文 + 位置锚点
    Location: "By interchanging the limit and the integral …"  
    Issue: Justification Gap – uniform convergence unverified.

    方便 Reviser 阶段用「行号」精准打补丁,避免全文重算。


4. 资源管理:32k token 不够怎么办?

IMO 题往往需要上万 token 的链式推导。作者用「步进式预算」解决:

  • 第一轮 32k token → 生成「半成品」。
  • 第二轮再追加 32k token → 做「反思 + 补细节」。
  • 如果还不够,把 bug report 作为 prompt 前缀继续生成,而不是一次性从头写到尾。

Prompt 小技巧:在每次续写前,把上一轮 verifier 的「bug 列表」塞进 system message,让模型把注意力集中在「待修补区域」。


5. 温度、采样与「策略引导」

  • temperature=0.1:低温度减少随机脑洞,保证逻辑链收敛。
  • 显式提示策略(只在 Problem 1 & 2 使用):
    • Problem 1 追加 「Let us try induction.」
    • Problem 2 追加 「Let us try analytic geometry.」

作者特意在论文第 4 章讨论:这不是「泄题」,而是模拟多智能体搜索里的「策略分配」。在真实生产环境,可以换成

Hint Pool = ["induction", "pigeonhole", "analytic_geo", "invariant"]

每次采样随机附一条,等价于给不同 agent 分配不同搜索方向。


6. 可迁移的 Prompt 模板

把论文方法抽象成「可插拔」的三件套:

6.1 Solver Prompt(可复用骨架)

You are a mathematician. 
Goal: Produce a **checkpoint** that can be independently verified.
Rules:
- Every non-trivial claim must be followed by 「(Reason: …)」
- If stuck, output: 「Partial Result: [Lemma/Bound/Case]」

6.2 Verifier Prompt(零样本即可用)

You are a grader.  
List all **Critical Errors** and **Justification Gaps** in bullet form.  
Quote the exact sentence that is wrong. Do not fix.

6.3 Reviser Prompt(精准补洞)

Below is a previous attempt and a bug report.  
Address each bug in the exact order listed.  
Quote the bug ID when you fix it.

7. 为什么这套方法不止于数学?

这套 pipeline 的通用性在于:

  • 任何需要「严谨+长链推理」的场景(法律合同审查、形式化验证、科研推导)都可以照搬。
  • Verifier 的「错误分级」思想可以迁移到代码审计、论文同行评议。
  • 步进式预算 + bug 重试是资源受限环境下的通用长链推理范式。

8. 一键复制脚本(伪代码)

solver_prompt   = open("solver.txt").read()
verifier_prompt = open("verifier.txt").read()
reviser_prompt  = open("reviser.txt").read()

def prove(problem_tex):
    draft = gemini(solver_prompt + problem_tex, temp=0.1)
    for _ in range(10):                # 最多 10 轮改进
        bugs = gemini(verifier_prompt + draft, temp=0)
        if "Critical Error" not in bugs:
            return draft
        draft = gemini(reviser_prompt + bugs + draft, temp=0.1)
    return None

9. 写在最后

从 2023 年「LLM 能做小学应用题」到 2025 年「LLM 拿 IMO 金牌」,差距并不在模型大小,而在于如何榨干现有模型的推理上限。这篇论文把「榨干」过程拆成了 2 个 prompt + 1 个循环,用最朴素的工程手段完成了最顶级的智力任务。

下次当你抱怨「模型不够聪明」时,不妨先问问自己:
「我的 prompt 真的配得上 IMO 金牌吗?」

发表评论

人生梦想 - 关注前沿的计算机技术 acejoy.com 🐾 步子哥の博客 🐾 背多分论坛 🐾 知差(chai)网 🐾 DeepracticeX 社区 🐾 老薛主机 🐾 智柴论坛 🐾