Abstract
Syntax Tree (AST). Nevertheless, like most literatures using NLM in code defect prediction, the S-gram only adopted one kind of tokenization standard in sequences generation, leading to the ignorance of some semantic contexts within a restricted sequence length. In this paper, we propose an improved model, namely MultiSemantic gram (MSgram), based on the S-gram to further boost its performance by analyzing sequences of multiple semantics. Basically, for each smart contract, we generate sequences in three ways for the multi-semantic purpose: 1) Text sequence covering only text information, i.e. only focus on leaf nodes in AST when tokenization 2) Structure sequences covering only structure information, i.e. only focus on non-leaf nodes in AST when tokenization 3) Combined sequences covering both structure and text information of a smart contract, i.e. a completely AST representation. For the part of constructing the sequences of structure, text and combined version, we modified the SBT Traversal proposed by Hu et al. [7] to make it more general in sequence extraction and fused the characteristic of type-based tokenization of S-gram, thereby to make the tokenizer focus mainly on Ethereum smart contracts. Since each kind of sequence represent a kind of semantic, for their different tokens combinations and permutations, thus the analysis on different kind of sequence will capture different information. As such, we feed each kind of sequence into their corresponding trained NLMs respectively to capture their individual semantic and thereby to obtain separate audited results. For each smart contract, we can get three audited results Abstract-Smart contracts vulnerability auditing is vitally critical to ensure transaction execution in normal on blockchain. The current data-driven approaches normally tokenize smart contracts into a series of sequences according to only one tokenization standard for vulnerability detection purpose, resulting some of the semantic contexts could not be reflected within restricted sequence length. To address this limitation, we generate sequences from smart contracts in three tokenization standards for which we utilize ngram language model