# Detecting Malicious Intents in Smart Contracts with Pre-trained Programming Language Models

**Authors:** Youwei Huang, Jianwen Li, Bin Hu, Sen Fang, Yao Li, and Peng Yang

arXiv: 2508.20086 · 2026-04-07

## TL;DR

This paper introduces SmartIntentV2, a state-of-the-art model for detecting malicious developer intents in smart contracts, leveraging a domain-adapted BERT model and outperforming previous methods significantly.

## Contribution

The paper presents SmartIntentV2, an improved smart contract intent detection model that integrates a domain-adapted BERT-based pre-trained programming language model.

## Key findings

- SmartIntentV2 achieves an F1 score of 0.9279, outperforming previous models.
- It delivers a 65.5% relative improvement in F1 score over GPT-4.
- The model attains high accuracy, precision, and recall on real-world smart contract data.

## Abstract

Malicious developer intents in smart contracts constitute significant security threats to decentralized applications, leading to substantial economic losses. Prior work introduced SmartIntentNN, a deep learning model for detecting unsafe developer intents. By combining the Universal Sentence Encoder, a K-means clustering-based intent highlighting mechanism, and a Bidirectional Long Short-Term Memory (BiLSTM) network, the model achieved an F1 score of 0.8633 on an evaluation set of 10,000 real-world smart contracts across ten distinct intent categories.   This paper presents SmartIntentV2 (Smart Contract Intent Neural Network Version 2). The primary enhancement is the integration of a BERT-based pre-trained programming language model, which we domain-adaptively pre-train on a dataset of 16,000 real-world smart contracts using a Masked Language Modeling objective. SmartIntentV2 retains the BiLSTM-based multi-label classification network for intent detection. On the same evaluation set of 10,000 smart contracts, it achieves superior performance with an accuracy of 0.9789, precision of 0.9090, recall of 0.9476, and an F1 score of 0.9279, substantially outperforming its predecessor and other baseline models. Notably, SmartIntentV2 also delivers a 65.5% relative improvement in F1 score over GPT-4.1 on this specialized task. These results establish SmartIntentV2 as a new state-of-the-art model for smart contract intent detection.

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/2508.20086/full.md

## Figures

4 figures with captions in the complete paper: https://tomesphere.com/paper/2508.20086/full.md

## References

48 references — full list in the complete paper: https://tomesphere.com/paper/2508.20086/full.md

---
Source: https://tomesphere.com/paper/2508.20086