一句话:提出 SOUP 框架,利用评论自动预测有效修改并更新 Stack Overflow 帖子,提升代码片段质量。
Stack Overflow 上的代码片段常被开发者复用,但其中可能包含缺陷或非最优实现。评论虽能指出问题并给出改进建议,却常被忽略,导致问题代码未被更新。本文提出 SOUP 框架,将任务分解为有效评论-编辑预测(VCP)与自动帖子更新(APU)。作者采用低秩适配(LoRA)微调 CodeLlama 完成 VCP,并构建包含 78k 有效评论-编辑对的数据集用于 APU,随后评测多个大语言模型在 APU 上的表现。实验表明 SOUP 在多项基准上取得良好效果;在 Stack Overflow 真实场景中,提交的 50 条编辑有 21 条被维护者验证并接受,证明了其实用价值。
Utilizing code snippets on Stack Overflow (SO) is a common practice among developers for problem-solving. Although SO code snippets serve as valuable resources, it is important to acknowledge their imperfections, reusing problematic code snippets can lead to the introduction of suboptimal or buggy code into software projects. SO comments often point out weaknesses of a post and provide valuable insights to improve the quality of answers, while SO comments are usually missed and/or ignored, leaving these problematic code snippets untouched. In this work, we first investigate the task of automatic SO posts updating based on their associated comments. We introduce a novel framework, named SOUP (Stack Overflow Updator for Post) for this task. SOUP addresses two key tasks: Valid Comment-Edit Prediction (VCP) and Automatic Post Updating (APU). We fine-tuned a large language model, CodeLlama, using low-rank adaptation techniques to complete the VCP task, and constructed a dataset containing 78k valid comment-edit pairs for the APU task. Subsequently, we tested the performance of multiple large language models on the APU task. Extensive experimental results show the promising performance of our model over a set of benchmarks. Moreover, we also perform an in-the-wild evaluation on Stack Overflow, we submitted 50 edits generated by our approach to Stack Overflow posts and 21 of them have been verified and accepted by SO maintainers, further proving the practical value of SOUP.
DOI 原文 ·
@inproceedings{paperbot8703,
title = {Towards Better Answers: Automated Stack Overflow Post Updating},
author = {Yubo Mai and Zhipeng Gao and Haoye Wang and Tingting Bi and Xing Hu and Xin Xia and Jianling Sun},
booktitle = {ICSE},
year = {2025},
doi = {10.1109/icse55347.2025.00024}
}