Trace Gadgets: Minimizing Code Context for Machine Learning-Based Vulnerability Prediction
Not on the map. Why?
Abstract (arXiv)
As the number of web applications and API endpoints exposed to the Internet continues to grow, so does the number of exploitable vulnerabilities. Manually identifying such vulnerabilities is tedious. Meanwhile, static security scanners tend to produce many false positives. While machine learning-based approaches are promising, they typically perform well only in scenarios where training and test data are closely related. A key challenge for ML-based vulnerability detection is providing suitable and concise code context, as excessively long contexts negatively affect the code comprehension capabilities of machine learning models, particularly smaller ones. This work introduces Trace Gadgets, a novel code representation that minimizes code context by removing non-related code. Trace Gadgets precisely capture the statements that cover the path to the vulnerability. As input for ML models, Trace Gadgets provide a minimal but complete context, thereby improving the detection performance. Moreover, we collect a large-scale dataset generated from real-world applications with manually curated labels to further improve the performance of ML-based vulnerability detectors. Our results show that state-of-the-art machine learning models perform best when using Trace Gadgets compared to previous code representations, surpassing the detection capabilities of industry-standard static scanners such as GitHub's CodeQL by at least 4% on a fully unseen dataset. By applying our framework to real-world applications, we identify and report previously unknown vulnerabilities in widely deployed software.
Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Builds on 30 of its 101 references that are in the map. First posted on arXiv 18 Apr 2025.
Builds on
30 of 101 references.
References · 30
- 2017Attention Is All You Needcited by 60,361
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,455
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2019GNNExplainer: Generating Explanations for Graph Neural Networkscited by 737
- 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 733
- 2023A Comprehensive Survey on Pretrained Foundation Models: A History from BERT to ChatGPTcited by 368
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 361
- 2023CodeT5+: Open Code Large Language Models for Code Understanding and Generationcited by 333
- 2024CRUXEval: A Benchmark for Code Reasoning, Understanding and Executioncited by 300
- 2019Devign: Effective Vulnerability Identification by Learning Comprehensive Program Semantics via Graph Neural Networkscited by 272
- 2024IRIS: LLM-Assisted Static Analysis for Detecting Security Vulnerabilitiescited by 103
- 2020Dos and Don'ts of Machine Learning in Computer Securitycited by 102
18 more
- 2023LLMs Cannot Reliably Identify and Reason About Security Vulnerabilities (Yet?): A Comprehensive Evaluation, Framework, and Benchmarkscited by 97
- 2018SySeVR: A Framework for Using Deep Learning to Detect Software Vulnerabilitiescited by 92
- 2023Understanding the Effectiveness of Large Language Models in Detecting Security Vulnerabilitiescited by 59
- 2021Vulnerability Detection with Fine-grained Interpretationscited by 56
- 2018Exploring Adversarial Examples in Malware Detectioncited by 42
- 2024Finetuning Large Language Models for Vulnerability Detectioncited by 40
- 2021ReGVD: Revisiting Graph Neural Networks for Vulnerability Detectioncited by 32
- 2023Uncovering the Limits of Machine Learning for Automatic Vulnerability Detectioncited by 30
- 2023TRACED: Execution-aware Pre-training for Source Codecited by 27
- 2024SemCoder: Training Code Language Models with Comprehensive Semantics Reasoningcited by 27
- 2021How could Neural Networks understand Programs?cited by 26
- 2024LLMDFA: Analyzing Dataflow in Code with Large Language Modelscited by 22
- 2022Dataflow Analysis-Inspired Deep Learning for Efficient Vulnerability Detectioncited by 19
- 2025LONGCODEU: Benchmarking Long-Context Language Models on Long Code Understandingcited by 13
- 2024Don't Label Twice: Quantity Beats Quality when Comparing Binary Classifiers on a Budgetcited by 7
- 2024A Survey of Source Code Representations for Machine Learning-Based Cybersecurity Taskscited by 5
- 2024OCEAN: Open-World Contrastive Authorship Identificationcited by 3
- 2023Madvex: Instrumentation-based Adversarial Attacks on Machine Learning Malware Detectioncited by 2
Built on by
Citing papers per year: 2025: 1; 2026: 4.
5 papers.
- 2025Prompt Pirates Need a Map: Stealing Seeds helps Stealing Promptscited by 1
- 2026AutoTrace: From Patches to Triggers via Agentic Interprocedural Explorationcited by 1
- 2026Beyond Accuracy: Characterizing Code Comprehension Capabilities in (Large) Language Modelscited by 0
- 2026Teaching LLMs Program Semantics via Symbolic Execution Tracescited by 0
- 2026PsychoSafe: Eliciting Psychologically-Informed Refusals in Large Language Modelscited by 0
- 2026AutoTrace: From Patches to Triggers via Agentic Interprocedural Exploration13 Jul 2026
- 2026PsychoSafe: Eliciting Psychologically-Informed Refusals in Large Language Models8 Jun 2026
- 2026Teaching LLMs Program Semantics via Symbolic Execution Traces7 May 2026
- 2026Beyond Accuracy: Characterizing Code Comprehension Capabilities in (Large) Language Models19 Jan 2026
- 2025Prompt Pirates Need a Map: Stealing Seeds helps Stealing Prompts11 Sep 2025