TIGER-Lab/FIM-Midtraining-400K
收藏资源简介:
FIM-Midtraining-400K 是论文《Function-Aware Fill-in-the-Middle as Mid-Training for Coding Agent Foundation Models》的中期训练语料库。它包含40万个函数感知的填充中间(FIM)样本(在Qwen2.5-Coder分词器下约26亿个token),这些样本来自968个宽松许可的GitHub仓库中的75,568个Python文件,并已完全去除了与SWE-Bench的污染。该语料库利用编码代理内部循环(行动 → 观察 → 继续)与函数调用点在结构上的同构性:不是随机掩码文本跨度,而是通过程序依赖图分析和复杂度-可推断性双重标准选择函数进行掩码,训练模型从周围文件中恢复这些函数,并先进行推理。该数据集用于在代理后训练(如R2E-Gym、SWE-Smith、SWE-Lego)之前对Qwen2.5-Coder-7B/14B-Instruct和Qwen3-8B模型进行中期训练,以提升SWE-Bench-Verified和SWE-Bench-Lite的性能,同时减轻代理后训练对通用能力的侵蚀。数据集包含四种配置:all_merged(默认,40万样本,混合单函数、函数对和函数三重掩码)、single_function(32万样本,单函数掩码)、function_pair(6万样本,函数对掩码)和function_triple(2万样本,函数三重掩码)。每个样本采用聊天格式的JSON记录,包含用户回合(带掩码的源代码文件)和助手回合(逐步推理和实现),并附带元数据(来源、选择分数等)。数据集的构建基于程序依赖图,通过复杂度(Ĥ)和可推断性(Î)分数选择目标函数,确保目标既有实质性又可从上下文恢复。所有样本均与SWE-Bench源代码仓库无重叠,且提交时间早于SWE-Bench基准的最早基础提交,以避免测试泄漏。语料库统计显示总token数为26.3亿,平均每个样本输入5,821个token、目标759个token,目标函数平均42.3行代码。主题覆盖从零开始、领域特定、科学计算、数据处理、小型框架、可视化、编译器、算法、游戏、教育、网络和安全等多个类别。数据集可用于通过Hugging Face的datasets库加载,并支持在LLaMA-Factory等框架中进行训练。基于该数据集训练的模型包括TIGER-Lab/FIM-Mid-7B、FIM-Mid-8B、FIM-Mid-14B及其后训练版本,在SWE-Bench基准上表现出显著改进。样本源自968个开源GitHub仓库,每个仓库有自己的宽松许可证(如MIT、Apache-2.0、BSD),添加的推理和注释以Apache-2.0许可证发布。
The mid-training corpus of "Function-Aware Fill-in-the-Middle as Mid-Training for Coding Agent Foundation Models": 400K function-aware FIM samples (~2.6B tokens under the Qwen2.5-Coder tokenizer) drawn from 75,568 Python files across 968 permissively-licensed GitHub repositories, fully decontaminated against SWE-Bench. A coding agents inner loop — act → observe → continue — is structurally isomorphic to a function call site: a caller binds arguments, a callee returns a value computed elsewhere, and downstream code consumes that value. This corpus exploits that isomorphism. Instead of masking random spans, we mask functions — selected by program-dependency-graph analysis and a complexity–inferability double criterion — and train the model to recover them from the surrounding file, reasoning first. Mid-training Qwen2.5-Coder-7B/14B-Instruct and Qwen3-8B on this corpus before agentic post-training (R2E-Gym / SWE-Smith / SWE-Lego, unmodified) improves SWE-Bench-Verified by +2.8 / +3.0 / +3.2 and SWE-Bench-Lite by +3.7 / +4.0 / +5.4, while restoring most of the general-capability erosion that agentic post-training otherwise inflicts (LiveCodeBench +11.1, τ-bench +3.9, BFCL +2.4 at 14B). The dataset includes four configs: all_merged (default, 400K samples, mixture of single/pair/triple function masking), single_function (320K samples, single function masking), function_pair (60K samples, function pair masking), and function_triple (20K samples, function triple masking). Each sample is a JSON record in chat format, with a user turn (source file with masked function bodies) and an assistant turn (step-by-step rationale and implementation), accompanied by metadata (provenance, selection scores, etc.). Target selection is based on program dependency graphs, using complexity (Ĥ) and inferability (Î) scores to ensure functions are both substantial and recoverable from context. All samples have zero overlap with SWE-Bench source repositories and are restricted to commits before the earliest base commit of SWE-Bench benchmarks to avoid test leakage. Corpus statistics show total tokens of 2.63B, mean input/target tokens per sample of 5,821/759, and mean target length of 42.3 LoC per sample. Topics cover From Scratch, Domain Specific, Scientific Computing, Data Processing, Small Frameworks, Visualization, Compilers, Algorithms, Games, Educational, Networking, and Security. The dataset can be loaded via Hugging Faces datasets library and used for training in frameworks like LLaMA-Factory. Models trained on this corpus include TIGER-Lab/FIM-Mid-7B, FIM-Mid-8B, FIM-Mid-14B and their post-trained versions, showing significant improvements on SWE-Bench. Samples are derived from 968 open-source GitHub repositories under permissive licenses (e.g., MIT, Apache-2.0, BSD), with added rationales and annotations released under Apache-2.0.




