arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2610.19769cs.SEcs.LG
收藏

依赖图何时有助于代码到架构的映射?

When Does the Dependency Graph Help Code-to-Architecture Mapping?

Linnaeus University(林奈大学);Electrolux Professional AB(伊莱克斯专业有限公司)

Rakhshanda Jabeen, Morgan Ericsson, Jonas Nordqvist, Anna Wingkvist

AI总结:

该研究将代码到架构的映射建模为半监督节点分类,对比GCN、GAT、MLP与朴素贝叶斯,发现GAT在Chrome等系统上表现最优,多关系聚合及图结构可提升映射效果。

摘要:

当系统的实现与其预期的模块化分解产生偏差,且源代码文件与架构模块之间的映射关系缺失、不完整或手动维护成本过高时,就会产生架构技术债务。我们将代码到架构的映射问题建模为有向多关系依赖图上的半监督节点分类任务,其中文件作为节点,类型化依赖作为边,特征来自代码标识符和目录布局的词汇信息。从少量标注样本出发,我们采用迭代自训练程序将映射扩展到剩余文件。我们对比了图卷积网络(GCN)、图注意力网络(GAT)和无图多层感知机(MLP),这些模型使用相同的特征和训练流程,并以朴素贝叶斯作为基准。在10个开源Java和C/C++系统的100次运行中,所有三种神经模型在F1指标上均优于基准。GAT达到了系统级中位数宏F1和微F1的最高平均值,分别为83.5和92.2,而MLP在多个系统上表现相当或更优。在拥有18343个文件的最大系统Chrome上,GAT和GCN的宏F1分别比MLP高22和19个百分点,且持续误分类的文件数量显著更少。连通性和同质性与神经消息传递的帮助位置相关,而多关系聚合在所有系统上对GCN和GAT均优于单一合并边类型。后续研究发现,部分模型排名依赖于训练种子,这削弱了较小的优势,但未消除在Chrome上观察到的大幅图优势。

英文摘要:

Architectural technical debt arises when a system's implementation drifts from its inten ded modular decomposition, while the mapping between source files and architectural modu les is missing, incomplete, or costly to maintain manually. We formulate code-to-archite cture mapping as semi-supervised node classification over a directed multi-relational de pendency graph, with files as nodes, typed dependencies as edges, and lexical features d erived from code identifiers and directory layout. Starting from a small labeled sample, an iterative self-training procedure expands the mapping to the remaining files. We com pare a graph convolutional network (GCN), a graph attention network (GAT), and a graph-f ree multi-layer perceptron (MLP), using identical features and training procedures for t he learned models, against a Naive Bayes reference. Across 100 runs on ten open-source J ava and C/C++ systems, all three neural models outperform the reference on both F1 metri cs. GAT achieves the highest averages of system-level median macro and micro F1, at 83.5 and 92.2, respectively, whereas MLP remains competitive or superior on several systems. On Chrome, the largest system with 18,343 files, GAT and GCN exceed MLP by 22 and 19 ma cro-F1 points, respectively, and have substantially fewer persistently misclassified fil es. Connectivity and homophily are associated with where neural message passing helps, w hile multi-relational aggregation outperforms a single merged edge type on every system for both GCN and GAT. A follow-up study finds that several model rankings depend on the training seed, qualifying smaller advantages without removing the large graph benefit ob served on Chrome.

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

↑