File size: 2,572 Bytes
383445e
 
 
 
 
 
 
 
 
 
 
 
 
 
f950961
 
 
 
 
383445e
be32582
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f950961
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
license: mit
task_categories:
- text-generation
- fill-mask
language:
- zh
tags:
- java
- spring-boot
- code-completion
- peft
- lora
- qlora
- code-dataset
- instruction-tuning
pretty_name: SpringBoot-Code-Completion-Dataset-zh
size_categories:
- 100K<n<1M
---
# Spring Boot Code Completion Dataset

## 概述
这是一个专为 Spring Boot 框架代码补全任务设计的中文优先数据集。通过从 GitHub 上 90 个高质量开源 Spring Boot 项目中提取方法级、类级代码片段及配置文件,构建而成。数据集重点突出 Spring Boot 典型特征(注解驱动、依赖注入、配置绑定等),适用于参数高效微调(PEFT,如 LoRA/QLoRA)下的代码生成研究。

## 数据集统计
- **总样本数**:81,085 条  
- **训练集**:64,868 条  
- **验证集**:8,108 条  
- **测试集**:8,109 条  
- **优先级 2 样本数**(含典型 Spring Boot 特征,如 @RestController、@Service、@Entity 等):19,740 条  
- **优先级 2 占比**:24.34%  

## 数据格式(Alpaca 风格)
每条数据为 JSON 对象,包含以下字段:
```json
{
  "instruction": "请在Spring Boot框架中完成以下Java代码" 或 "请完成以下Java代码",
  "input": "代码前缀(prefix)",
  "output": "代码补全部分(completion)",
  "source_file": "原始文件路径",
  "priority": 1 或 2   // 2 表示含有 Spring Boot 典型特征
}
提取与清洗流程

从 GitHub 采集 90 个典型 Spring Boot 项目
使用 javalang 进行 AST 解析,提取方法/类级代码片段及 application 配置
多维度 Spring Boot 特征检测(注解、接口实现、包路径、类名后缀等)标记 priority
清洗:精确 MD5 去重 + SentenceTransformer + FAISS 相似度去重(阈值 0.95)+ priority 2 优先保护
长度过滤:input > 50 字符,output > 20 字符
划分:80% 训练 / 10% 验证 / 10% 测试

使用方式
Pythonfrom datasets import load_dataset

dataset = load_dataset("您的用户名/springboot-code-completion-dataset")
# 或指定子集
train = dataset["train"]
许可
本数据集仅限学术研究与非商业用途使用。原始代码来源于 GitHub 开源项目,请遵守各项目原许可协议。
引用
如果在论文中使用,请引用本仓库:
text@misc{唯一2026-springboot-dataset,
  author = {唯一},
  title = {Spring Boot Code Completion Dataset},
  year = {2026},
  publisher = {Hugging Face},
  howpublished = {\url{https://huggingface.co/datasets/您的用户名/springboot-code-completion-dataset}}
}
欢迎反馈与合作!