Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models

DeepSeekMath 7B trains an open model to reason about competition mathematics

  • Problem Open language models lag behind closed systems such as GPT-4 on competition mathematics, and the strongest ones are not publicly available.
  • Method DeepSeekMath 7B continues pre-training on 120B math tokens filtered from web data. It is trained with GRPO, which drops PPO's value model and uses group average reward as the baseline.
  • Results DeepSeekMath 7B scored 51.7% on MATH without external toolkits or voting, approaching GPT-4 and Gemini-Ultra.

Why open models stall on competition math

Open models lag behind the strongest systems on competition mathematics, and the most capable ones, GPT-4 and Gemini-Ultra, are not publicly available. The authors bet that the public web already holds enough mathematical text to close part of this gap, provided the text is filtered carefully. Their second bet concerns training: a reinforcement learning step that doesn't need a separate critic, which would otherwise cost about as much memory as the policy.

Taken together, the model scored 51.7% on MATH without external toolkits or voting, and 60.9% with self-consistency over 64 samples.

Filtering Common Crawl into 120B math tokens

The pipeline starts from OpenWebMath as the seed, and a fastText classifier learns to separate those pages from 500,000 random Common Crawl pages. The seed pages act as positives and the random pages as negatives, so the classifier learns what math web text looks like against general web text. The classifier uses a vector dimension of 256 and a learning rate of 0.1, and the pipeline keeps only the pages it ranks highest.

URL-based and near-deduplication first cut the crawl to 40B HTML pages, and the classifier then ranks those pages by predicted score. The first iteration kept the top 40B tokens, a size chosen from pre-training runs on 40B, 80B, 120B and 160B tokens. That first pass lacked diverse positives, so the authors grouped Common Crawl by base URL and called a domain math-related when over 10% of its pages were already collected.

Annotators then marked math URL paths, and the uncollected pages under those paths joined the seed for a retrained classifier.

After four iterations the corpus holds 35.5M web pages and 120B tokens, and the authors stopped because nearly 98% of the fourth iteration's data had already been collected in the third. To keep benchmarks out, any text segment containing a 10-gram that exactly matches an evaluation benchmark was removed, and shorter benchmark texts of at least 3 grams were matched exactly.

Does the corpus beat the other math corpora?

To test corpus quality, the authors trained DeepSeek-LLM 1.3B on each math corpus for 150B tokens under the same setup.

On GSM8K the DeepSeekMath Corpus got 23.8%, compared to 14.3% for Proof-Pile-2. The gap is wider on the Chinese CMATH benchmark, where the DeepSeekMath Corpus scored 41.5% compared to 19.9% for Proof-Pile-2. The authors tie this to multilingual coverage, since English and Chinese are the main languages and the English-centric corpora helped Chinese little.

The learning curves show a steeper climb for the DeepSeekMath Corpus, which kept improving, while the smaller baselines had been repeated and plateaued. The comparison therefore bundles quality, language coverage and size, and this experiment does not pull those three apart.

DeepSeekMath-Base 7B on math, tools and general tasks

DeepSeekMath-Base 7B starts from DeepSeek-Coder-Base-v1.5 7B and trains for 500B tokens. Its mix is 56% DeepSeekMath Corpus, 20% GitHub code, 10% arXiv, 4% AlgebraicStack and 10% natural language from Common Crawl. The authors kept the earlier training setup but raised the batch to 10M tokens and set the peak learning rate to 4.2e-4.

On MATH with chain-of-thought, DeepSeekMath-Base 7B scored 36.2%, compared to 25.3% for Llemma 34B and 14.3% for Mistral 7B. Minerva 540B scored 33.6% on MATH in the quoted comparison, but that model is 77 times larger and its numbers come from prior work. The authors say the 7B base leads all eight open-source benchmarks in the table, and on MATH it is over 10% absolute ahead of the other open-source base models.

With Python program-of-thought, the model scored 66.9% on GSM8K and 31.4% on MATH, compared to 64.6% and 26.3% for Llemma 34B. General ability moved too: MMLU rose from 49.1% to 54.9% and BBH from 55.2% to 59.5% over its precursor, DeepSeek-Coder-Base-v1.5. Coding cost something, since HumanEval fell from 43.2% to 40.9% and MBPP from 60.4% to 52.6%, although the authors describe coding as effectively maintained.

How GRPO replaces the value model

PPO normally needs a value model of comparable size to the policy to estimate advantages, which adds memory and compute. GRPO drops that model and uses the average reward of several outputs to the same question as the baseline. This fits reward models, which are usually trained to compare outputs for one question.

For each question, GRPO samples a group of G outputs from the old policy, scores each with the reward model, and subtracts the group mean from each reward. It then divides by the group standard deviation, and under outcome supervision every token of an output takes that normalized reward as its advantage. The objective keeps PPO's clipped probability ratio, but instead of folding a KL penalty into the reward, it adds a KL divergence term directly to the loss.

That KL term uses an unbiased estimator that is always positive.

The process variant scores each reasoning step, and a token's advantage becomes the sum of normalized step rewards from that step onward. Iterative GRPO regenerates reward-model training data from policy samples, keeps 10% of historical data as replay, and sets the reference model to the current policy.

What the RL stage adds to the instruct model

The policy learning rate was 1e-6 and the KL coefficient 0.04, with a maximum length of 1024 tokens and a batch of 1024. These values belong to that run, and the RL data came only from the two datasets, which leaves other benchmarks unseen during this phase.

GSM8K rose from 82.9% to 88.2%, and MATH rose from 46.8% to 51.7%. On CMATH, which the RL data did not cover, the score rose from 84.6% to 88.8%. The authors call GSM8K and MATH in-domain and the other benchmarks out-of-domain, so the CMATH gain is the transfer evidence in this study.

Gemini Ultra scored 53.2% and GPT-4 52.9% on MATH with chain-of-thought, so the RL model sits just behind both. With tool-integrated reasoning, DeepSeekMath-Instruct 7B scored 57.4% on MATH and DeepSeekMath-RL 7B scored 58.8%. Self-consistency over 64 samples gives 60.9%, a separate voting setting from the Top1 numbers.

Why RL helps: majority vote versus any-correct

The authors compared Maj@K and Pass@K for the SFT and RL models on GSM8K and MATH at temperature 0.7. RL lifted Maj@K but not Pass@K. Maj@K scores the majority answer among K samples, while Pass@K scores whether any of the K samples is correct.

The authors read this as RL making the output distribution more robust, so correct answers move up in the ranking of samples. On that reading the gain comes from ranking correct answers higher, not from new fundamental capability. They offer a possible reason for the pattern: the RL data used only instruction-tuning questions with naive nucleus sampling.

Code and arXiv in pre-training

The authors tested whether code training before math training helps, using DeepSeek-LLM 1.3B. Code tokens for 400B followed by math tokens for 150B reached 15.3% on MATH, compared to 14.4% when general tokens came first and 13.1% for math training alone. So code helped the math stage beyond general pre-training, at least at this model size.

Mixing 400B code tokens with 150B math tokens in one stage gave 12.1% on MATH with chain-of-thought, below the two-stage path. With Python, though, the mixed run scored 19.7% on GSM8K+Python, compared to 17.4% for the two-stage path. The mixed run also scored 29.3% on HumanEval, compared to 12.2% after two-stage math training. The authors suspect the 1.3B model lacks the capacity to absorb both code and math at once.

They trained DeepSeek-LLM 1.3B for 150B tokens and DeepSeek-Coder-Base-v1.5 7B for 40B tokens on each arXiv corpus. On GSM8K, DeepSeek-LLM 1.3B moved from 2.9% to 2.7% with MathPile. DeepSeek-Coder-Base-v1.5 7B dropped from 29.0% to 23.6% on GSM8K with MathPile and was at 28.1% with ArXiv-RedPajama. The authors conclude that arXiv papers seem ineffective for mathematical reasoning in these tests.

Limitations

Geometry and theorem proving remain weaker than closed models, and the authors link this to possible data selection bias in pre-training and fine-tuning. In a dry run the model could not handle problems about triangles or ellipses.

Few-shot ability also trails GPT-4, since DeepSeekMath shows similar zero-shot and few-shot performance while GPT-4 gains from few-shot inputs. The arXiv conclusion was not tested for informalization of theorems, for mixes with other data, or at larger model scale. The main RL numbers start from DeepSeekMath-Instruct 7B, so the RL gains are shown for that starting point only.

Paper info

Authors
Zhihong Shao, Peiyi Wang, Qihao Zhu, Runxin Xu, Junxiao Song, Xiao Bi, Haowei Zhang, Mingchuan Zhang, Y. K. Li, Y. Wu, Daya Guo
Venue
arXiv · Preprint
First published
2024-2-5
Added
2026-11-11
Updated
2024-4-27
Version
v3
arXiv
2402.03300
Category
cs.CL · cs.AI · cs.LG
Original paper terms
arXiv non-exclusive 1.0
What we show
Paper info and commentary

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Quote from the paper

Zhihong Shao, Peiyi Wang, Qihao Zhu, Runxin Xu, Junxiao Song, Xiao Bi, Haowei Zhang, Mingchuan Zhang, Y. K. Li, Y. Wu, Daya Guo (2024). DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models. arXiv:2402.03300v3. https://arxiv.org/abs/2402.03300v3

BibTeX
@misc{shao2024deepseekmath,
  title = {{DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models}},
  author = {Zhihong Shao and Peiyi Wang and Qihao Zhu and Runxin Xu and Junxiao Song and Xiao Bi and Haowei Zhang and Mingchuan Zhang and Y. K. Li and Y. Wu and Daya Guo},
  year = {2024},
  eprint = {2402.03300},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.03300v3}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up