LLAMA: Multi-Feedback Smart Contract Fuzzing Framework With LLM-Guided Seed Generation

Keke Gai, Haochen Liang, Jing Yu, Liehuang Zhu, Dusit Niyato

TL;DR

LLAMA is a novel fuzzing framework that uses Large Language Models (LLMs) to generate "smart" initial test seeds and a multi-feedback loop to optimize the entire testing process. By combining semantic-aware seed generation with selective symbolic execution, it achieves 91% instruction coverage and detects nearly 90% of known vulnerabilities, significantly outperforming current state-of-the-art tools.

What Problem Does This Paper Address?

Smart contracts are self-executing code on blockchains. Because they are immutable once deployed, a single bug can lead to permanent financial loss (like the infamous DAO hack). Fuzzing—a technique that hammers code with random inputs to find crashes—is a popular security tool, but it faces three major hurdles in the blockchain world:

  1. Low-Quality Seeds: Traditional fuzzers use random or rule-based inputs that often fail to get past basic "guards" in the code, missing deeper logic.
  2. Ineffective Mutations: Most tools use a single feedback signal (like code coverage) to tweak inputs, which isn't enough to navigate complex contract states.
  3. Resource Exhaustion: "Hybrid" fuzzers use symbolic execution (a heavy mathematical approach) to solve complex code paths, but this is often too slow and memory-intensive for practical use.

Methods

The authors introduce LLAMA (Multi-feedback Smart Contract Fuzzing), which consists of three core modules:

  • LLM-Based Seed Generation (LSG): Instead of random bytes, LLAMA uses a hierarchical prompting strategy. It asks an LLM to first abstract the contract's function, infer valid transaction sequences, and then optimize those sequences to target edge cases (like reentrancy). It includes a "pre-fuzzing" phase to rank and select only the highest-potential seeds.
  • Multi-Feedback Optimization Strategy (MOS): Unlike tools that only look at coverage, LLAMA tracks three signals: Branch coverage, Instruction coverage, and Read-After-Write (RAW) dependencies. This allows the fuzzer to understand how different transactions affect the contract's internal state over time.
  • Hybrid Fuzzing Engine (HFE): This engine uses an evolutionary algorithm to mutate inputs. Crucially, it employs selective symbolic execution. It only triggers the "heavy" mathematical solver when the fuzzer hits a plateau (stagnation), saving massive amounts of CPU and memory.

Datasets

The researchers evaluated LLAMA using four distinct datasets:

  • Dataset 1: 21,147 contracts (17,803 small-scale, 3,344 large-scale) used to measure broad code coverage.
  • Dataset 2: 136 contracts containing 148 annotated vulnerabilities across ten categories (e.g., Reentrancy, Integer Overflow) to test detection accuracy.
  • Dataset 3 & 4: Curated sets of 155 and 600 contracts used for ablation studies and component validation. These datasets include real-world contracts and benchmarks from established tools like ConFuzzius and MuFuzz.

Key Insights and Ideas

  • LLMs as Semantic Guides: The "aha moment" here is that LLMs understand the intent of code. While a random fuzzer might never guess that a specific sequence of "Deposit -> Lock -> Withdraw" is needed to trigger a bug, an LLM can infer this sequence from the function names and logic.
  • The Power of Multi-Feedback: By tracking RAW dependencies, LLAMA recognizes when a mutation successfully changes a storage variable that influences future execution. This "state-aware" feedback is much more effective for smart contracts than simple code coverage.
  • Efficiency through Stagnation-Triggering: Instead of running symbolic execution constantly, LLAMA treats it as a "breakout" tool. If coverage hasn't improved by 1% over five generations, it calls in the heavy hitters to solve the specific path constraint blocking progress.

Key Results

LLAMA was compared against top-tier fuzzers like sFuzz, ConFuzzius, and ILF:

  • Superior Coverage: It achieved 91% instruction coverage and 90% branch coverage on small-scale contracts. Even on complex, large-scale contracts, it maintained a significant lead over competitors.
  • High Detection Rate: It detected 132 out of 148 known vulnerabilities (89% detection rate). For comparison, the next best tool, ConFuzzius, detected 71%.
  • Zero False Positives: In several categories like Integer Overflow and Reentrancy, LLAMA achieved 100% detection accuracy with zero false positives.
  • Resource Efficiency: Despite using LLMs for setup, the runtime resource consumption (CPU/Memory) was kept low due to the selective use of symbolic execution.

Limitations and Future Work

  • LLM Dependency: The quality of the initial seeds depends on the LLM's capability. While the paper uses a hierarchical approach to mitigate this, very obscure or highly obfuscated code might still baffle the generator.
  • Prompt Complexity: While the "Behavior-Guided Prompt Injection" helps, the framework still relies on a predefined pool of natural language hints.
  • Future Directions: The authors suggest exploring more granular feedback mechanisms and potentially fine-tuning smaller, specialized LLMs specifically for Solidity (the primary smart contract language) to further reduce the overhead of using general-purpose models.

Summary updated

BibTeX
@article{gai2026llama,
  author = {Keke Gai and Haochen Liang and Jing Yu and Liehuang Zhu and Dusit Niyato},
  title = {{LLAMA: Multi-Feedback Smart Contract Fuzzing Framework With LLM-Guided Seed Generation}},
  journal = {IEEE Trans. Inf. Forensics Secur.},
  year = {2026},
  doi = {10.1109/tifs.2026.3666859},
}
Figure