632. Eedi - Mining Misconceptions in Mathematics | eedi-mining-misconceptions-in-mathematics
祝贺所有获奖者!感谢主办方举办如此有趣的竞赛。我们非常享受这段旅程,并从所有参赛者那里获得了很多灵感!我很幸运能成为这样一个富有成效的团队的一员,并想感谢我所有的团队成员。在这里我们分享我们的解决方案。
我们发现了一个有用的 subject_metadata.csv 文件,其中的 SubjectId 和 SubjectName 与过去在 NeurlPS 2022 上举办的 EEDI 竞赛相同。subject_metadata.csv 包含父主题信息,因此我们利用此元数据构建了一个向量数据库,以便为 train.csv 和 test.csv 添加父主题信息。
我们生成了 3 次合成数据,分别称为 generation1、generation2、generation3。
基本方法如下:
每一代之间的区别如下:
Generation1:
Generation2:
Generation3:
误解通常只包含一个简短的句子。为了使误解的嵌入更有意义,我们使用 LLM 为每个误解生成解释。由于我们在提交时不需要运行误解推理,因此这种方法在提交时没有任何成本。
提示词如下。llama3.1-70b-Instruct 和 qwen2.5-72b-Instruct 的解释在训练检索器方面优于 gpt-4o-mini。
system_prompt_template = 'You are an excellent math teacher about to teach students of year group 1 to 14. The subject of your lesson includes Number, Algebra, Data and Statistics, Geometry and Measure. You will be provided a misconception that your students may have. Please explain the misconception in detail and provide some short cases when the misconception will occur. No need to provide the correct approach. The explanation should be in format of "Explanation: {explanation}"'
user_prompt_template = 'Misconception: {misconception}'
我们使用 qwen2.5-32B-Instruct-AWQ 生成思维链 (CoT),作为后续检索和重排序的额外输入。提示词如下:
system_prompt_template = "You are an excellent math teacher about to teach students of year group 1 to 14. The detail of your lesson is as follows. Subject:{first_subject}, Topic: {second_subject}, Subtopic {third_subject}. Your students have made a mistake in the following question. Please explain the mistake step by step briefly and describe the misunderstanding behind the wrong answer at conceptual level. No need to provide the correct way to achieve the answer."
user_prompt_template = "Question: {question_text}\nCorrect Answer: {correct_text}\nWrong Answer of your students: {answer_text}\n\nExplanation: \nMisunderstanding: "
我们使用两种不同的流程训练了检索器。
流程 1 (Pipeline1):
流程 2 (Pipeline2):
单个模型的性能如下:
| 检索器 (retriever) | 合成数据 | 私有榜 (Private LB) | 公有榜 (Public LB) | 推理时间 |
|---|---|---|---|---|
| Linq-AI-Research/Linq-Embed-Mistral | Generation123 | 0.461 | 0.484 | 50 分钟 |
| Qwen/Qwen2.5-14B | Generation12 | 0.479 | 0.507 | 45 分钟 |
| Qwen/Qwen2.5-14B | Generation123 | 0.485 | 0.492 | 45 分钟 |
| Qwen/Qwen2.5-32B | Generation123 | 0.495 | 0.536 | 140 分钟 |
| Qwen/QwQ-32B-Preview | Generation123 | 0.500 | 0.531 | 140 分钟 |
我们最好的提交使用了 Mistral 和 2 个 qwen2.5-14B 的集成,以便为 72B 重排序留出足够的时间,私有榜和公有榜得分为 0.513 和 0.530。
我们使用列表式 (listwise) 重排序器来优化检索候选项的排名。我们的重排序过程采用了滑动窗口方法:首先,我们使用轻量级 LLM 对排名第 8 到第 17 位的候选项进行重新排序。然后,我们利用更大的模型来确定前 10 名候选项的最终排名。
用于重排序的 LLM 是在合成数据和训练数据的组合上进行微调的。
我们基于 atmacup17 的第一名解决方案开发了用于 LLM 重排序器的 QLoRA 训练代码。特别感谢 @kcotton21 分享如此优秀的解决方案。
以下是一些在重排序模型训练期间证明有效的技巧:
dunzhang/stella_en_400M_v5 模型和 TF-IDF 的混合检索器。22,000 个正样本中的每一个都有使用此设置挖掘出的相应负样本。
Qwen2.5-14B: H100 上约 2 小时
Qwen2.5-72B: H100 上约 8 小时
我们使用 intel/auto-round 库对 LLM 重排序器进行量化。与 AutoGPTQ 和 AutoAWQ 相比,该库更易于使用,并且造成的精度损失最小(通常小于 2%)。此外,它可以生成与 vLLM 兼容的模型。
qwen2.5-72b-Instruct 由于其 intermediate_size(29568) 在 multi GPU 上运行存在一些问题。遵循 gptq 文档 中提供的解决方法,我们将权重填充到 29696,然后执行量化。
对于校准,我们使用了训练数据集。以下是量化参数:
bits, group_size, sym = 4, 128, True
autoround = AutoRound(
model, tokenizer, bits=bits, group_size=group_size, sym=sym, dataset=calib_prompts, seqlen=256,
nsamples=512,
iters=500,
)
我们使用 vLLM 进行推理。
通过将 enabling_prefix_cache 设置为 True,我们能够节省大约 10% 的推理时间。
jagatkiran 分享了关于使用 72B LLM 模型进行推理的见解。在这次竞赛中,较大的模型往往表现更好,这对我们非常有帮助。
我们使用 logits_processors 和 logprobs 实现了重排序器,通过为特定 token 分配 +100 的权重。这种方法帮助我们建立了排名器的框架。我们也尝试直接使用分类头,但结果并不令人满意,而且使用 vLLM 进行推理也不容易。我们相信这种方法可能会成为未来竞赛的范例。
| 基线 (检索器) | Qwen14B | Qwen72B | Llama70B | 8-17 名 Qwen14B | 私有榜 | 公有榜 |
|---|---|---|---|---|---|---|
| ✅ | 0.513 | 0.530 | ||||
| ✅ | ✅ | 0.568 | 0.583 | |||
| ✅ | ✅ | 0.593 | 0.582 | |||
| ✅ | ✅ | ✅ | ✅ | 0.596 | 0.609 | |
| ✅ | ✅ | ✅ | ✅ | ✅ | 0.604 | 0.622 |
在最后一天,我们尝试微调 Nexusflow/Athene-V2-Chat 来代替 Llama70B。不幸的是,由于 GPU 和超时问题,带有该模型的提交超时了,但它在排行榜上显示了令人印象深刻的性能:0.609。
训练代码:https://github.com/wangqihanginthesky/Eedi_kaggle
推理代码:https://www.kaggle.com/code/honglihang/2nd-place-inference-code