Semantic code search technology allows searching for existing code snippets through natural language, which can greatly improve programming efficiency. Smart contracts, programs that run on the blockchain, have a code reuse rate of more than 90%, which means developers have a great demand for semantic code search tools. However, the existing code search models still have a semantic gap between code and query, and perform poorly on specialized queries of smart contracts. In this paper, we propose a Multi-Modal Smart contract Code Search (MM-SCS) model. Specifically, we construct a Contract Elements Dependency Graph (CEDG) for MM-SCS as an additional modality to capture the data-flow and control-flow information of the code. To make the model more focused on the key contextual information, we use a multi-head attention network to generate embeddings for code features. In addition, we use a fine-tuned pretrained model to ensure the model's effectiveness when the training data is small. We compared MM-SCS with four state-of-the-art models on a dataset with 470K (code, docstring) pairs collected from Github and Etherscan. Experimental results show that MM-SCS achieves an MRR (Mean Reciprocal Rank) of 0.572, outperforming four state-of-the-art models UNIF, DeepCS, CARLCS-CNN, and TAB-CS by 34.2%, 59.3%, 36.8%, and 14.1%, respectively. Additionally, the search speed of MM-SCS is second only to UNIF, reaching 0.34s/query.


翻译:语义代码搜索技术允许通过自然语言搜索现有的代码片断,这可以大大提高编程效率。智能合同,在块链上运行的程序,其代码再利用率超过90%,这意味着开发者对语义代码搜索工具的需求很大。然而,现有的代码搜索模型在代码和查询之间仍然存在着语义差距,在智能合同的专门查询方面表现不佳。在本文中,我们提议了一个多模式智能合同代码搜索模式(MM-SSCS),具体地说,我们为MM-SCS建立了一个合同要素依赖性图(CEDG),作为捕获代码数据流和控制流信息的附加方式。为了使模型更加侧重于关键背景信息,我们使用多点关注网络生成代码特征的嵌入。此外,我们使用一个经过精细调整的预先培训模型,以确保模型在培训数据小时的有效性。我们用MM-SSCS与四个州级的CSFS-l3级模型进行了比较。我们用470K(代码, docretaminal AS-RAFS) 和四个州级的IMS-CS-CS-CS-CS-CS-CS-CS-CS-CFM-CS-CS-CS-CS-CFM-CFM-CRB-CS-CFM-CFM-CFM-CFM-CS-CS-CM-CR-CR-CR-CR-CM-CM-CR-CR-CFM-CR-CR-CR-CR-CFM-CM-CR-CR-CR-CR-CR-CM-CM-CM-R-C-C-CR-CR-CM-CM-CM-CR-CR-CM-CR-CR-CR-CR-CR-CFMDRBAR-CR-CR-CR-CR-CR-CR-CR-CR-CR-CR-CR-CR-CR-CR-CR-CR-CR-CR-CR-CR-C-C-C-C-C

0
下载
关闭预览

相关内容

ACM/IEEE第23届模型驱动工程语言和系统国际会议,是模型驱动软件和系统工程的首要会议系列,由ACM-SIGSOFT和IEEE-TCSE支持组织。自1998年以来,模型涵盖了建模的各个方面,从语言和方法到工具和应用程序。模特的参加者来自不同的背景,包括研究人员、学者、工程师和工业专业人士。MODELS 2019是一个论坛,参与者可以围绕建模和模型驱动的软件和系统交流前沿研究成果和创新实践经验。今年的版本将为建模社区提供进一步推进建模基础的机会,并在网络物理系统、嵌入式系统、社会技术系统、云计算、大数据、机器学习、安全、开源等新兴领域提出建模的创新应用以及可持续性。 官网链接:http://www.modelsconference.org/
【干货书】人工智能自动驾驶,AI FOR CARS,129页pdf
专知会员服务
99+阅读 · 2021年12月27日
专知会员服务
44+阅读 · 2020年10月31日
100+篇《自监督学习(Self-Supervised Learning)》论文最新合集
专知会员服务
163+阅读 · 2020年3月18日
Stabilizing Transformers for Reinforcement Learning
专知会员服务
57+阅读 · 2019年10月17日
Keras François Chollet 《Deep Learning with Python 》, 386页pdf
专知会员服务
149+阅读 · 2019年10月12日
开源书:PyTorch深度学习起步
专知会员服务
50+阅读 · 2019年10月11日
最新BERT相关论文清单,BERT-related Papers
专知会员服务
52+阅读 · 2019年9月29日
DAI2020 SMARTS 自动驾驶挑战赛(深度强化学习)
深度强化学习实验室
15+阅读 · 2020年8月15日
Hierarchically Structured Meta-learning
CreateAMind
24+阅读 · 2019年5月22日
人工智能 | 中低难度国际会议信息6条
Call4Papers
3+阅读 · 2019年4月3日
Facebook PyText 在 Github 上开源了
AINLP
7+阅读 · 2018年12月14日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
《pyramid Attention Network for Semantic Segmentation》
统计学习与视觉计算组
44+阅读 · 2018年8月30日
Hierarchical Imitation - Reinforcement Learning
CreateAMind
19+阅读 · 2018年5月25日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
carla 学习笔记
CreateAMind
9+阅读 · 2018年2月7日
强化学习 cartpole_a3c
CreateAMind
9+阅读 · 2017年7月21日
Arxiv
5+阅读 · 2020年10月22日
Arxiv
5+阅读 · 2019年8月22日
VIP会员
相关VIP内容
【干货书】人工智能自动驾驶,AI FOR CARS,129页pdf
专知会员服务
99+阅读 · 2021年12月27日
专知会员服务
44+阅读 · 2020年10月31日
100+篇《自监督学习(Self-Supervised Learning)》论文最新合集
专知会员服务
163+阅读 · 2020年3月18日
Stabilizing Transformers for Reinforcement Learning
专知会员服务
57+阅读 · 2019年10月17日
Keras François Chollet 《Deep Learning with Python 》, 386页pdf
专知会员服务
149+阅读 · 2019年10月12日
开源书:PyTorch深度学习起步
专知会员服务
50+阅读 · 2019年10月11日
最新BERT相关论文清单,BERT-related Papers
专知会员服务
52+阅读 · 2019年9月29日
相关资讯
DAI2020 SMARTS 自动驾驶挑战赛(深度强化学习)
深度强化学习实验室
15+阅读 · 2020年8月15日
Hierarchically Structured Meta-learning
CreateAMind
24+阅读 · 2019年5月22日
人工智能 | 中低难度国际会议信息6条
Call4Papers
3+阅读 · 2019年4月3日
Facebook PyText 在 Github 上开源了
AINLP
7+阅读 · 2018年12月14日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
《pyramid Attention Network for Semantic Segmentation》
统计学习与视觉计算组
44+阅读 · 2018年8月30日
Hierarchical Imitation - Reinforcement Learning
CreateAMind
19+阅读 · 2018年5月25日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
carla 学习笔记
CreateAMind
9+阅读 · 2018年2月7日
强化学习 cartpole_a3c
CreateAMind
9+阅读 · 2017年7月21日
Top
微信扫码咨询专知VIP会员