DMG: Dual-Stream multiple instance learning network for hunting vulnerable smart contracts via adaptive granularity fusion

IF 3.9 2区 计算机科学 Q3 COMPUTER SCIENCE, SOFTWARE ENGINEERING
Na Wang, Kun Zhang, Moroti Sonde, Victor S. Sheng
{"title":"DMG: Dual-Stream multiple instance learning network for hunting vulnerable smart contracts via adaptive granularity fusion","authors":"Na Wang,&nbsp;Kun Zhang,&nbsp;Moroti Sonde,&nbsp;Victor S. Sheng","doi":"10.1007/s10515-026-00687-w","DOIUrl":null,"url":null,"abstract":"<div><p>With the increasing complexity of smart contracts and the increasing number of vulnerabilities in real-world scenarios, ensuring smart contract security has become a critical challenge. Despite various detection methods being proposed, existing approaches primarily trained on synthetic (toy) contracts with oversimplified semantics exhibit limited generalization to deployment environments. Furthermore, their reliance on predefined patterns or single-perspective representations with fixed granularity, such as token sequences or control-flow graphs, limits their ability to capture the hierarchical structures and cross-functional dependencies of complex contracts. To this end, we propose a novel Dual-stream Multi-instance and Granularity Fusion Network (DMG). It is designed to capture the structural complexity of real-world contracts while maintaining effectiveness in simpler contracts, thereby ensuring both adaptability and practical relevance. Specifically, DMG learns representations at both the block-level and the function-level from bytecode with relatively structured dispatch organization. Then, it uses Bi-LSTM and a Multi-Head Attention mechanism to model block-level sequential dependencies and capture coarse-grained contextual relationships. Finally, it introduces a granularity-aware fusion mechanism to adaptively integrate both views, releasing the assumption of fixed granularity and enabling the model to learn the most informative representation under weak supervision. By integrating hierarchical granularity modeling with instance-level learning, DMG shifts from fixed to adaptive granularity, enabling structured and semantically aligned vulnerability analysis. Extensive experiments on toy and real-world datasets demonstrate strong performance, and compared with state-of-the-art methods, DMG delivers a balanced solution that bridges the gap between experimental settings and real-world applicability.</p></div>","PeriodicalId":55414,"journal":{"name":"Automated Software Engineering","volume":"33 4","pages":""},"PeriodicalIF":3.9000,"publicationDate":"2026-10-16","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"https://link.springer.com/content/pdf/10.1007/s10515-026-00687-w.pdf","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Automated Software Engineering","FirstCategoryId":"94","ListUrlMain":"https://link.springer.com/article/10.1007/s10515-026-00687-w","RegionNum":2,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q3","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
引用次数: 0

Abstract

With the increasing complexity of smart contracts and the increasing number of vulnerabilities in real-world scenarios, ensuring smart contract security has become a critical challenge. Despite various detection methods being proposed, existing approaches primarily trained on synthetic (toy) contracts with oversimplified semantics exhibit limited generalization to deployment environments. Furthermore, their reliance on predefined patterns or single-perspective representations with fixed granularity, such as token sequences or control-flow graphs, limits their ability to capture the hierarchical structures and cross-functional dependencies of complex contracts. To this end, we propose a novel Dual-stream Multi-instance and Granularity Fusion Network (DMG). It is designed to capture the structural complexity of real-world contracts while maintaining effectiveness in simpler contracts, thereby ensuring both adaptability and practical relevance. Specifically, DMG learns representations at both the block-level and the function-level from bytecode with relatively structured dispatch organization. Then, it uses Bi-LSTM and a Multi-Head Attention mechanism to model block-level sequential dependencies and capture coarse-grained contextual relationships. Finally, it introduces a granularity-aware fusion mechanism to adaptively integrate both views, releasing the assumption of fixed granularity and enabling the model to learn the most informative representation under weak supervision. By integrating hierarchical granularity modeling with instance-level learning, DMG shifts from fixed to adaptive granularity, enabling structured and semantically aligned vulnerability analysis. Extensive experiments on toy and real-world datasets demonstrate strong performance, and compared with state-of-the-art methods, DMG delivers a balanced solution that bridges the gap between experimental settings and real-world applicability.

Abstract Image

DMG:双流多实例学习网络,通过自适应粒度融合寻找易受攻击的智能合约
随着智能合约越来越复杂,现实场景中的漏洞越来越多,确保智能合约的安全已成为一项关键挑战。尽管提出了各种各样的检测方法,但是主要训练在语义过于简化的合成(玩具)契约上的现有方法对部署环境的泛化程度有限。此外,它们依赖于预定义的模式或具有固定粒度的单视角表示,例如令牌序列或控制流图,这限制了它们捕捉复杂契约的层次结构和跨功能依赖关系的能力。为此,我们提出了一种新的双流多实例和粒度融合网络(DMG)。它旨在捕捉现实世界契约的结构复杂性,同时保持简单契约的有效性,从而确保适应性和实际相关性。具体来说,DMG从具有相对结构化调度组织的字节码中学习块级和函数级的表示。然后,它使用Bi-LSTM和Multi-Head Attention机制来建模块级顺序依赖并捕获粗粒度的上下文关系。最后,引入粒度感知融合机制自适应整合两种视图,摆脱了固定粒度的假设,使模型能够在弱监督下学习到最具信息量的表示。通过将分层粒度建模与实例级学习集成在一起,DMG从固定粒度转变为自适应粒度,支持结构化和语义一致的漏洞分析。在玩具和现实世界数据集上进行的广泛实验显示出强大的性能,与最先进的方法相比,DMG提供了一个平衡的解决方案,弥合了实验设置和现实世界适用性之间的差距。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
Automated Software Engineering
Automated Software Engineering 工程技术-计算机:软件工程
CiteScore
4.80
自引率
11.80%
发文量
51
审稿时长
>12 weeks
期刊介绍: This journal details research, tutorial papers, survey and accounts of significant industrial experience in the foundations, techniques, tools and applications of automated software engineering technology. This includes the study of techniques for constructing, understanding, adapting, and modeling software artifacts and processes. Coverage in Automated Software Engineering examines both automatic systems and collaborative systems as well as computational models of human software engineering activities. In addition, it presents knowledge representations and artificial intelligence techniques applicable to automated software engineering, and formal techniques that support or provide theoretical foundations. The journal also includes reviews of books, software, conferences and workshops.
×
引用
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学术官方微信
小红书