GSM8K(Grade School Math 8K)是由 OpenAI 于 2021 年发布的小学数学应用题基准测试,用于评估语言模型的多步数学推理能力。全称"Grade School Math 8K",包含 8,500 道高质量、语言多样的小学数学应用题(7,500 道训练集 + 1,000 道测试集),每道题需要 2 到 8 步才能求解,所有解答仅使用基本算术运算(加减乘除)。
GSM8K 已成为衡量大语言模型(LLM)数学推理能力的事实标准,在论文中被引用数千次,是几乎所有主流模型的标准评估指标之一。
| 维度 | 说明 |
|---|---|
| 专注推理 | 数学限制在小学水平,失败即推理失败,而非知识不足 |
| 严格评判 | 答案精确匹配,17 不等于 18——没有"部分正确" |
| 多步推理 | 每道题需 2-8 步计算,考验推理链的连贯性 |
| 语言多样性 | 同一数学结构可用多种自然语言场景包装 |
| 影响深远 | 推动了 Chain-of-Thought 提示、Self-Consistency、Process Reward Model 等关键技术的诞生和验证 |
GSM8K 数据集构成
├── 训练集: 7,500 题
│ ├── 多步算术题: ~2,500
│ ├── 速率与比例题: ~1,800
│ ├── 部分-整体关系题: ~1,900
│ └── 时间序列题: ~1,300
├── 测试集: 1,000 题
│ └── (与训练集同分布)
└── 每道题
├── 问题描述(自然语言)
├── 答案(含逐步推理 + 最终数字)
└── 2-8 步计算步骤
GSM8K 的设计者刻意将数学复杂度限制在小学算术(自然数的加减乘除)范围内。这一决策源于一个重要洞察:
语言的复杂性与数学的复杂性应该被独立研究。
如果一个模型连三步小学算术题都无法可靠完成,那么它存在的是根本性的推理限制,而非高级数学知识的欠缺。通过将数学锚定在基础水平,GSM8K 确保:
与传统的只给出最终数字答案的数据集不同,GSM8K 为每道题注释了详细的自然语言逐步推理过程:
原始题目:
Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May?
标注的逐步解答:
Natalia sold 48/2 = 24 clips in May.
Natalia sold 48 + 24 = 72 clips altogether in April and May.¶ 72
这种"思维链"格式为后续的 Chain-of-Thought 提示技术提供了天然的训练数据。每道题的答案格式为:推理过程后跟 #### 分隔符和最终数字答案。
同样类型的数学问题,GSM8K 会用不同的场景和措辞包装:
同一数学结构的不同表述:
| 问题类型 | 例子 |
|---|---|
| 多步加法 | "John has 5 apples. He buys 3 more packs of 4 apples each. How many total?" |
| 多步乘法 | "Betty saves $10 per week. After 4 weeks, she spends $15. How much left?" |
| 速率问题 | "A car travels 60 miles/hour. After 2 hours, how far has it gone?" |
| 逆运算 | "Tom has twice as many marbles as Jerry. Together they have 36. How many does each have?" |
这种多样性防止了模型仅仅"记忆"答案格式,迫使模型真正理解数量关系。
需要顺序运算,上一步的输出作为下一步的输入。
典型例题:
Weng earns $12 an hour for babysitting. Yesterday, she just did 50 minutes of babysitting. How much did she earn?
逐步推理:
认知负荷分析: 模型需要在计算总工资前先完成单位转换(小时→分钟),然后再乘以时间。如果模型跳跃步骤,就容易出错。
涉及速度、工作效率、比例关系,考验对反比例关系的理解。
典型例题:
If 5 workers can build a wall in 10 days, how long would 10 workers take?
逐步推理:
常见错误: 模型可能直接做 的错误计算(先加倍工人数然后不变天数),或错误地将工人数翻倍理解为时间翻倍。
需要追踪哪些数量已被计算、哪些尚未计算,考验集合管理能力。
典型例题:
Betty is saving money for a new wallet which costs $100. Betty has only half of the money she needs. Her parents decided to give her $15 for that purpose, and her grandparents twice as much as her parents. How much more money does Betty need to buy the wallet?
逐步推理:
认知挑战: 模型必须正确判断"twice as much as her parents"是指祖父母给的钱是父母给的的两倍,而非总额的两倍。同时需要追踪所有收入来源。
涉及时间计算的顺序性、单位转换和持续时间累加。
典型例题:
Janet's ducks lay 16 eggs per day. She eats three for breakfast every morning and bakes muffins for her friends every day with four. She sells the rest at the farmers' market every day for $2 per egg. How much in dollars does she make every day at the farmers' market?
逐步推理:
常见错误模式: 模型可能在减法顺序上出错(如先减销售数量再减早餐),或者在乘法前忘记计算正确的剩余数量。
GSM8K 的标准评估方式使用 Chain-of-Thought (CoT) 提示——要求模型在给出最终答案前先展示逐步推理过程。
标准 8-shot CoT 提示示例:
Question: There are 15 trees in the grove. Grove workers will plant trees in the grove today. After they are done, there will be 21 trees. How many trees did the grove workers plant today?
Answer: There are 15 trees originally. Then there were 21 trees after some more were planted. So there must have been 21 - 15 = 6 trees planted. The answer is 6.
Question: If there are 3 cars in the parking lot and 2 more cars arrive, how many cars are in the parking lot?
Answer: There are originally 3 cars. 2 more cars arrive. 3 + 2 = 5. The answer is 5.
...
Question: Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May?
Answer:
模型需要生成类似以下的推理:
Natalia sold 48/2 = 24 clips in May.
Natalia sold 48 + 24 = 72 clips altogether in April and May.
The answer is 72.
GSM8K 使用精确匹配(EM)作为评分标准,即模型输出的最终数字必须与标注答案完全一致。这是一种严格的二元评判——没有"部分正确"的概念。
| 模型输出 | 正确 | 说明 |
|---|---|---|
| 72 | ✅ | 完全正确 |
| 71 | ❌ | 接近但不等同于正确 |
| "72 clips" | ❌ | 虽含正确数字但格式不对(应仅输出数字) |
| "She sold 72" | ❌ | 格式错误 |
一种更简单的变体是 Zero-shot CoT,只需在问题后附加"Let's think step by step":
Question: Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May?
Let's think step by step.
这种方法无需提供示例,但效果通常不如 few-shot CoT。
2022 年提出的改进方法:对同一个问题采样多个推理路径,然后进行多数投票选择最终答案。
| 方法 | GSM8K 准确率 | 说明 |
|---|---|---|
| Standard (no CoT) | ~18% | 直接输出答案 |
| CoT (8-shot) | ~75% | 标准 Chain-of-Thought |
| CoT + Self-Consistency | ~93% | 采样 40 条路径 + 多数投票 |
具体例子: 对于一个复杂的三步题,模型可能生成 40 条推理路径。其中 35 条得出 72,3 条得出 71,2 条得出 73。Self-Consistency 选择 72 作为最终答案。
2023 年 OpenAI 提出用过程监督(即对每步推理进行评分)替代结果监督(仅对最终答案评分),显著提升了 GSM8K 上的表现:
| 监督方式 | GSM8K 准确率 |
|---|---|
| 结果监督(仅最终答案) | ~88% |
| 过程监督(每步评分) | ~94% |
另一种变体是用 Python 代码而非自然语言来表达推理过程,利用外部计算器或解释器来确保计算准确:
| 方法 | GSM8K 准确率 | 优势 |
|---|---|---|
| 自然语言 CoT | ~75% | 推理过程可读 |
| Program-of-Thought | ~82% | 计算绝对准确(无算术错误) |
| CoT + Calculator | ~90% | 混合方法,兼具两者优势 |
2021年
├── GPT-3 (175B) + CoT: ~58%
├── 人类专家: ~98%
│
2022年
├── PaLM (540B): ~78%
├── GPT-3.5 (text-davinci-002): ~58%
├── GPT-3.5 (text-davinci-003): ~72%
├── Codex: ~58%
│
2023年
├── GPT-4: ~87%
├── Claude 2: ~88%
├── Gemini Pro: ~84%
├── LLaMA-2 70B: ~56%
├── Minerva (540B): ~79%
│
2024年
├── GPT-4o: ~95%
├── Claude 3.5 Sonnet: ~95%
├── Gemini 1.5 Pro: ~94%
├── DeepSeek-V2: ~93%
├── Qwen2 72B: ~91%
│
2025-2026年
├── Kimi K2 Instruct: ~97.3%
├── Claude Opus 4: ~96.2%
├── DeepSeek R1: ~96.2%
├── GPT-4.5: ~97.0%
├── o3-mini: ~95.2%
├── Llama 4 Maverick: ~95.2%
├── Qwen3 235B A22B: ~95.2%
| 排名 | 模型 | 准确率 | 模型大小 | 类别 |
|---|---|---|---|---|
| 1 | Claude Opus 4 (Thinking) | 96.2% | 未知 | 闭源 |
| 2 | DeepSeek R1 | 96.2% | ~670B | 开源 |
| 3 | OpenAI o4 Mini High | 96.0% | 未知 | 闭源 |
| 4 | Claude 3.7 Sonnet | 95.8% | 未知 | 闭源 |
| 5 | Claude Sonnet 4 | 95.7% | 未知 | 闭源 |
| 6 | Gemini 2.5 Pro | 95.7% | 未知 | 闭源 |
| 7 | Llama 4 Maverick | 95.2% | 未知 | 开源 |
| 8 | Qwen3 235B A22B (Thinking) | 95.2% | 235B | 开源 |
| 9 | GPT-5 | 94.8% | 未知 | 闭源 |
| 10 | Command A | 94.6% | 未知 | 开源 |
| 11 | Minimax M2.1 | 94.6% | 未知 | 开源 |
| 12 | Qwen3 32B | 94.6% | 32B | 开源 |
| 13 | DeepSeek V3 | 93.8% | 671B | 开源 |
| 14 | Mistral Medium 3 | 94.2% | 未知 | 开源 |
| 15 | QwQ 32B | 94.0% | 32B | 开源 |
| 16 | ERNIE 4.5 | 94.6% | 300B | 闭源 |
| 17 | Nemotron 3 Nano 30B A3B | 95.4% | 30B | 开源 |
| 18 | GPT-4.5 | 97.0% | 未知 | 闭源 |
| 19 | Gemini 2.0 Flash | 95.1% | 未知 | 闭源 |
| 20 | Kimi K2 0711 | 95.0% | 1.0T | 开源 |
注:不同评测来源的数据略有差异(因为 CoT 采样有随机性、评测配置不同)。例如 LLM-Stats 排行榜显示 Kimi K2 Instruct 以 97.3% 领先,而 LayerLens/PricePerToken 显示 Claude Opus 4 以 96.2% 领先。
GSM8K 准确率 vs 模型参数量(2025-2026年典型模型)
准确率
95% ┤ Qwen3-235B Claude 4 GPT-5
90% ┤ Qwen3-32B
85% ┤ Llama 4 Maverick
80% ┤
75% ┤
70% ┤
65% ┤ Phi-3.5-MoE
60% ┤
55% ┤
50% ┤
└────────────────────────────────────
1B 10B 100B 1T 参数量
关键发现:
| 模型 | 参数 | GSM8K (CoT) | 训练数据 |
|---|---|---|---|
| GPT-3 (few-shot, no CoT) | 175B | 18.0% | 通用文本 |
| GPT-3 (few-shot, CoT) | 175B | 58.1% | 通用文本 |
| PaLM | 540B | 76.0% | 通用文本 |
| PaLM (self-consistency) | 540B | 82.0% | 通用文本 |
| GPT-4 | 未知 | 87.1% | 通用文本 |
| GPT-4 (self-consistency) | 未知 | 92.0% | 通用文本 |
| Llama-2 7B | 7B | 14.1% | 通用文本 |
| Llama-2 13B | 13B | 22.4% | 通用文本 |
| Llama-2 70B | 70B | 56.8% | 通用文本 |
| Phi-3-mini 4K | 3.8B | 82.5% | 合成数据 |
| Phi-3.5-mini | 3.8B | 86.2% | 合成数据 |
| DeepSeek-V3 | 671B | 93.8% | 高质量多领域 |
以 GPT-3 (175B) 在 GSM8K 上的实验为基准:
| 提示方式 | 准确率 | 推理过程 |
|---|---|---|
| 无 CoT(直接输出) | 18% | 模型直接猜测数字 |
| 0-shot CoT("Let's think step by step") | 42% | 模型自动生成推理链 |
| 8-shot CoT(提供8个示例) | 58% | 更规范的推理模式 |
| 8-shot CoT + Self-Consistency | 78% | 多条路径取多数 |
| 8-shot CoT + 计算器 | 82% | 减少算术错误 |
为什么 CoT 有效? 因为模型将一步"直觉跳跃"分解为若干可验证的原子步骤。每步都是简单的运算,降低了对模型记忆和模式匹配的依赖,更接近真正的外显推理。
分析模型在 GSM8K 上的错误,可分为以下类型:
| 错误类型 | 比例 | 示例 |
|---|---|---|
| 算术错误 | ~35% | 3.5 × 2 算成 7.0(正确应是 7.0,但浮点精度问题) |
| 理解错误 | ~25% | 将 "half as many" 误解为 "half of total" |
| 遗漏步骤 | ~20% | 忘记计算最终总量,只算到中间结果 |
| 无关信息 | ~10% | 引入了不相关的数字进行计算 |
| 符号错误 | ~10% | 用加法代替了减法 |
题目:
A pet store had 56 puppies. In one day they sold 24 of them and gave away 1/4 of the remaining puppies to a shelter. How many puppies are left in the store?
GPT-3 (no CoT) 输出: 24
GPT-3 (CoT) 输出:
The store had 56 puppies. They sold 24, so 56 - 24 = 32 remain.
They gave away 1/4 of the remaining, so 32 / 4 = 8 were given away.
So 32 - 8 = 24 puppies are left. ✅
带 CoT 的模型正确分解了问题,而无 CoT 的模型只是猜了一个数字。
GSM8K 是 2021 年发布的静态数据集,模型的训练数据可能已包含这些题目。2023 年的研究表明,当测试集问题出现在训练数据中时,模型性能可能被高估 10-20%。
| 研究 | 发现 |
|---|---|
| GPT-4 论文 (2023) | GPT-4 训练数据可能包含 GSM8K 测试集的部分题目 |
| 数据污染检测研究 (2024) | 通过在问题中微小改动(如改数字),发现模型性能显著下降 |
| LiveCodeBench 方法 (2024) | 使用训练截止日期后发布的新题目,显示旧版 benchmark 性能虚高 |
到 2025-2026 年,顶级模型在 GSM8K 上的准确率已超过 95%,趋于饱和。这使得 GSM8K 对前沿模型的区分能力大幅下降。
区分度对比:
| Benchmark | 最优模型 | 最差模型(>=7B) | 区分间隔 |
|---|---|---|---|
| GSM8K (2021) | 18% | 95%+ | ~77% |
| GSM8K (2026) | 95%+ | 86%+ | ~9% |
| MATH (2021) | 6.9% | 90%+ | ~83% |
| MATH-500 (2026) | 75%+ | 90%+ | ~15% |
| AIME 2025 (2026) | ~8% | ~72% | ~64% |
在 2026 年的评测体系中,GSM8K 更适合作为入门级推理测试,而 harder benchmark(如 MATH-500、AIME、GPQA)承担高区分度评估的角色。
一个重要争议是:GSM8K 是否真的测试了数学推理,还是仅仅测试了模式匹配和计算能力?
支持"推理测试"观点:
支持"模式匹配"观点:
通过用字母变量替换原始数字来测试模型的真正泛化能力。例如将原题中的 48 替换为 :
Natalia sold clips to of her friends in April, and then she sold half as many clips in May. Express the total number of clips Natalia sold in terms of .
大多数模型在这种符号化变体上性能大幅下降(从 ~95% 降至 ~60%),这暴露了"数字记忆"的问题。
将问题结构反转,例如从"计算总和"变为"已知总和求分量":
正向: A + B = ? → 模型必须计算总和
反向: 总和已知,A 已知,B = ?
模型在反向问题上性能平均下降 15-25%,说明模型对问题方向敏感。
结合代码生成的评估,模型生成 Python 代码而非自然语言推理:
Question: Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May?
def solution():
april_sales = 48
may_sales = april_sales / 2
total = april_sales + may_sales
return total
这种方法消除了计算错误,得分通常比自然语言 CoT 高 5-10%。
以下是使用 lm-evaluation-harness 在 GSM8K 上评估模型的标准化流程:
pip install lm_eval
# 评估 HuggingFace 模型
lm_eval --model hf \
--model_args pretrained=Qwen/Qwen3-32B \
--tasks gsm8k \
--batch_size auto:4 \
--num_fewshot 8
# 评估 OpenAI API 模型
lm_eval --model openai-completions \
--model_args model=gpt-4o \
--tasks gsm8k \
--num_fewshot 8
| Tasks | Version | Filter |n_ shots| Metric | | Value | |Stderr|
|---------|---------|------------|-------:|-----------|---|------:|---|-----:|
|gsm8k |Yaml |flexible-extract| 8|exact_match|↑ | 0.956 |± |0.0065|
from lm_eval import evaluate
from lm_eval.models.huggingface import HFLM
# 加载模型
model = HFLM(pretrained="Qwen/Qwen3-32B")
# 获取 GSM8K 任务
import lm_eval.tasks as tasks
task_manager = tasks.TaskManager()
gsm8k_task = task_manager.load_task_or_group("gsm8k")
# 执行评估
results = evaluate(
model=model,
tasks=[gsm8k_task],
num_fewshot=8,
limit=100 # 可选:限制测试集大小(默认全量 1000 题)
)
print(f"GSM8K Accuracy: {results['results']['gsm8k']['exact_match,strict-match']}")
| 维度 | GSM8K | MATH | AIME | AMC |
|---|---|---|---|---|
| 难度等级 | 小学(2-8步) | 高中(竞赛) | 竞赛级 | 竞赛级 |
| 题目数量 | 8,500 | 12,500 | 30/年 | 25/年 |
| 运算类型 | 加减乘除 | 代数、几何、数论、组合 | 高级数学 | 高中数学 |
| 数字范围 | 自然数 | 整数、实数 | 整数 000-999 | 多种 |
| 典型准确率(2026年前沿模型) | ~96% | ~92% | ~72% | ~85% |
| 区分度(2026年) | 低 | 中 | 高 | 中高 |
| 数据污染风险 | 高(静态2021) | 高(静态2021) | 低(动态) | 低(动态) |
| 评估维度 | GSM8K | MATH-500 | GPQA | AIME 2025 | SWE-bench |
|---|---|---|---|---|---|
| 数学推理 | ✅ 基础 | ✅ 高级 | ❌ | ✅ 专家级 | ❌ |
| 科学推理 | ❌ | ❌ | ✅ | ❌ | ❌ |
| 代码生成 | ❌ | ❌ | ❌ | ❌ | ✅ |
| 领域知识 | ❌ 仅算术 | ✅ 多领域 | ✅ 博士级 | ✅ 高级数学 | ✅ 工程 |
| 防污染能力 | ❌ 差 | ❌ 差 | ✅ 强 | ✅ 强 | ✅ 强 |
| 评估成本 | 低 | 中 | 低 | 中 | 高 |
尽管存在饱和问题,GSM8K 在以下场景仍不可替代:
| 论文 | 发表 | 关键贡献 |
|---|---|---|
| GSM8K: Training Verifiers to Solve Math Word Problems | OpenAI, 2021 | GSM8K 数据集发布 + 验证器训练方法 |
| Chain-of-Thought Prompting Elicits Reasoning in LLMs | Google, 2022 | 提出 CoT 提示方法,在 GSM8K 上验证 |
| Large Language Models are Zero-Shot Reasoners | 东京大学, 2022 | "Let's think step by step" Zero-shot CoT |
| Self-Consistency Improves Chain-of-Thought Reasoning | Google, 2022 | 采样+多数投票,GSM8K 从 58%→78% |
| Training Verifiers to Solve Math Word Problems | OpenAI, 2021 | OVM(outcome verifier)方法 |
| Let's Verify Step by Step | OpenAI, 2023 | 过程奖励模型(PRM),解决 GSM8K 精细推理 |
| Solving Math Word Problems with Process- and Outcome-Based Feedback | 多机构, 2022 | 过程监督 VS 结果监督对比 |
| 资源 | 链接 |
|---|---|
| GSM8K 原始数据 (HuggingFace) | https://huggingface.co/datasets/openai/gsm8k |
| GSM8K 原始代码 | https://github.com/openai/grade-school-math |
| lm-evaluation-harness | https://github.com/EleutherAI/lm-evaluation-harness |
| EvalScope 集成 | https://evalscope.readthedocs.io/en/latest/benchmarks/gsm8k.html |
| LLM-Stats Leaderboard | https://llm-stats.com/benchmarks/gsm8k |
| PricePerToken Leaderboard | https://pricepertoken.com/leaderboards/benchmark/gsm8k |
GSM8K 是 LLM 数学推理评估的基准中的基准——它简单到任何模型都可以尝试,又困难到能够揭示模式匹配与真正推理之间的差距。尽管在 2026 年已趋于饱和,GSM8K 依然在快速验证、回归测试和小模型评估中占据不可替代的位置。
核心要点:
此页面为 AI Benchmark 评估体系 的一部分。