{
  "id": 571252,
  "title": "[LB Pub 29 Pvt 28] Enhancing the efficiency of a reasoner using SFT and GRPO [Fast-Math-R1-14B]",
  "content": "<p>First of all, congratulations to all the participants for making it through this long and challenging competition. We’d also like to express our sincere appreciation to the organizers for designing such an interesting competition with a high-quality dataset, and to the Kaggle team for providing the extensive computational resources that made this possible.</p>\n<p>Our team identified the main challenge of this competition as the redundancy in the reasoning process of the DeepSeek R1 series models — specifically, their long output token lengths, which made it difficult to solve 50 problems within the 5-hour time limit. To address this, we aimed to fine-tune a distilled version of the R1 model to reason more efficiently.</p>\n<p>Our final model scored <strong>29 on public LB and 28 on private LB</strong>.</p>\n<h2>Paper</h2>\n<p>ICML2025 AI for Math Workshop<br>\n<a href=\"https://arxiv.org/abs/2507.08267\" target=\"_blank\">A Practical Two-Stage Recipe for Mathematical LLMs: Maximizing Accuracy with SFT and Efficiency with Reinforcement Learning</a></p>\n<h2>Github</h2>\n<p><a href=\"https://github.com/analokmaus/kaggle-aimo2-fast-math-r1\" target=\"_blank\">https://github.com/analokmaus/kaggle-aimo2-fast-math-r1</a></p>\n<h2>Model</h2>\n<p><a href=\"https://huggingface.co/RabotniKuma/Fast-Math-R1-14B\" target=\"_blank\">https://huggingface.co/RabotniKuma/Fast-Math-R1-14B</a><br>\n<a href=\"https://www.kaggle.com/models/analokamus/fast_math_r1_14b/\" target=\"_blank\">https://www.kaggle.com/models/analokamus/fast_math_r1_14b/</a></p>\n<h2>Dataset</h2>\n<p><a href=\"https://huggingface.co/datasets/RabotniKuma/Fast-Math-R1-SFT\" target=\"_blank\">https://huggingface.co/datasets/RabotniKuma/Fast-Math-R1-SFT</a><br>\n<a href=\"https://huggingface.co/datasets/RabotniKuma/Fast-Math-R1-GRPO\" target=\"_blank\">https://huggingface.co/datasets/RabotniKuma/Fast-Math-R1-GRPO</a></p>\n<h1>First stage: intensive SFT using a high-difficulty dataset</h1>\n<h2>Dataset</h2>\n<p><a href=\"https://huggingface.co/datasets/open-r1/OpenR1-Math-220k\" target=\"_blank\">OpenR1 Math</a>: We randomly sampled 3000 examples where the R1’s trace had more than 12800 tokens and an accuracy of over 50%, along with another 3000 examples where the accuracy ranged between 50% and 75%.<br>\n<a href=\"https://huggingface.co/datasets/hoanganhpham/openr1_hard\" target=\"_blank\">openr1_hard</a>:  \"~2.5k hard samples from open-r1-math-220k. Samples deemed as hard were unsolvable by r1-distill-32b after 4 tries.\" (Thank you for the dataset, <a href=\"https://www.kaggle.com/andy2709\" target=\"_blank\">@andy2709</a> )<br>\n<a href=\"https://huggingface.co/datasets/qihoo360/Light-R1-SFTData\" target=\"_blank\">Light-R1-SFTData</a>: We used the 2nd stage data from Light-R1-SFTData. (Big thanks to LightR1 team, <a href=\"https://www.kaggle.com/zouhaosheng\" target=\"_blank\">@zouhaosheng</a> )</p>\n<p>We merged all the datasets mentioned above, removed duplicates, and selected the correct generation with the shortest token length. For samples in the Light-R1 dataset where ground truth answers were not provided, we extracted and substituted the answers from the R1 traces. As a result, we constructed a <strong>high-difficulty dataset consisting of 7900 problem - R1 trace - answer sets</strong>.</p>\n<h2>Training</h2>\n<p>Based on our prior experiments, we observed that the 14B models demonstrated more stable performance. Therefore, we chose DeepSeek-R1-Distill-Qwen-14B as our starting point. A full-parameter supervised fine-tuning training was conducted on a machine with 8 H200 GPUs, using the SFTTrainer from the trl library.</p>\n<h3>Key parameters</h3>\n<ul>\n<li>per_device_train_batch_size = 1</li>\n<li>gradient_accumulation_steps = 8</li>\n<li>num_train_epochs = 20 <ul>\n<li>This number is unusually big, but we found that meaningful performance gains only emerged after long long training</li></ul></li>\n<li>max_seq_length = 24000</li>\n<li>packing = True</li>\n<li>learning_rate = 1e-5</li>\n<li>lr_scheduler_type = cosine</li>\n<li>system_prompt = \"Please reason step by step, and put your final answer within \\boxed{{}}.\"</li>\n</ul>\n<p>Training time: approx. 10 hours (8× H200 GPUs)</p>\n<h2>Evaluation</h2>\n<p>We evaluated the model’s performance using a dataset of 40 problems, consisting of <strong>10 reference problems and 30 from AIME 2025</strong>.<br>\nInitially, we generated answers using 16k tokens × 32 prompts. We then applied post-hoc filtering based on token length and the number of prompts to assess performance under various inference conditions.</p>\n<h2>Results</h2>\n<table>\n<thead>\n<tr>\n<th>Experiment</th>\n<th>Token budget</th>\n<th>Accuracy (majority@32)</th>\n<th>Accuracy (pass@32)</th>\n<th>Num of answers collected</th>\n<th>Average generation length</th>\n<th>Public LB (quantized model)</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>DeepSeek-R1-Distill-Qwen-14B</td>\n<td>16384</td>\n<td>0.700</td>\n<td>0.775</td>\n<td>21.775</td>\n<td>9684</td>\n<td>25</td>\n</tr>\n<tr>\n<td>DeepSeek-R1-Distill-Qwen-14B</td>\n<td>12800</td>\n<td>0.675</td>\n<td>0.775</td>\n<td>16.775</td>\n<td>8331</td>\n<td></td>\n</tr>\n<tr>\n<td>DeepSeek-R1-Distill-Qwen-14B</td>\n<td>9000</td>\n<td>0.525</td>\n<td>0.600</td>\n<td>12.500</td>\n<td>4725</td>\n<td></td>\n</tr>\n<tr>\n<td>SFT</td>\n<td>16384</td>\n<td>0.750</td>\n<td>0.825</td>\n<td>20.725</td>\n<td>10396</td>\n<td>23</td>\n</tr>\n<tr>\n<td>SFT</td>\n<td>12800</td>\n<td>0.725</td>\n<td>0.725</td>\n<td>15.700</td>\n<td>7024</td>\n<td></td>\n</tr>\n<tr>\n<td>SFT</td>\n<td>9000</td>\n<td>0.550</td>\n<td>0.550</td>\n<td>11.600</td>\n<td>4387</td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<p>Our local validation scores improved remarkably after the first-stage SFT. However, we observed that the Public LB scores tended to be slightly lower.<br>\nWe believe this was <strong>due to increased reasoning redundancy introduced by SFT, causing many examples to fail to reach a conclusion within the time limit</strong>.<br>\nTo address this, our next objective was to apply reinforcement learning to encourage the model to reach accurate conclusions using fewer tokens, while maintaining performance.</p>\n<h1>Second stage: GRPO for more efficient reasoning</h1>\n<h2>Dataset</h2>\n<p><a href=\"https://huggingface.co/datasets/qihoo360/Light-R1-SFTData\" target=\"_blank\">Light-R1-SFTData</a>: We used the 2nd stage data from Light-R1-SFTData.</p>\n<h2>Training</h2>\n<p>We used the <a href=\"https://github.com/nhannguyen2709/open-r1\" target=\"_blank\">faster version of trl GRPOTrainer</a> created by <a href=\"https://www.kaggle.com/andy2709\" target=\"_blank\">@andy2709</a> (again, thank you so much!).</p>\n<p>We used the following reward function:</p>\n<ol>\n<li>Format reward<br>\nIn our submission, generation is stopped at the <code>&lt;/think&gt;</code> tag to save time, therefore we designed the reward to match the pattern <code>r\"^.*?oxed{(.*?)}.*?&lt;/think&gt;.*?$\"</code>.</li>\n<li>Cosine reward (correct [1.0, 0.1], incorrect [-0.1, -1.0], max_len=30000)<br>\nCompared to a normal accuracy-based reward, cosine reward applies a continuous penalty to longer correct reasoning traces and shorter incorrect ones.</li>\n<li>Length reward<br>\nLength-based rewards to discourage overthinking and promote token efficiency.<br>\nPaper: <a href=\"https://arxiv.org/abs/2501.12599\" target=\"_blank\">https://arxiv.org/abs/2501.12599</a></li>\n</ol>\n<h3>Key parameters</h3>\n<ul>\n<li>num_generations = 8</li>\n<li>beta = 0.04</li>\n<li>per_device_train_batch_size = 2</li>\n<li>gradient_accumulation_steps = 8</li>\n<li>num_train_epochs = 1 </li>\n<li>max_completion_length = 16384</li>\n<li>learning_rate = 4e-6</li>\n<li>lr_scheduler_type = cosine</li>\n<li>system_prompt = (<br>\n    'You are a helpful and harmless assistant. You are Qwen developed by Alibaba. '<br>\n    'You should think step-by-step. Return final answer within \\boxed{{}}.'<br>\n)</li>\n</ul>\n<p>Training time: approx. 10 hours (8× H200 GPUs)</p>\n<h2>Evaluation</h2>\n<p>Same as first stage.</p>\n<h2>Results</h2>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1973217%2Fdbd9dd1814ade77cc5c840319d36cf72%2FScreenshot%202025-04-02%20at%2016.55.07.png?generation=1743580526542546&amp;alt=media\" alt=\"\"><br>\nThe reward was optimized steadily throughout training, but after step 60, catastrophic shifts occurred, causing a substantial decline in performance. We thus decided to use checkpoints from earlier steps for evaluation.</p>\n<table>\n<thead>\n<tr>\n<th>Experiment</th>\n<th>Token budget</th>\n<th>Accuracy (majority@32)</th>\n<th>Accuracy (pass@32)</th>\n<th>Num of answers collected</th>\n<th>Average generation length</th>\n<th>Public LB (quantized model)</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>DeepSeek-R1-Distill-Qwen-14B</td>\n<td>12800</td>\n<td>0.675</td>\n<td>0.775</td>\n<td>16.775</td>\n<td>8331</td>\n<td>25</td>\n</tr>\n<tr>\n<td>DeepSeek-R1-Distill-Qwen-14B</td>\n<td>9000</td>\n<td>0.525</td>\n<td>0.600</td>\n<td>12.5</td>\n<td>4725</td>\n<td></td>\n</tr>\n<tr>\n<td>SFT</td>\n<td>12800</td>\n<td>0.725</td>\n<td>0.725</td>\n<td>15.7</td>\n<td>7024</td>\n<td>23</td>\n</tr>\n<tr>\n<td>SFT</td>\n<td>9000</td>\n<td>0.550</td>\n<td>0.550</td>\n<td>11.6</td>\n<td>4387</td>\n<td></td>\n</tr>\n<tr>\n<td>SFT + GRPO (best checkpoint)</td>\n<td>12800</td>\n<td><strong>0.725</strong></td>\n<td><strong>0.775</strong></td>\n<td><strong>18.5</strong></td>\n<td>6817</td>\n<td><strong>29</strong></td>\n</tr>\n<tr>\n<td>SFT + GRPO (best checkpoint)</td>\n<td>9000</td>\n<td><strong>0.625</strong></td>\n<td><strong>0.700</strong></td>\n<td><strong>15.25</strong></td>\n<td>4759</td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<p>GRPO enabled us to train a model that preserved accuracy while significantly improving inference efficiency through shorter token lengths. </p>\n<h1>Submission inference setup</h1>\n<h2>Quantization</h2>\n<p>We applied 4-bit quantization using <a href=\"https://github.com/casper-hansen/AutoAWQ\" target=\"_blank\">AutoAWQ</a>.<br>\nWe observed some degradation in validation performance after quantization, and attempted to recover it through calibration on a math-specific dataset. Unfortunately, this approach did not succeed in preserving the original performance.</p>\n<h2>Inference time scheduling</h2>\n<p>We trained a ModernBERT model to predict the shortest token length of correct R1 traces for each problem in the OpenR1 Math dataset, thereby quantifying problem difficulty.<br>\nOn the validation set, we observed a moderate correlation between the predicted difficulty and the actual number of tokens generated, as shown in the figure below.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1973217%2F75f9af2011608c982ac21ca1bd091464%2Flongcontext_tokenlength_scatter.png?generation=1743582693786625&amp;alt=media\" alt=\"\"></p>\n<p>Using this model, we scaled the output token length dynamically during inference. This approach stabilized the Public LB scores and led to an improvement of approx. +1 point (though it could be placebo).</p>\n<h2>Misc.</h2>\n<ul>\n<li>Prompts: prompt_config0 * 8 + prompt_config1 * 2 (10 prompts in total)</li>\n</ul>\n<pre><code>prompt_config0 = (\n    system=(\n        \n        \n    ),\n    prompt=\n)\n\nprompt_config1 = (\n    system=(\n        \n        \n    ),\n    prompt=\n)\n</code></pre>\n<ul>\n<li>Output token length: 10500 - 13300 (dynamic scaling described above)</li>\n<li>vLLM version 0.7.3 with V1</li>\n</ul>\n<h1>What didn’t work</h1>\n<h2>Constrained decoding</h2>\n<p>Many studies have explored controlling the reasoning processes of LLMs through constrained decoding methods, such as:</p>\n<ul>\n<li><a href=\"https://arxiv.org/pdf/2501.18585\" target=\"_blank\">https://arxiv.org/pdf/2501.18585</a></li>\n<li><a href=\"https://arxiv.org/pdf/2412.21187\" target=\"_blank\">https://arxiv.org/pdf/2412.21187</a></li>\n</ul>\n<p>We experimented extensively with these approaches and tuned various parameters; however, none of them proved effective on our validation dataset. Our hypothesis is that these methods might only be suitable for relatively simple problems.</p>\n<h2>Rewritiing the reasoning process and retraining</h2>\n<p>We also experimented with rewriting the original R1-Qwen model’s reasoning process into a more compact one, following the <a href=\"https://github.com/NovaSky-AI/SkyThought\" target=\"_blank\">SkyThought</a> approach, and retraining the model via SFT and DPO. Although this method significantly reduced the number of tokens generated before reaching an answer, it also caused a substantial drop in accuracy.</p>\n<p>For highly capable LLMs, forcibly altering their natural reasoning process externally might not be an effective strategy, particularly when dealing with complex problem-solving scenarios like ours.</p>",
  "comments": [
    {
      "id": 3168397,
      "author_name": "xz",
      "author_url": "",
      "post_date": "2025-04-02T11:45:28.740000",
      "content": "<p>Thanks for sharing! I tried to use the cosine reward in a first couple of my experiments as well, I think after certain steps, depending on your lr and beta, it will just give up on difficult problems because it is afraid of the penalty for providing long and incorrect solutions.</p>",
      "votes": 6,
      "replies": [
        {
          "id": 3168499,
          "author_name": "Togawa Sakiko",
          "author_url": "",
          "post_date": "2025-04-02T14:02:24.060000",
          "content": "<p>Based on this <a href=\"https://github.com/huggingface/open-r1/issues/312\" target=\"_blank\">issue</a>, there seems to be a small bug in the arguments of <strong>cosine reward</strong> in the repo <code>open-r1</code>.<br>\nThe default value of <code>cosine_min_value_wrong</code> is set to <code>0</code> and the <code>cosine_max_value_wrong</code> is <code>-0.5</code> in the config <a href=\"https://github.com/huggingface/open-r1/blob/4f5b21e21dec473af9729bce8e084deb16223ae4/src/open_r1/configs.py#L116\" target=\"_blank\">file</a>, which makes the  longer incorrect solutions are penalized more than shorter ones after we swap the min/max value. So if you use the default value in <code>configs.py</code>, I suggest you may try to use the value in <code>rewards.py</code>😉.</p>",
          "votes": 1,
          "replies": [
            {
              "id": 3168508,
              "author_name": "xz",
              "author_url": "",
              "post_date": "2025-04-02T14:11:58.083000",
              "content": "<p>Giving higher reward to longer incorrect answer will lead to reward hacking. It can be used on a base model to encourage outputting longer reasoning traces but not ideal for a model like deepseek r1 distill.</p>",
              "votes": 0,
              "replies": []
            }
          ]
        },
        {
          "id": 3169125,
          "author_name": "Chan Kha Vu",
          "author_url": "",
          "post_date": "2025-04-03T06:26:33.273000",
          "content": "<p>I also have this impression (just checked my veRL fork, the rewards values are correct - my wrongs are from -1.0 to -0.5 and my corrects are 0.5 to 1.0). In (most) of my experiments, overlong buffer (from DAPO) has a more gentle effect than cosine length reward.</p>\n<p>But again, there are sooooo many factors and other parameters that goes into each experiments that I'm not sure what caused what lol. Maybe cosine is fine and the reason that experiment was worse was from a totally different reason</p>",
          "votes": 1,
          "replies": [
            {
              "id": 3169281,
              "author_name": "xz",
              "author_url": "",
              "post_date": "2025-04-03T09:37:06.117000",
              "content": "<p>Yeah, it’s is kinda hard to know for sure. The length normalization from Dr GRPO paper also has a length bias, although removing standard deviation is definitely a sound idea.</p>",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 3168372,
      "author_name": "NguyenThanhNhan",
      "author_url": "",
      "post_date": "2025-04-02T11:13:28.410000",
      "content": "<p><a href=\"https://www.kaggle.com/analokamus\" target=\"_blank\">@analokamus</a> Thanks for sharing your team's solution. I also really appreciate you testing out and verifying my GRPO implementation correctness 🤣.</p>\n<p>I could only afford to lora finetune the r1 14b model with GRPO on 16k sequences and got kinda similar validation results on reference + aime 25. However, the public LB score was really absymal and completely discouraged me from sharing anything 🥲</p>",
      "votes": 6,
      "replies": []
    },
    {
      "id": 3190249,
      "author_name": "Darragh",
      "author_url": "",
      "post_date": "2025-04-30T11:21:51.580000",
      "content": "<p>Congrats <a href=\"https://www.kaggle.com/analokamus\" target=\"_blank\">@analokamus</a> <a href=\"https://www.kaggle.com/inoueu1\" target=\"_blank\">@inoueu1</a> <a href=\"https://www.kaggle.com/charmq\" target=\"_blank\">@charmq</a> <br>\nI have some questions for your great approach - we missed this training based on length. </p>\n<ul>\n<li>Is there a weighting to the three reward functions you used - Format reward / Cosine reward / Length reward ? Or equal weight. </li>\n<li>If I look at the description of the three rewards they seem more focused to length, than accuracy. Is there a risk the model could lose accuracy, or you did not see that. I am just learning GRPO, maybe that is handled with KL divergence already. </li>\n<li>For Format reward, what is the reason you stop at <code>/&lt;think&gt;</code> … we tried this and it seems the best answer usually comes after that in the summarise. Maybe I missed something. </li>\n</ul>",
      "votes": 3,
      "replies": [
        {
          "id": 3190363,
          "author_name": "RabotniKuma",
          "author_url": "",
          "post_date": "2025-04-30T14:56:19.077000",
          "content": "<p>Thank you, <a href=\"https://www.kaggle.com/darraghdog\" target=\"_blank\">@darraghdog</a> !<br>\nAs a Kaggler-runner, it’s an honor to see you on the Kaggle leaderboard, rather than on Strava.</p>\n<p>You’re raising really important points</p>\n<blockquote>\n  <p>Is there a weighting to the three reward functions you used - Format reward / Cosine reward / Length reward ? Or equal weight.</p>\n</blockquote>\n<p>We used equal weight, and the range of reward values can be found <a href=\"https://github.com/analokmaus/kaggle-aimo2-fast-math-r1/blob/master/finetune/grpo_rewards.py\" target=\"_blank\">here</a>.</p>\n<blockquote>\n  <p>If I look at the description of the three rewards they seem more focused to length, than accuracy. Is there a risk the model could lose accuracy, or you did not see that. I am just learning GRPO, maybe that is handled with KL divergence already.</p>\n</blockquote>\n<p>This was the most challenging part of developing our GRPO recipe.<br>\nOne of the biggest pitfalls in RL is <strong>reward hacking</strong>, and we encountered it in the beginning.<br>\nEarly on, we experimented with simple reward functions such as format reward, accuracy reward, and length reward, but they often led to models that “confidently generated incorrect answers without thinking deeply.” </p>\n<p>To address this, we replaced the accuracy reward with a cosine reward and tuned its scaling parameters (max_value_wrong and min_value_correct).<br>\nThis allowed us to moderately shorten the reasoning process while maintaining accuracy.<br>\nHowever, since we were also modifying the dataset at the same time, we plan to run additional ablation experiments as part of the paper we’re currently preparing to verify whether this effect was truly due to the reward change.</p>\n<blockquote>\n  <p>For Format reward, what is the reason you stop at / … we tried this and it seems the best answer usually comes after that in the summarise. Maybe I missed something.</p>\n</blockquote>\n<p>We observed a similar drop in accuracy when applying early stopping at  without RL.<br>\nHowever, by explicitly incorporating format rewards into the RL objective during training, we found that the resulting accuracy gap became almost negligible, especially considering the benefit by the 300–400 tokens saved.</p>",
          "votes": 2,
          "replies": [
            {
              "id": 3190476,
              "author_name": "Darragh",
              "author_url": "",
              "post_date": "2025-04-30T17:48:57.913000",
              "content": "<p>Thank you for the explanation, looking forward to the paper and trying this out more. Yes, AIMO (and small injury) kept me off Strava.. good to see you going strong.</p>",
              "votes": 2,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 3168535,
      "author_name": "JasonZuo",
      "author_url": "",
      "post_date": "2025-04-02T14:34:01.233000",
      "content": "<p>Great efforts! Our approach is actually quite similar to yours : ). We only SFT-ed for 2 epochs (maybe we should do more epochs like yours, but fear for overfitting XD) by distilling on QwQ-32B on 16k math problems selected from LIMO dataset. This step is quite crucial. Then, for GRPO we used verl (and based on DeepScaleR's work), which is quite a handy and efficient library. Interestingly, we have similarly used length penalty and reward reweight (the cosine reward in your post). We also stop at  during training, but didn't use a format reward because we thought that the model might somehow hack the reward----anyhow, the format reward is implicit in the rule-based reward. We track our training progress primarily based on the number of solved-alls and solved-nones at each batch (shape of 32bs, 8gens, and 12k len).</p>",
      "votes": 4,
      "replies": []
    },
    {
      "id": 3168273,
      "author_name": "ducnh279",
      "author_url": "",
      "post_date": "2025-04-02T09:42:29.830000",
      "content": "<p>Training a model with controlled response length is a clever approach in the context of this competition! </p>\n<p>I remember asking deepseek 1 + 1 = ? and it responded with nearly 1k tokens. 😆</p>",
      "votes": 2,
      "replies": [
        {
          "id": 3168334,
          "author_name": "",
          "author_url": "",
          "post_date": "2025-04-02T10:34:44.047000",
          "content": "",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 3178083,
      "author_name": "corochann",
      "author_url": "",
      "post_date": "2025-04-13T17:39:54.280000",
      "content": "<p>Congrats <a href=\"https://www.kaggle.com/analokamus\" target=\"_blank\">@analokamus</a> <a href=\"https://www.kaggle.com/inoueu1\" target=\"_blank\">@inoueu1</a> <a href=\"https://www.kaggle.com/charmq\" target=\"_blank\">@charmq</a> , and thank you for sharing detailed writeup!<br>\nIt's interesting that the purpose of the RL was to reduce reasoning tokens.<br>\nAnd it is also informative that constrained decoding and off-policy SFT &amp; DPO didn't work well.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 3169314,
      "author_name": "eldenring",
      "author_url": "",
      "post_date": "2025-04-03T10:38:39.280000",
      "content": "<p>Thanks for your great article! Respect! 🎩🎩🎩</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 3168773,
      "author_name": "Quickpanda",
      "author_url": "",
      "post_date": "2025-04-02T19:03:19.137000",
      "content": "<p>Great article! looking for the full version.<br>\nThanks for sharing!</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 3168298,
      "author_name": "BJBA99",
      "author_url": "",
      "post_date": "2025-04-02T10:10:41.567000",
      "content": "<p>Congratulations and Thanks for this post! Your team's identification of main challenge what I was looking for. I had a reasonable doubt about it but couldn't find ways to verify it. All my efforts went in opposite direction in using RAG, verification prompts, detailed prompts which must have resulted in more tokens, and always scored less than the simple prompt notebook. I got to learn lot from your post, thanks again.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 3168208,
      "author_name": "a14iiiii",
      "author_url": "",
      "post_date": "2025-04-02T08:24:40.113000",
      "content": "<p>Congratulation! I also tried SFT on 7B qwen2.5-ds model using Light-R1-SFTData(stage 2), I set epoch to 3 and it seems to underfit, after several attempts, finally i abandoned🫠</p>",
      "votes": 1,
      "replies": [
        {
          "id": 3168251,
          "author_name": "RabotniKuma",
          "author_url": "",
          "post_date": "2025-04-02T09:14:01.073000",
          "content": "<p>Initially, we also conducted similar training and came to the conclusion that SFT wasn’t particularly helpful. However, in the case of task-specific LLMs like this one, it’s possible that extended SFT might actually be more effective — this is something we’d like to explore further through additional experiments.</p>\n<p>Another point is that R1-Qwen-7B was originally trained starting from Qwen-Math-7B, whereas the 14B version was based on the general-purpose Qwen-14B. Our experiments also suggested that it’s more difficult to improve the 7B model’s performance further using math-specific datasets, compared to the 14B model.</p>",
          "votes": 2,
          "replies": []
        }
      ]
    },
    {
      "id": 3168468,
      "author_name": "冬云金雨",
      "author_url": "",
      "post_date": "2025-04-02T13:26:42.880000",
      "content": "<p>Hello! I'm interested in your GRPO session, have you tried 0 for the beta parameter? Which is better 0 or 0.04?</p>",
      "votes": 2,
      "replies": [
        {
          "id": 3169153,
          "author_name": "RabotniKuma",
          "author_url": "",
          "post_date": "2025-04-03T06:59:20.153000",
          "content": "<p>Hi, I didn't try that, but I would like to run some additional experiments later. I will add this to the queue.</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 3170775,
          "author_name": "JasonZuo",
          "author_url": "",
          "post_date": "2025-04-05T02:07:22.183000",
          "content": "<p>Removing kl works. Not sure how much KL hinders convergence. We first adopted it, but soon dropped it for the rest of our experiments. The model's KL loss won't go away too far per se even with beta=0, otherwise the model's training just failed. </p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 3168236,
      "author_name": "AI-Cat",
      "author_url": "",
      "post_date": "2025-04-02T08:58:34.080000",
      "content": "<p>You did a great job! My applause! I really missed node with 8xH200.</p>\n<p>I take my hat off to you, I have nothing even close to that.</p>",
      "votes": 2,
      "replies": [
        {
          "id": 3168243,
          "author_name": "RabotniKuma",
          "author_url": "",
          "post_date": "2025-04-02T09:08:32.373000",
          "content": "<p>Hi Konstantin,</p>\n<p>I’d like to return the same kind words to you. Throughout this competition, you’ve been very active in the discussions, and I’ve learned a lot from your comments. I’m also really looking forward to seeing your solution, especially since you’ve managed to consistently achieve wonderful results without any fine-tuning.</p>\n<p>Our team happened to have access to good amount of compute resources this time, so we deliberately took an approach centered around large scale fine-tuning - something most teams wouldn’t typically be able to do, in hopes of gaining additional insights.<br>\nWhile compute is undeniably a big advantage in competitions like this, we hope to give back to the community by sharing as much of what we’ve learned as possible.</p>",
          "votes": 5,
          "replies": [
            {
              "id": 3168258,
              "author_name": "AI-Cat",
              "author_url": "",
              "post_date": "2025-04-02T09:23:49.637000",
              "content": "<p>Hi Rabotni,</p>\n<p>In fact, I just did what anyone can do, without additional computing resources. I squeezed out of the model everything that it can reproduce in 7.2 minutes. My solution is based on an accurate planner and a selected strategy for its work. I tried many strategies, but one turned out to be very successful.</p>",
              "votes": 2,
              "replies": []
            },
            {
              "id": 3168403,
              "author_name": "bliao",
              "author_url": "",
              "post_date": "2025-04-02T11:54:25.103000",
              "content": "<p>Can't wait to hear your solution! </p>",
              "votes": 0,
              "replies": []
            },
            {
              "id": 3168505,
              "author_name": "",
              "author_url": "",
              "post_date": "2025-04-02T14:09:51.740000",
              "content": "",
              "votes": 0,
              "replies": []
            },
            {
              "id": 3168507,
              "author_name": "Jason Bourne",
              "author_url": "",
              "post_date": "2025-04-02T14:11:00.877000",
              "content": "<p>I have no access to computing resources too . My laptop gpu is 3080, so I spent almost 2k RMB on renting cloud gpus😱</p>",
              "votes": 2,
              "replies": []
            },
            {
              "id": 3169136,
              "author_name": "AI-Cat",
              "author_url": "",
              "post_date": "2025-04-03T06:39:34.350000",
              "content": "<p>And how many hours did you get for that money? And what computing power?</p>",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 3200308,
      "author_name": "IOC",
      "author_url": "",
      "post_date": "2025-05-12T11:55:13.060000",
      "content": "<p>What are the differences between Hugging Face’s Open-R1 and the Open-R1 you have mentioned?</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 3175536,
      "author_name": "Raviksh Singh Dikola",
      "author_url": "",
      "post_date": "2025-04-10T09:10:16.993000",
      "content": "<p>thanks for sharing this article it provides great insight 🤗</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 3168527,
      "author_name": "",
      "author_url": "",
      "post_date": "2025-04-02T14:23:24.950000",
      "content": "",
      "votes": 1,
      "replies": []
    },
    {
      "id": 3168281,
      "author_name": "",
      "author_url": "",
      "post_date": "2025-04-02T09:54:35.147000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 3169598,
      "author_name": "HARRABI Raouf",
      "author_url": "",
      "post_date": "2025-04-03T16:24:27.873000",
      "content": "<p>thanks a lot for sharing, big love</p>",
      "votes": 0,
      "replies": []
    }
  ],
  "comment_count": 33,
  "messages": [
    {
      "id": 3168197,
      "postDate": "2025-04-02T08:12:48.697Z",
      "content": "<p>First of all, congratulations to all the participants for making it through this long and challenging competition. We’d also like to express our sincere appreciation to the organizers for designing such an interesting competition with a high-quality dataset, and to the Kaggle team for providing the extensive computational resources that made this possible.</p>\n<p>Our team identified the main challenge of this competition as the redundancy in the reasoning process of the DeepSeek R1 series models — specifically, their long output token lengths, which made it difficult to solve 50 problems within the 5-hour time limit. To address this, we aimed to fine-tune a distilled version of the R1 model to reason more efficiently.</p>\n<p>Our final model scored <strong>29 on public LB and 28 on private LB</strong>.</p>\n<h2>Paper</h2>\n<p>ICML2025 AI for Math Workshop<br>\n<a href=\"https://arxiv.org/abs/2507.08267\" target=\"_blank\">A Practical Two-Stage Recipe for Mathematical LLMs: Maximizing Accuracy with SFT and Efficiency with Reinforcement Learning</a></p>\n<h2>Github</h2>\n<p><a href=\"https://github.com/analokmaus/kaggle-aimo2-fast-math-r1\" target=\"_blank\">https://github.com/analokmaus/kaggle-aimo2-fast-math-r1</a></p>\n<h2>Model</h2>\n<p><a href=\"https://huggingface.co/RabotniKuma/Fast-Math-R1-14B\" target=\"_blank\">https://huggingface.co/RabotniKuma/Fast-Math-R1-14B</a><br>\n<a href=\"https://www.kaggle.com/models/analokamus/fast_math_r1_14b/\" target=\"_blank\">https://www.kaggle.com/models/analokamus/fast_math_r1_14b/</a></p>\n<h2>Dataset</h2>\n<p><a href=\"https://huggingface.co/datasets/RabotniKuma/Fast-Math-R1-SFT\" target=\"_blank\">https://huggingface.co/datasets/RabotniKuma/Fast-Math-R1-SFT</a><br>\n<a href=\"https://huggingface.co/datasets/RabotniKuma/Fast-Math-R1-GRPO\" target=\"_blank\">https://huggingface.co/datasets/RabotniKuma/Fast-Math-R1-GRPO</a></p>\n<h1>First stage: intensive SFT using a high-difficulty dataset</h1>\n<h2>Dataset</h2>\n<p><a href=\"https://huggingface.co/datasets/open-r1/OpenR1-Math-220k\" target=\"_blank\">OpenR1 Math</a>: We randomly sampled 3000 examples where the R1’s trace had more than 12800 tokens and an accuracy of over 50%, along with another 3000 examples where the accuracy ranged between 50% and 75%.<br>\n<a href=\"https://huggingface.co/datasets/hoanganhpham/openr1_hard\" target=\"_blank\">openr1_hard</a>:  \"~2.5k hard samples from open-r1-math-220k. Samples deemed as hard were unsolvable by r1-distill-32b after 4 tries.\" (Thank you for the dataset, <a href=\"https://www.kaggle.com/andy2709\" target=\"_blank\">@andy2709</a> )<br>\n<a href=\"https://huggingface.co/datasets/qihoo360/Light-R1-SFTData\" target=\"_blank\">Light-R1-SFTData</a>: We used the 2nd stage data from Light-R1-SFTData. (Big thanks to LightR1 team, <a href=\"https://www.kaggle.com/zouhaosheng\" target=\"_blank\">@zouhaosheng</a> )</p>\n<p>We merged all the datasets mentioned above, removed duplicates, and selected the correct generation with the shortest token length. For samples in the Light-R1 dataset where ground truth answers were not provided, we extracted and substituted the answers from the R1 traces. As a result, we constructed a <strong>high-difficulty dataset consisting of 7900 problem - R1 trace - answer sets</strong>.</p>\n<h2>Training</h2>\n<p>Based on our prior experiments, we observed that the 14B models demonstrated more stable performance. Therefore, we chose DeepSeek-R1-Distill-Qwen-14B as our starting point. A full-parameter supervised fine-tuning training was conducted on a machine with 8 H200 GPUs, using the SFTTrainer from the trl library.</p>\n<h3>Key parameters</h3>\n<ul>\n<li>per_device_train_batch_size = 1</li>\n<li>gradient_accumulation_steps = 8</li>\n<li>num_train_epochs = 20 <ul>\n<li>This number is unusually big, but we found that meaningful performance gains only emerged after long long training</li></ul></li>\n<li>max_seq_length = 24000</li>\n<li>packing = True</li>\n<li>learning_rate = 1e-5</li>\n<li>lr_scheduler_type = cosine</li>\n<li>system_prompt = \"Please reason step by step, and put your final answer within \\boxed{{}}.\"</li>\n</ul>\n<p>Training time: approx. 10 hours (8× H200 GPUs)</p>\n<h2>Evaluation</h2>\n<p>We evaluated the model’s performance using a dataset of 40 problems, consisting of <strong>10 reference problems and 30 from AIME 2025</strong>.<br>\nInitially, we generated answers using 16k tokens × 32 prompts. We then applied post-hoc filtering based on token length and the number of prompts to assess performance under various inference conditions.</p>\n<h2>Results</h2>\n<table>\n<thead>\n<tr>\n<th>Experiment</th>\n<th>Token budget</th>\n<th>Accuracy (majority@32)</th>\n<th>Accuracy (pass@32)</th>\n<th>Num of answers collected</th>\n<th>Average generation length</th>\n<th>Public LB (quantized model)</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>DeepSeek-R1-Distill-Qwen-14B</td>\n<td>16384</td>\n<td>0.700</td>\n<td>0.775</td>\n<td>21.775</td>\n<td>9684</td>\n<td>25</td>\n</tr>\n<tr>\n<td>DeepSeek-R1-Distill-Qwen-14B</td>\n<td>12800</td>\n<td>0.675</td>\n<td>0.775</td>\n<td>16.775</td>\n<td>8331</td>\n<td></td>\n</tr>\n<tr>\n<td>DeepSeek-R1-Distill-Qwen-14B</td>\n<td>9000</td>\n<td>0.525</td>\n<td>0.600</td>\n<td>12.500</td>\n<td>4725</td>\n<td></td>\n</tr>\n<tr>\n<td>SFT</td>\n<td>16384</td>\n<td>0.750</td>\n<td>0.825</td>\n<td>20.725</td>\n<td>10396</td>\n<td>23</td>\n</tr>\n<tr>\n<td>SFT</td>\n<td>12800</td>\n<td>0.725</td>\n<td>0.725</td>\n<td>15.700</td>\n<td>7024</td>\n<td></td>\n</tr>\n<tr>\n<td>SFT</td>\n<td>9000</td>\n<td>0.550</td>\n<td>0.550</td>\n<td>11.600</td>\n<td>4387</td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<p>Our local validation scores improved remarkably after the first-stage SFT. However, we observed that the Public LB scores tended to be slightly lower.<br>\nWe believe this was <strong>due to increased reasoning redundancy introduced by SFT, causing many examples to fail to reach a conclusion within the time limit</strong>.<br>\nTo address this, our next objective was to apply reinforcement learning to encourage the model to reach accurate conclusions using fewer tokens, while maintaining performance.</p>\n<h1>Second stage: GRPO for more efficient reasoning</h1>\n<h2>Dataset</h2>\n<p><a href=\"https://huggingface.co/datasets/qihoo360/Light-R1-SFTData\" target=\"_blank\">Light-R1-SFTData</a>: We used the 2nd stage data from Light-R1-SFTData.</p>\n<h2>Training</h2>\n<p>We used the <a href=\"https://github.com/nhannguyen2709/open-r1\" target=\"_blank\">faster version of trl GRPOTrainer</a> created by <a href=\"https://www.kaggle.com/andy2709\" target=\"_blank\">@andy2709</a> (again, thank you so much!).</p>\n<p>We used the following reward function:</p>\n<ol>\n<li>Format reward<br>\nIn our submission, generation is stopped at the <code>&lt;/think&gt;</code> tag to save time, therefore we designed the reward to match the pattern <code>r\"^.*?oxed{(.*?)}.*?&lt;/think&gt;.*?$\"</code>.</li>\n<li>Cosine reward (correct [1.0, 0.1], incorrect [-0.1, -1.0], max_len=30000)<br>\nCompared to a normal accuracy-based reward, cosine reward applies a continuous penalty to longer correct reasoning traces and shorter incorrect ones.</li>\n<li>Length reward<br>\nLength-based rewards to discourage overthinking and promote token efficiency.<br>\nPaper: <a href=\"https://arxiv.org/abs/2501.12599\" target=\"_blank\">https://arxiv.org/abs/2501.12599</a></li>\n</ol>\n<h3>Key parameters</h3>\n<ul>\n<li>num_generations = 8</li>\n<li>beta = 0.04</li>\n<li>per_device_train_batch_size = 2</li>\n<li>gradient_accumulation_steps = 8</li>\n<li>num_train_epochs = 1 </li>\n<li>max_completion_length = 16384</li>\n<li>learning_rate = 4e-6</li>\n<li>lr_scheduler_type = cosine</li>\n<li>system_prompt = (<br>\n    'You are a helpful and harmless assistant. You are Qwen developed by Alibaba. '<br>\n    'You should think step-by-step. Return final answer within \\boxed{{}}.'<br>\n)</li>\n</ul>\n<p>Training time: approx. 10 hours (8× H200 GPUs)</p>\n<h2>Evaluation</h2>\n<p>Same as first stage.</p>\n<h2>Results</h2>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1973217%2Fdbd9dd1814ade77cc5c840319d36cf72%2FScreenshot%202025-04-02%20at%2016.55.07.png?generation=1743580526542546&amp;alt=media\" alt=\"\"><br>\nThe reward was optimized steadily throughout training, but after step 60, catastrophic shifts occurred, causing a substantial decline in performance. We thus decided to use checkpoints from earlier steps for evaluation.</p>\n<table>\n<thead>\n<tr>\n<th>Experiment</th>\n<th>Token budget</th>\n<th>Accuracy (majority@32)</th>\n<th>Accuracy (pass@32)</th>\n<th>Num of answers collected</th>\n<th>Average generation length</th>\n<th>Public LB (quantized model)</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>DeepSeek-R1-Distill-Qwen-14B</td>\n<td>12800</td>\n<td>0.675</td>\n<td>0.775</td>\n<td>16.775</td>\n<td>8331</td>\n<td>25</td>\n</tr>\n<tr>\n<td>DeepSeek-R1-Distill-Qwen-14B</td>\n<td>9000</td>\n<td>0.525</td>\n<td>0.600</td>\n<td>12.5</td>\n<td>4725</td>\n<td></td>\n</tr>\n<tr>\n<td>SFT</td>\n<td>12800</td>\n<td>0.725</td>\n<td>0.725</td>\n<td>15.7</td>\n<td>7024</td>\n<td>23</td>\n</tr>\n<tr>\n<td>SFT</td>\n<td>9000</td>\n<td>0.550</td>\n<td>0.550</td>\n<td>11.6</td>\n<td>4387</td>\n<td></td>\n</tr>\n<tr>\n<td>SFT + GRPO (best checkpoint)</td>\n<td>12800</td>\n<td><strong>0.725</strong></td>\n<td><strong>0.775</strong></td>\n<td><strong>18.5</strong></td>\n<td>6817</td>\n<td><strong>29</strong></td>\n</tr>\n<tr>\n<td>SFT + GRPO (best checkpoint)</td>\n<td>9000</td>\n<td><strong>0.625</strong></td>\n<td><strong>0.700</strong></td>\n<td><strong>15.25</strong></td>\n<td>4759</td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<p>GRPO enabled us to train a model that preserved accuracy while significantly improving inference efficiency through shorter token lengths. </p>\n<h1>Submission inference setup</h1>\n<h2>Quantization</h2>\n<p>We applied 4-bit quantization using <a href=\"https://github.com/casper-hansen/AutoAWQ\" target=\"_blank\">AutoAWQ</a>.<br>\nWe observed some degradation in validation performance after quantization, and attempted to recover it through calibration on a math-specific dataset. Unfortunately, this approach did not succeed in preserving the original performance.</p>\n<h2>Inference time scheduling</h2>\n<p>We trained a ModernBERT model to predict the shortest token length of correct R1 traces for each problem in the OpenR1 Math dataset, thereby quantifying problem difficulty.<br>\nOn the validation set, we observed a moderate correlation between the predicted difficulty and the actual number of tokens generated, as shown in the figure below.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1973217%2F75f9af2011608c982ac21ca1bd091464%2Flongcontext_tokenlength_scatter.png?generation=1743582693786625&amp;alt=media\" alt=\"\"></p>\n<p>Using this model, we scaled the output token length dynamically during inference. This approach stabilized the Public LB scores and led to an improvement of approx. +1 point (though it could be placebo).</p>\n<h2>Misc.</h2>\n<ul>\n<li>Prompts: prompt_config0 * 8 + prompt_config1 * 2 (10 prompts in total)</li>\n</ul>\n<pre><code>prompt_config0 = (\n    system=(\n        \n        \n    ),\n    prompt=\n)\n\nprompt_config1 = (\n    system=(\n        \n        \n    ),\n    prompt=\n)\n</code></pre>\n<ul>\n<li>Output token length: 10500 - 13300 (dynamic scaling described above)</li>\n<li>vLLM version 0.7.3 with V1</li>\n</ul>\n<h1>What didn’t work</h1>\n<h2>Constrained decoding</h2>\n<p>Many studies have explored controlling the reasoning processes of LLMs through constrained decoding methods, such as:</p>\n<ul>\n<li><a href=\"https://arxiv.org/pdf/2501.18585\" target=\"_blank\">https://arxiv.org/pdf/2501.18585</a></li>\n<li><a href=\"https://arxiv.org/pdf/2412.21187\" target=\"_blank\">https://arxiv.org/pdf/2412.21187</a></li>\n</ul>\n<p>We experimented extensively with these approaches and tuned various parameters; however, none of them proved effective on our validation dataset. Our hypothesis is that these methods might only be suitable for relatively simple problems.</p>\n<h2>Rewritiing the reasoning process and retraining</h2>\n<p>We also experimented with rewriting the original R1-Qwen model’s reasoning process into a more compact one, following the <a href=\"https://github.com/NovaSky-AI/SkyThought\" target=\"_blank\">SkyThought</a> approach, and retraining the model via SFT and DPO. Although this method significantly reduced the number of tokens generated before reaching an answer, it also caused a substantial drop in accuracy.</p>\n<p>For highly capable LLMs, forcibly altering their natural reasoning process externally might not be an effective strategy, particularly when dealing with complex problem-solving scenarios like ours.</p>",
      "rawMarkdown": "First of all, congratulations to all the participants for making it through this long and challenging competition. We’d also like to express our sincere appreciation to the organizers for designing such an interesting competition with a high-quality dataset, and to the Kaggle team for providing the extensive computational resources that made this possible.\n\nOur team identified the main challenge of this competition as the redundancy in the reasoning process of the DeepSeek R1 series models — specifically, their long output token lengths, which made it difficult to solve 50 problems within the 5-hour time limit. To address this, we aimed to fine-tune a distilled version of the R1 model to reason more efficiently.\n\nOur final model scored **29 on public LB and 28 on private LB**.\n\n## Paper\nICML2025 AI for Math Workshop\n[A Practical Two-Stage Recipe for Mathematical LLMs: Maximizing Accuracy with SFT and Efficiency with Reinforcement Learning](https://arxiv.org/abs/2507.08267)\n\n## Github\nhttps://github.com/analokmaus/kaggle-aimo2-fast-math-r1\n\n## Model\nhttps://huggingface.co/RabotniKuma/Fast-Math-R1-14B\nhttps://www.kaggle.com/models/analokamus/fast_math_r1_14b/\n\n## Dataset\nhttps://huggingface.co/datasets/RabotniKuma/Fast-Math-R1-SFT\nhttps://huggingface.co/datasets/RabotniKuma/Fast-Math-R1-GRPO\n\n# First stage: intensive SFT using a high-difficulty dataset\n## Dataset\n[OpenR1 Math](https://huggingface.co/datasets/open-r1/OpenR1-Math-220k): We randomly sampled 3000 examples where the R1’s trace had more than 12800 tokens and an accuracy of over 50%, along with another 3000 examples where the accuracy ranged between 50% and 75%.\n[openr1_hard](https://huggingface.co/datasets/hoanganhpham/openr1_hard):  \"~2.5k hard samples from open-r1-math-220k. Samples deemed as hard were unsolvable by r1-distill-32b after 4 tries.\" (Thank you for the dataset, @andy2709 )\n[Light-R1-SFTData](https://huggingface.co/datasets/qihoo360/Light-R1-SFTData): We used the 2nd stage data from Light-R1-SFTData. (Big thanks to LightR1 team, @zouhaosheng )\n\nWe merged all the datasets mentioned above, removed duplicates, and selected the correct generation with the shortest token length. For samples in the Light-R1 dataset where ground truth answers were not provided, we extracted and substituted the answers from the R1 traces. As a result, we constructed a **high-difficulty dataset consisting of 7900 problem - R1 trace - answer sets**.\n\n## Training\nBased on our prior experiments, we observed that the 14B models demonstrated more stable performance. Therefore, we chose DeepSeek-R1-Distill-Qwen-14B as our starting point. A full-parameter supervised fine-tuning training was conducted on a machine with 8 H200 GPUs, using the SFTTrainer from the trl library.\n\n### Key parameters\n- per_device_train_batch_size = 1\n- gradient_accumulation_steps = 8\n- num_train_epochs = 20 \n - This number is unusually big, but we found that meaningful performance gains only emerged after long long training\n- max_seq_length = 24000\n- packing = True\n- learning_rate = 1e-5\n- lr_scheduler_type = cosine\n- system_prompt = \"Please reason step by step, and put your final answer within \\\\boxed{{}}.\"\n\nTraining time: approx. 10 hours (8× H200 GPUs)\n\n## Evaluation\nWe evaluated the model’s performance using a dataset of 40 problems, consisting of **10 reference problems and 30 from AIME 2025**.\nInitially, we generated answers using 16k tokens × 32 prompts. We then applied post-hoc filtering based on token length and the number of prompts to assess performance under various inference conditions.\n\n## Results\n\n| Experiment                    | Token budget | Accuracy (majority@32) | Accuracy (pass@32) | Num of answers collected | Average generation length | Public LB (quantized model) |\n|-------------------------------|---------------------|--------------------------|---------------------|--------------------------|---------------------------|-----------|\n| DeepSeek-R1-Distill-Qwen-14B  | 16384               | 0.700                    | 0.775               | 21.775                   | 9684                      | 25        |\n| DeepSeek-R1-Distill-Qwen-14B  | 12800               | 0.675                    | 0.775               | 16.775                   | 8331                      |           |\n| DeepSeek-R1-Distill-Qwen-14B  | 9000                | 0.525                    | 0.600               | 12.500                   | 4725                      |           |\n| SFT          | 16384               | 0.750                    | 0.825               | 20.725                   | 10396                     | 23        |\n| SFT         | 12800               | 0.725                    | 0.725               | 15.700                   | 7024                      |           |\n| SFT        | 9000                | 0.550                    | 0.550               | 11.600                   | 4387                      |           |\n\n\nOur local validation scores improved remarkably after the first-stage SFT. However, we observed that the Public LB scores tended to be slightly lower.\nWe believe this was **due to increased reasoning redundancy introduced by SFT, causing many examples to fail to reach a conclusion within the time limit**.\nTo address this, our next objective was to apply reinforcement learning to encourage the model to reach accurate conclusions using fewer tokens, while maintaining performance.\n\n# Second stage: GRPO for more efficient reasoning\n## Dataset\n[Light-R1-SFTData](https://huggingface.co/datasets/qihoo360/Light-R1-SFTData): We used the 2nd stage data from Light-R1-SFTData.\n\n## Training\nWe used the [faster version of trl GRPOTrainer](https://github.com/nhannguyen2709/open-r1) created by @andy2709 (again, thank you so much!).\n\nWe used the following reward function:\n1. Format reward\nIn our submission, generation is stopped at the `</think>` tag to save time, therefore we designed the reward to match the pattern `r\"^.*?oxed{(.*?)}.*?</think>.*?$\"`.\n2. Cosine reward (correct [1.0, 0.1], incorrect [-0.1, -1.0], max_len=30000)\nCompared to a normal accuracy-based reward, cosine reward applies a continuous penalty to longer correct reasoning traces and shorter incorrect ones.\n3. Length reward\nLength-based rewards to discourage overthinking and promote token efficiency.\nPaper: https://arxiv.org/abs/2501.12599\n\n### Key parameters\n- num_generations = 8\n- beta = 0.04\n- per_device_train_batch_size = 2\n- gradient_accumulation_steps = 8\n- num_train_epochs = 1 \n- max_completion_length = 16384\n- learning_rate = 4e-6\n- lr_scheduler_type = cosine\n- system_prompt = (\n        'You are a helpful and harmless assistant. You are Qwen developed by Alibaba. '\n        'You should think step-by-step. Return final answer within \\\\boxed{{}}.'\n    )\n\nTraining time: approx. 10 hours (8× H200 GPUs)\n\n## Evaluation\nSame as first stage.\n\n## Results\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1973217%2Fdbd9dd1814ade77cc5c840319d36cf72%2FScreenshot%202025-04-02%20at%2016.55.07.png?generation=1743580526542546&alt=media)\nThe reward was optimized steadily throughout training, but after step 60, catastrophic shifts occurred, causing a substantial decline in performance. We thus decided to use checkpoints from earlier steps for evaluation.\n\n| Experiment                    | Token budget | Accuracy (majority@32) | Accuracy (pass@32) | Num of answers collected | Average generation length | Public LB (quantized model) |\n|-------------------------------|---------------------|--------------------------|---------------------|--------------------------|---------------------------|-----------|\n| DeepSeek-R1-Distill-Qwen-14B  | 12800               | 0.675                    | 0.775               | 16.775                   | 8331                      | 25        |\n| DeepSeek-R1-Distill-Qwen-14B  | 9000                | 0.525                    | 0.600               | 12.5                     | 4725                      |           |\n| SFT         | 12800               | 0.725                    | 0.725               | 15.7                     | 7024                      | 23        |\n| SFT         | 9000                | 0.550                    | 0.550               | 11.6                     | 4387                      |           |\n| SFT + GRPO (best checkpoint)       | 12800               | **0.725**                | **0.775**           | **18.5**               | 6817                      | **29**    |\n| SFT + GRPO (best checkpoint)       | 9000                | **0.625**                | **0.700**           | **15.25**                | 4759                      |           |\n\n\nGRPO enabled us to train a model that preserved accuracy while significantly improving inference efficiency through shorter token lengths. \n\n# Submission inference setup\n## Quantization\nWe applied 4-bit quantization using [AutoAWQ](https://github.com/casper-hansen/AutoAWQ).\nWe observed some degradation in validation performance after quantization, and attempted to recover it through calibration on a math-specific dataset. Unfortunately, this approach did not succeed in preserving the original performance.\n\n## Inference time scheduling\nWe trained a ModernBERT model to predict the shortest token length of correct R1 traces for each problem in the OpenR1 Math dataset, thereby quantifying problem difficulty.\nOn the validation set, we observed a moderate correlation between the predicted difficulty and the actual number of tokens generated, as shown in the figure below.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1973217%2F75f9af2011608c982ac21ca1bd091464%2Flongcontext_tokenlength_scatter.png?generation=1743582693786625&alt=media)\n\nUsing this model, we scaled the output token length dynamically during inference. This approach stabilized the Public LB scores and led to an improvement of approx. +1 point (though it could be placebo).\n\n## Misc.\n- Prompts: prompt_config0 * 8 + prompt_config1 * 2 (10 prompts in total)\n```python\nprompt_config0 = dict(\n    system=(\n        'You are a helpful and harmless assistant. You are Qwen developed by Alibaba. '\n        'You should think step-by-step. Return final answer within \\\\boxed{{}}, after taking modulo 1000.'\n    ),\n    prompt='{question}'\n)\n\nprompt_config1 = dict(\n    system=(\n        'You are a helpful and harmless assistant. You are Qwen developed by Alibaba. '\n        'You should think step-by-step. After you get your final answer, take modulo 1000, and return the final answer within \\\\boxed{{}}.'\n    ),\n    prompt='{question}'\n)\n```\n- Output token length: 10500 - 13300 (dynamic scaling described above)\n- vLLM version 0.7.3 with V1\n\n# What didn’t work\n## Constrained decoding\nMany studies have explored controlling the reasoning processes of LLMs through constrained decoding methods, such as:\n\n- https://arxiv.org/pdf/2501.18585\n- https://arxiv.org/pdf/2412.21187\n\nWe experimented extensively with these approaches and tuned various parameters; however, none of them proved effective on our validation dataset. Our hypothesis is that these methods might only be suitable for relatively simple problems.\n\n## Rewritiing the reasoning process and retraining\nWe also experimented with rewriting the original R1-Qwen model’s reasoning process into a more compact one, following the [SkyThought](https://github.com/NovaSky-AI/SkyThought) approach, and retraining the model via SFT and DPO. Although this method significantly reduced the number of tokens generated before reaching an answer, it also caused a substantial drop in accuracy.\n\nFor highly capable LLMs, forcibly altering their natural reasoning process externally might not be an effective strategy, particularly when dealing with complex problem-solving scenarios like ours.\n",
      "votes": 89
    },
    {
      "id": 3168397,
      "postDate": "2025-04-02T11:45:28.740Z",
      "content": "<p>Thanks for sharing! I tried to use the cosine reward in a first couple of my experiments as well, I think after certain steps, depending on your lr and beta, it will just give up on difficult problems because it is afraid of the penalty for providing long and incorrect solutions.</p>",
      "rawMarkdown": "Thanks for sharing! I tried to use the cosine reward in a first couple of my experiments as well, I think after certain steps, depending on your lr and beta, it will just give up on difficult problems because it is afraid of the penalty for providing long and incorrect solutions.",
      "votes": 6,
      "replies": [
        {
          "id": 3168499,
          "postDate": "2025-04-02T14:02:24.060Z",
          "content": "<p>Based on this <a href=\"https://github.com/huggingface/open-r1/issues/312\" target=\"_blank\">issue</a>, there seems to be a small bug in the arguments of <strong>cosine reward</strong> in the repo <code>open-r1</code>.<br>\nThe default value of <code>cosine_min_value_wrong</code> is set to <code>0</code> and the <code>cosine_max_value_wrong</code> is <code>-0.5</code> in the config <a href=\"https://github.com/huggingface/open-r1/blob/4f5b21e21dec473af9729bce8e084deb16223ae4/src/open_r1/configs.py#L116\" target=\"_blank\">file</a>, which makes the  longer incorrect solutions are penalized more than shorter ones after we swap the min/max value. So if you use the default value in <code>configs.py</code>, I suggest you may try to use the value in <code>rewards.py</code>😉.</p>",
          "rawMarkdown": "Based on this [issue](https://github.com/huggingface/open-r1/issues/312), there seems to be a small bug in the arguments of **cosine reward** in the repo `open-r1`.\nThe default value of `cosine_min_value_wrong` is set to `0` and the `cosine_max_value_wrong` is `-0.5` in the config [file](https://github.com/huggingface/open-r1/blob/4f5b21e21dec473af9729bce8e084deb16223ae4/src/open_r1/configs.py#L116), which makes the  longer incorrect solutions are penalized more than shorter ones after we swap the min/max value. So if you use the default value in `configs.py`, I suggest you may try to use the value in `rewards.py`😉.",
          "votes": 1,
          "replies": [
            {
              "id": 3168508,
              "postDate": "2025-04-02T14:11:58.083Z",
              "content": "<p>Giving higher reward to longer incorrect answer will lead to reward hacking. It can be used on a base model to encourage outputting longer reasoning traces but not ideal for a model like deepseek r1 distill.</p>",
              "rawMarkdown": "Giving higher reward to longer incorrect answer will lead to reward hacking. It can be used on a base model to encourage outputting longer reasoning traces but not ideal for a model like deepseek r1 distill."
            }
          ]
        },
        {
          "id": 3169125,
          "postDate": "2025-04-03T06:26:33.273Z",
          "content": "<p>I also have this impression (just checked my veRL fork, the rewards values are correct - my wrongs are from -1.0 to -0.5 and my corrects are 0.5 to 1.0). In (most) of my experiments, overlong buffer (from DAPO) has a more gentle effect than cosine length reward.</p>\n<p>But again, there are sooooo many factors and other parameters that goes into each experiments that I'm not sure what caused what lol. Maybe cosine is fine and the reason that experiment was worse was from a totally different reason</p>",
          "rawMarkdown": "I also have this impression (just checked my veRL fork, the rewards values are correct - my wrongs are from -1.0 to -0.5 and my corrects are 0.5 to 1.0). In (most) of my experiments, overlong buffer (from DAPO) has a more gentle effect than cosine length reward.\n\nBut again, there are sooooo many factors and other parameters that goes into each experiments that I'm not sure what caused what lol. Maybe cosine is fine and the reason that experiment was worse was from a totally different reason",
          "votes": 1,
          "replies": [
            {
              "id": 3169281,
              "postDate": "2025-04-03T09:37:06.117Z",
              "content": "<p>Yeah, it’s is kinda hard to know for sure. The length normalization from Dr GRPO paper also has a length bias, although removing standard deviation is definitely a sound idea.</p>",
              "rawMarkdown": "Yeah, it’s is kinda hard to know for sure. The length normalization from Dr GRPO paper also has a length bias, although removing standard deviation is definitely a sound idea."
            }
          ]
        }
      ]
    },
    {
      "id": 3168372,
      "postDate": "2025-04-02T11:13:28.410Z",
      "content": "<p><a href=\"https://www.kaggle.com/analokamus\" target=\"_blank\">@analokamus</a> Thanks for sharing your team's solution. I also really appreciate you testing out and verifying my GRPO implementation correctness 🤣.</p>\n<p>I could only afford to lora finetune the r1 14b model with GRPO on 16k sequences and got kinda similar validation results on reference + aime 25. However, the public LB score was really absymal and completely discouraged me from sharing anything 🥲</p>",
      "rawMarkdown": "@analokamus Thanks for sharing your team's solution. I also really appreciate you testing out and verifying my GRPO implementation correctness 🤣.\n\nI could only afford to lora finetune the r1 14b model with GRPO on 16k sequences and got kinda similar validation results on reference + aime 25. However, the public LB score was really absymal and completely discouraged me from sharing anything 🥲",
      "votes": 6
    },
    {
      "id": 3190249,
      "postDate": "2025-04-30T11:21:51.580Z",
      "content": "<p>Congrats <a href=\"https://www.kaggle.com/analokamus\" target=\"_blank\">@analokamus</a> <a href=\"https://www.kaggle.com/inoueu1\" target=\"_blank\">@inoueu1</a> <a href=\"https://www.kaggle.com/charmq\" target=\"_blank\">@charmq</a> <br>\nI have some questions for your great approach - we missed this training based on length. </p>\n<ul>\n<li>Is there a weighting to the three reward functions you used - Format reward / Cosine reward / Length reward ? Or equal weight. </li>\n<li>If I look at the description of the three rewards they seem more focused to length, than accuracy. Is there a risk the model could lose accuracy, or you did not see that. I am just learning GRPO, maybe that is handled with KL divergence already. </li>\n<li>For Format reward, what is the reason you stop at <code>/&lt;think&gt;</code> … we tried this and it seems the best answer usually comes after that in the summarise. Maybe I missed something. </li>\n</ul>",
      "rawMarkdown": "Congrats @analokamus @inoueu1 @charmq \nI have some questions for your great approach - we missed this training based on length. \n- Is there a weighting to the three reward functions you used - Format reward / Cosine reward / Length reward ? Or equal weight. \n- If I look at the description of the three rewards they seem more focused to length, than accuracy. Is there a risk the model could lose accuracy, or you did not see that. I am just learning GRPO, maybe that is handled with KL divergence already. \n- For Format reward, what is the reason you stop at `/<think>` ... we tried this and it seems the best answer usually comes after that in the summarise. Maybe I missed something. ",
      "votes": 3,
      "replies": [
        {
          "id": 3190363,
          "postDate": "2025-04-30T14:56:19.077Z",
          "content": "<p>Thank you, <a href=\"https://www.kaggle.com/darraghdog\" target=\"_blank\">@darraghdog</a> !<br>\nAs a Kaggler-runner, it’s an honor to see you on the Kaggle leaderboard, rather than on Strava.</p>\n<p>You’re raising really important points</p>\n<blockquote>\n  <p>Is there a weighting to the three reward functions you used - Format reward / Cosine reward / Length reward ? Or equal weight.</p>\n</blockquote>\n<p>We used equal weight, and the range of reward values can be found <a href=\"https://github.com/analokmaus/kaggle-aimo2-fast-math-r1/blob/master/finetune/grpo_rewards.py\" target=\"_blank\">here</a>.</p>\n<blockquote>\n  <p>If I look at the description of the three rewards they seem more focused to length, than accuracy. Is there a risk the model could lose accuracy, or you did not see that. I am just learning GRPO, maybe that is handled with KL divergence already.</p>\n</blockquote>\n<p>This was the most challenging part of developing our GRPO recipe.<br>\nOne of the biggest pitfalls in RL is <strong>reward hacking</strong>, and we encountered it in the beginning.<br>\nEarly on, we experimented with simple reward functions such as format reward, accuracy reward, and length reward, but they often led to models that “confidently generated incorrect answers without thinking deeply.” </p>\n<p>To address this, we replaced the accuracy reward with a cosine reward and tuned its scaling parameters (max_value_wrong and min_value_correct).<br>\nThis allowed us to moderately shorten the reasoning process while maintaining accuracy.<br>\nHowever, since we were also modifying the dataset at the same time, we plan to run additional ablation experiments as part of the paper we’re currently preparing to verify whether this effect was truly due to the reward change.</p>\n<blockquote>\n  <p>For Format reward, what is the reason you stop at / … we tried this and it seems the best answer usually comes after that in the summarise. Maybe I missed something.</p>\n</blockquote>\n<p>We observed a similar drop in accuracy when applying early stopping at  without RL.<br>\nHowever, by explicitly incorporating format rewards into the RL objective during training, we found that the resulting accuracy gap became almost negligible, especially considering the benefit by the 300–400 tokens saved.</p>",
          "rawMarkdown": "Thank you, @darraghdog !\nAs a Kaggler-runner, it’s an honor to see you on the Kaggle leaderboard, rather than on Strava.\n\nYou’re raising really important points\n\n>Is there a weighting to the three reward functions you used - Format reward / Cosine reward / Length reward ? Or equal weight.\n\n We used equal weight, and the range of reward values can be found [here](https://github.com/analokmaus/kaggle-aimo2-fast-math-r1/blob/master/finetune/grpo_rewards.py).\n\n>If I look at the description of the three rewards they seem more focused to length, than accuracy. Is there a risk the model could lose accuracy, or you did not see that. I am just learning GRPO, maybe that is handled with KL divergence already.\n\nThis was the most challenging part of developing our GRPO recipe.\nOne of the biggest pitfalls in RL is **reward hacking**, and we encountered it in the beginning.\nEarly on, we experimented with simple reward functions such as format reward, accuracy reward, and length reward, but they often led to models that “confidently generated incorrect answers without thinking deeply.” \n\nTo address this, we replaced the accuracy reward with a cosine reward and tuned its scaling parameters (max_value_wrong and min_value_correct).\nThis allowed us to moderately shorten the reasoning process while maintaining accuracy.\nHowever, since we were also modifying the dataset at the same time, we plan to run additional ablation experiments as part of the paper we’re currently preparing to verify whether this effect was truly due to the reward change.\n\n>For Format reward, what is the reason you stop at /<think> … we tried this and it seems the best answer usually comes after that in the summarise. Maybe I missed something.\n\nWe observed a similar drop in accuracy when applying early stopping at </think> without RL.\nHowever, by explicitly incorporating format rewards into the RL objective during training, we found that the resulting accuracy gap became almost negligible, especially considering the benefit by the 300–400 tokens saved.",
          "votes": 2,
          "replies": [
            {
              "id": 3190476,
              "postDate": "2025-04-30T17:48:57.913Z",
              "content": "<p>Thank you for the explanation, looking forward to the paper and trying this out more. Yes, AIMO (and small injury) kept me off Strava.. good to see you going strong.</p>",
              "rawMarkdown": "Thank you for the explanation, looking forward to the paper and trying this out more. Yes, AIMO (and small injury) kept me off Strava.. good to see you going strong.",
              "votes": 2
            }
          ]
        }
      ]
    },
    {
      "id": 3168535,
      "postDate": "2025-04-02T14:34:01.233Z",
      "content": "<p>Great efforts! Our approach is actually quite similar to yours : ). We only SFT-ed for 2 epochs (maybe we should do more epochs like yours, but fear for overfitting XD) by distilling on QwQ-32B on 16k math problems selected from LIMO dataset. This step is quite crucial. Then, for GRPO we used verl (and based on DeepScaleR's work), which is quite a handy and efficient library. Interestingly, we have similarly used length penalty and reward reweight (the cosine reward in your post). We also stop at  during training, but didn't use a format reward because we thought that the model might somehow hack the reward----anyhow, the format reward is implicit in the rule-based reward. We track our training progress primarily based on the number of solved-alls and solved-nones at each batch (shape of 32bs, 8gens, and 12k len).</p>",
      "rawMarkdown": "Great efforts! Our approach is actually quite similar to yours : ). We only SFT-ed for 2 epochs (maybe we should do more epochs like yours, but fear for overfitting XD) by distilling on QwQ-32B on 16k math problems selected from LIMO dataset. This step is quite crucial. Then, for GRPO we used verl (and based on DeepScaleR's work), which is quite a handy and efficient library. Interestingly, we have similarly used length penalty and reward reweight (the cosine reward in your post). We also stop at </think> during training, but didn't use a format reward because we thought that the model might somehow hack the reward----anyhow, the format reward is implicit in the rule-based reward. We track our training progress primarily based on the number of solved-alls and solved-nones at each batch (shape of 32bs, 8gens, and 12k len).",
      "votes": 4
    },
    {
      "id": 3168273,
      "postDate": "2025-04-02T09:42:29.830Z",
      "content": "<p>Training a model with controlled response length is a clever approach in the context of this competition! </p>\n<p>I remember asking deepseek 1 + 1 = ? and it responded with nearly 1k tokens. 😆</p>",
      "rawMarkdown": "Training a model with controlled response length is a clever approach in the context of this competition! \n\nI remember asking deepseek 1 + 1 = ? and it responded with nearly 1k tokens. 😆",
      "votes": 2,
      "replies": [
        {
          "id": 3168334,
          "postDate": "2025-04-02T10:34:44.047Z",
          "rawMarkdown": "",
          "isDeleted": true
        }
      ]
    },
    {
      "id": 3178083,
      "postDate": "2025-04-13T17:39:54.280Z",
      "content": "<p>Congrats <a href=\"https://www.kaggle.com/analokamus\" target=\"_blank\">@analokamus</a> <a href=\"https://www.kaggle.com/inoueu1\" target=\"_blank\">@inoueu1</a> <a href=\"https://www.kaggle.com/charmq\" target=\"_blank\">@charmq</a> , and thank you for sharing detailed writeup!<br>\nIt's interesting that the purpose of the RL was to reduce reasoning tokens.<br>\nAnd it is also informative that constrained decoding and off-policy SFT &amp; DPO didn't work well.</p>",
      "rawMarkdown": "Congrats @analokamus @inoueu1 @charmq , and thank you for sharing detailed writeup!\nIt's interesting that the purpose of the RL was to reduce reasoning tokens.\nAnd it is also informative that constrained decoding and off-policy SFT & DPO didn't work well.",
      "votes": 1
    },
    {
      "id": 3169314,
      "postDate": "2025-04-03T10:38:39.280Z",
      "content": "<p>Thanks for your great article! Respect! 🎩🎩🎩</p>",
      "rawMarkdown": "Thanks for your great article! Respect! 🎩🎩🎩",
      "votes": 1
    },
    {
      "id": 3168773,
      "postDate": "2025-04-02T19:03:19.137Z",
      "content": "<p>Great article! looking for the full version.<br>\nThanks for sharing!</p>",
      "rawMarkdown": "Great article! looking for the full version.\nThanks for sharing!",
      "votes": 1
    },
    {
      "id": 3168298,
      "postDate": "2025-04-02T10:10:41.567Z",
      "content": "<p>Congratulations and Thanks for this post! Your team's identification of main challenge what I was looking for. I had a reasonable doubt about it but couldn't find ways to verify it. All my efforts went in opposite direction in using RAG, verification prompts, detailed prompts which must have resulted in more tokens, and always scored less than the simple prompt notebook. I got to learn lot from your post, thanks again.</p>",
      "rawMarkdown": "Congratulations and Thanks for this post! Your team's identification of main challenge what I was looking for. I had a reasonable doubt about it but couldn't find ways to verify it. All my efforts went in opposite direction in using RAG, verification prompts, detailed prompts which must have resulted in more tokens, and always scored less than the simple prompt notebook. I got to learn lot from your post, thanks again.",
      "votes": 1
    },
    {
      "id": 3168208,
      "postDate": "2025-04-02T08:24:40.113Z",
      "content": "<p>Congratulation! I also tried SFT on 7B qwen2.5-ds model using Light-R1-SFTData(stage 2), I set epoch to 3 and it seems to underfit, after several attempts, finally i abandoned🫠</p>",
      "rawMarkdown": "Congratulation! I also tried SFT on 7B qwen2.5-ds model using Light-R1-SFTData(stage 2), I set epoch to 3 and it seems to underfit, after several attempts, finally i abandoned🫠",
      "votes": 1,
      "replies": [
        {
          "id": 3168251,
          "postDate": "2025-04-02T09:14:01.073Z",
          "content": "<p>Initially, we also conducted similar training and came to the conclusion that SFT wasn’t particularly helpful. However, in the case of task-specific LLMs like this one, it’s possible that extended SFT might actually be more effective — this is something we’d like to explore further through additional experiments.</p>\n<p>Another point is that R1-Qwen-7B was originally trained starting from Qwen-Math-7B, whereas the 14B version was based on the general-purpose Qwen-14B. Our experiments also suggested that it’s more difficult to improve the 7B model’s performance further using math-specific datasets, compared to the 14B model.</p>",
          "rawMarkdown": "Initially, we also conducted similar training and came to the conclusion that SFT wasn’t particularly helpful. However, in the case of task-specific LLMs like this one, it’s possible that extended SFT might actually be more effective — this is something we’d like to explore further through additional experiments.\n\nAnother point is that R1-Qwen-7B was originally trained starting from Qwen-Math-7B, whereas the 14B version was based on the general-purpose Qwen-14B. Our experiments also suggested that it’s more difficult to improve the 7B model’s performance further using math-specific datasets, compared to the 14B model.",
          "votes": 2
        }
      ]
    },
    {
      "id": 3168468,
      "postDate": "2025-04-02T13:26:42.880Z",
      "content": "<p>Hello! I'm interested in your GRPO session, have you tried 0 for the beta parameter? Which is better 0 or 0.04?</p>",
      "rawMarkdown": "Hello! I'm interested in your GRPO session, have you tried 0 for the beta parameter? Which is better 0 or 0.04?",
      "votes": 2,
      "replies": [
        {
          "id": 3169153,
          "postDate": "2025-04-03T06:59:20.153Z",
          "content": "<p>Hi, I didn't try that, but I would like to run some additional experiments later. I will add this to the queue.</p>",
          "rawMarkdown": "Hi, I didn't try that, but I would like to run some additional experiments later. I will add this to the queue.",
          "votes": 1
        },
        {
          "id": 3170775,
          "postDate": "2025-04-05T02:07:22.183Z",
          "content": "<p>Removing kl works. Not sure how much KL hinders convergence. We first adopted it, but soon dropped it for the rest of our experiments. The model's KL loss won't go away too far per se even with beta=0, otherwise the model's training just failed. </p>",
          "rawMarkdown": "Removing kl works. Not sure how much KL hinders convergence. We first adopted it, but soon dropped it for the rest of our experiments. The model's KL loss won't go away too far per se even with beta=0, otherwise the model's training just failed. "
        }
      ]
    },
    {
      "id": 3168236,
      "postDate": "2025-04-02T08:58:34.080Z",
      "content": "<p>You did a great job! My applause! I really missed node with 8xH200.</p>\n<p>I take my hat off to you, I have nothing even close to that.</p>",
      "rawMarkdown": "You did a great job! My applause! I really missed node with 8xH200.\n\nI take my hat off to you, I have nothing even close to that.",
      "votes": 2,
      "replies": [
        {
          "id": 3168243,
          "postDate": "2025-04-02T09:08:32.373Z",
          "content": "<p>Hi Konstantin,</p>\n<p>I’d like to return the same kind words to you. Throughout this competition, you’ve been very active in the discussions, and I’ve learned a lot from your comments. I’m also really looking forward to seeing your solution, especially since you’ve managed to consistently achieve wonderful results without any fine-tuning.</p>\n<p>Our team happened to have access to good amount of compute resources this time, so we deliberately took an approach centered around large scale fine-tuning - something most teams wouldn’t typically be able to do, in hopes of gaining additional insights.<br>\nWhile compute is undeniably a big advantage in competitions like this, we hope to give back to the community by sharing as much of what we’ve learned as possible.</p>",
          "rawMarkdown": "Hi Konstantin,\n\nI’d like to return the same kind words to you. Throughout this competition, you’ve been very active in the discussions, and I’ve learned a lot from your comments. I’m also really looking forward to seeing your solution, especially since you’ve managed to consistently achieve wonderful results without any fine-tuning.\n\nOur team happened to have access to good amount of compute resources this time, so we deliberately took an approach centered around large scale fine-tuning - something most teams wouldn’t typically be able to do, in hopes of gaining additional insights.\nWhile compute is undeniably a big advantage in competitions like this, we hope to give back to the community by sharing as much of what we’ve learned as possible.",
          "votes": 5,
          "replies": [
            {
              "id": 3168258,
              "postDate": "2025-04-02T09:23:49.637Z",
              "content": "<p>Hi Rabotni,</p>\n<p>In fact, I just did what anyone can do, without additional computing resources. I squeezed out of the model everything that it can reproduce in 7.2 minutes. My solution is based on an accurate planner and a selected strategy for its work. I tried many strategies, but one turned out to be very successful.</p>",
              "rawMarkdown": "Hi Rabotni,\n\nIn fact, I just did what anyone can do, without additional computing resources. I squeezed out of the model everything that it can reproduce in 7.2 minutes. My solution is based on an accurate planner and a selected strategy for its work. I tried many strategies, but one turned out to be very successful.",
              "votes": 2
            },
            {
              "id": 3168403,
              "postDate": "2025-04-02T11:54:25.103Z",
              "content": "<p>Can't wait to hear your solution! </p>",
              "rawMarkdown": "Can't wait to hear your solution! "
            },
            {
              "id": 3168505,
              "postDate": "2025-04-02T14:09:51.740Z",
              "rawMarkdown": "",
              "isDeleted": true
            },
            {
              "id": 3168507,
              "postDate": "2025-04-02T14:11:00.877Z",
              "content": "<p>I have no access to computing resources too . My laptop gpu is 3080, so I spent almost 2k RMB on renting cloud gpus😱</p>",
              "rawMarkdown": "I have no access to computing resources too . My laptop gpu is 3080, so I spent almost 2k RMB on renting cloud gpus😱",
              "votes": 2
            },
            {
              "id": 3169136,
              "postDate": "2025-04-03T06:39:34.350Z",
              "content": "<p>And how many hours did you get for that money? And what computing power?</p>",
              "rawMarkdown": "And how many hours did you get for that money? And what computing power?"
            }
          ]
        }
      ]
    },
    {
      "id": 3200308,
      "postDate": "2025-05-12T11:55:13.060Z",
      "content": "<p>What are the differences between Hugging Face’s Open-R1 and the Open-R1 you have mentioned?</p>",
      "rawMarkdown": "What are the differences between Hugging Face’s Open-R1 and the Open-R1 you have mentioned?"
    },
    {
      "id": 3175536,
      "postDate": "2025-04-10T09:10:16.993Z",
      "content": "<p>thanks for sharing this article it provides great insight 🤗</p>",
      "rawMarkdown": "thanks for sharing this article it provides great insight 🤗"
    },
    {
      "id": 3168527,
      "postDate": "2025-04-02T14:23:24.950Z",
      "rawMarkdown": "",
      "votes": 1,
      "isDeleted": true
    },
    {
      "id": 3168281,
      "postDate": "2025-04-02T09:54:35.147Z",
      "rawMarkdown": "",
      "isDeleted": true
    },
    {
      "id": 3169598,
      "postDate": "2025-04-03T16:24:27.873Z",
      "content": "<p>thanks a lot for sharing, big love</p>",
      "rawMarkdown": "thanks a lot for sharing, big love"
    }
  ],
  "complete": true,
  "source": "live",
  "fetched_at": "2026-10-20T06:42:38Z",
  "competition_id": 86023,
  "competition_slug": "ai-mathematical-olympiad-progress-prize-2",
  "team_id": 13275024,
  "solution_url": "/competitions/ai-mathematical-olympiad-progress-prize-2/writeups/fast-math-r1-14b-lb-pub-29-pvt-28-enhancing-the-ef"
}