MulVuln: Enhancing Pre-trained LMs with Shared and Language-Specific Knowledge for Multilingual Vulnerability Detection
Van Nguyen, Surya Nepal, Xingliang Yuan, Tingmin Wu, Fengchao Chen, Carsten Rudolph
TL;DR
MulVuln tackles multilingual vulnerability detection by combining a pre-trained language model encoder that captures shared cross-language patterns with a language-specific parameter pool that injects per-language cues. It dynamically selects or masks language-specific parameters during input embedding, enabling robust cross-language generalization while preserving language-specific knowledge. Evaluated on the REEF dataset, MulVuln achieves state-of-the-art F1-scores (e.g., 72.20% with language-aware masking) and recall near 97%, outperforming 13 baselines by up to 23.59% in F1. The framework provides a practical approach for multilingual SVD and offers insights into when to share representations versus specialize parameters for cross-language code understanding.
Abstract
Software vulnerabilities (SVs) pose a critical threat to safety-critical systems, driving the adoption of AI-based approaches such as machine learning and deep learning for software vulnerability detection. Despite promising results, most existing methods are limited to a single programming language. This is problematic given the multilingual nature of modern software, which is often complex and written in multiple languages. Current approaches often face challenges in capturing both shared and language-specific knowledge of source code, which can limit their performance on diverse programming languages and real-world codebases. To address this gap, we propose MULVULN, a novel multilingual vulnerability detection approach that learns from source code across multiple languages. MULVULN captures both the shared knowledge that generalizes across languages and the language-specific knowledge that reflects unique coding conventions. By integrating these aspects, it achieves more robust and effective detection of vulnerabilities in real-world multilingual software systems. The rigorous and extensive experiments on the real-world and diverse REEF dataset, consisting of 4,466 CVEs with 30,987 patches across seven programming languages, demonstrate the superiority of MULVULN over thirteen effective and state-of-the-art baselines. Notably, MULVULN achieves substantially higher F1-score, with improvements ranging from 1.45% to 23.59% compared to the baseline methods.
