FLAG: Finding Line Anomalies (in code) with Generative AI
Not on the map. Why?
Abstract (arXiv)
Code contains security and functional bugs. The process of identifying and localizing them is difficult and relies on human labor. In this work, we present a novel approach (FLAG) to assist human debuggers. FLAG is based on the lexical capabilities of generative AI, specifically, Large Language Models (LLMs). Here, we input a code file then extract and regenerate each line within that file for self-comparison. By comparing the original code with an LLM-generated alternative, we can flag notable differences as anomalies for further inspection, with features such as distance from comments and LLM confidence also aiding this classification. This reduces the inspection search space for the designer. Unlike other automated approaches in this area, FLAG is language-agnostic, can work on incomplete (and even non-compiling) code and requires no creation of security properties, functional tests or definition of rules. In this work, we explore the features that help LLMs in this classification and evaluate the performance of FLAG on known bugs. We use 121 benchmarks across C, Python and Verilog; with each benchmark containing a known security or functional weakness. We conduct the experiments using two state of the art LLMs in OpenAI's code-davinci-002 and gpt-3.5-turbo, but our approach may be used by other models. FLAG can identify 101 of the defects and helps reduce the search space to 12-17% of source code.
Key facts. Cited by 7 papers in the map (data through 7 Oct 2026). Builds on 11 of its 42 references that are in the map. First posted on arXiv 22 Jun 2023.
Builds on
11 of 42 references.
References · 11
- 2017Attention Is All You Needcited by 59,932
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 417
- 2021Examining Zero-Shot Vulnerability Repair with Large Language Modelscited by 105
- 2022Lost at C: A User Study on the Security Implications of Large Language Model Code Assistantscited by 87
- 2018DeepBugs: A Learning Approach to Name-based Bug Detectioncited by 65
- 2023Large Language Models are Edge-Case Fuzzers: Testing Deep Learning Libraries via FuzzGPTcited by 36
- 2023Fixing Hardware Security Bugs with Large Language Modelscited by 24
- 2023Nuances are the Key: Unlocking ChatGPT to Find Failure-Inducing Tests with Differential Promptingcited by 23
- 2018Entropy Guided Spectrum Based Bug Localization Using Statistical Language Modelcited by 4
Built on by
Citing papers per year: 2024: 5; 2025: 2.
7 papers.
- 2024When LLMs Meet Cybersecurity: A Systematic Literature Reviewcited by 70
- 2024Large Language Models for Cyber Security: A Systematic Literature Reviewcited by 65
- 2024Evaluating LLMs for Hardware Design and Testcited by 8
- 2025MARVEL: Multi-Agent RTL Vulnerability Extraction using Large Language Modelscited by 5
- 2025LPASS: Linear Probes as Stepping Stones for vulnerability detection using compressed LLMscited by 4
- 2024Generative transformations and patterns in LLM-native approaches for software verification and falsificationcited by 2
- 2024ANVIL: Anomaly-based Vulnerability Identification without Labelled Training Datacited by 1
- 2025LPASS: Linear Probes as Stepping Stones for vulnerability detection using compressed LLMs30 May 2025
- 2025MARVEL: Multi-Agent RTL Vulnerability Extraction using Large Language Models17 May 2025
- 2024ANVIL: Anomaly-based Vulnerability Identification without Labelled Training Data28 Aug 2024
- 2024Large Language Models for Cyber Security: A Systematic Literature Review8 May 2024
- 2024When LLMs Meet Cybersecurity: A Systematic Literature Review6 May 2024
- 2024Evaluating LLMs for Hardware Design and Test23 Apr 2024
- 2024Generative transformations and patterns in LLM-native approaches for software verification and falsification14 Apr 2024