Code2Doc: A Quality-First Curated Dataset for Code Documentation

📅 2025-12-21
📈 Citations: 0
Influential: 0
📄 PDF

career value

151K/year
🤖 AI Summary
Existing code documentation datasets suffer from high noise levels, pervasive redundancy, and severe contamination by AI-generated content, thereby degrading supervision signals and compromising evaluation validity. To address these issues, this work introduces the first quality-centric, function-level code documentation dataset, covering Python, Java, TypeScript, JavaScript, and C++. We propose a novel four-stage human-augmented cleaning pipeline integrating structural complexity filtering, near-duplicate detection, AI-generated content identification, type annotation analysis, and heuristic discrimination. The pipeline reduces the raw corpus to 25.6% high signal-to-noise ratio samples, achieving an average documentation quality score of 6.93/10, with 86.9% containing explicit type annotations and only 2.9% exhibiting AI-generation hallmarks. Fine-tuning LLMs on this dataset yields substantial improvements: BLEU increases by 29.47% and ROUGE-L by 24.04%, demonstrating its efficacy for robust code documentation modeling.

Technology Category

Application Category

📝 Abstract
The performance of automatic code documentation generation models depends critically on the quality of the training data used for supervision. However, most existing code documentation datasets are constructed through large scale scraping of public repositories with limited quality control. As a result, they often contain noisy documentation, extensive duplication, and increasing contamination from AI generated content. These issues weaken the supervision signal available to learning-based models and complicate evaluation. We introduce extbf{Code2Doc}, a quality-first curated dataset for function-level code documentation generation. Code2Doc consists of 13,358 high-quality function-documentation pairs extracted from widely used open-source repositories spanning five programming languages: Python, Java, TypeScript, JavaScript, and C++. The dataset is constructed using a four-stage curation pipeline that enforces documentation completeness and clarity, filters functions based on structural and complexity criteria, removes exact and near-duplicate code, and identifies documentation likely to be AI generated. Starting from 52,069 extracted candidates, only 25.6 percent satisfy all quality constraints. We provide a detailed analysis of the resulting dataset, which achieves a mean documentation quality score of 6.93 out of 10. Overall, 86.9% of samples contain explicit type annotations, and only 2.9% are flagged as potentially AI generated. Baseline experiments show that fine-tuning a large language model on Code2Doc yields relative improvements of 29.47% in BLEU and 24.04% in ROUGE-L over zero shot performance, despite the modest dataset size. We release both the dataset and the full curation pipeline to support reproducible research on automatic code documentation generation.
Problem

Research questions and friction points this paper is trying to address.

Existing datasets contain noisy documentation and duplication
Current datasets have limited quality control and AI contamination
Poor quality training data weakens model supervision and evaluation
Innovation

Methods, ideas, or system contributions that make the work stand out.

Quality-first curation pipeline ensures documentation completeness and clarity
Filters functions based on structural and complexity criteria
Removes duplicates and identifies AI-generated content to reduce noise
R
Recep Kaan Karaman
Department of Computer Engineering, Uludag University
M
Meftun Akarsu
M.Eng. AI Engineering of Autonomous Systems, Technische Hochschule Ingolstadt