SmartBERT V3 is a domain-adapted pre-trained programming language model for smart contract code understanding, built upon CodeBERT-base-mlm.
The model is further trained on SmartBERT V2 with a substantially larger corpus of smart contracts, enabling improved robustness and richer semantic representations of function-level smart contract code.
SmartBERT V3 is particularly suitable for tasks such as:
Smart contract intent detection
Code representation learning
Code similarity analysis
Vulnerability detection
Smart contract classification
Compared with SmartBERT V2, this version significantly expands the training corpus and improves the model’s ability to capture semantic patterns in smart contract functions.
Training Data
SmartBERT V3 was trained on a total of 80,000 smart contracts, including:
64,000 additional smart contracts collected from public blockchain repositories
All contracts are primarily written in Solidity and processed at the function level to better capture fine-grained semantic structures of smart contract code.
Training Objective
The model is trained using the Masked Language Modeling (MLM) objective, following the same training paradigm as CodeBERT.
During training:
A subset of tokens in the input code is randomly masked
The model learns to predict these masked tokens from surrounding context
This process enables the model to learn deeper syntactic and semantic representations of smart contract programs.
Training Setup
Training was conducted using the HuggingFace Transformers framework.
During preprocessing, all newline (\n) and tab (\t) characters in the function code were replaced with a single space to ensure a consistent input format for tokenization.
1@article{huang2025smart,
2 title={Smart Contract Intent Detection with Pre-trained Programming Language Model},
3 author={Huang, Youwei and Li, Jianwen and Fang, Sen and Li, Yao and Yang, Peng and Hu, Bin},
4 journal={arXiv preprint arXiv:2508.20086},
5 year={2025}6}