Effective communication, specifically through documentation, is the beating heart of collaboration among contributors in software development. Recent advancements in language models (LMs) have enabled the introduction of a new type of actor in that ecosystem: LM-powered assistants capable of code generation, optimization, and maintenance. Our study investigates the efficacy of small language models (SLMs) for generating high-quality docstrings by assessing accuracy, conciseness, and clarity, benchmarking performance quantitatively through mathematical formulas and qualitatively through human evaluation using Likert scale. Further, we introduce DocuMint, as a large-scale supervised fine-tuning dataset with 100,000 samples. In quantitative experiments, Llama 3 8B achieved the best performance across all metrics, with conciseness and clarity scores of 0.605 and 64.88, respectively. However, under human evaluation, CodeGemma 7B achieved the highest overall score with an average of 8.3 out of 10 across all metrics. Fine-tuning the CodeGemma 2B model using the DocuMint dataset led to significant improvements in performance across all metrics, with gains of up to 22.5% in conciseness. The fine-tuned model and the dataset can be found in HuggingFace and the code can be found in the repository.
翻译:有效的沟通,特别是通过文档进行的沟通,是软件开发中协作者之间合作的核心。语言模型的最新进展使得在该生态系统中引入一种新型参与者成为可能:能够进行代码生成、优化和维护的语言模型驱动的助手。我们的研究通过评估准确性、简洁性和清晰度,使用数学公式进行定量基准测试,并通过Likert量表进行人工评估进行定性比较,探讨了小型语言模型在生成高质量文档字符串方面的有效性。此外,我们引入了DocuMint,这是一个包含100,000个样本的大规模监督微调数据集。在定量实验中,Llama 3 8B在所有指标上取得了最佳性能,简洁性和清晰度得分分别为0.605和64.88。然而,在人工评估中,CodeGemma 7B获得了最高总分,所有指标的平均分为8.3分(满分10分)。使用DocuMint数据集对CodeGemma 2B模型进行微调,显著提升了所有指标的性能,其中简洁性提升高达22.5%。微调后的模型和数据集可在HuggingFace上获取,代码可在代码库中找到。