A LoRA fine-tunedLlama 3.2 3B model for decompiling EVM smart contract bytecode into human-readable Solidity source code.
This model implements the methodology from "Decompiling Smart Contracts with a Large Language Model" (arXiv:2506.19624v1).
Overview
Traditional decompilers (Panoramix, Heimdall) produce low-level, hard-to-read output with 0.4–0.5 semantic similarity to original source. This model achieves 0.82 semantic similarity by combining deterministic static analysis with neural code generation in a two-stage pipeline:
Bytecode → TAC — Static analysis converts raw EVM bytecode into a Three-Address Code (TAC) intermediate representation (control flow graph, basic blocks, jump targets, function selectors).
TAC → Solidity — This fine-tuned LLM generates readable Solidity from the TAC representation.
Source: Ethereum mainnet verified contracts fetched via the Etherscan API
Format: JSONL with bytecode, tac, and solidity fields
Pipeline: Bytecode is fetched → converted to TAC via BytecodeAnalyzer (static analysis with control flow, basic blocks, dominance analysis, loop detection) → paired with the verified Solidity source
Size: 95 examples (85 train / 10 validation) from the demo dataset
Training Configuration
Parameter
Value
Epochs
3
Batch Size (per device)
1
Gradient Accumulation Steps
8
Effective Batch Size
8
Optimizer
AdamW (8-bit via bitsandbytes)
Learning Rate
2×10⁻⁴
LR Scheduler
Cosine
Warmup Steps
3
Weight Decay
0.01
Max Gradient Norm
1.0
FP16
Yes
Gradient Checkpointing
Yes
Training Results
Metric
Value
Final Training Loss
0.6553
Training Duration
~31 minutes
Total Optimization Steps
285
Hardware
NVIDIA RTX 4080 (16 GB VRAM)
Training Date
July 4, 2025
Evaluation Metrics
Metric
Target
Description
Semantic Similarity
> 0.80
CodeBERT embedding cosine similarity
Edit Distance
< 0.40
Normalized Levenshtein distance
Success Rate
> 78%
Percentage of functions exceeding similarity threshold
If you use this model, please cite the underlying research paper:
bibtex
1@article{david2025decompiling,
2 title={Decompiling Smart Contracts with a Large Language Model},
3 author={David, Sifei and Zhou, Zhiyu and Song, Xuan and Gervais, Arthur and Qin, Benjamin},
4 journal={arXiv preprint arXiv:2506.19624v1},
5 year={2025}
6}