Smart contract classification holds significant application value in the field of blockchain. However, existing methods suffer from inefficiencies and high computational complexity when dealing with smart contract data. To address these issues, this paper proposes a cluster-BERT model based on neural clustering techniques. The model reduces the computational burden of self-attention mechanisms by clustering attention heads, thereby improving training efficiency. The cluster-BERT model comprises multiple modules. Module 1 preprocesses smart contract data, converting abstract syntax trees and graph structure features into text representations suitable for BERT models. Module 2 serves as the core of the model, introducing neural clustering methods to reduce computational complexity. Module 3 further optimizes the model by finding the optimal number of centroids, achieving a balance between training efficiency and classification accuracy. Experimental results show that our proposed cluster-BERT achieves an accuracy of 91.42%, a recall of 91.44%, and an F1 score of 91.43%, which indicates a noticeable improvement over the baseline model. Our model reduces computational complexity from quadratic to linear, resulting in an average reduction of 8.48% in training time and 7.88% in prediction time compared to the baseline model. On the smart contract dataset, the accuracy and precision of our model outperformed other models proposed in recent years by 1–2 percentage points on average.
扫码关注我们
求助内容:
应助结果提醒方式:
