Skip to content

Back to the catalog

Enhancing LLM-Based Vulnerability Detection via Representation-Aware Logical Ensemble
arxiv.orgpaper

Enhancing LLM-Based Vulnerability Detection via Representation-Aware Logical Ensemble

RALE (Representation-Aware Logical Ensemble) is a method for detecting vulnerabilities in C source code with LLMs trained on different code representations: raw source, Abstract Syntax Trees and Control Flow Graphs. The authors show the representations suit different vulnerability classes, and combine the models with explicit logical rules and majority voting. Single-representation models reach up to 73% F1, while the ensemble reaches 78%.

TL;DR Combines LLMs trained on source, AST and CFG views of C code with logical rules and voting, lifting vulnerability-detection F1 from 73% to 78%.
Also seen from another angle🧠 AI →
Document

What it is

RALE (Representation-Aware Logical Ensemble) is a C/C++ function-level vulnerability detector from Grasso, Liguori, Natella and Cotroneo (arXiv 2610.33756v1, 24 October 2026). It combines separately fine-tuned classifiers for raw source, AST and CFG views. The abstract reports 73% F1 for the best single model and 78% for the ensemble.

How it works

  • Data: MegaVul, which has 17,380 vulnerable and 322,168 non-vulnerable functions from 992 open-source repositories, covering 169 CWE types. Joern supplies the ASTs and CFGs. The authors also regenerated ASTs with Clang. They used Joern only for CFGs, because Clang's CFG extraction needs a full translation unit and the setup works on isolated functions.
  • Input format: Graphs are converted to adjacency lists. Each node carries a type label, an operation name and a code snippet. Two variants were tested: "Complete" keeps operation names and snippets, and "Structural" keeps only node types and topology. Source code was stripped of comments and preprocessor directives.
  • Models: CodeT5 220M (encoder only), CodeBERT 125M and CodeGPT 124M, each with a classification head. That gives 21 experiments (three models, seven representations, no Clang CFG), plus a traditional static analyzer as a baseline.
  • Training: An 88/6/6 train, validation and test split, with early stopping when validation loss rises.
  • Ensemble: Predictions from independently trained models are combined with explicit logical rules and majority voting. The authors chose the rules to reduce missed vulnerabilities while keeping robustness on non-vulnerable samples. The rules were motivated by per-CWE differences: some representations do consistently better on particular vulnerability classes.
flowchart LR
  F[C function] --> S[Source model]
  F --> A[AST model]
  F --> C[CFG model]
  S --> R[Logical rules + majority vote]
  A --> R
  C --> R
  R --> V[Vulnerable / not]

Preconditions / Affected

  • Function-level C/C++ input only.
  • Joern is needed to produce CFGs for partial code.
  • Training fit on a GTX 1660 with 6 GB VRAM and 32 GB RAM, so the small models need modest hardware.

Caveats

  • The 78% figure comes from a 50/50 balanced dataset. The authors chose this after testing other splits (Appendix A) and say it deviates from real-world distributions, where vulnerable functions may be around 5%. MegaVul itself is about 5% vulnerable. Precision at realistic base rates is not reported in the text available.
  • The test set is 6% of the balanced data, and the text shows no variance or repeated runs.
  • The fetched text cuts off at Table 2. The exact logical rules, per-CWE results and the numbers for the static-analysis baseline were not available, so they are not described here.
  • The introduction says "up to 78% accuracy and F1-score", which is a slightly different claim from the abstract's "commensurate gains".

Organisations named here

  • Abstract Syntax Tree
  • Control Flow Graph
  • RALE
  • Representation-Aware Logical Ensemble

Technologies named here

  • C source code
  • Large Language Models
  • Traditional static analysis tools
  • LLM
  • C