Table of Contents
Fetching ...

Focus on What Matters: Fisher-Guided Adaptive Multimodal Fusion for Vulnerability Detection

Yun Bian, Yi Chen, HaiQuan Wang, ShiHao Li, Zhe Cui

TL;DR

This work tackles multimodal vulnerability detection by addressing redundancy and asymmetry between Natural Code Sequences (NCS) and Code Property Graphs (CPG). It introduces TaCCS-DFA, a Fisher-information-guided fusion framework that first aligns modalities and then restricts cross-modal interaction to a task-sensitive subspace via dynamic Fisher attention, augmented by an adaptive gating mechanism. Theoretical analysis shows a tighter robustness bound under isotropic noise, and empirical results on BigVul, Devign, and ReVeal demonstrate improved F1 scores and calibration across backbones, with strong performance under class imbalance. The approach offers practical benefits by reducing noise propagation and maintaining efficiency, suggesting a scalable path for robust, interpretable multimodal vulnerability detection in real-world pipelines.

Abstract

Software vulnerability detection is a critical task for securing software systems and can be formulated as a binary classification problem: given a code snippet, determine whether it contains a vulnerability. Existing multimodal approaches typically fuse Natural Code Sequence (NCS) representations from pretrained language models with Code Property Graph (CPG) representations from graph neural networks, often under the implicit assumption that adding a modality necessarily yields extra information. In practice, sequence and graph representations can be redundant, and fluctuations in the quality of the graph modality can dilute the discriminative signal of the dominant modality. To address this, we propose TaCCS-DFA, a framework that introduces Fisher information as a geometric measure of how sensitive feature directions are to the classification decision, enabling task-oriented complementary fusion. TaCCS-DFA online estimates a low-rank principal Fisher subspace and restricts cross-modal attention to task-sensitive directions, thereby retrieving structural features from CPG that complement the sequence modality; meanwhile, an adaptive gating mechanism dynamically adjusts the contribution of the graph modality for each sample to suppress noise propagation. Our analysis shows that, under an isotropic perturbation assumption, the proposed mechanism admits a tighter risk bound than conventional full-spectrum attention. Experiments on BigVul, Devign, and ReVeal show that TaCCS-DFA achieves strong performance across multiple backbones. With CodeT5 as the backbone, TaCCS-DFA reaches an F1 score of 87.80\% on the highly imbalanced BigVul dataset, improving over a strong baseline Vul-LMGNNs by 6.3 percentage points while maintaining low calibration error and computational overhead.

Focus on What Matters: Fisher-Guided Adaptive Multimodal Fusion for Vulnerability Detection

TL;DR

This work tackles multimodal vulnerability detection by addressing redundancy and asymmetry between Natural Code Sequences (NCS) and Code Property Graphs (CPG). It introduces TaCCS-DFA, a Fisher-information-guided fusion framework that first aligns modalities and then restricts cross-modal interaction to a task-sensitive subspace via dynamic Fisher attention, augmented by an adaptive gating mechanism. Theoretical analysis shows a tighter robustness bound under isotropic noise, and empirical results on BigVul, Devign, and ReVeal demonstrate improved F1 scores and calibration across backbones, with strong performance under class imbalance. The approach offers practical benefits by reducing noise propagation and maintaining efficiency, suggesting a scalable path for robust, interpretable multimodal vulnerability detection in real-world pipelines.

Abstract

Software vulnerability detection is a critical task for securing software systems and can be formulated as a binary classification problem: given a code snippet, determine whether it contains a vulnerability. Existing multimodal approaches typically fuse Natural Code Sequence (NCS) representations from pretrained language models with Code Property Graph (CPG) representations from graph neural networks, often under the implicit assumption that adding a modality necessarily yields extra information. In practice, sequence and graph representations can be redundant, and fluctuations in the quality of the graph modality can dilute the discriminative signal of the dominant modality. To address this, we propose TaCCS-DFA, a framework that introduces Fisher information as a geometric measure of how sensitive feature directions are to the classification decision, enabling task-oriented complementary fusion. TaCCS-DFA online estimates a low-rank principal Fisher subspace and restricts cross-modal attention to task-sensitive directions, thereby retrieving structural features from CPG that complement the sequence modality; meanwhile, an adaptive gating mechanism dynamically adjusts the contribution of the graph modality for each sample to suppress noise propagation. Our analysis shows that, under an isotropic perturbation assumption, the proposed mechanism admits a tighter risk bound than conventional full-spectrum attention. Experiments on BigVul, Devign, and ReVeal show that TaCCS-DFA achieves strong performance across multiple backbones. With CodeT5 as the backbone, TaCCS-DFA reaches an F1 score of 87.80\% on the highly imbalanced BigVul dataset, improving over a strong baseline Vul-LMGNNs by 6.3 percentage points while maintaining low calibration error and computational overhead.
Paper Structure (58 sections, 1 theorem, 24 equations, 8 figures, 4 tables)

This paper contains 58 sections, 1 theorem, 24 equations, 8 figures, 4 tables.

Key Result

theorem 1

Let $L$ be the Lipschitz constant of the attention mechanism. Under the isotropic noise assumption, the output error bound of full-spectrum attention $\mathcal{F}_{\text{full}}$ is: whereas the expected error bound of TaCCS-DFA $\mathcal{F}_{\text{dfa}}$ satisfies: where $\sqrt{k/d}$ is the noise suppression factor. Since $k \ll d$, DFA substantially tightens the bound.

Figures (8)

  • Figure 1: An example of code and its code property graph. (a) A C code snippet containing a UAF vulnerability; (b) the corresponding CPG, where black solid lines denote AST edges, blue dashed lines denote CFG edges, and red dashed lines denote DDG edges. The data-dependence path reveals the causal structure of the vulnerability.
  • Figure 2: Feature space analysis. (a) The CKA similarity between NCS and CPG representations reaches 0.68, indicating substantial overlap between modalities; (b) unimodal detection performance, where RGCN’s feature extraction on CPG is much weaker than CodeBERT’s modeling capacity on NCS, and naive concatenation fails to bridge the gap.
  • Figure 3: Overview of the TaCCS-DFA framework.
  • Figure 4: Metric profiles of the main results on three datasets. The x-axis shows Precision, Recall, Accuracy, and F1 score, and the y-axis shows the corresponding performance (%). Each curve corresponds to one model/method and its four metrics on the dataset.
  • Figure 5: Line-level attention visualization. The two panels at the top show the same use-after-free sample under two attention mechanisms: on the left, standard cross-attention spreads weights over multiple irrelevant lines and yields an incorrect prediction; on the right, Fisher-guided attention concentrates on the causal vulnerability path—allocation (line 6, malloc), deallocation (line 13, free), and illegal access (lines 19--20, use-after-free)—and correctly detects the vulnerability. The bar chart at the bottom quantifies the change of attention weights per line, and the red dashed lines mark key vulnerability points.
  • ...and 3 more figures

Theorems & Definitions (1)

  • theorem 1: Tightness of the DFA perturbation bound