All projects

02 / Applied security ML

Smart Contract Vulnerability Detection

A transformer-based static analysis system designed to classify vulnerability patterns directly from Solidity source code.

99.96%
Training accuracy
CodeBERT
Pretrained encoder
Multi-class
Classification
Solidity
Target language

The challenge

Problem & approach

Manual smart contract audits are expensive and difficult to scale. This pipeline learns contextual code representations to flag likely vulnerabilities earlier in development, prioritizing contracts and code regions for expert review rather than replacing security auditors.

PyTorchHugging FaceCodeBERTSolidityTransformers

MODEL EVALUATION

Training performance

99.96%
TRAINING ACCURACY
CodeBERT
ENCODER
Solidity
SOURCE
Multi-class
OBJECTIVE
PyTorch
RUNTIME

The displayed accuracy is the supplied training result; production assessment would additionally report held-out precision, recall, F1, and class-level error analysis.

System architecture

01

Normalize

Clean Solidity source while retaining security-relevant syntax and structural cues.

02

Tokenize

Encode contracts with CodeBERT’s code-aware tokenizer and bounded sequences.

03

Fine-tune

Train a classification head in PyTorch over contextual transformer embeddings.

04

Evaluate

Track accuracy and class-level behavior to surface likely vulnerability families.

Next case study

ESRGAN Image Enhancer

View project