Manuscript Offprint

arXiv:2610.34431

SymLift: Neural Semantic Lifting for Compile-Free Vulnerability Detection in Context-Incomplete Code Fragments

Xiarun Chen, Jiaxing Xu, Bozhi Wu, Chenhui Cui, Chunrong Fang, Weiping Wen, Tao Li, Rubing Huang, Tsong Yueh Chen

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Xiarun Chen, Jiaxing Xu, Bozhi Wu, Chenhui Cui, Chunrong Fang Member, IEEE, Weiping Wen, Tao Li, Rubing Huang, Senior Member, IEEE, Tsong Yueh Chen, IEEE Fellow, IEEE

Abstract—Vulnerability detection is increasingly performed on context-incomplete code fragments, such as code generated by large language models (LLMs) and individual functions extracted from larger repositories. Missing project context can prevent build-dependent analyzers from constructing the control-flow or data-flow relations required for vulnerability detection. Learning-based detectors and LLMs used directly as vulnerability detectors can analyze such fragments, but their predictions alone do not establish an auditable derivation from explicit program relations. To enable auditable vulnerability detection without requiring the input to compile, we present SYMLIFT, a framework centered on Vulnerability-Oriented Neural Semantic Lifting. SYMLIFT uses a neural lifter to reconstruct vulnerability-relevant control-flow, data-flow, memory, and resource relations in a constrained LLVM-like intermediate representation (IR), without reconstructing the full project context or predicting vulnerability labels directly. A deterministic parser validates the IR and maps its supported operations and relations into normalized evidence facts. A Datalog engine applies explicit vulnerability rules to derive findings with supporting facts and derivation traces. SYMLIFT keeps vulnerability reasoning deterministic for fixed facts and rules. We conduct experiments on FormAI, Juliet, and MegaVul. When complete Juliet programs are reduced to function-level fragments, the Clang compilation success rate drops from 100% to 12.00%, whereas SYMLIFT's analysis completion rate decreases by only 1.17 percentage points. After task-specific fine-tuning, the neural lifter achieves a control-flow intersection over union (IoU) of 96.85% on FormAI. The task-fine-tuned SYMLIFT-Qwen-7B configuration achieves a Target-F1 of 94.41% on FormAI and, across six vulnerability families on MegaVul, a micro-averaged precision of 98.24% and a micro-averaged Target-F1 of 91.66%. Overall, vulnerability-oriented neural semantic lifting supports accurate and auditable detection in the evaluated context-incomplete settings, even when the reconstructed program relations are partial.

Index Terms—Vulnerability detection, LLM, static analysis,

symbolic reasoning

I. INTRODUCTION

VULNERABILITY analysis increasingly encounters code fragments that must be assessed without their project context. For example, functions generated by large language models (LLMs) may contain security vulnerabilities and lack necessary defensive checks [1–4]. Recent studies report security weaknesses in C/C++ generation [5] and code from developer–LLM interactions [6]. When these outputs are analyzed in isolation, context required for vulnerability analysis may be unavailable [7]. Similarly, individual functions extracted from larger repositories [8, 9] may be analyzed without their original project context. These fragments can be context-incomplete even if they are syntactically valid and can compile independently [10, 11]. We refer to code fragments that lack some context required for conventional program analysis as context-incomplete code fragments.

Traditional static analyzers derive vulnerability-relevant evidence from typed abstract syntax trees (ASTs), control-flow graphs (CFGs), and definition-use relations [12–14]. When context is missing, compilers may fail to construct these representations, while tolerant parsers may recover only partial syntactic structure [15]. However, recovering an AST alone does not ensure that relations required by vulnerability rules can be recovered. We refer to the mismatch between available source code and the recovery of program relations needed for downstream vulnerability detection as the compilation gap. Under missing context, this gap can manifest as failed relation construction, incomplete recovery, or structural divergence from representations obtained with more complete context.

Xiarun Chen, Jiaxing Xu, and Weiping Wen are with Peking University, Beijing 100191, China (e-mail: jxxu25@stu.pku.edu.cn; xiar_c@pku.edu.cn; weipingwen@pku.edu.cn).

Bozhi Wu is with Nanyang Technological University, Singapore 639798, Singapore (e-mail: bozhi001@e.ntu.edu.sg).

Chenhui Cui is with the University of Alberta, Edmonton T6G 2R3, Canada (e-mail: chenhui.cui@ualberta.ca).

Chunrong Fang is with Nanjing University, Nanjing 210023, China (e-mail: fangchunrong@nju.edu.cn).

Tao Li is with Beihang University, Beijing 100191, China (e-mail: abelli@buaa.edu.cn).

Rubing Huang is with Macau University of Science and Technology, Macao SAR 999078, China (e-mail: rbhuang@must.edu.mo).

Tsong Yueh Chen is with Swinburne University of Technology, Melbourne 3122, Australia (e-mail: tychen@swin.edu.au).

Xiarun Chen and Jiaxing Xu are co-first authors and contributed equally to this work.

Bozhi Wu and Tao Li are corresponding authors.

Learning-based vulnerability detectors can reduce compilation dependence by encoding source-code tokens, program slices, or learned graph representations [16–21]. However, their probabilistic predictions are difficult to trace to explicit program evidence [22–25], and their detection performance can degrade under realistic data distributions [26]. Moreover, LLMs have been used directly as vulnerability detectors [27–30]. Their predictions and explanations alone do not establish an auditable derivation from explicit program relations. IRIS [31] uses LLMs to infer taint specifications for project-level CodeQL reasoning. MoCQ [32] uses LLMs to generate and iteratively refine vulnerability queries executed over Joern and CodeQL representations. Their downstream reasoning still relies on analysis frontends to construct the required program representations. These limitations highlight the need to reconstruct vulnerability-relevant program representations from context-incomplete code fragments and support deterministic, auditable vulnerability reasoning.

To enable auditable vulnerability detection on context-incomplete code fragments, we propose SYMLIFT, a compile-free neuro-symbolic framework. Here, compile-free means that, at analysis time, SYMLIFT requires neither a complete build environment nor successful compilation of the input code. The core of SYMLIFT is Vulnerability-Oriented Neural Semantic Lifting, which uses a fine-tuned LLM to reconstruct vulnerability-relevant program relations in a constrained LLVM-like intermediate representation (IR). The neural lifter neither reconstructs the full project context nor directly predicts vulnerability labels.

SYMLIFT uses LLVM-like IR as the interface in a three-stage pipeline: (1) the neural lifter generates IR (Stage I); (2) a deterministic parser validates it and maps supported operations and relations into evidence facts (Stage II); and (3) SYMLIFT evaluates explicit vulnerability rules using Soufflé Datalog [33] (Stage III). Each reported vulnerability is linked to supporting facts, a matched rule, and a derivation trace.

SYMLIFT’s core semantic-lifting objective is supported by three design choices: (1) The neural lifter focuses on vulnerability-relevant relations. (2) LLVM-like IR provides a constrained semantic interface. (3) The deterministic parser and explicit rules separate neural semantic reconstruction from vulnerability judgment. The IR layer does not eliminate uncertainty in neural lifting; it makes the reconstructed relations inspectable and supports deterministic reasoning for fixed facts and rules.

We implement and evaluate SYMLIFT on FormAI, Juliet, and MegaVul [9, 34, 35]. On Juliet, reducing programs to function-level fragments lowers compilation success from 100% to 12.00%, while SYMLIFT's analysis completion drops by only 1.17 percentage points. On FormAI, SYMLIFT-Qwen7B achieves 87.83% overall relation-level intersection over union (IoU), 96.85% control-flow IoU, and 94.41% Target-F1, exceeding the strongest direct-LLM baseline, Gemini-3.5-Flash, by 24.08 percentage points. On MegaVul, it achieves 98.24% precision and 91.66% micro-averaged Target-F1.

In summary, this paper makes the following contributions:

  1. We characterize the compilation gap for context-incomplete code fragments and show that syntactic recoverability does not guarantee the availability of vulnerability-relevant control-flow and data-flow relations.

  2. We develop Vulnerability-Oriented Neural Semantic Lifting, which uses two-stage fine-tuning to reconstruct vulnerability-relevant program relations in constrained LLVM-like IR.

  3. We design a deterministic IR-to-fact parser and an explicit vulnerability-rule system that separate evidence extraction from vulnerability judgment and produce reproducible detection results with supporting facts and derivation traces for fixed input facts and rules.

  4. We implement SYMLIFT and evaluate representation availability, semantic fidelity, and vulnerability-detection effectiveness on AI-generated code, controlled context removal, and real-world CVE-related functions. 1^{1}

The remainder of this paper is organized as follows. Section II introduces the technical background. Section III illustrates the challenges of detecting vulnerabilities in context-incomplete code fragments. Section IV presents the design of SYMLIFT. Section V reports the empirical evaluation. Section VI discusses practical implications and limitations. Sections VII and VIII review related work and threats to validity, respectively. Finally, Section IX concludes the paper.

References (80)