674. Jigsaw - Agile Community Rules Classification | jigsaw-agile-community-rules
首先,我们感谢主办团队举办这次比赛。这是一个学习实用 LLM 微调的绝佳机会。我们也感谢我们的队友 (kfsky, hasibirok0) 一起在漫长的赛程中竞争。
在这次比赛中,测试时训练 (Test-Time Training, TTT) 实际上是强制性的,这使得它与常规比赛的性质大不相同。我们将其视为一场在 12 小时限制内优化训练和推理以最大化分数的“游戏”,并享受了这一挑战。
我们的解决方案使用了七个多样化模型的集成,获得了第 15 名(公开榜:0.93183 / 私有榜:0.92657)。
Qwen3-4B 是唯一一个单模型得分超过 0.92 的模型,但集成使我们总体达到了第 15 名。尽管高分单模型很少,但能获得如此强劲的结果很有趣。
集成概念:
我们专注于通过改变模型架构、任务和训练数据来最大化多样性。即使是单模型得分在 0.88x 范围内的模型也被包含在内,因为它们在集成中有所帮助。
我们没有使用交叉验证 (CV);我们仅使用公开榜来评估有效性。测试集 (55k) 足够大,且公开/私有分割是随机的,所以我们信任公开榜。
模型通用的预处理:
r/{subreddit})subset=[body, rule] 去重。对于因果模型,我们没有去重以保留数据多样性。合成数据 (kfsky):
| 模型 | 任务 | 训练数据 | 公开榜 | 私有榜 | 时间 (分钟) |
|---|---|---|---|---|---|
| Qwen3-4B | 因果 LM | test.csv + train.csv (少样本) | 0.920 | 0.914 | 278 |
| Qwen2.5-7B | 因果 LM | test.csv + train.csv + 合成数据* (零样本) | 0.902 | 0.899 | 193 |
| Gemma2-2B | 分类 | test.csv (subreddit 去重) | 0.914 | 0.906 | 90 |
| DeBERTa-v3-base | 分类 | 阶段 1: 合成数据*, 阶段 2: test.csv (subreddit 去重) | 0.909 | 0.901 | 38 |
| ModernBERT-base | 分类 | test.csv (subreddit 去重) | 0.895 | 0.889 | 30 |
| BGE-base | 分类 | test.csv (subreddit 去重) | 0.903 | 0.895 | 56 |
| E5-base | 语义搜索 | 无训练 (仅检索) | 0.887 | 0.877 | 15 |
基础: 最初的方法预测规则违规,公开榜得分为 0.918。
想法: 我们将任务从违规预测改为合规预测。
实现:
# 之前 (违规预测,0.918)
BASE_PROMPT = '''You are given a comment from reddit and a rule. Your task is to classify whether the comment violates the rule. Only respond Yes/No.'''
# 之后 (合规预测,0.920)
BASE_PROMPT = '''You are given a comment from reddit and a rule. Your job is to classify whether the comment complies with the rules or not. Please only answer "Yes" if it complies and "No" if it violates them.'''
提示词格式:
You are given a comment from reddit and a rule. Your job is to classify
whether the comment complies with the rules or not. Please only answer
"Yes" if it complies and "No" if it violates them.
Subreddit: r/{subreddit}
Rule: {rule}
Examples:
1) {negative_example}
Answer: Yes
2) {positive_example}
Answer: No
---
Comment: {body}
Answer:
训练:
结果: 0.918 → 0.920 公开榜 (+0.002)
确切的改进原因尚不清楚,需要进一步调查。
基础: 我们使用了一个 公开 notebook 作为基线,得分为 0.906。
想法: 使用合成数据作为预训练的两阶段继续训练。
实现:
阶段 1: 合成数据预训练
阶段 2: 测试数据微调
结果: 0.906 → 0.909 公开榜 (+0.003)
我们 adapted LMSYS 的 公开 notebook 代码 用于 Jigsaw 任务,并扩展了 LoRA 的目标模块。
实现:
架构:
google/gemma-2-2b-itq_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj训练:
数据:
输入格式:
{body}
{url_semantics}
Rule: {rule}
Subreddit: r/{subreddit}
结果: 90 分钟内获得 0.914 公开榜 / 0.906 私有榜
我们控制了步数并将其用作集成的一个组件。原始得分为私有榜 0.911,但在集成期间运行时成为瓶颈,因此我们减少了步数。减少步数会降低单模型得分,但会增加集成多样性,所以我们包含了它。
在混合之前将所有预测转换为排名:
r_model = predictions.rank(method='average') / (len(predictions) + 1)
blend = (
0.20 * r_causal_qwen25_7b +
0.25 * r_causal_qwen3_4b +
0.20 * r_seqcls_gemma2 +
0.125 * r_cls_deberta +
0.075 * r_seqcls_modernbert_base +
0.075 * r_cls_bge +
0.075 * r_e_e5
)
注意:我们发现权重调整对最终得分影响很小。