{
  "id": 553317,
  "title": "31st place solution",
  "content": "<p>Hopefully it's not too late to post my solution🙃</p>\n<p>I am so excited that I got my first silver medal. <br>\nSince last year, I have started participating in kaggle competitions in my spare time of work. As a beginner, sometimes I feel it really hard to construct a runnable pipeline for submission, but thanks to the kaggle community users for their selfless sharing, I learned a lot of tricks and techniques, and many useful insights to solve the given task.  Also, I would like to thank Kaggle and EEDI for hosting such an interesting competition. </p>\n<h1>Solution</h1>\n<p>Like many other players, my solution is a 2-stage approach:</p>\n<h2>Retrieve</h2>\n<p>The retriever is a Qwen-14b-awq from <a href=\"https://www.kaggle.com/code/anhvth226/eedi-11-21-14b\" target=\"_blank\">https://www.kaggle.com/code/anhvth226/eedi-11-21-14b</a>. For each query, select the top 25 likely misconceptions.</p>\n<h2>Rerank</h2>\n<p>Given a question, a correct answer, a wrong answer and a list of possible misconceptions (9 candidates each query) from the previous stage, let Qwen2.5-32b-awq predict the most likely misconception index. <br>\nPlease refer to the hot public notebook <a href=\"https://www.kaggle.com/code/jagatkiran/qwen14b-retrieval-qwen32b-logits-processor-zoo\" target=\"_blank\">https://www.kaggle.com/code/jagatkiran/qwen14b-retrieval-qwen32b-logits-processor-zoo</a>. <br>\nAnd my infer notebook: <a href=\"https://www.kaggle.com/code/doublezeta/notebook0d961c3b94\" target=\"_blank\">https://www.kaggle.com/code/doublezeta/notebook0d961c3b94</a></p>\n<h1>What's new in my solution</h1>\n<h2>Lora</h2>\n<p>I finetuned (lora) a Qwen2.5-32b-awq reranker via trl.SFTTrainer. Here are my hyper parameters</p>\n<pre><code>peft_config = LoraConfig(\n    =,\n    =,\n    =64,\n    =16,\n    =0.05,\n    target_modules=[, , , , , , ],\n    =\n)\ntraining_args = SFTConfig(\n    =,\n    =tokenizer.model_max_length,\n    =1e-4,\n    =4,\n    =1,\n    =0.001,\n    =3,\n    =,\n    =,\n    =,\n    =0.03,\n)\n</code></pre>\n<p>My demo training notebook: <a href=\"https://www.kaggle.com/code/doublezeta/train-reranker\" target=\"_blank\">https://www.kaggle.com/code/doublezeta/train-reranker</a> Actually I did the training in Colab.</p>\n<p>I construct my SFT training dataset by</p>\n<ol>\n<li>run the retrieval (stage-1) on the competition train dataset, obtaining 25 candidates misconceptions for each question-option pair.</li>\n<li>From the original 25 candidates, 8 wrong misconceptions are selected and, together with the correct misconception, form a sample with 9 candidates. The label is the index of the correct misconception. Since there are 25 candidates, I can generate 3 samples for each question-option pair.</li>\n</ol>\n<h2>Train Data Augmentation</h2>\n<p>The competition overview mentions \"The goal is to create a model that not only aligns with known misconceptions but also generalizes to new, emerging misconceptions\". <br>\nThere are ~900 misconceptions not appeared in the train set. I suppose the private LB would focus more on the unseen misconceptions.<br>\nTherefore I slightly adjust my strategy for constructing the SFT training set. Among the 8 wrong candidates of each sample, 4 are from the retrieval result, and 4 are from the 900 unseen misconceptions. <br>\nI believe increasing the ratio of the unseen misconceptions can help the LLM enhance the ability of reasoning upon these misconceptions.</p>\n<p>It indeed brought me sort of improvement on the private board.</p>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>Public Score</th>\n<th>Private Score</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>with Augmentation</td>\n<td>0.539</td>\n<td>0.531</td>\n</tr>\n<tr>\n<td>without Augmentation</td>\n<td>0.554</td>\n<td>0.514</td>\n</tr>\n</tbody>\n</table>\n<p>Notebook to build SFT training set : <a href=\"https://www.kaggle.com/code/doublezeta/train-data-sft\" target=\"_blank\">https://www.kaggle.com/code/doublezeta/train-data-sft</a></p>\n<p>I found similar insight in the 3rd place solution: <a href=\"https://www.kaggle.com/competitions/eedi-mining-misconceptions-in-mathematics/discussion/551498\" target=\"_blank\">https://www.kaggle.com/competitions/eedi-mining-misconceptions-in-mathematics/discussion/551498</a>, maybe I should push it further🥂</p>\n<h1>Tried but not worked</h1>\n<p>I noticed that the reranker just select the most likely misconception without changing the order of the rest candidates. <br>\nInspired by <br>\n<a href=\"https://www.kaggle.com/competitions/eedi-mining-misconceptions-in-mathematics/discussion/543519\" target=\"_blank\">https://www.kaggle.com/competitions/eedi-mining-misconceptions-in-mathematics/discussion/543519</a> <br>\n<a href=\"https://openreview.net/pdf?id=vhLAb1dpIw\" target=\"_blank\">https://openreview.net/pdf?id=vhLAb1dpIw</a>, <br>\nI used LLM as a pointwise scorer by getting the <strong>Yes</strong> token's logprob.  <br>\nI finetuned (lora) a Qwen2.5-32b-awq. During inference, I prompt it to predict \"Yes\" or \"No\" for given a question, a correct answer, an incorrect answer, and a possible misconception.<br>\nBut the Public LB is poor (0.3+), I guess it's because</p>\n<ul>\n<li>I did not correctly finetune the model. I forgot to train on completions only.</li>\n<li>Unlike Pointwise inference, Listwise inference allows the LLM to compare between different candidates.</li>\n</ul>\n<h1>Some experience</h1>\n<ul>\n<li>Speed up vLLM inference by setting <code>enable_prefix_caching=True</code></li>\n<li>Correctly manage your python environment<br>\nAs a beginner, I spent quite a lot of time on figuring out the dependencies among different packages (transformers, torch, vllm …). <br>\nFor example, I was struggling on running vLLM with LoraRank &gt;= 64 on T4 GPU until I found such links<br>\n<a href=\"https://github.com/vllm-project/vllm/issues/5199\" target=\"_blank\">https://github.com/vllm-project/vllm/issues/5199</a><br>\n<a href=\"https://github.com/vllm-project/vllm/issues/3934\" target=\"_blank\">https://github.com/vllm-project/vllm/issues/3934</a><br>\nFor convenience I fixed the dependencies I need in a notebook: <a href=\"https://www.kaggle.com/code/doublezeta/eedi-dependencies\" target=\"_blank\">https://www.kaggle.com/code/doublezeta/eedi-dependencies</a></li>\n</ul>",
  "comments": [
    {
      "id": 3081842,
      "author_name": "MrSimple",
      "author_url": "",
      "post_date": "2024-12-27T09:29:02.313000",
      "content": "<p>Great job!I</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 3081797,
      "author_name": "marble",
      "author_url": "",
      "post_date": "2024-12-27T08:01:29.027000",
      "content": "<p>Great job!I wonder what gpu do you use for trainning the rerank model.</p>",
      "votes": 0,
      "replies": [
        {
          "id": 3081808,
          "author_name": "Double Zeta",
          "author_url": "",
          "post_date": "2024-12-27T08:44:05.590000",
          "content": "<p>~7 hours on A100 </p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "comment_count": 3,
  "messages": [
    {
      "id": 3080447,
      "postDate": "2024-12-25T07:47:02.377Z",
      "content": "<p>Hopefully it's not too late to post my solution🙃</p>\n<p>I am so excited that I got my first silver medal. <br>\nSince last year, I have started participating in kaggle competitions in my spare time of work. As a beginner, sometimes I feel it really hard to construct a runnable pipeline for submission, but thanks to the kaggle community users for their selfless sharing, I learned a lot of tricks and techniques, and many useful insights to solve the given task.  Also, I would like to thank Kaggle and EEDI for hosting such an interesting competition. </p>\n<h1>Solution</h1>\n<p>Like many other players, my solution is a 2-stage approach:</p>\n<h2>Retrieve</h2>\n<p>The retriever is a Qwen-14b-awq from <a href=\"https://www.kaggle.com/code/anhvth226/eedi-11-21-14b\" target=\"_blank\">https://www.kaggle.com/code/anhvth226/eedi-11-21-14b</a>. For each query, select the top 25 likely misconceptions.</p>\n<h2>Rerank</h2>\n<p>Given a question, a correct answer, a wrong answer and a list of possible misconceptions (9 candidates each query) from the previous stage, let Qwen2.5-32b-awq predict the most likely misconception index. <br>\nPlease refer to the hot public notebook <a href=\"https://www.kaggle.com/code/jagatkiran/qwen14b-retrieval-qwen32b-logits-processor-zoo\" target=\"_blank\">https://www.kaggle.com/code/jagatkiran/qwen14b-retrieval-qwen32b-logits-processor-zoo</a>. <br>\nAnd my infer notebook: <a href=\"https://www.kaggle.com/code/doublezeta/notebook0d961c3b94\" target=\"_blank\">https://www.kaggle.com/code/doublezeta/notebook0d961c3b94</a></p>\n<h1>What's new in my solution</h1>\n<h2>Lora</h2>\n<p>I finetuned (lora) a Qwen2.5-32b-awq reranker via trl.SFTTrainer. Here are my hyper parameters</p>\n<pre><code>peft_config = LoraConfig(\n    =,\n    =,\n    =64,\n    =16,\n    =0.05,\n    target_modules=[, , , , , , ],\n    =\n)\ntraining_args = SFTConfig(\n    =,\n    =tokenizer.model_max_length,\n    =1e-4,\n    =4,\n    =1,\n    =0.001,\n    =3,\n    =,\n    =,\n    =,\n    =0.03,\n)\n</code></pre>\n<p>My demo training notebook: <a href=\"https://www.kaggle.com/code/doublezeta/train-reranker\" target=\"_blank\">https://www.kaggle.com/code/doublezeta/train-reranker</a> Actually I did the training in Colab.</p>\n<p>I construct my SFT training dataset by</p>\n<ol>\n<li>run the retrieval (stage-1) on the competition train dataset, obtaining 25 candidates misconceptions for each question-option pair.</li>\n<li>From the original 25 candidates, 8 wrong misconceptions are selected and, together with the correct misconception, form a sample with 9 candidates. The label is the index of the correct misconception. Since there are 25 candidates, I can generate 3 samples for each question-option pair.</li>\n</ol>\n<h2>Train Data Augmentation</h2>\n<p>The competition overview mentions \"The goal is to create a model that not only aligns with known misconceptions but also generalizes to new, emerging misconceptions\". <br>\nThere are ~900 misconceptions not appeared in the train set. I suppose the private LB would focus more on the unseen misconceptions.<br>\nTherefore I slightly adjust my strategy for constructing the SFT training set. Among the 8 wrong candidates of each sample, 4 are from the retrieval result, and 4 are from the 900 unseen misconceptions. <br>\nI believe increasing the ratio of the unseen misconceptions can help the LLM enhance the ability of reasoning upon these misconceptions.</p>\n<p>It indeed brought me sort of improvement on the private board.</p>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>Public Score</th>\n<th>Private Score</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>with Augmentation</td>\n<td>0.539</td>\n<td>0.531</td>\n</tr>\n<tr>\n<td>without Augmentation</td>\n<td>0.554</td>\n<td>0.514</td>\n</tr>\n</tbody>\n</table>\n<p>Notebook to build SFT training set : <a href=\"https://www.kaggle.com/code/doublezeta/train-data-sft\" target=\"_blank\">https://www.kaggle.com/code/doublezeta/train-data-sft</a></p>\n<p>I found similar insight in the 3rd place solution: <a href=\"https://www.kaggle.com/competitions/eedi-mining-misconceptions-in-mathematics/discussion/551498\" target=\"_blank\">https://www.kaggle.com/competitions/eedi-mining-misconceptions-in-mathematics/discussion/551498</a>, maybe I should push it further🥂</p>\n<h1>Tried but not worked</h1>\n<p>I noticed that the reranker just select the most likely misconception without changing the order of the rest candidates. <br>\nInspired by <br>\n<a href=\"https://www.kaggle.com/competitions/eedi-mining-misconceptions-in-mathematics/discussion/543519\" target=\"_blank\">https://www.kaggle.com/competitions/eedi-mining-misconceptions-in-mathematics/discussion/543519</a> <br>\n<a href=\"https://openreview.net/pdf?id=vhLAb1dpIw\" target=\"_blank\">https://openreview.net/pdf?id=vhLAb1dpIw</a>, <br>\nI used LLM as a pointwise scorer by getting the <strong>Yes</strong> token's logprob.  <br>\nI finetuned (lora) a Qwen2.5-32b-awq. During inference, I prompt it to predict \"Yes\" or \"No\" for given a question, a correct answer, an incorrect answer, and a possible misconception.<br>\nBut the Public LB is poor (0.3+), I guess it's because</p>\n<ul>\n<li>I did not correctly finetune the model. I forgot to train on completions only.</li>\n<li>Unlike Pointwise inference, Listwise inference allows the LLM to compare between different candidates.</li>\n</ul>\n<h1>Some experience</h1>\n<ul>\n<li>Speed up vLLM inference by setting <code>enable_prefix_caching=True</code></li>\n<li>Correctly manage your python environment<br>\nAs a beginner, I spent quite a lot of time on figuring out the dependencies among different packages (transformers, torch, vllm …). <br>\nFor example, I was struggling on running vLLM with LoraRank &gt;= 64 on T4 GPU until I found such links<br>\n<a href=\"https://github.com/vllm-project/vllm/issues/5199\" target=\"_blank\">https://github.com/vllm-project/vllm/issues/5199</a><br>\n<a href=\"https://github.com/vllm-project/vllm/issues/3934\" target=\"_blank\">https://github.com/vllm-project/vllm/issues/3934</a><br>\nFor convenience I fixed the dependencies I need in a notebook: <a href=\"https://www.kaggle.com/code/doublezeta/eedi-dependencies\" target=\"_blank\">https://www.kaggle.com/code/doublezeta/eedi-dependencies</a></li>\n</ul>",
      "rawMarkdown": "Hopefully it's not too late to post my solution🙃\n\nI am so excited that I got my first silver medal. \nSince last year, I have started participating in kaggle competitions in my spare time of work. As a beginner, sometimes I feel it really hard to construct a runnable pipeline for submission, but thanks to the kaggle community users for their selfless sharing, I learned a lot of tricks and techniques, and many useful insights to solve the given task.  Also, I would like to thank Kaggle and EEDI for hosting such an interesting competition. \n# Solution\nLike many other players, my solution is a 2-stage approach:\n## Retrieve\nThe retriever is a Qwen-14b-awq from [https://www.kaggle.com/code/anhvth226/eedi-11-21-14b](https://www.kaggle.com/code/anhvth226/eedi-11-21-14b). For each query, select the top 25 likely misconceptions.\n## Rerank\nGiven a question, a correct answer, a wrong answer and a list of possible misconceptions (9 candidates each query) from the previous stage, let Qwen2.5-32b-awq predict the most likely misconception index. \nPlease refer to the hot public notebook [https://www.kaggle.com/code/jagatkiran/qwen14b-retrieval-qwen32b-logits-processor-zoo](https://www.kaggle.com/code/jagatkiran/qwen14b-retrieval-qwen32b-logits-processor-zoo). \nAnd my infer notebook: [https://www.kaggle.com/code/doublezeta/notebook0d961c3b94](https://www.kaggle.com/code/doublezeta/notebook0d961c3b94)\n# What's new in my solution\n## Lora\nI finetuned (lora) a Qwen2.5-32b-awq reranker via trl.SFTTrainer. Here are my hyper parameters\n```\npeft_config = LoraConfig(\n    task_type=\"CAUSAL_LM\",\n    inference_mode=False,\n    r=64,\n    lora_alpha=16,\n    lora_dropout=0.05,\n    target_modules=[\"q_proj\", \"k_proj\", \"v_proj\", \"o_proj\", \"gate_proj\", \"up_proj\", \"down_proj\"],\n    bias=\"none\"\n)\ntraining_args = SFTConfig(\n    packing=False,\n    max_seq_length=tokenizer.model_max_length,\n    learning_rate=1e-4,\n    per_device_train_batch_size=4,\n    num_train_epochs=1,\n    weight_decay=0.001,\n    gradient_accumulation_steps=3,\n    gradient_checkpointing=True,\n    fp16=True,\n    lr_scheduler_type='cosine',\n    warmup_ratio=0.03,\n)\n```\n\nMy demo training notebook: [https://www.kaggle.com/code/doublezeta/train-reranker](https://www.kaggle.com/code/doublezeta/train-reranker) Actually I did the training in Colab.\n\nI construct my SFT training dataset by\n1. run the retrieval (stage-1) on the competition train dataset, obtaining 25 candidates misconceptions for each question-option pair.\n2. From the original 25 candidates, 8 wrong misconceptions are selected and, together with the correct misconception, form a sample with 9 candidates. The label is the index of the correct misconception. Since there are 25 candidates, I can generate 3 samples for each question-option pair.\n\n## Train Data Augmentation\nThe competition overview mentions \"The goal is to create a model that not only aligns with known misconceptions but also generalizes to new, emerging misconceptions\". \nThere are ~900 misconceptions not appeared in the train set. I suppose the private LB would focus more on the unseen misconceptions.\nTherefore I slightly adjust my strategy for constructing the SFT training set. Among the 8 wrong candidates of each sample, 4 are from the retrieval result, and 4 are from the 900 unseen misconceptions. \nI believe increasing the ratio of the unseen misconceptions can help the LLM enhance the ability of reasoning upon these misconceptions.\n\nIt indeed brought me sort of improvement on the private board.\n|  | Public Score | Private Score |\n| --- | --- | --- |\n| with Augmentation | 0.539 | 0.531 |\n| without Augmentation | 0.554 | 0.514 |\n\nNotebook to build SFT training set : [https://www.kaggle.com/code/doublezeta/train-data-sft](https://www.kaggle.com/code/doublezeta/train-data-sft)\n\nI found similar insight in the 3rd place solution: [https://www.kaggle.com/competitions/eedi-mining-misconceptions-in-mathematics/discussion/551498](https://www.kaggle.com/competitions/eedi-mining-misconceptions-in-mathematics/discussion/551498), maybe I should push it further🥂\n\n# Tried but not worked\nI noticed that the reranker just select the most likely misconception without changing the order of the rest candidates. \nInspired by \n[https://www.kaggle.com/competitions/eedi-mining-misconceptions-in-mathematics/discussion/543519](https://www.kaggle.com/competitions/eedi-mining-misconceptions-in-mathematics/discussion/543519) \n[https://openreview.net/pdf?id=vhLAb1dpIw](https://openreview.net/pdf?id=vhLAb1dpIw), \nI used LLM as a pointwise scorer by getting the **Yes** token's logprob.  \nI finetuned (lora) a Qwen2.5-32b-awq. During inference, I prompt it to predict \"Yes\" or \"No\" for given a question, a correct answer, an incorrect answer, and a possible misconception.\nBut the Public LB is poor (0.3+), I guess it's because\n- I did not correctly finetune the model. I forgot to train on completions only.\n- Unlike Pointwise inference, Listwise inference allows the LLM to compare between different candidates.\n\n# Some experience\n- Speed up vLLM inference by setting `enable_prefix_caching=True`\n- Correctly manage your python environment\nAs a beginner, I spent quite a lot of time on figuring out the dependencies among different packages (transformers, torch, vllm ...). \nFor example, I was struggling on running vLLM with LoraRank >= 64 on T4 GPU until I found such links\n[https://github.com/vllm-project/vllm/issues/5199](https://github.com/vllm-project/vllm/issues/5199)\n[https://github.com/vllm-project/vllm/issues/3934](https://github.com/vllm-project/vllm/issues/3934)\nFor convenience I fixed the dependencies I need in a notebook: [https://www.kaggle.com/code/doublezeta/eedi-dependencies](https://www.kaggle.com/code/doublezeta/eedi-dependencies)\n\n",
      "votes": 6
    },
    {
      "id": 3081842,
      "postDate": "2024-12-27T09:29:02.313Z",
      "content": "<p>Great job!I</p>",
      "rawMarkdown": "Great job!I"
    },
    {
      "id": 3081797,
      "postDate": "2024-12-27T08:01:29.027Z",
      "content": "<p>Great job!I wonder what gpu do you use for trainning the rerank model.</p>",
      "rawMarkdown": "Great job!I wonder what gpu do you use for trainning the rerank model.",
      "replies": [
        {
          "id": 3081808,
          "postDate": "2024-12-27T08:44:05.590Z",
          "content": "<p>~7 hours on A100 </p>",
          "rawMarkdown": "~7 hours on A100 "
        }
      ]
    }
  ],
  "complete": true,
  "source": "live",
  "fetched_at": "2026-10-20T03:44:59Z",
  "competition_id": 82695,
  "competition_slug": "eedi-mining-misconceptions-in-mathematics",
  "team_id": 12635200,
  "solution_url": "/competitions/eedi-mining-misconceptions-in-mathematics/writeups/double-zeta-31st-place-solution"
}