{
  "id": 563866,
  "title": "Niboshi's solution",
  "content": "<p>We first went with Stockfish 4, then Stockfish 16, then finally Cfish due to RAM constraint.</p>\n<p>Our code is <a href=\"https://github.com/chettub/Niboshi\" target=\"_blank\">here</a>.</p>\n<h1>NNUE</h1>\n<p>We disabled HCE and relied our evaluation totally on NNUE.</p>\n<p>We assumed that the accuracy of the evaluation function was essential, and therefore searched for a binary-size-efficient network.</p>\n<p>Our final network was inspired by the latest Stockfish's network. To save the size, we replaced the feature transformer by concatting the output of the following 2 networks. The first is a CNN with input channel 12 (=number of pieces), output channel 13, kernel size 15x15, and padding 7, so that the CNN could produce features for each square. The second is a dense network with 64 outputs, but it shares the same weight for neighbor positions. A normal dense network would have 768 inputs, but ours has only 96 inputs.</p>\n<p>However, one thing that we missed was that the computation cost was very heavy; the equivalent L1 size was 896, too large to compensate the accuracy loss caused by the shared weights in the CNN.</p>\n<p>As for the training dataset, we used a mix of leela-generated data and stockfish-generated data, though we didn't see much difference when changing the dataset.</p>\n<h1>Other changes</h1>\n<ul>\n<li>Transposition table : 512 KiB</li>\n<li>Use hash table for continuation History : 128 KiB</li>\n<li>Compile nnue.c with -O3, and others with -Os</li>\n<li>Delete features that were unused, or did not hurt the performance too much</li>\n</ul>\n<h1>Final remarks</h1>\n<p>We were happy to be able to participate in this competition.<br>\nI personally knew little about chess programming before entering this competition, but I learned a lot from the competition that I could not have learned from other places.</p>\n<p>Congratulations for the top 3 teams. You chess engine developers totally deserve it.</p>\n<p>Many thanks to the organizers and the participants. Thank you <a href=\"https://www.kaggle.com/bovard\" target=\"_blank\">@bovard</a>, <a href=\"https://www.kaggle.com/competitions/llm-20-questions/discussion/531387\" target=\"_blank\">for taking action when it was necessary and only when absolutely necessary</a>. And special thanks for those who worked hard debugging the environment.</p>",
  "comments": [
    {
      "id": 3143268,
      "author_name": "C R Suthikshn Kumar",
      "author_url": "",
      "post_date": "2025-03-07T04:13:03.813000",
      "content": "<p>How could you package into 64KiB? Even stockfish 4 also will exceed this.</p>",
      "votes": 0,
      "replies": [
        {
          "id": 3143339,
          "author_name": "c-number",
          "author_url": "",
          "post_date": "2025-03-07T05:59:19.170000",
          "content": "<p>We deleted every feature that is not needed during submission, i.e. bench, trace etc., and also disabled some heavy components like endgame and opening book.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "comment_count": 2,
  "messages": [
    {
      "id": 3128451,
      "postDate": "2025-02-19T15:10:47.500Z",
      "content": "<p>We first went with Stockfish 4, then Stockfish 16, then finally Cfish due to RAM constraint.</p>\n<p>Our code is <a href=\"https://github.com/chettub/Niboshi\" target=\"_blank\">here</a>.</p>\n<h1>NNUE</h1>\n<p>We disabled HCE and relied our evaluation totally on NNUE.</p>\n<p>We assumed that the accuracy of the evaluation function was essential, and therefore searched for a binary-size-efficient network.</p>\n<p>Our final network was inspired by the latest Stockfish's network. To save the size, we replaced the feature transformer by concatting the output of the following 2 networks. The first is a CNN with input channel 12 (=number of pieces), output channel 13, kernel size 15x15, and padding 7, so that the CNN could produce features for each square. The second is a dense network with 64 outputs, but it shares the same weight for neighbor positions. A normal dense network would have 768 inputs, but ours has only 96 inputs.</p>\n<p>However, one thing that we missed was that the computation cost was very heavy; the equivalent L1 size was 896, too large to compensate the accuracy loss caused by the shared weights in the CNN.</p>\n<p>As for the training dataset, we used a mix of leela-generated data and stockfish-generated data, though we didn't see much difference when changing the dataset.</p>\n<h1>Other changes</h1>\n<ul>\n<li>Transposition table : 512 KiB</li>\n<li>Use hash table for continuation History : 128 KiB</li>\n<li>Compile nnue.c with -O3, and others with -Os</li>\n<li>Delete features that were unused, or did not hurt the performance too much</li>\n</ul>\n<h1>Final remarks</h1>\n<p>We were happy to be able to participate in this competition.<br>\nI personally knew little about chess programming before entering this competition, but I learned a lot from the competition that I could not have learned from other places.</p>\n<p>Congratulations for the top 3 teams. You chess engine developers totally deserve it.</p>\n<p>Many thanks to the organizers and the participants. Thank you <a href=\"https://www.kaggle.com/bovard\" target=\"_blank\">@bovard</a>, <a href=\"https://www.kaggle.com/competitions/llm-20-questions/discussion/531387\" target=\"_blank\">for taking action when it was necessary and only when absolutely necessary</a>. And special thanks for those who worked hard debugging the environment.</p>",
      "rawMarkdown": "We first went with Stockfish 4, then Stockfish 16, then finally Cfish due to RAM constraint.\n\nOur code is [here](https://github.com/chettub/Niboshi).\n\n# NNUE\n\nWe disabled HCE and relied our evaluation totally on NNUE.\n\nWe assumed that the accuracy of the evaluation function was essential, and therefore searched for a binary-size-efficient network.\n\nOur final network was inspired by the latest Stockfish's network. To save the size, we replaced the feature transformer by concatting the output of the following 2 networks. The first is a CNN with input channel 12 (=number of pieces), output channel 13, kernel size 15x15, and padding 7, so that the CNN could produce features for each square. The second is a dense network with 64 outputs, but it shares the same weight for neighbor positions. A normal dense network would have 768 inputs, but ours has only 96 inputs.\n\nHowever, one thing that we missed was that the computation cost was very heavy; the equivalent L1 size was 896, too large to compensate the accuracy loss caused by the shared weights in the CNN.\n\nAs for the training dataset, we used a mix of leela-generated data and stockfish-generated data, though we didn't see much difference when changing the dataset.\n\n# Other changes\n\n- Transposition table : 512 KiB\n- Use hash table for continuation History : 128 KiB\n- Compile nnue.c with -O3, and others with -Os\n- Delete features that were unused, or did not hurt the performance too much\n\n# Final remarks\n\nWe were happy to be able to participate in this competition.\nI personally knew little about chess programming before entering this competition, but I learned a lot from the competition that I could not have learned from other places.\n\nCongratulations for the top 3 teams. You chess engine developers totally deserve it.\n\nMany thanks to the organizers and the participants. Thank you @bovard, [for taking action when it was necessary and only when absolutely necessary](https://www.kaggle.com/competitions/llm-20-questions/discussion/531387). And special thanks for those who worked hard debugging the environment.\n",
      "votes": 21
    },
    {
      "id": 3143268,
      "postDate": "2025-03-07T04:13:03.813Z",
      "content": "<p>How could you package into 64KiB? Even stockfish 4 also will exceed this.</p>",
      "rawMarkdown": "How could you package into 64KiB? Even stockfish 4 also will exceed this.",
      "replies": [
        {
          "id": 3143339,
          "postDate": "2025-03-07T05:59:19.170Z",
          "content": "<p>We deleted every feature that is not needed during submission, i.e. bench, trace etc., and also disabled some heavy components like endgame and opening book.</p>",
          "rawMarkdown": "We deleted every feature that is not needed during submission, i.e. bench, trace etc., and also disabled some heavy components like endgame and opening book."
        }
      ]
    }
  ],
  "complete": true,
  "source": "live",
  "fetched_at": "2026-10-20T08:25:54Z",
  "competition_id": 86524,
  "competition_slug": "fide-google-efficiency-chess-ai-challenge",
  "team_id": 12966139,
  "solution_url": "/competitions/fide-google-efficiency-chess-ai-challenge/writeups/niboshi-niboshi-s-solution"
}