🔥 Apple Research 开源代码 - 一种简单却极其有效的代码生成模型后训练方法
本仓库是 Apple Research 论文 "Embarrassingly Simple Self-Distillation Improves Code Generation" 的复现实现。
核心发现:代码模型的"正确能力"其实已经藏在权重里了,只是被 greedy decoding 锁住了。用自己生成的数据再训练一轮,就能挖掘出隐藏实力!
1. Sample → 从冻结模型采样(非单位温度)
2. Fine-tune → 用原始未验证输出做标准交叉熵微调
3. Decode → 用单独调优的温度解码
不需要:
- ❌ 更好的教师模型
- ❌ 验证器(正确性检查)
- ❌ 强化学习
- ❌ 代码执行环境
- ❌ 外部标签
| 模型 | Pass@1 提升 | Pass@5 提升 |
|---|---|---|
| Qwen3-30B-Instruct | 42.4% → 55.3% (+30%) | 31.1% → 54.1% |
- 每个 prompt 只需一个样本
- 在 4B、8B、30B 规模都有效
- 困难问题提升尤为显著
git clone https://github.com/zhang588/ml-ssd.git
cd ml-ssd
uv sync --group evaluation# 评估
python -m evaluation.eval --help
# 运行基准测试
python -m evaluation.benchmark --model <model_name>ml-ssd/
├── evaluation/
│ ├── eval.py # CLI 入口
│ ├── benchmark.py # LiveCodeBench v6 实现
│ └── livecodebench_utils.py # 代码执行工具
├── figures/
│ └── fig_teaser.png # 论文图表
├── pyproject.toml
└── README.md
- arXiv: 2604.01193
- 作者: Ruixiang Zhang*, Richard He Bai*, Huangjie Zheng*, Navdeep Jaitly, Ronan Collobert, Yizhe Zhang*
- 🌐 GitHub 仓库
- 📄 原仓库 (apple/ml-ssd)
- 📝 论文 (arXiv)
- 🤗 模型权重 (即将发布)
@misc{zhang2026embarrassinglysimpleselfdistillationimproves,
title={Embarrassingly Simple Self-Distillation Improves Code Generation},
author={Ruixiang Zhang and Richard He Bai and Huangjie Zheng and Navdeep Jaitly and Ronan Collobert and Yizhe Zhang},
year={2026},
eprint={2604.01193},
archivePrefix={arXiv},
primaryClass={cs.CL}
}Apache 2.0 License