利用增强代码表示的深度学习为智能合约推荐应用程序编程接口

IF 1.7 4区 计算机科学 Q3 COMPUTER SCIENCE, SOFTWARE ENGINEERING
Jie Cai, Qian Cai, Bin Li, Jiale Zhang, Xiaobing Sun
{"title":"利用增强代码表示的深度学习为智能合约推荐应用程序编程接口","authors":"Jie Cai,&nbsp;Qian Cai,&nbsp;Bin Li,&nbsp;Jiale Zhang,&nbsp;Xiaobing Sun","doi":"10.1002/smr.2658","DOIUrl":null,"url":null,"abstract":"<p>Application programming interface (API) recommendation plays a crucial role in facilitating smart contract development by providing developers with a ranked list of candidate APIs for specific recommendation points. Deep learning-based approaches have shown promising results in this field. However, existing approaches mainly rely on token sequences or abstract syntax trees (ASTs) for learning recommendation point-related features, which may overlook the essential knowledge implied in the relations between or within statements and may include task-irrelevant components during feature learning. To address these limitations, we propose a novel code graph called pruned and augmented AST (pa-AST). Our approach enhances the AST by incorporating additional knowledge derived from the control and data flow relations between and within statements in the smart contract code. Through this augmentation, the pa-AST can better represent the semantic features of the code. Furthermore, we conduct AST pruning to eliminate task-irrelevant components based on the identified flow relations. This step helps mitigate the interference caused by these irrelevant parts during the model feature learning process. Additionally, we extract the API sequence surrounding the recommendation point to provide supplementary knowledge for the model learning. The experimental results demonstrate our proposed approach achieving an average mean reciprocal rank (MRR) of 68.02%, outperforming the baselines' performance. Furthermore, through ablation experiments, we explore the effectiveness of our proposed code representation approach. The results indicate that combining pa-AST with the API sequence yields improved performance compared with using them individually. Moreover, our AST augmentation and pruning techniques significantly contribute to the overall results.</p>","PeriodicalId":48898,"journal":{"name":"Journal of Software-Evolution and Process","volume":"36 8","pages":""},"PeriodicalIF":1.7000,"publicationDate":"2024-03-03","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Application programming interface recommendation for smart contract using deep learning from augmented code representation\",\"authors\":\"Jie Cai,&nbsp;Qian Cai,&nbsp;Bin Li,&nbsp;Jiale Zhang,&nbsp;Xiaobing Sun\",\"doi\":\"10.1002/smr.2658\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"<p>Application programming interface (API) recommendation plays a crucial role in facilitating smart contract development by providing developers with a ranked list of candidate APIs for specific recommendation points. Deep learning-based approaches have shown promising results in this field. However, existing approaches mainly rely on token sequences or abstract syntax trees (ASTs) for learning recommendation point-related features, which may overlook the essential knowledge implied in the relations between or within statements and may include task-irrelevant components during feature learning. To address these limitations, we propose a novel code graph called pruned and augmented AST (pa-AST). Our approach enhances the AST by incorporating additional knowledge derived from the control and data flow relations between and within statements in the smart contract code. Through this augmentation, the pa-AST can better represent the semantic features of the code. Furthermore, we conduct AST pruning to eliminate task-irrelevant components based on the identified flow relations. This step helps mitigate the interference caused by these irrelevant parts during the model feature learning process. Additionally, we extract the API sequence surrounding the recommendation point to provide supplementary knowledge for the model learning. The experimental results demonstrate our proposed approach achieving an average mean reciprocal rank (MRR) of 68.02%, outperforming the baselines' performance. Furthermore, through ablation experiments, we explore the effectiveness of our proposed code representation approach. The results indicate that combining pa-AST with the API sequence yields improved performance compared with using them individually. Moreover, our AST augmentation and pruning techniques significantly contribute to the overall results.</p>\",\"PeriodicalId\":48898,\"journal\":{\"name\":\"Journal of Software-Evolution and Process\",\"volume\":\"36 8\",\"pages\":\"\"},\"PeriodicalIF\":1.7000,\"publicationDate\":\"2024-03-03\",\"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.2658\",\"RegionNum\":4,\"RegionCategory\":\"计算机科学\",\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"Q3\",\"JCRName\":\"COMPUTER SCIENCE, SOFTWARE ENGINEERING\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Journal of Software-Evolution and Process","FirstCategoryId":"94","ListUrlMain":"https://onlinelibrary.wiley.com/doi/10.1002/smr.2658","RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q3","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
引用次数: 0

摘要

应用编程接口(API)推荐通过为开发人员提供特定推荐点的候选 API 排名列表,在促进智能合约开发方面发挥着至关重要的作用。基于深度学习的方法在这一领域取得了可喜的成果。然而,现有方法主要依靠标记序列或抽象语法树(AST)来学习推荐点相关特征,这可能会忽略语句之间或语句内部关系中隐含的基本知识,并可能在特征学习过程中包含与任务无关的成分。为了解决这些局限性,我们提出了一种名为 "剪枝增强语法树"(pa-AST)的新型代码图。我们的方法通过纳入从智能合约代码中语句之间和语句内部的控制和数据流关系中获得的额外知识来增强 AST。通过这种增强,pa-AST 可以更好地表示代码的语义特征。此外,我们还根据确定的流程关系进行 AST 修剪,以消除与任务无关的组件。这一步骤有助于减轻模型特征学习过程中这些无关部分造成的干扰。此外,我们还提取了推荐点周围的 API 序列,为模型学习提供补充知识。实验结果表明,我们提出的方法实现了 68.02% 的平均倒数等级 (MRR),优于基准性能。此外,通过消融实验,我们探索了我们提出的代码表示方法的有效性。结果表明,将 pa-AST 与 API 序列相结合比单独使用它们性能更高。此外,我们的 AST 增强和剪枝技术也为整体结果做出了重大贡献。
本文章由计算机程序翻译,如有差异,请以英文原文为准。

Application programming interface recommendation for smart contract using deep learning from augmented code representation

Application programming interface recommendation for smart contract using deep learning from augmented code representation

Application programming interface (API) recommendation plays a crucial role in facilitating smart contract development by providing developers with a ranked list of candidate APIs for specific recommendation points. Deep learning-based approaches have shown promising results in this field. However, existing approaches mainly rely on token sequences or abstract syntax trees (ASTs) for learning recommendation point-related features, which may overlook the essential knowledge implied in the relations between or within statements and may include task-irrelevant components during feature learning. To address these limitations, we propose a novel code graph called pruned and augmented AST (pa-AST). Our approach enhances the AST by incorporating additional knowledge derived from the control and data flow relations between and within statements in the smart contract code. Through this augmentation, the pa-AST can better represent the semantic features of the code. Furthermore, we conduct AST pruning to eliminate task-irrelevant components based on the identified flow relations. This step helps mitigate the interference caused by these irrelevant parts during the model feature learning process. Additionally, we extract the API sequence surrounding the recommendation point to provide supplementary knowledge for the model learning. The experimental results demonstrate our proposed approach achieving an average mean reciprocal rank (MRR) of 68.02%, outperforming the baselines' performance. Furthermore, through ablation experiments, we explore the effectiveness of our proposed code representation approach. The results indicate that combining pa-AST with the API sequence yields improved performance compared with using them individually. Moreover, our AST augmentation and pruning techniques significantly contribute to the overall results.

求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
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学术文献互助群
群 号:481959085
Book学术官方微信