{
  "id": 551420,
  "title": "Private 9th (Public 7th) Place Solution",
  "content": "<p>I must show my appreciation with respect to the eedi organization and kaggle team, for hosting such a stunning competition. This is my first participation of a kaggle competition, and I am very happy to take the gold medal.</p>\n<h3>Overview</h3>\n<ol>\n<li>Synthetic data generation (GPT-4o)</li>\n<li>Rationale generation (Qwen 2.5 32B Instruct AWQ with vllm)</li>\n<li>Retriever (Qwen 2.5 14B Instruct)</li>\n<li>Reranker (Qwen 2.5 14B Instruct and Qwen 2.5 32B Instruct with vllm)</li>\n</ol>\n<h3>Synthetic data generation</h3>\n<p>We generated SubjectName, ConstructName, QuestionText, Correct Answer, Incorrect Answer by providing misconceptions to GPT-4o.<br>\nNext, start filtering:</p>\n<ul>\n<li>For misconceptions in <code>train.csv</code>, we filtered generated data with base model (training Qwen 2.5 14B Instruct without synthetic data scored 0.447 on LB).</li>\n<li>For misconceptions not in <code>train.csv</code>, do nothing.</li>\n</ul>\n<h3>Rationale generation</h3>\n<p>Input the SubjectName, ConstructName, QuestionText, Correct Answer and Incorrect Answer into Qwen 2.5 32B Instruct AWQ to generate a briefly rationale (up to 50 words).<br>\nPrompt:</p>\n<pre><code>Prompt = \n</code></pre>\n<h3>Retriever</h3>\n<p>Following <a href=\"https://www.kaggle.com/sayoulala\" target=\"_blank\">@sayoulala</a> and his discussion <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>.</p>\n<ul>\n<li>Upsample original trainset question once for training, where misconceptions occur less than 3.</li>\n<li>Training retriever by contrastive learning and using sfr for hard negative sample mining.</li>\n</ul>\n<h3>Reranker</h3>\n<ul>\n<li>Binary classification reranker (14B), predict whether incorrect answer and misconception are matched. (we didn't use it finally because of unefficiency)</li>\n<li>Causal LM reranker (32B), using lm head take yes token logits as ranking score.Once trained, AWQ quantization is performed.</li>\n</ul>\n<p>32B inference referer to <a href=\"https://www.kaggle.com/code/cdeotte/infer-34b-with-vllm\" target=\"_blank\">https://www.kaggle.com/code/cdeotte/infer-34b-with-vllm</a>.</p>\n<table>\n<thead>\n<tr>\n<th>Model</th>\n<th>Public LB</th>\n<th>Private LB</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Retriever</td>\n<td>0.547</td>\n<td>0.491</td>\n</tr>\n<tr>\n<td>Binary classification reranker</td>\n<td>0.606</td>\n<td>0.542</td>\n</tr>\n<tr>\n<td>Causal LM reranker</td>\n<td>0.641</td>\n<td>0.571</td>\n</tr>\n</tbody>\n</table>\n<p>btw, we started training Reranker only a week before the competition cut-off and not much time for attempt😭</p>",
  "comments": [
    {
      "id": 3070999,
      "author_name": "narsil (jobs-in-data.com)",
      "author_url": "",
      "post_date": "2024-12-13T08:13:48.823000",
      "content": "<p>Great work! Lots to learn here. Thanks for the write up</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 3070967,
      "author_name": "hinsay",
      "author_url": "",
      "post_date": "2024-12-13T07:37:02.163000",
      "content": "<p>Inference code<a href=\"https://www.kaggle.com/code/hinsay/kfold-recall-and-reranker\" target=\"_blank\">infer</a><br>\nTraining the retriever is referenced from<a href=\"https://github.com/BlackPearl-Lab/KddCup-2024-OAG-Challenge-1st-Solutions/blob/main/AQA/train/simcse_deepspeed_mistrial_qlora_argu.py\" target=\"_blank\">retriever</a><br>\nTraining the reranker is referenced from<a href=\"https://github.com/FlagOpen/FlagEmbedding/blob/master/FlagEmbedding/abc/finetune/reranker/AbsModeling.py\" target=\"_blank\">reranker</a></p>",
      "votes": 0,
      "replies": [
        {
          "id": 3070971,
          "author_name": "",
          "author_url": "",
          "post_date": "2024-12-13T07:42:12.207000",
          "content": "",
          "votes": 0,
          "replies": []
        },
        {
          "id": 3070984,
          "author_name": "",
          "author_url": "",
          "post_date": "2024-12-13T07:56:21.897000",
          "content": "",
          "votes": 0,
          "replies": []
        },
        {
          "id": 3070985,
          "author_name": "Okinawa",
          "author_url": "",
          "post_date": "2024-12-13T07:56:54.103000",
          "content": "<p>training and inference codes are available here</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 3070920,
      "author_name": "James owen",
      "author_url": "",
      "post_date": "2024-12-13T07:03:27.390000",
      "content": "<p>hi@zuoyouzuo, congratulations on your achievement. will you publish your complete code, I can't wait to learn your code. To be honest, I learned a lot from your public notebook, which is very useful for me as a new llm</p>",
      "votes": 0,
      "replies": [
        {
          "id": 3070959,
          "author_name": "Okinawa",
          "author_url": "",
          "post_date": "2024-12-13T07:29:30.373000",
          "content": "<p>Thanks <a href=\"https://www.kaggle.com/xuyilehhh\" target=\"_blank\">@xuyilehhh</a>, I'll make the inference code public soon.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 3070872,
      "author_name": "Nikhil Tumbde",
      "author_url": "",
      "post_date": "2024-12-13T06:00:58.723000",
      "content": "<p>Hi, thanks for the solution. Would you be sharing a detailed solution or inference code? I really wanted to understand how to properly use synthetic data. <br>\nI also have the following questions for you:<br>\nWhat do you mean by \"we filtered generated data with base model\" ? <br>\nI still couldn't understand how the generated data and rationales were used in modelling, can you please explain?</p>",
      "votes": 0,
      "replies": [
        {
          "id": 3070955,
          "author_name": "Okinawa",
          "author_url": "",
          "post_date": "2024-12-13T07:24:40.170000",
          "content": "<p>Base model means the model do not use synthetic data, training on single fold trainset scored 447 on LB.<br>\nI'll make the inference code public soon.</p>",
          "votes": 1,
          "replies": [
            {
              "id": 3071926,
              "author_name": "Nikhil Tumbde",
              "author_url": "",
              "post_date": "2024-12-14T14:23:14.490000",
              "content": "<p>Hi. Can you elaborate on the \"filtered\" part? I am unable to understand that. Really appreciate your response.</p>",
              "votes": 0,
              "replies": []
            },
            {
              "id": 3072061,
              "author_name": "Okinawa",
              "author_url": "",
              "post_date": "2024-12-14T16:31:52.373000",
              "content": "<p>Because the synthetic data generated by GPT4o is inaccurate, these data are filtered by the retriever with the highest score on LB. Specifically, we dropped the synthetic  data where their misconception not in recall top 5 or 10 from retriever.</p>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 3072335,
              "author_name": "Nikhil Tumbde",
              "author_url": "",
              "post_date": "2024-12-15T03:46:27.100000",
              "content": "<p>Understood. Thanks for the clarification 😊</p>",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 3070869,
      "author_name": "Nicholas Broad",
      "author_url": "",
      "post_date": "2024-12-13T05:55:07.443000",
      "content": "<p>Nice job! Can you share the private lb scores in the table for retriever, binary classification reranker, and CLM reranker?</p>",
      "votes": 0,
      "replies": [
        {
          "id": 3070969,
          "author_name": "Okinawa",
          "author_url": "",
          "post_date": "2024-12-13T07:40:48.190000",
          "content": "<p>Thanks <a href=\"https://www.kaggle.com/nbroad\" target=\"_blank\">@nbroad</a> , I've made my private score public.</p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 3070846,
      "author_name": "xbustc",
      "author_url": "",
      "post_date": "2024-12-13T05:18:03.683000",
      "content": "<p>Big con! I wonder whether you tried the cross entropy loss to train reranker just like flagemedding reranker? </p>",
      "votes": 0,
      "replies": [
        {
          "id": 3070851,
          "author_name": "Okinawa",
          "author_url": "",
          "post_date": "2024-12-13T05:28:57.333000",
          "content": "<p>yes, we modified code and llm prompt adapting for our solution</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 3070963,
      "author_name": "",
      "author_url": "",
      "post_date": "2024-12-13T07:32:09.940000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "comment_count": 17,
  "messages": [
    {
      "id": 3070822,
      "postDate": "2024-12-13T04:34:38.297Z",
      "content": "<p>I must show my appreciation with respect to the eedi organization and kaggle team, for hosting such a stunning competition. This is my first participation of a kaggle competition, and I am very happy to take the gold medal.</p>\n<h3>Overview</h3>\n<ol>\n<li>Synthetic data generation (GPT-4o)</li>\n<li>Rationale generation (Qwen 2.5 32B Instruct AWQ with vllm)</li>\n<li>Retriever (Qwen 2.5 14B Instruct)</li>\n<li>Reranker (Qwen 2.5 14B Instruct and Qwen 2.5 32B Instruct with vllm)</li>\n</ol>\n<h3>Synthetic data generation</h3>\n<p>We generated SubjectName, ConstructName, QuestionText, Correct Answer, Incorrect Answer by providing misconceptions to GPT-4o.<br>\nNext, start filtering:</p>\n<ul>\n<li>For misconceptions in <code>train.csv</code>, we filtered generated data with base model (training Qwen 2.5 14B Instruct without synthetic data scored 0.447 on LB).</li>\n<li>For misconceptions not in <code>train.csv</code>, do nothing.</li>\n</ul>\n<h3>Rationale generation</h3>\n<p>Input the SubjectName, ConstructName, QuestionText, Correct Answer and Incorrect Answer into Qwen 2.5 32B Instruct AWQ to generate a briefly rationale (up to 50 words).<br>\nPrompt:</p>\n<pre><code>Prompt = \n</code></pre>\n<h3>Retriever</h3>\n<p>Following <a href=\"https://www.kaggle.com/sayoulala\" target=\"_blank\">@sayoulala</a> and his discussion <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>.</p>\n<ul>\n<li>Upsample original trainset question once for training, where misconceptions occur less than 3.</li>\n<li>Training retriever by contrastive learning and using sfr for hard negative sample mining.</li>\n</ul>\n<h3>Reranker</h3>\n<ul>\n<li>Binary classification reranker (14B), predict whether incorrect answer and misconception are matched. (we didn't use it finally because of unefficiency)</li>\n<li>Causal LM reranker (32B), using lm head take yes token logits as ranking score.Once trained, AWQ quantization is performed.</li>\n</ul>\n<p>32B inference referer to <a href=\"https://www.kaggle.com/code/cdeotte/infer-34b-with-vllm\" target=\"_blank\">https://www.kaggle.com/code/cdeotte/infer-34b-with-vllm</a>.</p>\n<table>\n<thead>\n<tr>\n<th>Model</th>\n<th>Public LB</th>\n<th>Private LB</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Retriever</td>\n<td>0.547</td>\n<td>0.491</td>\n</tr>\n<tr>\n<td>Binary classification reranker</td>\n<td>0.606</td>\n<td>0.542</td>\n</tr>\n<tr>\n<td>Causal LM reranker</td>\n<td>0.641</td>\n<td>0.571</td>\n</tr>\n</tbody>\n</table>\n<p>btw, we started training Reranker only a week before the competition cut-off and not much time for attempt😭</p>",
      "rawMarkdown": "I must show my appreciation with respect to the eedi organization and kaggle team, for hosting such a stunning competition. This is my first participation of a kaggle competition, and I am very happy to take the gold medal.\n\n### Overview\n1. Synthetic data generation (GPT-4o)\n2. Rationale generation (Qwen 2.5 32B Instruct AWQ with vllm)\n3. Retriever (Qwen 2.5 14B Instruct)\n4. Reranker (Qwen 2.5 14B Instruct and Qwen 2.5 32B Instruct with vllm)\n\n### Synthetic data generation\nWe generated SubjectName, ConstructName, QuestionText, Correct Answer, Incorrect Answer by providing misconceptions to GPT-4o.\nNext, start filtering:\n- For misconceptions in `train.csv`, we filtered generated data with base model (training Qwen 2.5 14B Instruct without synthetic data scored 0.447 on LB).\n- For misconceptions not in `train.csv`, do nothing.\n\n### Rationale generation\nInput the SubjectName, ConstructName, QuestionText, Correct Answer and Incorrect Answer into Qwen 2.5 32B Instruct AWQ to generate a briefly rationale (up to 50 words).\nPrompt:\n```python\nPrompt = \"\"\"Here is a question about {ConstructName} ({SubjectName}).\nQuestion: {Question}\nCorrect Answer: {CorrectAnswer}\nIncorrect Answer: {IncorrectAnswer}\n\nGenerate a brief rationale for the Incorrect Answer in a sentences, within 50 tokens. Describe the reasoning process that might lead to this choice, including any logical errors or misconceptions.\n\nKeep the explanation concise and focused on the key points, and ensure it does not exceed 50 tokens\n***Important***\n1.There is no need to analyze the relationship between the wrong answer and the correct answer. Simply describe the rationale of the incorrect answer in a few words.\n2.There is no need to have fields such as \"Incorrect Answer:\" and \"Incorrect Answer is\". Just give the rationale directly.\n3.Output results in English.\n\"\"\"\n```\n\n### Retriever\nFollowing @sayoulala and his discussion https://www.kaggle.com/competitions/eedi-mining-misconceptions-in-mathematics/discussion/543519.\n- Upsample original trainset question once for training, where misconceptions occur less than 3.\n- Training retriever by contrastive learning and using sfr for hard negative sample mining.\n\n### Reranker\n- Binary classification reranker (14B), predict whether incorrect answer and misconception are matched. (we didn't use it finally because of unefficiency)\n- Causal LM reranker (32B), using lm head take yes token logits as ranking score.Once trained, AWQ quantization is performed.\n\n32B inference referer to https://www.kaggle.com/code/cdeotte/infer-34b-with-vllm.\n\n| Model | Public LB | Private LB |\n| --- | --- | --- |\n| Retriever | 0.547 | 0.491 |\n| Binary classification reranker | 0.606 | 0.542 |\n| Causal LM reranker | 0.641 | 0.571 |\n\n\nbtw, we started training Reranker only a week before the competition cut-off and not much time for attempt😭\n",
      "votes": 27
    },
    {
      "id": 3070999,
      "postDate": "2024-12-13T08:13:48.823Z",
      "content": "<p>Great work! Lots to learn here. Thanks for the write up</p>",
      "rawMarkdown": "Great work! Lots to learn here. Thanks for the write up"
    },
    {
      "id": 3070967,
      "postDate": "2024-12-13T07:37:02.163Z",
      "content": "<p>Inference code<a href=\"https://www.kaggle.com/code/hinsay/kfold-recall-and-reranker\" target=\"_blank\">infer</a><br>\nTraining the retriever is referenced from<a href=\"https://github.com/BlackPearl-Lab/KddCup-2024-OAG-Challenge-1st-Solutions/blob/main/AQA/train/simcse_deepspeed_mistrial_qlora_argu.py\" target=\"_blank\">retriever</a><br>\nTraining the reranker is referenced from<a href=\"https://github.com/FlagOpen/FlagEmbedding/blob/master/FlagEmbedding/abc/finetune/reranker/AbsModeling.py\" target=\"_blank\">reranker</a></p>",
      "rawMarkdown": "Inference code[infer](https://www.kaggle.com/code/hinsay/kfold-recall-and-reranker)\nTraining the retriever is referenced from[retriever](https://github.com/BlackPearl-Lab/KddCup-2024-OAG-Challenge-1st-Solutions/blob/main/AQA/train/simcse_deepspeed_mistrial_qlora_argu.py)\nTraining the reranker is referenced from[reranker](https://github.com/FlagOpen/FlagEmbedding/blob/master/FlagEmbedding/abc/finetune/reranker/AbsModeling.py)",
      "replies": [
        {
          "id": 3070971,
          "postDate": "2024-12-13T07:42:12.207Z",
          "rawMarkdown": "",
          "isDeleted": true
        },
        {
          "id": 3070984,
          "postDate": "2024-12-13T07:56:21.897Z",
          "rawMarkdown": "",
          "isDeleted": true
        },
        {
          "id": 3070985,
          "postDate": "2024-12-13T07:56:54.103Z",
          "content": "<p>training and inference codes are available here</p>",
          "rawMarkdown": "training and inference codes are available here"
        }
      ]
    },
    {
      "id": 3070920,
      "postDate": "2024-12-13T07:03:27.390Z",
      "content": "<p>hi@zuoyouzuo, congratulations on your achievement. will you publish your complete code, I can't wait to learn your code. To be honest, I learned a lot from your public notebook, which is very useful for me as a new llm</p>",
      "rawMarkdown": "hi@zuoyouzuo, congratulations on your achievement. will you publish your complete code, I can't wait to learn your code. To be honest, I learned a lot from your public notebook, which is very useful for me as a new llm",
      "replies": [
        {
          "id": 3070959,
          "postDate": "2024-12-13T07:29:30.373Z",
          "content": "<p>Thanks <a href=\"https://www.kaggle.com/xuyilehhh\" target=\"_blank\">@xuyilehhh</a>, I'll make the inference code public soon.</p>",
          "rawMarkdown": "Thanks @xuyilehhh, I'll make the inference code public soon."
        }
      ]
    },
    {
      "id": 3070872,
      "postDate": "2024-12-13T06:00:58.723Z",
      "content": "<p>Hi, thanks for the solution. Would you be sharing a detailed solution or inference code? I really wanted to understand how to properly use synthetic data. <br>\nI also have the following questions for you:<br>\nWhat do you mean by \"we filtered generated data with base model\" ? <br>\nI still couldn't understand how the generated data and rationales were used in modelling, can you please explain?</p>",
      "rawMarkdown": "Hi, thanks for the solution. Would you be sharing a detailed solution or inference code? I really wanted to understand how to properly use synthetic data. \nI also have the following questions for you:\nWhat do you mean by \"we filtered generated data with base model\" ? \nI still couldn't understand how the generated data and rationales were used in modelling, can you please explain?\n",
      "replies": [
        {
          "id": 3070955,
          "postDate": "2024-12-13T07:24:40.170Z",
          "content": "<p>Base model means the model do not use synthetic data, training on single fold trainset scored 447 on LB.<br>\nI'll make the inference code public soon.</p>",
          "rawMarkdown": "Base model means the model do not use synthetic data, training on single fold trainset scored 447 on LB.\nI'll make the inference code public soon.",
          "votes": 1,
          "replies": [
            {
              "id": 3071926,
              "postDate": "2024-12-14T14:23:14.490Z",
              "content": "<p>Hi. Can you elaborate on the \"filtered\" part? I am unable to understand that. Really appreciate your response.</p>",
              "rawMarkdown": "Hi. Can you elaborate on the \"filtered\" part? I am unable to understand that. Really appreciate your response."
            },
            {
              "id": 3072061,
              "postDate": "2024-12-14T16:31:52.373Z",
              "content": "<p>Because the synthetic data generated by GPT4o is inaccurate, these data are filtered by the retriever with the highest score on LB. Specifically, we dropped the synthetic  data where their misconception not in recall top 5 or 10 from retriever.</p>",
              "rawMarkdown": "Because the synthetic data generated by GPT4o is inaccurate, these data are filtered by the retriever with the highest score on LB. Specifically, we dropped the synthetic  data where their misconception not in recall top 5 or 10 from retriever.",
              "votes": 1
            },
            {
              "id": 3072335,
              "postDate": "2024-12-15T03:46:27.100Z",
              "content": "<p>Understood. Thanks for the clarification 😊</p>",
              "rawMarkdown": "Understood. Thanks for the clarification 😊"
            }
          ]
        }
      ]
    },
    {
      "id": 3070869,
      "postDate": "2024-12-13T05:55:07.443Z",
      "content": "<p>Nice job! Can you share the private lb scores in the table for retriever, binary classification reranker, and CLM reranker?</p>",
      "rawMarkdown": "Nice job! Can you share the private lb scores in the table for retriever, binary classification reranker, and CLM reranker?",
      "replies": [
        {
          "id": 3070969,
          "postDate": "2024-12-13T07:40:48.190Z",
          "content": "<p>Thanks <a href=\"https://www.kaggle.com/nbroad\" target=\"_blank\">@nbroad</a> , I've made my private score public.</p>",
          "rawMarkdown": "Thanks @nbroad , I've made my private score public.",
          "votes": 1
        }
      ]
    },
    {
      "id": 3070846,
      "postDate": "2024-12-13T05:18:03.683Z",
      "content": "<p>Big con! I wonder whether you tried the cross entropy loss to train reranker just like flagemedding reranker? </p>",
      "rawMarkdown": "Big con! I wonder whether you tried the cross entropy loss to train reranker just like flagemedding reranker? ",
      "replies": [
        {
          "id": 3070851,
          "postDate": "2024-12-13T05:28:57.333Z",
          "content": "<p>yes, we modified code and llm prompt adapting for our solution</p>",
          "rawMarkdown": "yes, we modified code and llm prompt adapting for our solution"
        }
      ]
    },
    {
      "id": 3070963,
      "postDate": "2024-12-13T07:32:09.940Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "complete": true,
  "source": "live",
  "fetched_at": "2026-10-20T03:47:37Z",
  "competition_id": 82695,
  "competition_slug": "eedi-mining-misconceptions-in-mathematics",
  "team_id": 12674927,
  "solution_url": "/competitions/eedi-mining-misconceptions-in-mathematics/writeups/study-hard-private-9th-public-7th-place-solution"
}