TL;DR
Static analysis tools are notorious for flooding developers with false positives, often exceeding a 90% false alarm rate in enterprise settings. This paper presents the first comprehensive industrial study (at Tencent) using Large Language Models (LLMs) to filter these false alarms, revealing that hybrid approaches combining LLMs with static analysis can automatically eliminate 94–98% of false positives for a fraction of the time and cost of manual review.
What Problem Does This Paper Address?
Static Analysis Tools (SATs) are essential for catching bugs early in the development lifecycle. However, to guarantee they don't miss critical vulnerabilities (soundness), they over-approximate program behaviors. This conservative design trade-off results in an overwhelming number of false positives—spurious warnings triggered along execution paths that are practically impossible.
In a massive enterprise environment like Tencent, dealing with these false alarms is a major bottleneck. Developers must manually inspect each warning, a process that takes an average of 10 to 20 minutes per alarm across multiple review rounds. Traditional automated filtering methods like symbolic execution don't scale well to enterprise codebases, and older deep-learning approaches require massive amounts of labeled training data that companies simply don't have. This paper investigates whether modern LLMs can step in to accurately and cost-effectively filter out these false alarms in a real-world industrial pipeline.
Methods
The authors evaluated a diverse suite of LLM-based false alarm reduction techniques using four state-of-the-art backbone models: GPT-4o, Claude-3.5-Sonnet, Qwen-2.5-Coder-32B, and DeepSeek-R1.
They tested these models across three tiers of sophistication:
- Basic & Advanced Prompting: Standard prompts compared against Chain-of-Thought (CoT), Few-shot learning (providing concrete examples), and Bug-type augmentation (adding structured bug descriptions).
- Hybrid Methods: Techniques that explicitly blend static analysis with LLMs. Specifically, they evaluated LLM4SA (which feeds extensive code context around the bug "sink" to the LLM) and LLM4PFA (which injects static analysis-derived path constraints into an agent-driven LLM reasoning loop).
- Traditional Deep Learning Baselines: They compared the LLMs against four established deep-learning vulnerability detectors (Devign, ReGVD, LLMAO, and LineVul).
Datasets
The study was conducted using a proprietary dataset harvested from Tencent's Advertising and Marketing Services business line. The initial automated scanning was performed by BkCheck, Tencent's internal static analysis tool.
After a rigorous double-round manual verification process by enterprise developers and code reviewers, the authors compiled a dataset of 433 fully validated alarms (328 false positives and 105 true positives). The dataset spans 10 months and covers three prevalent bug types:
- Null Pointer Dereference (NPD) (136 alarms)
- Divide-by-Zero (DBZ) (158 alarms)
- Out-of-Bounds (OOB) (139 alarms)
Key Insights and Ideas
- The Power of Hybrid Synergy: Standalone LLMs using basic prompts struggle to beat a coin flip. However, when you feed the LLM explicit path constraints from static analysis (as in LLM4PFA), performance skyrockets. Static analysis provides the hard logical facts, while the LLM excels at semantic understanding.
- Chain-of-Thought (CoT) Can Backfire: Explicitly forcing advanced models to use CoT prompting occasionally degraded performance. The authors hypothesize that these frontier models have already internalized reasoning capabilities during pre-training, and rigid CoT constraints can paradoxically disrupt their internal logic.
- Deep Learning Fails the Enterprise Test: Traditional deep learning models performed terribly on the Tencent dataset (accuracies between 36% and 44%). These models suffer from severe data distribution shifts; they are trained on open-source datasets and fail to generalize to unique, proprietary enterprise codebases.
- Bug Complexity Dictates Success: LLMs perform exceptionally well on Divide-by-Zero bugs because the patterns are localized and simple. Conversely, Null Pointer Dereferences often involve intricate, cascaded conditional constraints across long stretches of code, which frequently trip up the models.
Key Results
- High-Fidelity Filtering: The hybrid method LLM4PFA achieved an overall accuracy of 93% to 94% across all backbone LLMs. Crucially, it achieved a False Positive Reduction Recall (FPR_R) of up to 98%, meaning it successfully eliminated nearly all false alarms while maintaining a high recall for actual bugs.
- Massive Cost Savings: Compared to the 10–20 minutes of human labor required to review a single alarm, LLM-based methods processed alarms in 2.1 to 109.5 seconds. The financial cost ranged from $0.0011 to $0.12 per alarm, representing an orders-of-magnitude reduction in developer overhead.
Limitations and Future Work
Despite the impressive numbers, the authors identified three core limitations of LLMs in enterprise settings:
- Long-Context Blindness: When a bug's context requires analyzing long functions or cross-module dependencies, LLM accuracy drops significantly.
- Cascaded Constraint Reasoning: LLMs struggle to accurately track variable states through complex code structures containing numerous loops and deeply nested conditional branches.
- Niche Syntax: Rare syntactic constructs and custom, user-defined data structures often lead to LLM misinterpretation.
Future research directions include exploring automated retrieval-augmented generation (RAG) to supply LLMs with historical enterprise bug contexts and designing better task-decomposition pipelines to break down complex code reasoning into smaller, bite-sized subproblems.
Summary updated