BigDong commited on
Commit
d9099a0
·
1 Parent(s): c9829be

update UltraData-Code-L2 Classifier

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +9 -0
  2. README.md +178 -0
  3. README_ZH.md +164 -0
  4. assets/multilingual-training-dynamics.png +3 -0
  5. assets/multilingual_results.png +3 -0
  6. assets/python-training-dynamics.png +3 -0
  7. assets/python_results.png +3 -0
  8. assets/ultradata-code-l0-l3-overview.png +3 -0
  9. assets/ultradata-code-l2.png +3 -0
  10. classifiers/.DS_Store +0 -0
  11. classifiers/cpp/A_relevance.bin +3 -0
  12. classifiers/cpp/C_file_role.bin +3 -0
  13. classifiers/cpp/C_file_role.json +11 -0
  14. classifiers/cpp/Q_quality.bin +3 -0
  15. classifiers/cpp/Q_scaler.npz +3 -0
  16. classifiers/csharp/A_relevance.bin +3 -0
  17. classifiers/csharp/C_file_role.bin +3 -0
  18. classifiers/csharp/C_file_role.json +11 -0
  19. classifiers/csharp/Q_quality.bin +3 -0
  20. classifiers/csharp/Q_scaler.npz +3 -0
  21. classifiers/go/A_relevance.bin +3 -0
  22. classifiers/go/C_file_role.bin +3 -0
  23. classifiers/go/C_file_role.json +11 -0
  24. classifiers/go/Q_quality.bin +3 -0
  25. classifiers/go/Q_scaler.npz +3 -0
  26. classifiers/java/A_relevance.bin +3 -0
  27. classifiers/java/C_file_role.bin +3 -0
  28. classifiers/java/C_file_role.json +11 -0
  29. classifiers/java/Q_quality.bin +3 -0
  30. classifiers/java/Q_scaler.npz +3 -0
  31. classifiers/javascript/A_relevance.bin +3 -0
  32. classifiers/javascript/C_file_role.bin +3 -0
  33. classifiers/javascript/C_file_role.json +11 -0
  34. classifiers/javascript/Q_quality.bin +3 -0
  35. classifiers/javascript/Q_scaler.npz +3 -0
  36. classifiers/php/A_relevance.bin +3 -0
  37. classifiers/php/C_file_role.bin +3 -0
  38. classifiers/php/C_file_role.json +11 -0
  39. classifiers/php/Q_quality.bin +3 -0
  40. classifiers/php/Q_scaler.npz +3 -0
  41. classifiers/python/A_relevance.bin +3 -0
  42. classifiers/python/C_file_role.bin +3 -0
  43. classifiers/python/C_file_role.json +11 -0
  44. classifiers/python/Q_quality.bin +3 -0
  45. classifiers/python/Q_scaler.npz +3 -0
  46. classifiers/r/A_relevance.bin +3 -0
  47. classifiers/r/C_file_role.bin +3 -0
  48. classifiers/r/C_file_role.json +11 -0
  49. classifiers/r/Q_quality.bin +3 -0
  50. classifiers/r/Q_scaler.npz +3 -0
.gitattributes CHANGED
@@ -33,3 +33,12 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ # Image files - uncompressed
37
+ *.bmp filter=lfs diff=lfs merge=lfs -text
38
+ *.gif filter=lfs diff=lfs merge=lfs -text
39
+ *.png filter=lfs diff=lfs merge=lfs -text
40
+ *.tiff filter=lfs diff=lfs merge=lfs -text
41
+ # Image files - compressed
42
+ *.jpg filter=lfs diff=lfs merge=lfs -text
43
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
44
+ *.webp filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: pytorch
4
+ tags:
5
+ - code
6
+ - classification
7
+ - code-filtering
8
+ - algorithmic-relevance
9
+ - ultradata
10
+ language:
11
+ - en
12
+ - zh
13
+ ---
14
+
15
+ # UltraData-Code-L2-Classifier
16
+
17
+ <p align="center">
18
+ <a href="https://huggingface.co/collections/openbmb/ultradata">📦 UltraData Collection</a> |
19
+ <a href="https://ultradata.openbmb.cn/">🌐 UltraData</a> |
20
+ <a href="https://huggingface.co/collections/openbmb/minicpm5">🤗 MiniCPM5 Series</a> |
21
+ 📖 Tech Report (Coming Soon) |
22
+ <a href="https://huggingface.co/datasets/openbmb/UltraData-Code">🤗 UltraData-Code Dataset</a>
23
+ </p>
24
+
25
+ <p align="center">English | <a href="README_ZH.md">中文</a></p>
26
+
27
+ ## 📚 Introduction
28
+
29
+ ***UltraData-Code-L2-Classifier*** is a suite of language-specific, file-level scorers for the 11 programming languages covered by [UltraData-Code](https://huggingface.co/datasets/openbmb/UltraData-Code). It is the L2 selection model used to build **UltraData-Code-L2** from UltraData-Code-L1.
30
+
31
+ For each language, a dedicated scorer ranks L1 files by algorithmic relevance and code quality. Selected files form UltraData-Code-L2 (~**400B tokens**), retaining about **12.23%** of L1 files overall. The goal is to concentrate interpretable computation and problem-solving logic for code pretraining.
32
+
33
+ ## 📢 What's New
34
+
35
+ - **[2026.09.07]** ***UltraData-Code-L2-Classifier*** is released, together with [***UltraData-Code***](https://huggingface.co/datasets/openbmb/UltraData-Code) (**L2** \~400B tokens / **L3** \~150B tokens across 11 languages). 🚀🚀🚀
36
+ - **[2026.09.07]** ***[MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B) is released!***, the second model in the MiniCPM5 series after MiniCPM5-1B. 🚀🚀🚀
37
+ - **[2026.02.08]** The [***UltraData***](https://ultradata.openbmb.cn/) platform is now live, introducing the [L0-L4 tiered data management framework](https://arxiv.org/pdf/2602.09003). 🔍🔍🔍
38
+
39
+ ## 💡 Highlights
40
+
41
+ > **Abstract:** Code generation is a core capability of large language models, and code data is central to the pretraining process that develops it. As code corpora grow, their scale, diversity, and quality increasingly shape the capabilities learned during pretraining. Following a tiered data management perspective, we present **UltraData-Code** as a family of four connected data states: repository archival at L0, standardized natural code at L1, algorithmic selection at L2, and task-oriented synthesis at L3. L0 archives the latest revision on the default branch of each public GitHub repository with its file structure, relationships, and provenance. L1 applies scalable filtering, normalization, and near deduplication to obtain standardized natural code. L2 selects algorithmically relevant files from L1 using language-adaptive signals from file roles and heuristics, together with code-quality constraints, yielding approximately 400B tokens across 11 programming languages. L3 applies task-oriented synthesis to algorithmic files from L2, turning each implementation into a structured programming exercise with aligned task, analysis, solution, and test fields, and generating approximately 150B tokens in the same 11 languages. Under controlled 10B-token continual pretraining of a 1B model, training on L2 instead of L1 raises pass@1 on EvalPlus by **7.80 points** and on MultiPL-E by **5.13 points**, while exceeding Stack-Edu by 4.37 and 3.05 points, respectively. Replacing half of the L2 training tokens with L3 yields a further gain of **8.42 points** on EvalPlus and **8.07 points** on MultiPL-E over training on L2 alone, while exceeding the strongest synthetic data baseline by 5.57 and 7.80 points, respectively.
42
+
43
+ - **A connected code data construction pipeline:** UltraData-Code links repository archival and standardized natural code with fine-grained selection and structured synthesis, yielding approximately 400B tokens at L2 and 150B tokens at L3 across 11 programming languages.
44
+ - **Fine-grained curation of algorithmically relevant code:** We introduce file-level algorithmic relevance as a selection objective and combine file-role cues with language-specific heuristic evidence to identify computational content beyond files explicitly labeled as algorithm implementations.
45
+ - **Task-oriented synthesis grounded in implementations:** Each selected implementation serves as the common source for a task, analysis, solution, and test record, preserving computational intent while adding task semantics and structured supervision.
46
+
47
+ <div align="center">
48
+ <img src="assets/ultradata-code-l0-l3-overview.png" width="760" alt="UltraData-Code L0-L3 construction pipeline"/>
49
+ </div>
50
+
51
+ ## 🔎 L2 Selection Framework
52
+
53
+ The L2 framework is applied independently to each of the 11 languages in UltraData-Code-L1:
54
+
55
+ 1. **Encode files.** Each file is represented with a 1024-dimensional embedding from [Qwen3-Embedding-0.6B](https://huggingface.co/Qwen/Qwen3-Embedding-0.6B).
56
+ 2. **Predict file roles.** The role classifier assigns one of `ALGO`, `WEB`, `TOOL`, `DATA`, `TEST`, `CONFIG`, or `EXCLUDE`.
57
+ 3. **Construct dual-cue supervision.** ALGO role labels are combined with language-specific heuristic evidence to identify algorithmically relevant files beyond the ALGO role alone.
58
+ 4. **Score relevance and quality.** The relevance model outputs `algo_rel_score`; the quality model outputs `quality_score`.
59
+ 5. **Calibrate and select.** A language-specific relevance threshold is calibrated on held-out data. A file is retained when it passes the relevance and quality thresholds and is not predicted as `EXCLUDE`.
60
+
61
+ <div align="center">
62
+ <img src="assets/ultradata-code-l2.png" width="760" alt="UltraData-Code L2 selection framework"/>
63
+ </div>
64
+
65
+ ## 📈 Evaluation Results
66
+
67
+ The 10B-token comparisons use the same 1B base model, architecture, optimization settings, preprocessing, decontamination, and evaluation protocol.
68
+
69
+ ### Python Results
70
+
71
+ - **Algorithmic selection yields the strongest natural code result.** UltraData-Code-L2-py improves the average EvalPlus pass@1 by **17.91 points** over UltraData-Code-L1-py and by **8.46 points** over Stack-Edu-py. Ultra-Stack-v3-py reaches the second-highest natural code average, while UltraData-Code-L2-py records the strongest average overall among the natural code settings.
72
+ - **Structured synthesis improves the matched mixture.** The equal-token UltraData-Code-L2-py + UltraData-Code-L3-py mixture reaches a **46.43** average pass@1, **3.30 points** above training on L2 alone and **4.46 points** above the matched L2 + SwallowCode-v2 mixture.
73
+
74
+ <div align="center">
75
+ <img src="assets/python-training-dynamics.png" alt="Python training dynamics" width="760"/>
76
+ </div>
77
+
78
+ <div align="center">
79
+ <img src="assets/python_results.png" alt="Python main results table" width="900"/>
80
+ </div>
81
+
82
+ ### Multilingual Results
83
+
84
+ - **L2 selection improves over L1 baselines.** UltraData-Code-L2 exceeds UltraData-Code-L1 by **7.80 points** on EvalPlus and **5.13 points** on MultiPL-E, and exceeds Stack-Edu by **4.37** and **3.05 points**, respectively.
85
+ - **L3 synthesis provides a further gain.** Replacing half of the L2 training tokens with L3 yields **8.42** and **8.07 points** over training on L2 alone on EvalPlus and MultiPL-E. Under the same 1:1 token mix, UltraData-Code-L2-L3 exceeds the strongest reported synthetic baseline by **5.57** and **7.80 points**, respectively.
86
+ - **The advantage persists during scaling.** At 100B tokens, the L2-L3 mixture reaches 57.06 on EvalPlus and 39.54 on MultiPL-E, exceeding training on L2 alone by 10.11 and 12.39 points and the matched CodeAlchemy-code-qa mixture by 10.86 and 9.60 points.
87
+
88
+ <div align="center">
89
+ <img src="assets/multilingual-training-dynamics.png" alt="Multilingual training dynamics" width="760"/>
90
+ </div>
91
+
92
+ <div align="center">
93
+ <img src="assets/multilingual_results.png" alt="Multilingual main results table" width="900"/>
94
+ </div>
95
+
96
+ ## 🚀 Usage
97
+
98
+ ```bash
99
+ pip install numpy torch pyarrow
100
+ ```
101
+
102
+ ### Score embeddings in Python
103
+
104
+ ```python
105
+ import sys
106
+ sys.path.insert(0, "scripts")
107
+ from scorers import LanguageScorers
108
+
109
+ scorers = LanguageScorers.load("classifiers/cpp")
110
+
111
+ # float32 [N, 1024]; paths are repository-relative and aligned with embeddings
112
+ out = scorers.score(embeddings, paths)
113
+ ```
114
+
115
+ Use the matching language directory under `classifiers/` (`cpp`, `csharp`, `go`, `java`, `javascript`, `php`, `python`, `r`, `ruby`, `rust`, `shell`). Real repository-relative paths are required by the relevance model.
116
+
117
+ ### Score Parquet files
118
+
119
+ [`scripts/score_parquet.py`](scripts/score_parquet.py) accepts one Parquet file or recursively walks a directory. Inputs must contain an `embedding` column and either `relative_path` or `meta.file_path`.
120
+
121
+ ```bash
122
+ SCORERS=classifiers/cpp
123
+ DATA_PATH=data/input
124
+ SAVE_PATH=data/output
125
+
126
+ python scripts/score_parquet.py \
127
+ --scorers ${SCORERS} \
128
+ --input ${DATA_PATH} \
129
+ --output-root ${SAVE_PATH} \
130
+ --batch-size 1024 \
131
+ --device cpu \
132
+ --apply-policy
133
+ ```
134
+
135
+ The output mirrors the input directory structure and keeps existing columns. Use `--describe` to inspect a scorer set, `--limit N` to process at most `N` Parquet files, or `--algo-rel-min`, `--quality-min`, and `--exclude-categories` to override policy values.
136
+
137
+ ### Output fields
138
+
139
+ ```text
140
+ category: {Predicted file role}
141
+ cls_confidence: {File-role confidence}
142
+ algo_rel_score: {Algorithmic-relevance score}
143
+ quality_score: {Code-quality score}
144
+ selected: {Whether the file passes the selection policy}
145
+ ```
146
+
147
+ - `category` ∈ {`ALGO`, `WEB`, `TOOL`, `DATA`, `TEST`, `CONFIG`, `EXCLUDE`}
148
+ - `cls_confidence` / `algo_rel_score` ∈ `[0, 1]`; `quality_score` ∈ `[0, 10]`
149
+ - `selected` is written only with `--apply-policy`; it marks policy passes and does not delete rows
150
+
151
+ ### Notes
152
+
153
+ - Embeddings must be 1024-d from [Qwen3-Embedding-0.6B](https://huggingface.co/Qwen/Qwen3-Embedding-0.6B).
154
+ - The relevance scorer also uses the repository-relative path; keep paths aligned with embeddings.
155
+ - [`config.json`](config.json) defaults: `algo_rel_min = 0.8`, `quality_min = 3.0`, veto category `EXCLUDE`. CLI flags override these.
156
+ - `score_parquet.py` is single-process; shard externally for large corpora.
157
+
158
+ ## ❤️ Acknowledgements
159
+
160
+ This release builds on [Qwen3-Embedding-0.6B](https://huggingface.co/Qwen/Qwen3-Embedding-0.6B), [PyTorch](https://pytorch.org/), and [PyArrow](https://arrow.apache.org/docs/python/). Thanks for their awesome work! 🙌
161
+
162
+ ## 💳 License
163
+
164
+ This project is released under the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) license.
165
+
166
+ ## 📖 Citation
167
+
168
+ If you find **UltraData-Code** or this classifier useful, please consider citing:
169
+
170
+ ```bibtex
171
+ @misc{ultradata_code,
172
+ title = {{UltraData-Code}: From Raw Repositories to Algorithmically Dense and Task-Oriented Code Data},
173
+ author = {Chengying Tu and Hengyu Zhao and Shuaikang Xue and Zhongming Qu and Jihao Zhou and Xinle Lin and Junshao Guo and Zixuan Fu and Qiang Ma and Jie Zhou and Chaojun Xiao and Hongfei Yan and Yudong Wang and Xu Han and Zhiyuan Liu and Maosong Sun},
174
+ year = {2026},
175
+ publisher = {Hugging Face},
176
+ howpublished = {\url{https://huggingface.co/datasets/openbmb/UltraData-Code}}
177
+ }
178
+ ```
README_ZH.md ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # UltraData-Code-L2-Classifier
2
+
3
+ <p align="center">
4
+ <a href="https://huggingface.co/collections/openbmb/ultradata">📦 UltraData 合集</a> |
5
+ <a href="https://ultradata.openbmb.cn/">🌐 UltraData</a> |
6
+ <a href="https://huggingface.co/collections/openbmb/minicpm5">🤗 MiniCPM5 系列</a> |
7
+ 📖 技术报告(即将发布)|
8
+ <a href="https://huggingface.co/datasets/openbmb/UltraData-Code">🤗 UltraData-Code 数据集</a>
9
+ </p>
10
+
11
+ <p align="center"><a href="README.md">English</a> | 中文</p>
12
+
13
+ ## 📚 简介
14
+
15
+ ***UltraData-Code-L2-Classifier*** 是面向 [UltraData-Code](https://huggingface.co/datasets/openbmb/UltraData-Code) 覆盖的 11 种编程语言的一组语言特定、文件级打分器。它是从 UltraData-Code-L1 构建 **UltraData-Code-L2** 所使用的 L2 筛选模型。
16
+
17
+ 对每种语言,专用打分器按算法相关性和代码质量对 L1 文件排序。筛选后的文件构成 UltraData-Code-L2(约 **400B tokens**),总体保留 L1 约 **12.23%** 的文件。目标是为代码预训练集中可解释的计算与问题求解逻辑。
18
+
19
+ ## 📢 最新动态
20
+
21
+ - **[2026.09.07]** ***UltraData-Code-L2-Classifier*** 正式发布,同步开源 [***UltraData-Code***](https://huggingface.co/datasets/openbmb/UltraData-Code)(**L2** 约 400B tokens / **L3** 约 150B tokens,覆盖 11 种语言)。🚀🚀🚀
22
+ - **[2026.09.07]** ***[MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B) 正式发布!*** 作为 MiniCPM5 系列在 MiniCPM5-1B 之后的第二款模型。🚀🚀🚀
23
+ - **[2026.02.08]** [***UltraData***](https://ultradata.openbmb.cn/) 平台正式上线,并发布 [L0-L4 分级数据管理框架](https://arxiv.org/pdf/2602.09003)。🔍🔍🔍
24
+
25
+ ## 💡 亮点
26
+
27
+ > **摘要:** 代码生成是大语言模型的核心能力,代码数据是培养该能力的预训练过程的重要组成部分。随着代码语料规模不断增长,其规模、多样性和质量日益决定模型在预训练中学习到的能力。遵循分级数据治理视角,我们将 **UltraData-Code** 构建为四个相互连接的数据状态:L0 仓库归档、L1 规范化自然代码、L2 算法相关性精选和 L3 面向任务的合成。L0 保留每个公开 GitHub 仓库默认分支的最新版本及其文件结构、文件关系和来源信息。L1 通过规模化过滤、规范化和近重复去重得到标准化自然代码。L2 基于文件角色、语言自适应启发式信号和代码质量约束,从 L1 中筛选算法相关文件,覆盖 11 种编程语言、约 400B tokens。L3 以 L2 中的算法相关文件为基础,将每个实现转换为任务、分析、解答和测试字段对齐的结构化编程练习,覆盖相同的 11 种语言、约 150B tokens。在相同的 1B 模型和 10B-token 持续预训练设置下,使用 L2 替代 L1 后,EvalPlus 的 pass@1 提升 **7.80 个百分点**,MultiPL-E 提升 **5.13 个百分点**,相比 Stack-Edu 分别提升 4.37 和 3.05 个百分点。将一半 L2 训练 token 替换为 L3 后,相比仅使用 L2 的训练,EvalPlus 进一步提升 **8.42 个百分点**,MultiPL-E 进一步提升 **8.07 个百分点**,相比最强的合成数据基线分别提升 5.57 和 7.80 个百分点。
28
+
29
+ - **完整的代码数据构建流水线:** 将仓库归档和规范化自然代码与细粒度精选、结构化合成连接起来,在 11 种编程语言上分别形成约 400B tokens 的 L2 和约 150B tokens 的 L3。
30
+ - **细粒度算法相关代码精选:** 将文件级算法相关性定义为选择目标,结合文件角色线索与语言特定启发式证据,识别超出显式算法实现标签范围的计算内容。
31
+ - **面向任务且以实现为基础的合成:** 以每个精选实现作为任务、分析、解答和测试记录的共同来源,在保留计算意图的同时补充任务语义和结构化监督。
32
+
33
+ <div align="center">
34
+ <img src="assets/ultradata-code-l0-l3-overview.png" width="760" alt="UltraData-Code L0-L3 构建流程"/>
35
+ </div>
36
+
37
+ ## 🔎 L2 筛选框架
38
+
39
+ L2 框架分别独立应用于 UltraData-Code-L1 中的 11 种语言:
40
+
41
+ 1. **编码文件。** 使用 [Qwen3-Embedding-0.6B](https://huggingface.co/Qwen/Qwen3-Embedding-0.6B) 为每个文件生成 1024 维 embedding。
42
+ 2. **预测文件角色。** 角色分类器将文件分为 `ALGO`、`WEB`、`TOOL`、`DATA`、`TEST`、`CONFIG` 或 `EXCLUDE`。
43
+ 3. **构造双线索监督。** 将 ALGO 角色标注与语言特定启发式证据结合,识别 ALGO 角色之外的算法相关文件。
44
+ 4. **打分相关性与质量。** 相关性模型输出 `algo_rel_score`,质量模型输出 `quality_score`。
45
+ 5. **校准并筛选。** 在留出数据上为每种语言校准相关性阈值。文件需通过相关性和质量阈值,且未被预测为 `EXCLUDE`,才会保留。
46
+
47
+ <div align="center">
48
+ <img src="assets/ultradata-code-l2.png" width="760" alt="UltraData-Code L2 筛选框架"/>
49
+ </div>
50
+
51
+ ## 📈 评测结果
52
+
53
+ 10B-token 对比均使用相同的 1B 基座模型、模型架构、优化设置、预处理���去污染流程和评测协议。
54
+
55
+ ### Python 结果
56
+
57
+ - **算法相关性精选带来最强的自然代码结果。** UltraData-Code-L2-py 的 EvalPlus 平均 pass@1 比 UltraData-Code-L1-py 提升 **17.91 个百分点**,比 Stack-Edu-py 提升 **8.46 个百分点**。Ultra-Stack-v3-py 在自然代码设置中取得第二高的平均分,而 UltraData-Code-L2-py 在自然代码设置中取得最高平均分。
58
+ - **结构化合成提升等 token 混合训练效果。** UltraData-Code-L2-py 与 UltraData-Code-L3-py 的等 token 混合训练平均 pass@1 达到 **46.43**,比仅使用 L2 高 **3.30 个百分点**,比对应的 L2 + SwallowCode-v2 混合训练高 **4.46 个百分点**。
59
+
60
+ <div align="center">
61
+ <img src="assets/python-training-dynamics.png" alt="Python 训练动态" width="760"/>
62
+ </div>
63
+
64
+ <div align="center">
65
+ <img src="assets/python_results.png" alt="Python 主结果表" width="900"/>
66
+ </div>
67
+
68
+ ### 多语言结果
69
+
70
+ - **L2 精选优于自然代码基线。** UltraData-Code-L2 相比 UltraData-Code-L1 在 EvalPlus 和 MultiPL-E 上分别提升 **7.80** 和 **5.13 个百分点**,相比 Stack-Edu 分别提升 **4.37** 和 **3.05 个百分点**。
71
+ - **L3 合成带来进一步提升。** 将一半 L2 训练 token 替换为 L3 后,相比仅使用 L2 的训练,EvalPlus 和 MultiPL-E 分别提升 **8.42** 和 **8.07 个百分点**。在相同的 1:1 token 配比下,UltraData-Code-L2-L3 混合训练相比最强的已报告合成数据基线,两个基准分别提升 **5.57** 和 **7.80 个百分点**。
72
+ - **优势在规模扩展中持续存在。** 在 100B tokens 训练规模下,L2-L3 混合训练在 EvalPlus 和 MultiPL-E 上分别达到 57.06 和 39.54,相比仅使用 L2 的训练分别高 10.11 和 12.39 个百分点,相比对应的 CodeAlchemy-code-qa 混合训练分别高 10.86 和 9.60 个百分点。
73
+
74
+ <div align="center">
75
+ <img src="assets/multilingual-training-dynamics.png" alt="多语言训练动态" width="760"/>
76
+ </div>
77
+
78
+ <div align="center">
79
+ <img src="assets/multilingual_results.png" alt="多语言主结果表" width="900"/>
80
+ </div>
81
+
82
+ ## 🚀 使用方法
83
+
84
+ ```bash
85
+ pip install numpy torch pyarrow
86
+ ```
87
+
88
+ ### 在 Python 中对 embedding 打分
89
+
90
+ ```python
91
+ import sys
92
+ sys.path.insert(0, "scripts")
93
+ from scorers import LanguageScorers
94
+
95
+ scorers = LanguageScorers.load("classifiers/cpp")
96
+
97
+ # float32 [N, 1024];paths 为仓库相对路径,并与 embeddings 对齐
98
+ out = scorers.score(embeddings, paths)
99
+ ```
100
+
101
+ 请使用 `classifiers/` 下对应语言目录(`cpp`、`csharp`、`go`、`java`、`javascript`、`php`、`python`、`r`、`ruby`、`rust`、`shell`)。相关性模型需要真实的仓库相对路径。
102
+
103
+ ### 对 Parquet 文件打分
104
+
105
+ [`scripts/score_parquet.py`](scripts/score_parquet.py) 可处理单个 Parquet 文件,或递归处理目录。输入必须包含 `embedding` 列,以及 `relative_path` 或 `meta.file_path`。
106
+
107
+ ```bash
108
+ SCORERS=classifiers/cpp
109
+ DATA_PATH=data/input
110
+ SAVE_PATH=data/output
111
+
112
+ python scripts/score_parquet.py \
113
+ --scorers ${SCORERS} \
114
+ --input ${DATA_PATH} \
115
+ --output-root ${SAVE_PATH} \
116
+ --batch-size 1024 \
117
+ --device cpu \
118
+ --apply-policy
119
+ ```
120
+
121
+ 输出会镜像输入目录结构,并保留原有列。使用 `--describe` 查看打分器配置,使用 `--limit N` 最多处理 `N` 个 Parquet 文件,或使用 `--algo-rel-min`、`--quality-min` 和 `--exclude-categories` 覆盖策略值。
122
+
123
+ ### 输出字段
124
+
125
+ ```text
126
+ category: {预测的文件角色}
127
+ cls_confidence: {文件角色置信度}
128
+ algo_rel_score: {算法相关性分数}
129
+ quality_score: {代码质量分数}
130
+ selected: {是否通过筛选策略}
131
+ ```
132
+
133
+ - `category` ∈ {`ALGO`, `WEB`, `TOOL`, `DATA`, `TEST`, `CONFIG`, `EXCLUDE`}
134
+ - `cls_confidence` / `algo_rel_score` ∈ `[0, 1]`;`quality_score` ∈ `[0, 10]`
135
+ - 仅在启用 `--apply-policy` 时写入 `selected`;它标记通过策略的行,不会删除未通过的行
136
+
137
+ ### 注意事项
138
+
139
+ - embedding 必须来自 [Qwen3-Embedding-0.6B](https://huggingface.co/Qwen/Qwen3-Embedding-0.6B) 的 1024 维表示。
140
+ - 相关性打分器还会使用仓库相对路径;请保持路径与 embedding 对齐。
141
+ - [`config.json`](config.json) 默认值:`algo_rel_min = 0.8`、`quality_min = 3.0`,veto 类别为 `EXCLUDE`。命令行参数优先。
142
+ - `score_parquet.py` 为单进程实现;大规模语料请在外部分片调度。
143
+
144
+ ## ❤️ 致谢
145
+
146
+ 本发布基于 [Qwen3-Embedding-0.6B](https://huggingface.co/Qwen/Qwen3-Embedding-0.6B)、[PyTorch](https://pytorch.org/) 和 [PyArrow](https://arrow.apache.org/docs/python/)。感谢这些优秀开源工作!🙌
147
+
148
+ ## 💳 许可证
149
+
150
+ 本项目基于 [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) 许可证发布。
151
+
152
+ ## 📖 引用
153
+
154
+ 如果 **UltraData-Code** 或本 Classifier 对您的研究有帮助,请考虑引用:
155
+
156
+ ```bibtex
157
+ @misc{ultradata_code,
158
+ title = {{UltraData-Code}: From Raw Repositories to Algorithmically Dense and Task-Oriented Code Data},
159
+ author = {Chengying Tu and Hengyu Zhao and Shuaikang Xue and Zhongming Qu and Jihao Zhou and Xinle Lin and Junshao Guo and Zixuan Fu and Qiang Ma and Jie Zhou and Chaojun Xiao and Hongfei Yan and Yudong Wang and Xu Han and Zhiyuan Liu and Maosong Sun},
160
+ year = {2026},
161
+ publisher = {Hugging Face},
162
+ howpublished = {\url{https://huggingface.co/datasets/openbmb/UltraData-Code}}
163
+ }
164
+ ```
assets/multilingual-training-dynamics.png ADDED

Git LFS Details

  • SHA256: 66d7b047effac3b6e182140c9a98fa8b81f3f1f654b1c02f2f13be8246c65c20
  • Pointer size: 131 Bytes
  • Size of remote file: 104 kB
assets/multilingual_results.png ADDED

Git LFS Details

  • SHA256: d27c9bc9bdbeaebf6471eaefcfb5783ea91dd2adecce46093ac37edb1e070d9e
  • Pointer size: 131 Bytes
  • Size of remote file: 212 kB
assets/python-training-dynamics.png ADDED

Git LFS Details

  • SHA256: 5a4a194b2bfa9d487a4b539ac28bdfc814a0a45140f9b718648fd01417053c45
  • Pointer size: 131 Bytes
  • Size of remote file: 178 kB
assets/python_results.png ADDED

Git LFS Details

  • SHA256: 341dd485ed0465024bb11f484104b1837aca16e39d8d4111977f5ceb32c01c32
  • Pointer size: 131 Bytes
  • Size of remote file: 191 kB
assets/ultradata-code-l0-l3-overview.png ADDED

Git LFS Details

  • SHA256: 01f4f23c1a8c3ad134eca73b7a3272b0ce389f3e2e489ceb55da4e748c8d3664
  • Pointer size: 132 Bytes
  • Size of remote file: 3.04 MB
assets/ultradata-code-l2.png ADDED

Git LFS Details

  • SHA256: b2101a2e56f095ded9a3f1fd5b4f26949bf7e64560cb3fdacbf1776642c57736
  • Pointer size: 131 Bytes
  • Size of remote file: 815 kB
classifiers/.DS_Store ADDED
Binary file (8.2 kB). View file
 
classifiers/cpp/A_relevance.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:69d9fac735e3bcd6a5ac229971c10bba983d4ff054d8fcd555afaa8f820e4a79
3
+ size 692293
classifiers/cpp/C_file_role.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:26815d880b5880d63b1f70f55db0eae8b5ba87ed482f324f8967884e5c1e2f60
3
+ size 3955829
classifiers/cpp/C_file_role.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "idx2cat": {
3
+ "0": "ALGO",
4
+ "1": "CONFIG",
5
+ "2": "DATA",
6
+ "3": "EXCLUDE",
7
+ "4": "TEST",
8
+ "5": "TOOL",
9
+ "6": "WEB"
10
+ }
11
+ }
classifiers/cpp/Q_quality.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd7b2072a5ec493cc7f87a7f214bdb0ab22f4db8872680ff9a8ce83d9f4afe23
3
+ size 2645859
classifiers/cpp/Q_scaler.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b55b8b39a3d254ce56e595f1c1f46d5f40f6f4e02c447934bb2620bb66b74e59
3
+ size 8696
classifiers/csharp/A_relevance.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8907abd9a500359a505984332517562b10bb99c486419ac46d38a8247485cd60
3
+ size 692421
classifiers/csharp/C_file_role.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:55e3a2c2f9066bb3c1027140a02af6f483a9f467f8d91b9fdd08ee8f9b9b2fb6
3
+ size 5269621
classifiers/csharp/C_file_role.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "idx2cat": {
3
+ "0": "ALGO",
4
+ "1": "CONFIG",
5
+ "2": "DATA",
6
+ "3": "EXCLUDE",
7
+ "4": "TEST",
8
+ "5": "TOOL",
9
+ "6": "WEB"
10
+ }
11
+ }
classifiers/csharp/Q_quality.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df3417dd4a7a05acf3ce330e1bb149dc28c7e397a72ac026002b344789064d12
3
+ size 2645859
classifiers/csharp/Q_scaler.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ab8d6cb4705304b14622df8fdf2aa770814305c6077408816c5afd0b5087139b
3
+ size 8696
classifiers/go/A_relevance.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7441a4dcbe6a75232053d30aa8987fe366cc55e1357e69b5cdfe51a1dade6e8c
3
+ size 692421
classifiers/go/C_file_role.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f7993ac50b52a0fb2320fa1cf09571457d75e8d6c50379013dfa42e318da5684
3
+ size 3955829
classifiers/go/C_file_role.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "idx2cat": {
3
+ "0": "ALGO",
4
+ "1": "CONFIG",
5
+ "2": "DATA",
6
+ "3": "EXCLUDE",
7
+ "4": "TEST",
8
+ "5": "TOOL",
9
+ "6": "WEB"
10
+ }
11
+ }
classifiers/go/Q_quality.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ab58f06e5e5099590dd0fcda2e902fbe3ed28e0383047a74b4fa84b4267e648e
3
+ size 2645859
classifiers/go/Q_scaler.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3204acf88ec63a714728f12ebe60d5f05463832c21bc1717ed9c9716ae5bd0cf
3
+ size 8696
classifiers/java/A_relevance.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d3bb8f42061135312f693d252302bd7f6c9107f2a753d6e6c9cf885ecfbe60c3
3
+ size 1446981
classifiers/java/C_file_role.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4699cf2c7b7db875d4edb8ba5147a118e8d10323f5512c92cf69e3045fc3fb07
3
+ size 3955426
classifiers/java/C_file_role.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "idx2cat": {
3
+ "0": "ALGO",
4
+ "1": "CONFIG",
5
+ "2": "DATA",
6
+ "3": "EXCLUDE",
7
+ "4": "TEST",
8
+ "5": "TOOL",
9
+ "6": "WEB"
10
+ }
11
+ }
classifiers/java/Q_quality.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:140ba3641b5db61b6e84d28e3d74237839f523e644d50e1966d6f1d09337a3b6
3
+ size 2645859
classifiers/java/Q_scaler.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:102ffd81a344ed33919c3c99996c48c9e2136e503ed3e406d47abc83c8ac1f44
3
+ size 8696
classifiers/javascript/A_relevance.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb261d0ba07f624d0476ce5d27b315c1d71cdcf8c524797554885ff302af0ad5
3
+ size 692421
classifiers/javascript/C_file_role.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:424a1934a321c683dedbd6613dd6021a0500a8248444ddfce135eb9d8bde6334
3
+ size 5269621
classifiers/javascript/C_file_role.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "idx2cat": {
3
+ "0": "ALGO",
4
+ "1": "CONFIG",
5
+ "2": "DATA",
6
+ "3": "EXCLUDE",
7
+ "4": "TEST",
8
+ "5": "TOOL",
9
+ "6": "WEB"
10
+ }
11
+ }
classifiers/javascript/Q_quality.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96c06d31398978c87a36cd76b14fbecf7d2a503158b8d34c1f0e511f6f4c8e0d
3
+ size 4359523
classifiers/javascript/Q_scaler.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:edb08e6d9131d5f137a548f54297745c9c6c579c0d5e78726e3ce3b9bf9c6693
3
+ size 8696
classifiers/php/A_relevance.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:47a91f7423fd0ca3c3691bc83c32c790d14c99323335c81e95ae7ad7c60e3024
3
+ size 692421
classifiers/php/C_file_role.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:067f21a3c1685407ef9c5c5bcfd08993c8fb1d34cf0f40a00af75eae46343821
3
+ size 5269621
classifiers/php/C_file_role.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "idx2cat": {
3
+ "0": "ALGO",
4
+ "1": "CONFIG",
5
+ "2": "DATA",
6
+ "3": "EXCLUDE",
7
+ "4": "TEST",
8
+ "5": "TOOL",
9
+ "6": "WEB"
10
+ }
11
+ }
classifiers/php/Q_quality.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a14861f0b57adfc5746303dc7d6f7690c58b0a8f364ae744ff27204400c81d50
3
+ size 2645859
classifiers/php/Q_scaler.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fc285ab85d610fc7bee5bf48f6fefe53af94f92aaddebcaaeb2c1b36c4022d1f
3
+ size 8696
classifiers/python/A_relevance.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:215475344c065b4ec34bc92bced8b39b67c84b826bc95e95c407dc00a05cfab5
3
+ size 691952
classifiers/python/C_file_role.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1b681afb0528c975dba8cef9edb3e8a21db943debce42717fd4a35493b36284d
3
+ size 5269445
classifiers/python/C_file_role.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "idx2cat": {
3
+ "0": "ALGO",
4
+ "1": "CONFIG",
5
+ "2": "DATA",
6
+ "3": "EXCLUDE",
7
+ "4": "TEST",
8
+ "5": "TOOL",
9
+ "6": "WEB"
10
+ }
11
+ }
classifiers/python/Q_quality.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f10a4bb1f77644e43478e6b89cdf392b77a6c00d471de0bc80746ddbabae9165
3
+ size 4359595
classifiers/python/Q_scaler.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a7afd8c690c96094a1f689c764345ec7ccb99d3b7d52d0fc2fce0f28f4ea273a
3
+ size 8696
classifiers/r/A_relevance.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7f72114badc2838ebd565f0fe3cb07d6ad5e4a4df6afa7f8d9f8e9aa023e5ccf
3
+ size 692421
classifiers/r/C_file_role.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:90fbac1d554770f77d0c939e9fa17d4508bef6334e9a5dce4e1280fcd40a7dea
3
+ size 2374773
classifiers/r/C_file_role.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "idx2cat": {
3
+ "0": "ALGO",
4
+ "1": "CONFIG",
5
+ "2": "DATA",
6
+ "3": "EXCLUDE",
7
+ "4": "TEST",
8
+ "5": "TOOL",
9
+ "6": "WEB"
10
+ }
11
+ }
classifiers/r/Q_quality.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2504cce34461f1bc2afd82a75c860d8aea49c196663ebaab706ae39367407cf1
3
+ size 2645859
classifiers/r/Q_scaler.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4bf48f51a045acdffd1363d5f1df2b05d8b7a8ae79e84644e6dc57f69a65a0c6
3
+ size 8696