{
  "id": 703222,
  "title": "1st Place Solution for the AIMO3 Competition",
  "content": "<h1>GPT-OSS-120B on a Single H100: Efficient Large-Scale Reasoning</h1>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2F96f1e57b11f516cfdce63beeaff1c9e4%2Fgpt-oss-120b.png?generation=1780048553192626&amp;alt=media\" alt=\"\"></p>\n<p>This work is the product of <strong>empirical research</strong> carried out through, benchmarking, observation, and analysis of publicly available notebooks, technical reports, and competition solutions. </p>\n<h2>Based on the work of Parthenos</h2>\n<h1>1. Introduction</h1>\n<p>GPT-OSS-120B is a powerful open-weight <strong>Mixture-of-Experts (MoE)</strong> language model designed for high-performance reasoning and agentic workloads. Although the model contains approximately <strong>117 billion parameters</strong>, only around <strong>12 billion parameters are active per token</strong>, enabling efficient execution on a single <strong>NVIDIA H100 80GB GPU</strong>.</p>\n<p>This solution included:</p>\n<ul>\n<li>Memory optimization</li>\n<li>Prefix caching</li>\n<li>KV cache quantization</li>\n<li>Entropy-weighted self-consistency</li>\n<li>Verification-assisted reasoning</li>\n<li>Adaptive runtime scheduling</li>\n</ul>\n<hr>\n<h1>2. System Architecture and Memory Optimization</h1>\n<p>One of the most difficult engineering challenges was fitting a 120B-scale model within single-GPU memory constraints while preserving long-context reasoning performance.</p>\n<p>To solve this, the system relied on multiple layers of optimization.</p>\n<h2><em>OS-Level Weight Preloading</em></h2>\n<p>A deliberate file-read operation was used before model initialization to force weights into the Linux page cache. This significantly reduced repeated disk access and lowered startup latency during inference initialization.</p>\n<pre><code>Disk Storage\n      ↓\nLinux Page Cache\n      ↓\nGPU Transfer\n      ↓\nInference Runtime\n</code></pre>\n<h2><em>Prefix Caching</em></h2>\n<p>Shared prompt prefixes were reused across multiple parallel generations to avoid redundant attention computation. Since many reasoning samples begin with identical system prompts and instruction templates, prefix caching substantially improved throughput efficiency.</p>\n<h2><em>KV Cache Quantization</em></h2>\n<p>The KV cache was quantized to 8-bit precision to reduce memory pressure during long-context inference.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2F60ef566e53c3dd2876e771219c0c7d59%2FScreenshot%202026-05-29%20110704.png?generation=1780049250466400&amp;alt=media\" alt=\"\"></p>\n<p><em>The Key and Value matrices belong to an n × d real-valued vector space.</em></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2F9c781128c5dba2ea0ba963a0f80a2727%2FScreenshot%202026-05-29%20110750.png?generation=1780049288266337&amp;alt=media\" alt=\"\"></p>\n<p><em>The original Key and Value matrices are transformed into their 8-bit quantized representations to reduce memory usage during inference.</em></p>\n<p><strong>This enabled:</strong></p>\n<ul>\n<li>Longer context windows</li>\n<li>Improved VRAM stability</li>\n<li>Reduced fragmentation</li>\n<li>Increased parallel generation capacity</li>\n</ul>\n<hr>\n<h1>3. Prompt Engineering and Inference Strategy</h1>\n<p>One of the most important findings during research was that <strong>prompt engineering consistently produced larger gains than several complex optimization techniques</strong>.</p>\n<p>Carefully refined prompts improved:</p>\n<ul>\n<li>Symbolic consistency</li>\n<li>Chain-of-thought stability</li>\n<li>Verification behavior</li>\n<li>Mathematical structure</li>\n<li>Formatting reliability</li>\n</ul>\n<p>Multiple prompt variants were analysed, including:</p>\n<ul>\n<li><p>Gemini-generated prompts\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2F914f4f9b8eb0faade7508ea821259f30%2FScreenshot%202026-05-29%20093125.png?generation=1780049525246514&amp;alt=media\" alt=\"\"></p></li>\n<li><p>Community reasoning templates\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2Fdbdcca5e5e88c3f760eed1b7839c3925%2FScreenshot%202026-05-29%20093631.png?generation=1780049548472486&amp;alt=media\" alt=\"\"></p></li>\n<li><p>Original notebook prompts\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2Fef2cbb9d864aae126782c4039ae855af%2FScreenshot%202026-05-29%20092758.png?generation=1780049573228033&amp;alt=media\" alt=\"\"></p></li>\n</ul>\n<p>However, the original notebook prompt was used eventually.</p>\n<p>External reference:</p>\n<p><a href=\"https://www.kaggle.com/code/datasciencegrad/aimo-3-42-50-stable-lb-possible-43-luck\" target=\"_blank\">https://www.kaggle.com/code/datasciencegrad/aimo-3-42-50-stable-lb-possible-43-luck</a></p>\n<h2><em>Entropy-Weighted Self-Consistency</em></h2>\n<p>Traditional majority voting was replaced with entropy-weighted aggregation.</p>\n<p>Instead of treating all generated samples equally, it estimated confidence using token-level probability distributions based on Shannon entropy.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2F31e767396da113bf7faeba0b3d885422%2FScreenshot%202026-05-29%20111440.png?generation=1780049699987385&amp;alt=media\" alt=\"\"></p>\n<p>Lower entropy implied higher confidence and stronger reasoning stability.</p>\n<p>The inference pipeline operated as follows:</p>\n<pre><code>Parallel Generations\n          ↓\nEntropy Scoring\n          ↓\nConfidence Weighting\n          ↓\nFinal Aggregation\n</code></pre>\n<p>Compared to standard majority voting, entropy-weighted aggregation reduced instability and penalized uncertain generations.</p>\n<hr>\n<h1>4. Verification and Runtime Orchestration</h1>\n<p>A major component of the architecture was a persistent sandbox verification system built around long-lived Jupyter kernels.</p>\n<p>Instead of repeatedly restarting Python environments, the system preserved:</p>\n<ul>\n<li>Variables</li>\n<li>Functions</li>\n<li>Intermediate reasoning states</li>\n<li>Mathematical objects</li>\n<li>Verification outputs</li>\n</ul>\n<p>Generated reasoning steps were executed programmatically, and execution outputs were fed back into the inference pipeline for refinement.</p>\n<pre><code>Model Generation\n       ↓\nCode Execution\n       ↓\nVerification\n       ↓\nFeedback Injection\n       ↓\nRefined Solution\n</code></pre>\n<h2><em>Adaptive Runtime Scheduling</em></h2>\n<p>To operate efficiently within Kaggle’s runtime constraints, the system implemented adaptive compute scheduling.</p>\n<p>Each remaining problem received a baseline compute allocation, while unused time was redistributed dynamically according to:</p>\n<ul>\n<li>Problem difficulty</li>\n<li>Verification complexity</li>\n<li>Reasoning depth</li>\n<li>Generation stability</li>\n</ul>\n<p>As execution approached the notebook timeout limit:</p>\n<ul>\n<li>Sampling depth was reduced</li>\n<li>Verification loops were shortened</li>\n<li>Best-valid partial outputs were returned</li>\n</ul>\n<p>This prevented runtime failures near deadline limits.</p>\n<hr>\n<h1>5.  Findings</h1>\n<p>A major observation was that inference engineering itself became a competitive advantage. The final system behaved less like a traditional language model and more like a coordinated reasoning engine.</p>\n<hr>\n<h1>6. Future Direction</h1>\n<p>One particularly promising direction comes from strategies described in the DeepSeek technical reports, where multiple specialized expert models are independently trained using reinforcement learning and later distilled back into a single unified system.</p>\n<p>Such a framework could significantly improve:</p>\n<ul>\n<li>Formal mathematical reasoning</li>\n<li>Verification planning</li>\n<li>Tool usage reliability</li>\n<li>Long-chain symbolic consistency</li>\n<li>Multi-domain specialization</li>\n</ul>\n<p>This type of multi-expert reinforcement learning followed by consolidation appears to be a powerful direction for future competition systems.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2F56eb9e85d8db9da0460a94be9e58ec81%2FScreenshot%202026-05-29%20111930.png?generation=1780049991374084&amp;alt=media\" alt=\"\"></p>\n<hr>\n<h1>7. Conclusion</h1>\n<p>The final architecture combined:</p>\n<ul>\n<li>OS-level memory optimization</li>\n<li>Prefix caching</li>\n<li>KV cache quantization</li>\n<li>Entropy-weighted self-consistency</li>\n<li>Adaptive runtime scheduling</li>\n<li>Persistent sandbox verification</li>\n<li>Prompt-engineered reasoning orchestration</li>\n</ul>\n<p>One of the most important conclusions from this research is that careful inference design and prompt engineering can contribute more consistently to leaderboard performance than naive scaling strategies alone.</p>\n<hr>\n<h1>References</h1>\n<ol>\n<li>GPT-OSS-120B Technical Documentation</li>\n<li>Kaggle AIMO Competition Discussions</li>\n<li>DeepSeek Technical Reports</li>\n<li>Shannon, C. E. — <em>A Mathematical Theory of Communication</em></li>\n<li>Sparse Mixture-of-Experts Transformer Literature</li>\n<li>Public Community Inference Implementations</li>\n<li>Bycloud: <a href=\"https://www.youtube.com/watch?v=gC76aeibdFA\" target=\"_blank\">https://www.youtube.com/watch?v=gC76aeibdFA</a></li>\n</ol>",
  "comments": [
    {
      "id": 3464271,
      "author_name": "Mohammad Shadab Alam",
      "author_url": "",
      "post_date": "2026-05-29T11:13:55.260000",
      "content": "<p>Congratulations and Thanks for sharing, so this is submission is an exact copy of [44/50] LET ME (over)COOK!!! <a href=\"https://www.kaggle.com/code/nihilisticneuralnet/44-50-let-me-over-cook?scriptVersionId=291499043\" target=\"_blank\">version 1</a></p>",
      "votes": 20,
      "replies": [
        {
          "id": 3464272,
          "author_name": "JK-Piece",
          "author_url": "",
          "post_date": "2026-05-29T11:16:49.327000",
          "content": "<p>I just confirmed this too🤣. I am not surprised. Congratulations <a href=\"https://www.kaggle.com/theexaltedone\" target=\"_blank\">@theexaltedone</a> </p>",
          "votes": 4,
          "replies": [
            {
              "id": 3466386,
              "author_name": "zulfikar.khalwaniev",
              "author_url": "",
              "post_date": "2026-06-04T03:13:55.487000",
              "content": "<p>really unchanged ? </p>",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 3464645,
      "author_name": "Akagha Chimgozirim",
      "author_url": "",
      "post_date": "2026-05-30T17:17:17.533000",
      "content": "<p>Big Congratulations ma guy.</p>\n<p>I'm realy happy for you.</p>\n<p>Naija all the way!!!</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 3464648,
      "author_name": "Durga Kumari",
      "author_url": "",
      "post_date": "2026-05-30T17:28:43.153000",
      "content": "<p>Amazing achievement. The entropy weighted self consistency idea is particularly interesting.</p>",
      "votes": -13,
      "replies": []
    },
    {
      "id": 3464586,
      "author_name": "Taha",
      "author_url": "",
      "post_date": "2026-05-30T11:54:21.227000",
      "content": "<p>you received the prize?</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 3464274,
      "author_name": "Laureano Arcanio",
      "author_url": "",
      "post_date": "2026-05-29T11:35:49.677000",
      "content": "<p>Thanks for sharing, and congratulations on the result.</p>\n<p>I had a question about the <strong>“Adaptive Runtime Scheduling”</strong> section in your writeup. You mention:</p>\n<blockquote>\n  <p>“Unused time redistributed according to problem difficulty, verification complexity, reasoning depth, generation stability.”</p>\n</blockquote>\n<p>Could you clarify where this logic is implemented? I may have overlooked it, but I could not find it in the provided notebook. </p>",
      "votes": 0,
      "replies": [
        {
          "id": 3464286,
          "author_name": "Exalted Joseph",
          "author_url": "",
          "post_date": "2026-05-29T12:08:01.453000",
          "content": "<p>The system is \"adaptive\" only to the ticking clock. If a problem finishes early (e.g., due to early stopping when 4 matching answers are found), the unused time naturally goes back into the global pool for the next problem,\nedit: A fancy way of describing it😉</p>",
          "votes": -6,
          "replies": [
            {
              "id": 3464296,
              "author_name": "Laureano Arcanio",
              "author_url": "",
              "post_date": "2026-05-29T12:54:34.807000",
              "content": "<p>Thanks for clarifying.</p>\n<p>I think this is an important distinction. Your explanation sounds like a standard global time budget with early stopping, where unused time naturally remains available for later problems.</p>\n<p>That is not the same as an adaptive scheduler based on problem difficulty, verification complexity, reasoning depth, or generation stability. Unless those factors are explicitly computed and used to control runtime allocation, the wording seems misleading.</p>\n<p>Also, since this notebook appears to be based heavily on public kernels, I think it is especially important that the writeup accurately explains what the code actually does. The technical claims should still match the implementation.</p>",
              "votes": 0,
              "replies": []
            },
            {
              "id": 3464298,
              "author_name": "Exalted Joseph",
              "author_url": "",
              "post_date": "2026-05-29T13:14:09.950000",
              "content": "<p>You’re right about the mechanism, but the key point is what triggers the rollover. The system saves time through early stopping based on generation consensus. If the model reaches 4 matching answers quickly, that usually means the problem is simpler and the outputs are stable, so it stops early and carries the unused time forward.</p>\n<p>For harder problems, the outputs are less consistent, which prevents early consensus and forces the system to use more of its budget. It doesn’t need an explicit “difficulty score” because the allocation naturally emerges from the model’s own certainty. The rollover is just the mechanism that enables that adaptive behavior.</p>",
              "votes": -7,
              "replies": []
            }
          ]
        }
      ]
    }
  ],
  "comment_count": 10,
  "messages": [
    {
      "id": 3464271,
      "postDate": "2026-05-29T11:13:55.260Z",
      "content": "<p>Congratulations and Thanks for sharing, so this is submission is an exact copy of [44/50] LET ME (over)COOK!!! <a href=\"https://www.kaggle.com/code/nihilisticneuralnet/44-50-let-me-over-cook?scriptVersionId=291499043\" target=\"_blank\">version 1</a></p>",
      "rawMarkdown": "Congratulations and Thanks for sharing, so this is submission is an exact copy of [44/50] LET ME (over)COOK!!! [version 1](https://www.kaggle.com/code/nihilisticneuralnet/44-50-let-me-over-cook?scriptVersionId=291499043)\n",
      "votes": 20,
      "replies": [
        {
          "id": 3464272,
          "postDate": "2026-05-29T11:16:49.327Z",
          "content": "<p>I just confirmed this too🤣. I am not surprised. Congratulations <a href=\"https://www.kaggle.com/theexaltedone\" target=\"_blank\">@theexaltedone</a> </p>",
          "rawMarkdown": "I just confirmed this too🤣. I am not surprised. Congratulations @theexaltedone ",
          "votes": 4,
          "replies": [
            {
              "id": 3466386,
              "postDate": "2026-06-04T03:13:55.487Z",
              "content": "<p>really unchanged ? </p>",
              "rawMarkdown": "really unchanged ? "
            }
          ]
        }
      ]
    },
    {
      "id": 3464257,
      "postDate": "2026-05-29T10:31:47.830Z",
      "content": "<h1>GPT-OSS-120B on a Single H100: Efficient Large-Scale Reasoning</h1>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2F96f1e57b11f516cfdce63beeaff1c9e4%2Fgpt-oss-120b.png?generation=1780048553192626&amp;alt=media\" alt=\"\"></p>\n<p>This work is the product of <strong>empirical research</strong> carried out through, benchmarking, observation, and analysis of publicly available notebooks, technical reports, and competition solutions. </p>\n<h2>Based on the work of Parthenos</h2>\n<h1>1. Introduction</h1>\n<p>GPT-OSS-120B is a powerful open-weight <strong>Mixture-of-Experts (MoE)</strong> language model designed for high-performance reasoning and agentic workloads. Although the model contains approximately <strong>117 billion parameters</strong>, only around <strong>12 billion parameters are active per token</strong>, enabling efficient execution on a single <strong>NVIDIA H100 80GB GPU</strong>.</p>\n<p>This solution included:</p>\n<ul>\n<li>Memory optimization</li>\n<li>Prefix caching</li>\n<li>KV cache quantization</li>\n<li>Entropy-weighted self-consistency</li>\n<li>Verification-assisted reasoning</li>\n<li>Adaptive runtime scheduling</li>\n</ul>\n<hr>\n<h1>2. System Architecture and Memory Optimization</h1>\n<p>One of the most difficult engineering challenges was fitting a 120B-scale model within single-GPU memory constraints while preserving long-context reasoning performance.</p>\n<p>To solve this, the system relied on multiple layers of optimization.</p>\n<h2><em>OS-Level Weight Preloading</em></h2>\n<p>A deliberate file-read operation was used before model initialization to force weights into the Linux page cache. This significantly reduced repeated disk access and lowered startup latency during inference initialization.</p>\n<pre><code>Disk Storage\n      ↓\nLinux Page Cache\n      ↓\nGPU Transfer\n      ↓\nInference Runtime\n</code></pre>\n<h2><em>Prefix Caching</em></h2>\n<p>Shared prompt prefixes were reused across multiple parallel generations to avoid redundant attention computation. Since many reasoning samples begin with identical system prompts and instruction templates, prefix caching substantially improved throughput efficiency.</p>\n<h2><em>KV Cache Quantization</em></h2>\n<p>The KV cache was quantized to 8-bit precision to reduce memory pressure during long-context inference.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2F60ef566e53c3dd2876e771219c0c7d59%2FScreenshot%202026-05-29%20110704.png?generation=1780049250466400&amp;alt=media\" alt=\"\"></p>\n<p><em>The Key and Value matrices belong to an n × d real-valued vector space.</em></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2F9c781128c5dba2ea0ba963a0f80a2727%2FScreenshot%202026-05-29%20110750.png?generation=1780049288266337&amp;alt=media\" alt=\"\"></p>\n<p><em>The original Key and Value matrices are transformed into their 8-bit quantized representations to reduce memory usage during inference.</em></p>\n<p><strong>This enabled:</strong></p>\n<ul>\n<li>Longer context windows</li>\n<li>Improved VRAM stability</li>\n<li>Reduced fragmentation</li>\n<li>Increased parallel generation capacity</li>\n</ul>\n<hr>\n<h1>3. Prompt Engineering and Inference Strategy</h1>\n<p>One of the most important findings during research was that <strong>prompt engineering consistently produced larger gains than several complex optimization techniques</strong>.</p>\n<p>Carefully refined prompts improved:</p>\n<ul>\n<li>Symbolic consistency</li>\n<li>Chain-of-thought stability</li>\n<li>Verification behavior</li>\n<li>Mathematical structure</li>\n<li>Formatting reliability</li>\n</ul>\n<p>Multiple prompt variants were analysed, including:</p>\n<ul>\n<li><p>Gemini-generated prompts\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2F914f4f9b8eb0faade7508ea821259f30%2FScreenshot%202026-05-29%20093125.png?generation=1780049525246514&amp;alt=media\" alt=\"\"></p></li>\n<li><p>Community reasoning templates\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2Fdbdcca5e5e88c3f760eed1b7839c3925%2FScreenshot%202026-05-29%20093631.png?generation=1780049548472486&amp;alt=media\" alt=\"\"></p></li>\n<li><p>Original notebook prompts\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2Fef2cbb9d864aae126782c4039ae855af%2FScreenshot%202026-05-29%20092758.png?generation=1780049573228033&amp;alt=media\" alt=\"\"></p></li>\n</ul>\n<p>However, the original notebook prompt was used eventually.</p>\n<p>External reference:</p>\n<p><a href=\"https://www.kaggle.com/code/datasciencegrad/aimo-3-42-50-stable-lb-possible-43-luck\" target=\"_blank\">https://www.kaggle.com/code/datasciencegrad/aimo-3-42-50-stable-lb-possible-43-luck</a></p>\n<h2><em>Entropy-Weighted Self-Consistency</em></h2>\n<p>Traditional majority voting was replaced with entropy-weighted aggregation.</p>\n<p>Instead of treating all generated samples equally, it estimated confidence using token-level probability distributions based on Shannon entropy.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2F31e767396da113bf7faeba0b3d885422%2FScreenshot%202026-05-29%20111440.png?generation=1780049699987385&amp;alt=media\" alt=\"\"></p>\n<p>Lower entropy implied higher confidence and stronger reasoning stability.</p>\n<p>The inference pipeline operated as follows:</p>\n<pre><code>Parallel Generations\n          ↓\nEntropy Scoring\n          ↓\nConfidence Weighting\n          ↓\nFinal Aggregation\n</code></pre>\n<p>Compared to standard majority voting, entropy-weighted aggregation reduced instability and penalized uncertain generations.</p>\n<hr>\n<h1>4. Verification and Runtime Orchestration</h1>\n<p>A major component of the architecture was a persistent sandbox verification system built around long-lived Jupyter kernels.</p>\n<p>Instead of repeatedly restarting Python environments, the system preserved:</p>\n<ul>\n<li>Variables</li>\n<li>Functions</li>\n<li>Intermediate reasoning states</li>\n<li>Mathematical objects</li>\n<li>Verification outputs</li>\n</ul>\n<p>Generated reasoning steps were executed programmatically, and execution outputs were fed back into the inference pipeline for refinement.</p>\n<pre><code>Model Generation\n       ↓\nCode Execution\n       ↓\nVerification\n       ↓\nFeedback Injection\n       ↓\nRefined Solution\n</code></pre>\n<h2><em>Adaptive Runtime Scheduling</em></h2>\n<p>To operate efficiently within Kaggle’s runtime constraints, the system implemented adaptive compute scheduling.</p>\n<p>Each remaining problem received a baseline compute allocation, while unused time was redistributed dynamically according to:</p>\n<ul>\n<li>Problem difficulty</li>\n<li>Verification complexity</li>\n<li>Reasoning depth</li>\n<li>Generation stability</li>\n</ul>\n<p>As execution approached the notebook timeout limit:</p>\n<ul>\n<li>Sampling depth was reduced</li>\n<li>Verification loops were shortened</li>\n<li>Best-valid partial outputs were returned</li>\n</ul>\n<p>This prevented runtime failures near deadline limits.</p>\n<hr>\n<h1>5.  Findings</h1>\n<p>A major observation was that inference engineering itself became a competitive advantage. The final system behaved less like a traditional language model and more like a coordinated reasoning engine.</p>\n<hr>\n<h1>6. Future Direction</h1>\n<p>One particularly promising direction comes from strategies described in the DeepSeek technical reports, where multiple specialized expert models are independently trained using reinforcement learning and later distilled back into a single unified system.</p>\n<p>Such a framework could significantly improve:</p>\n<ul>\n<li>Formal mathematical reasoning</li>\n<li>Verification planning</li>\n<li>Tool usage reliability</li>\n<li>Long-chain symbolic consistency</li>\n<li>Multi-domain specialization</li>\n</ul>\n<p>This type of multi-expert reinforcement learning followed by consolidation appears to be a powerful direction for future competition systems.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2F56eb9e85d8db9da0460a94be9e58ec81%2FScreenshot%202026-05-29%20111930.png?generation=1780049991374084&amp;alt=media\" alt=\"\"></p>\n<hr>\n<h1>7. Conclusion</h1>\n<p>The final architecture combined:</p>\n<ul>\n<li>OS-level memory optimization</li>\n<li>Prefix caching</li>\n<li>KV cache quantization</li>\n<li>Entropy-weighted self-consistency</li>\n<li>Adaptive runtime scheduling</li>\n<li>Persistent sandbox verification</li>\n<li>Prompt-engineered reasoning orchestration</li>\n</ul>\n<p>One of the most important conclusions from this research is that careful inference design and prompt engineering can contribute more consistently to leaderboard performance than naive scaling strategies alone.</p>\n<hr>\n<h1>References</h1>\n<ol>\n<li>GPT-OSS-120B Technical Documentation</li>\n<li>Kaggle AIMO Competition Discussions</li>\n<li>DeepSeek Technical Reports</li>\n<li>Shannon, C. E. — <em>A Mathematical Theory of Communication</em></li>\n<li>Sparse Mixture-of-Experts Transformer Literature</li>\n<li>Public Community Inference Implementations</li>\n<li>Bycloud: <a href=\"https://www.youtube.com/watch?v=gC76aeibdFA\" target=\"_blank\">https://www.youtube.com/watch?v=gC76aeibdFA</a></li>\n</ol>",
      "rawMarkdown": "# GPT-OSS-120B on a Single H100: Efficient Large-Scale Reasoning \n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2F96f1e57b11f516cfdce63beeaff1c9e4%2Fgpt-oss-120b.png?generation=1780048553192626&alt=media)\n\nThis work is the product of **empirical research** carried out through, benchmarking, observation, and analysis of publicly available notebooks, technical reports, and competition solutions. \nBased on the work of Parthenos\n---\n\n# 1. Introduction\n\nGPT-OSS-120B is a powerful open-weight **Mixture-of-Experts (MoE)** language model designed for high-performance reasoning and agentic workloads. Although the model contains approximately **117 billion parameters**, only around **12 billion parameters are active per token**, enabling efficient execution on a single **NVIDIA H100 80GB GPU**.\n\n\nThis solution included:\n\n* Memory optimization\n* Prefix caching\n* KV cache quantization\n* Entropy-weighted self-consistency\n* Verification-assisted reasoning\n* Adaptive runtime scheduling\n\n\n---\n\n# 2. System Architecture and Memory Optimization\n\nOne of the most difficult engineering challenges was fitting a 120B-scale model within single-GPU memory constraints while preserving long-context reasoning performance.\n\nTo solve this, the system relied on multiple layers of optimization.\n\n## *OS-Level Weight Preloading*\n\nA deliberate file-read operation was used before model initialization to force weights into the Linux page cache. This significantly reduced repeated disk access and lowered startup latency during inference initialization.\n\n```\nDisk Storage\n      ↓\nLinux Page Cache\n      ↓\nGPU Transfer\n      ↓\nInference Runtime\n```\n\n\n## *Prefix Caching*\n\nShared prompt prefixes were reused across multiple parallel generations to avoid redundant attention computation. Since many reasoning samples begin with identical system prompts and instruction templates, prefix caching substantially improved throughput efficiency.\n\n## *KV Cache Quantization*\n\nThe KV cache was quantized to 8-bit precision to reduce memory pressure during long-context inference.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2F60ef566e53c3dd2876e771219c0c7d59%2FScreenshot%202026-05-29%20110704.png?generation=1780049250466400&alt=media)\n\n*The Key and Value matrices belong to an n × d real-valued vector space.*\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2F9c781128c5dba2ea0ba963a0f80a2727%2FScreenshot%202026-05-29%20110750.png?generation=1780049288266337&alt=media)\n\n*The original Key and Value matrices are transformed into their 8-bit quantized representations to reduce memory usage during inference.*\n\n**This enabled:**\n\n* Longer context windows\n* Improved VRAM stability\n* Reduced fragmentation\n* Increased parallel generation capacity\n\n\n---\n\n# 3. Prompt Engineering and Inference Strategy\n\nOne of the most important findings during research was that **prompt engineering consistently produced larger gains than several complex optimization techniques**.\n\nCarefully refined prompts improved:\n\n* Symbolic consistency\n* Chain-of-thought stability\n* Verification behavior\n* Mathematical structure\n* Formatting reliability\n\nMultiple prompt variants were analysed, including:\n\n* Gemini-generated prompts\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2F914f4f9b8eb0faade7508ea821259f30%2FScreenshot%202026-05-29%20093125.png?generation=1780049525246514&alt=media)\n* Community reasoning templates\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2Fdbdcca5e5e88c3f760eed1b7839c3925%2FScreenshot%202026-05-29%20093631.png?generation=1780049548472486&alt=media)\n\n* Original notebook prompts\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2Fef2cbb9d864aae126782c4039ae855af%2FScreenshot%202026-05-29%20092758.png?generation=1780049573228033&alt=media)\n\nHowever, the original notebook prompt was used eventually.\n\nExternal reference:\n\nhttps://www.kaggle.com/code/datasciencegrad/aimo-3-42-50-stable-lb-possible-43-luck\n\n## *Entropy-Weighted Self-Consistency*\n\nTraditional majority voting was replaced with entropy-weighted aggregation.\n\nInstead of treating all generated samples equally, it estimated confidence using token-level probability distributions based on Shannon entropy.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2F31e767396da113bf7faeba0b3d885422%2FScreenshot%202026-05-29%20111440.png?generation=1780049699987385&alt=media)\n\nLower entropy implied higher confidence and stronger reasoning stability.\n\nThe inference pipeline operated as follows:\n\n```\nParallel Generations\n          ↓\nEntropy Scoring\n          ↓\nConfidence Weighting\n          ↓\nFinal Aggregation\n```\n\nCompared to standard majority voting, entropy-weighted aggregation reduced instability and penalized uncertain generations.\n\n\n---\n\n# 4. Verification and Runtime Orchestration\n\nA major component of the architecture was a persistent sandbox verification system built around long-lived Jupyter kernels.\n\nInstead of repeatedly restarting Python environments, the system preserved:\n\n* Variables\n* Functions\n* Intermediate reasoning states\n* Mathematical objects\n* Verification outputs\n\nGenerated reasoning steps were executed programmatically, and execution outputs were fed back into the inference pipeline for refinement.\n\n```\nModel Generation\n       ↓\nCode Execution\n       ↓\nVerification\n       ↓\nFeedback Injection\n       ↓\nRefined Solution\n```\n\n\n## *Adaptive Runtime Scheduling*\n\nTo operate efficiently within Kaggle’s runtime constraints, the system implemented adaptive compute scheduling.\n\nEach remaining problem received a baseline compute allocation, while unused time was redistributed dynamically according to:\n\n* Problem difficulty\n* Verification complexity\n* Reasoning depth\n* Generation stability\n\nAs execution approached the notebook timeout limit:\n\n* Sampling depth was reduced\n* Verification loops were shortened\n* Best-valid partial outputs were returned\n\nThis prevented runtime failures near deadline limits.\n\n\n---\n\n# 5.  Findings\n\nA major observation was that inference engineering itself became a competitive advantage. The final system behaved less like a traditional language model and more like a coordinated reasoning engine.\n\n\n---\n\n# 6. Future Direction\n\nOne particularly promising direction comes from strategies described in the DeepSeek technical reports, where multiple specialized expert models are independently trained using reinforcement learning and later distilled back into a single unified system.\n\nSuch a framework could significantly improve:\n\n* Formal mathematical reasoning\n* Verification planning\n* Tool usage reliability\n* Long-chain symbolic consistency\n* Multi-domain specialization\n\nThis type of multi-expert reinforcement learning followed by consolidation appears to be a powerful direction for future competition systems.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F21070744%2F56eb9e85d8db9da0460a94be9e58ec81%2FScreenshot%202026-05-29%20111930.png?generation=1780049991374084&alt=media)\n\n---\n\n# 7. Conclusion\n\nThe final architecture combined:\n\n* OS-level memory optimization\n* Prefix caching\n* KV cache quantization\n* Entropy-weighted self-consistency\n* Adaptive runtime scheduling\n* Persistent sandbox verification\n* Prompt-engineered reasoning orchestration\n\nOne of the most important conclusions from this research is that careful inference design and prompt engineering can contribute more consistently to leaderboard performance than naive scaling strategies alone.\n\n\n---\n\n# References\n\n1. GPT-OSS-120B Technical Documentation\n2. Kaggle AIMO Competition Discussions\n3. DeepSeek Technical Reports\n4. Shannon, C. E. — *A Mathematical Theory of Communication*\n5. Sparse Mixture-of-Experts Transformer Literature\n6. Public Community Inference Implementations\n7. Bycloud: https://www.youtube.com/watch?v=gC76aeibdFA\n",
      "votes": 15
    },
    {
      "id": 3464645,
      "postDate": "2026-05-30T17:17:17.533Z",
      "content": "<p>Big Congratulations ma guy.</p>\n<p>I'm realy happy for you.</p>\n<p>Naija all the way!!!</p>",
      "rawMarkdown": "Big Congratulations ma guy.\n\nI'm realy happy for you.\n\nNaija all the way!!!"
    },
    {
      "id": 3464648,
      "postDate": "2026-05-30T17:28:43.153Z",
      "content": "<p>Amazing achievement. The entropy weighted self consistency idea is particularly interesting.</p>",
      "rawMarkdown": "Amazing achievement. The entropy weighted self consistency idea is particularly interesting.",
      "votes": -13
    },
    {
      "id": 3464586,
      "postDate": "2026-05-30T11:54:21.227Z",
      "content": "<p>you received the prize?</p>",
      "rawMarkdown": "you received the prize?"
    },
    {
      "id": 3464274,
      "postDate": "2026-05-29T11:35:49.677Z",
      "content": "<p>Thanks for sharing, and congratulations on the result.</p>\n<p>I had a question about the <strong>“Adaptive Runtime Scheduling”</strong> section in your writeup. You mention:</p>\n<blockquote>\n  <p>“Unused time redistributed according to problem difficulty, verification complexity, reasoning depth, generation stability.”</p>\n</blockquote>\n<p>Could you clarify where this logic is implemented? I may have overlooked it, but I could not find it in the provided notebook. </p>",
      "rawMarkdown": "Thanks for sharing, and congratulations on the result.\n\nI had a question about the **“Adaptive Runtime Scheduling”** section in your writeup. You mention:\n\n> “Unused time redistributed according to problem difficulty, verification complexity, reasoning depth, generation stability.”\n\nCould you clarify where this logic is implemented? I may have overlooked it, but I could not find it in the provided notebook. ",
      "replies": [
        {
          "id": 3464286,
          "postDate": "2026-05-29T12:08:01.453Z",
          "content": "<p>The system is \"adaptive\" only to the ticking clock. If a problem finishes early (e.g., due to early stopping when 4 matching answers are found), the unused time naturally goes back into the global pool for the next problem,\nedit: A fancy way of describing it😉</p>",
          "rawMarkdown": "The system is \"adaptive\" only to the ticking clock. If a problem finishes early (e.g., due to early stopping when 4 matching answers are found), the unused time naturally goes back into the global pool for the next problem,\nedit: A fancy way of describing it😉",
          "votes": -6,
          "replies": [
            {
              "id": 3464296,
              "postDate": "2026-05-29T12:54:34.807Z",
              "content": "<p>Thanks for clarifying.</p>\n<p>I think this is an important distinction. Your explanation sounds like a standard global time budget with early stopping, where unused time naturally remains available for later problems.</p>\n<p>That is not the same as an adaptive scheduler based on problem difficulty, verification complexity, reasoning depth, or generation stability. Unless those factors are explicitly computed and used to control runtime allocation, the wording seems misleading.</p>\n<p>Also, since this notebook appears to be based heavily on public kernels, I think it is especially important that the writeup accurately explains what the code actually does. The technical claims should still match the implementation.</p>",
              "rawMarkdown": "Thanks for clarifying.\n\nI think this is an important distinction. Your explanation sounds like a standard global time budget with early stopping, where unused time naturally remains available for later problems.\n\nThat is not the same as an adaptive scheduler based on problem difficulty, verification complexity, reasoning depth, or generation stability. Unless those factors are explicitly computed and used to control runtime allocation, the wording seems misleading.\n\nAlso, since this notebook appears to be based heavily on public kernels, I think it is especially important that the writeup accurately explains what the code actually does. The technical claims should still match the implementation."
            },
            {
              "id": 3464298,
              "postDate": "2026-05-29T13:14:09.950Z",
              "content": "<p>You’re right about the mechanism, but the key point is what triggers the rollover. The system saves time through early stopping based on generation consensus. If the model reaches 4 matching answers quickly, that usually means the problem is simpler and the outputs are stable, so it stops early and carries the unused time forward.</p>\n<p>For harder problems, the outputs are less consistent, which prevents early consensus and forces the system to use more of its budget. It doesn’t need an explicit “difficulty score” because the allocation naturally emerges from the model’s own certainty. The rollover is just the mechanism that enables that adaptive behavior.</p>",
              "rawMarkdown": "You’re right about the mechanism, but the key point is what triggers the rollover. The system saves time through early stopping based on generation consensus. If the model reaches 4 matching answers quickly, that usually means the problem is simpler and the outputs are stable, so it stops early and carries the unused time forward.\n\nFor harder problems, the outputs are less consistent, which prevents early consensus and forces the system to use more of its budget. It doesn’t need an explicit “difficulty score” because the allocation naturally emerges from the model’s own certainty. The rollover is just the mechanism that enables that adaptive behavior.\n",
              "votes": -7
            }
          ]
        }
      ]
    }
  ],
  "complete": true,
  "source": "live",
  "fetched_at": "2026-10-20T04:27:03Z",
  "competition_id": 118448,
  "competition_slug": "ai-mathematical-olympiad-progress-prize-3",
  "team_id": 14801520,
  "solution_url": "/competitions/ai-mathematical-olympiad-progress-prize-3/writeups/1st-place-solution-for-the-aimo3-competition"
}