mlsanityData to 14 Oct 2026

Large Language Models for In-File Vulnerability Localization Can Be "Lost in the End"

arXiv 2502.06898 ↗First posted 9 Feb 2025cs.SE cs.AIcited by 5

Not on the map. Why?

Abstract (arXiv)

Recent advancements in artificial intelligence have enabled processing of larger inputs, leading everyday software developers to increasingly rely on chat-based large language models (LLMs) like GPT-3.5 and GPT-4 to detect vulnerabilities across entire files, not just within functions. This new development practice requires researchers to urgently investigate whether commonly used LLMs can effectively analyze large file-sized inputs, in order to provide timely insights for software developers and engineers about the pros and cons of this emerging technological trend. Hence, the goal of this paper is to evaluate the effectiveness of several state-of-the-art chat-based LLMs, including the GPT models, in detecting in-file vulnerabilities. We conducted a costly investigation into how the performance of LLMs varies based on vulnerability type, input size, and vulnerability location within the file. To give enough statistical power to our study, we could only focus on the three most common (as well as dangerous) vulnerabilities: XSS, SQL injection, and path traversal. Our findings indicate that the effectiveness of LLMs in detecting these vulnerabilities is strongly influenced by both the location of the vulnerability and the overall size of the input. Specifically, regardless of the vulnerability type, LLMs tend to significantly (p < .05) underperform when detecting vulnerabilities located toward the end of larger files, a pattern we call the 'lost-in-the-end' effect. Finally, to further support software developers and practitioners, we also explored the optimal input size for these LLMs and presented a simple strategy for identifying it, which can be applied to other models and vulnerability types. Eventually, we show how adjusting the input size can lead to significant improvements in LLM-based vulnerability detection, with an average recall increase of over 37% across all models.

Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Builds on 22 of its 49 references that are in the map. First posted on arXiv 9 Feb 2025.

Builds on

22 of 49 references.

References · 22

  1. 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,455
  2. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
  3. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
  4. 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 740
  5. 2024LongRoPE: Extending LLM Context Window Beyond 2 Million Tokenscited by 313
  6. 2023Using an LLM to Help With Code Understandingcited by 228
  7. 2024Make Your LLM Fully Utilize the Contextcited by 119
  8. 2023DiverseVul: A New Vulnerable Source Code Dataset for Deep Learning Based Vulnerability Detectioncited by 102
  9. 2023LLMs Cannot Reliably Identify and Reason About Security Vulnerabilities (Yet?): A Comprehensive Evaluation, Framework, and Benchmarkscited by 97
  10. 2024Arithmetic Without Algorithms: Language Models Solve Math With a Bag of Heuristicscited by 97
  11. 2023Prompt-Enhanced Software Vulnerability Detection Using ChatGPTcited by 51
  12. 2024Large Language Model for Vulnerability Detection: Emerging Results and Future Directionscited by 45
10 more
  1. 2023ChatGPT for Vulnerability Detection, Classification, and Repair: How Far Are We?cited by 44
  2. 2023When ChatGPT Meets Smart Contract Vulnerability Detection: How Far Are We?cited by 42
  3. 2022Transformer-Based Language Models for Software Vulnerability Detectioncited by 39
  4. 2024ReposVul: A Repository-Level High-Quality Vulnerability Datasetcited by 36
  5. 2023Evaluation of ChatGPT Model for Vulnerability Detectioncited by 33
  6. 2023Giraffe: Adventures in Expanding Context Lengths in LLMscited by 33
  7. 2024LLM In-Context Recall is Prompt Dependentcited by 15
  8. 2024Just another copy and paste? Comparing the security vulnerabilities of ChatGPT generated code and StackOverflow answerscited by 13
  9. 2023A Comparative Study of Code Generation using ChatGPT 3.5 across 10 Programming Languagescited by 12
  10. 2024Comparing large language models and human programmers for generating programming codecited by 9

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 3; 2026: 2.

5 papers.