arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2605.21943cs.SE
收藏

确定性与概率性摘要:设计模式导向Java代码中的经验性权衡研究

Deterministic vs. Probabilistic Summarisation: An Empirical Trade-off Study in Design Pattern Centric Java Code

Monash University(莫纳什大学);Singapore Management University(新加坡管理大学)

Najam Nazar, Christoph Treude

AI总结:

本文通过对比确定性(基于启发式)和概率性(基于LLM)管道在面向意图的设计模式Java代码摘要中的表现,研究了摘要方法的权衡问题,发现概率性摘要在语义对齐和上下文覆盖上更优,而确定性方法在简洁性和可重复性上更胜一筹。

摘要:

背景:自动代码摘要支持程序理解和文档编写,但确定性(基于启发式)和概率性(基于LLM)管道的相对优势和局限性仍不明确。目标:本文通过受控的实证比较,探讨这些范式在面向意图的设计模式代码摘要中的表现。方法:使用以设计模式为中心的Java代码作为结构化测试平台(150个文件来自三个开源仓库,涵盖九种模式),我们比较了基于规则的自然语言生成(NLG)管道、基于软件词用法模型(SWUM)的方法,以及基于Mixtral LLM的概率性管道。摘要通过BERTScore和余弦相似度与人类参考进行评估,并辅以由Llama 3生成的基于评分标准的判断,涵盖五个维度:准确性、简洁性、充分性、代码上下文意识和设计模式保真度。统计分析包括Wilcoxon符号秩检验(含效应量)、Friedman检验与事后检验,以及Spearman相关性用于评分一致性敏感性分析。结果:概率性摘要在语义对齐和上下文覆盖上表现更强,而确定性方法生成的摘要更简洁且完全可重复。提示敏感性和多轮分析表明LLM输出存在变化,但相对趋势保持稳定。结论:出现了清晰的权衡:概率性方法更倾向于语义深度和上下文准确性,而确定性管道更适合简洁性和可重复性。这些发现为选择代码摘要技术提供了实用指导。

英文摘要:

Background: Automated code summarisation supports program comprehension and documentation, yet the relative strengths and limitations of deterministic (heuristic-based) and probabilistic (LLM-based) pipelines remain unclear. Aims: This paper presents a controlled empirical comparison of these paradigms for intent-oriented design-pattern code summarisation. Method: Using design-pattern-centric Java code as a structured testbed (150 files from three open-source repositories covering nine patterns), we compare a rule-based natural language generation (NLG) pipeline, a Software Word Usage Model (SWUM)-based approach, and a probabilistic pipeline based on the Mixtral LLM. Summaries are evaluated against human references using BERTScore and cosine similarity, complemented by rubric-based judgements produced by Llama 3 across five dimensions: accuracy, conciseness, adequacy, code-context awareness, and design-pattern fidelity. Statistical analysis includes Wilcoxon signed-rank tests (with effect sizes), Friedman tests with post-hoc corrections, and Spearman correlation for sensitivity analysis of rubric consistency. Results: Probabilistic summaries show stronger semantic alignment and richer contextual coverage, while deterministic approaches produce more concise and fully reproducible outputs. Prompt-sensitivity and multi-run analyses indicate variability in LLM outputs, though relative trends remain stable. Conclusions: A clear trade-off emerges: probabilistic methods favour semantic depth and contextual accuracy, whereas deterministic pipelines are preferable for brevity and reproducibility. These findings provide practical guidance for selecting code summarisation techniques.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑