Syn2Vec: A Semantic-Aware Initialization Method for AST Path–Based Code Representation

IF 1.6 4区 计算机科学 Q3 COMPUTER SCIENCE, SOFTWARE ENGINEERING
Xuekai Sun, Shi Dong, Xianyu Zuo
{"title":"Syn2Vec: A Semantic-Aware Initialization Method for AST Path–Based Code Representation","authors":"Xuekai Sun,&nbsp;Shi Dong,&nbsp;Xianyu Zuo","doi":"10.1002/smr.70145","DOIUrl":null,"url":null,"abstract":"<div>\n \n <p>Although abstract syntax tree (AST) path–based approaches have proven effective, the impact of node embedding initialization methods on model performance remains understudied. This work presents a comprehensive investigation of node embedding initialization for AST path–based code analysis models, proposing Syn2Vec, a semantic-aware initialization method. Our approach learns the semantic relationships between AST nodes in path contexts through a pre-training process, simultaneously capturing structural features and contextual dependencies. This generates initial embeddings that integrate both syntactic and semantic information. Syn2Vec effectively models the structural relatedness and semantic correlation between AST nodes, providing superior initialization for downstream code analysis models. Experimental results on standard code classification benchmarks demonstrate that Syn2Vec-initialized models achieve a 9.43% improvement in the F1-score compared with random initialization, conclusively establishing the importance of initialization strategies for the analysis of AST path–based code.</p>\n </div>","PeriodicalId":48898,"journal":{"name":"Journal of Software-Evolution and Process","volume":"38 6","pages":""},"PeriodicalIF":1.6000,"publicationDate":"2026-06-09","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Journal of Software-Evolution and Process","FirstCategoryId":"94","ListUrlMain":"https://onlinelibrary.wiley.com/doi/10.1002/smr.70145","RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q3","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
引用次数: 0

Abstract

Although abstract syntax tree (AST) path–based approaches have proven effective, the impact of node embedding initialization methods on model performance remains understudied. This work presents a comprehensive investigation of node embedding initialization for AST path–based code analysis models, proposing Syn2Vec, a semantic-aware initialization method. Our approach learns the semantic relationships between AST nodes in path contexts through a pre-training process, simultaneously capturing structural features and contextual dependencies. This generates initial embeddings that integrate both syntactic and semantic information. Syn2Vec effectively models the structural relatedness and semantic correlation between AST nodes, providing superior initialization for downstream code analysis models. Experimental results on standard code classification benchmarks demonstrate that Syn2Vec-initialized models achieve a 9.43% improvement in the F1-score compared with random initialization, conclusively establishing the importance of initialization strategies for the analysis of AST path–based code.

基于AST路径的代码表示的语义感知初始化方法
尽管基于抽象语法树(AST)路径的方法已被证明是有效的,但节点嵌入初始化方法对模型性能的影响仍有待研究。本文对基于AST路径的代码分析模型的节点嵌入初始化进行了全面研究,提出了一种语义感知初始化方法Syn2Vec。我们的方法通过预训练过程学习路径上下文中AST节点之间的语义关系,同时捕获结构特征和上下文依赖关系。这将生成集成句法和语义信息的初始嵌入。Syn2Vec有效地建模AST节点之间的结构相关性和语义相关性,为下游代码分析模型提供了优越的初始化。在标准代码分类基准上的实验结果表明,与随机初始化相比,syn2vec初始化模型的f1得分提高了9.43%,从而明确了初始化策略对基于AST路径的代码分析的重要性。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
Journal of Software-Evolution and Process
Journal of Software-Evolution and Process COMPUTER SCIENCE, SOFTWARE ENGINEERING-
自引率
10.00%
发文量
109
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信
小红书