{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,11,25]],"date-time":"2026-11-25T00:08:46Z","timestamp":1795565326875,"version":"4.11.0"},"reference-count":52,"publisher":"Association for Computing Machinery (ACM)","issue":"FSE","license":[{"start":{"date-parts":[[2025,6,19]],"date-time":"2025-06-19T00:00:00Z","timestamp":1750291200000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/legalcode"}],"funder":[{"DOI":"10.13039\/501100001711","name":"Swiss National Science Foundation","doi-asserted-by":"crossref","award":["200021_197227"],"award-info":[{"award-number":["200021_197227"]}],"id":[{"id":"10.13039\/501100001711","id-type":"DOI","asserted-by":"crossref"}]}],"content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":["Proc. ACM Softw. Eng."],"published-print":{"date-parts":[[2025,6,19]]},"abstract":"<jats:p>\n                    Traditionally, software vulnerability detection research has focused on individual small functions due to earlier language processing technologies\u2019 limitations in handling larger inputs. However, this function-level approach may miss bugs that span multiple functions and code blocks. 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\n                    <jats:italic toggle=\"yes\">vulnerability type, input size<\/jats:italic>\n                    , and\n                    <jats:italic toggle=\"yes\">vulnerability location<\/jats:italic>\n                    within the file. To give enough statistical power (\n                    <jats:italic toggle=\"yes\">\u03b2<\/jats:italic>\n                    \u2265 .8) 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 (\n                    <jats:inline-formula>\n                      <mml:math xmlns:mml=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\">\n                        <mml:mrow>\n                          <mml:mi>p<\/mml:mi>\n                          <mml:mo>&lt;<\/mml:mo>\n                          <mml:mn>.05<\/mml:mn>\n                        <\/mml:mrow>\n                      <\/mml:math>\n                    <\/jats:inline-formula>\n                    ) underperform when detecting vulnerabilities located toward the end of larger files\u2014a pattern we call the \u2018lost-in-the-end\u2019 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.\n                  <\/jats:p>","DOI":"10.1145\/3715758","type":"journal-article","created":{"date-parts":[[2025,6,19]],"date-time":"2025-06-19T11:15:34Z","timestamp":1750331734000},"page":"891-913","source":"Crossref","is-referenced-by-count":12,"title":["Large Language Models for In-File Vulnerability Localization Can Be \u201cLost in the End\u201d"],"prefix":"10.1145","volume":"2","author":[{"ORCID":"https:\/\/orcid.org\/0000-0002-6285-1041","authenticated-orcid":false,"given":"Francesco","family":"Sovrano","sequence":"first","affiliation":[{"name":"ETH Zurich, Collegium Helveticum, Zurich, Switzerland"},{"name":"University of Zurich, Department of Informatics, Zurich, Switzerland"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0009-0002-5871-1094","authenticated-orcid":false,"given":"Adam","family":"Bauer","sequence":"additional","affiliation":[{"name":"University of Zurich, Zurich, Switzerland"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0003-0193-6823","authenticated-orcid":false,"given":"Alberto","family":"Bacchelli","sequence":"additional","affiliation":[{"name":"University of Zurich, Department of Informatics, Zurich, Switzerland"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"320","published-online":{"date-parts":[[2025,6,19]]},"reference":[{"key":"e_1_3_1_2_2","doi-asserted-by":"publisher","unstructured":"Shengnan An Zexiong Ma Zeqi Lin Nanning Zheng and Jian-Guang Lou. 2024. Make Your LLM Fully Utilize the Context. CoRR abs\/2404.16811 (2024). doi:10.48550\/ARXIV.2404.16811 arXiv:2404.16811","DOI":"10.48550\/ARXIV.2404.16811"},{"key":"e_1_3_1_3_2","doi-asserted-by":"publisher","unstructured":"Adam Bauer and Francesco Sovrano. 2025. Replication Package for In-file Vulnerability Detection. https:\/\/doi.org\/10.5281\/zenodo.14840519 10.5281\/zenodo.14840519.","DOI":"10.5281\/zenodo.14840519"},{"key":"e_1_3_1_4_2","doi-asserted-by":"publisher","unstructured":"Dipkamal Bhusal Md Tanvirul Alam Le Nguyen Ashim Mahara Zachary Lightcap Rodney Frazier Romy Fieblinger Grace Long Torales and Nidhi Rastogi. 2024. SECURE: Benchmarking Generative Large Language Models for Cybersecurity Advisory. CoRR abs\/2405.20441 (2024). doi:10.48550\/ARXIV.2405.20441 arXiv:2405.20441","DOI":"10.48550\/ARXIV.2405.20441"},{"key":"e_1_3_1_5_2","doi-asserted-by":"publisher","unstructured":"Alessio Buscemi. 2023. A Comparative Study of Code Generation using ChatGPT 3.5 across 10 Programming Languages. CoRR abs\/2308.04477 (2023). doi:10.48550\/ARXIV.2308.04477 arXiv:2308.04477","DOI":"10.48550\/ARXIV.2308.04477"},{"key":"e_1_3_1_6_2","doi-asserted-by":"publisher","unstructured":"Chong Chen Jianzhong Su Jiachi Chen Yanlin Wang Tingting Bi Yanli Wang Xingwei Lin Ting Chen and Zibin Zheng. 2023. When ChatGPT Meets Smart Contract Vulnerability Detection: How Far Are We? doi:10.48550\/ARXIV.2309.05520 arXiv:2309.05520","DOI":"10.48550\/ARXIV.2309.05520"},{"key":"e_1_3_1_7_2","doi-asserted-by":"publisher","DOI":"10.1080\/03610911003650383"},{"key":"e_1_3_1_8_2","doi-asserted-by":"publisher","unstructured":"Shouyuan Chen Sherman Wong Liangjian Chen and Yuandong Tian. 2023. Extending Context Window of Large Language Models via Positional Interpolation. CoRR abs\/2306.15595 (2023). doi:10.48550\/ARXIV.2306.15595 arXiv:2306.15595","DOI":"10.48550\/ARXIV.2306.15595"},{"key":"e_1_3_1_9_2","doi-asserted-by":"publisher","DOI":"10.1145\/3607199.3607242"},{"key":"e_1_3_1_10_2","doi-asserted-by":"publisher","unstructured":"Anton Cheshkov Pavel Zadorozhny and Rodion Levichev. 2023. Evaluation of ChatGPT Model for Vulnerability Detection. CoRR abs\/2304.07232 (2023). doi:10.48550\/ARXIV.2304.07232 arXiv:2304.07232","DOI":"10.48550\/ARXIV.2304.07232"},{"key":"e_1_3_1_11_2","doi-asserted-by":"publisher","DOI":"10.1007\/978-1-4614-7792-1"},{"key":"e_1_3_1_12_2","unstructured":"Aparna Dhinakaran. 2024. The Needle in a Haystack Test. https:\/\/towardsdatascience.com\/the-needle-in-a-haystack-test-a94974c1ad38. Accessed: 2024-06-03."},{"key":"e_1_3_1_13_2","doi-asserted-by":"publisher","DOI":"10.48550\/ARXIV.2402.13753"},{"key":"e_1_3_1_14_2","doi-asserted-by":"publisher","DOI":"10.3758\/BF03203630"},{"key":"e_1_3_1_15_2","doi-asserted-by":"publisher","DOI":"10.18653\/V1\/2020.FINDINGS-EMNLP.139"},{"key":"e_1_3_1_16_2","doi-asserted-by":"publisher","DOI":"10.1145\/3524842.3528452"},{"key":"e_1_3_1_17_2","doi-asserted-by":"publisher","DOI":"10.1109\/APSEC60848.2023.00085"},{"key":"e_1_3_1_18_2","unstructured":"GitLab. 2022. 2022 DevSecOps Report. https:\/\/learn.gitlab.com\/dev-survey-22\/2022-devsecops-report. Accessed: 2024-06-03."},{"key":"e_1_3_1_19_2","doi-asserted-by":"publisher","unstructured":"Sivana Hamer Marcelo d\u2019Amorim and Laurie Williams. 2024. Just another copy and paste? Comparing the security vulnerabilities of ChatGPT generated code and StackOverflow answers. doi:10.48550\/ARXIV.2403.15600 arXiv:2403.15600","DOI":"10.48550\/ARXIV.2403.15600"},{"key":"e_1_3_1_20_2","doi-asserted-by":"publisher","DOI":"10.14722\/ndss.2019.23349"},{"key":"e_1_3_1_21_2","doi-asserted-by":"publisher","unstructured":"Wenpin Hou and Zhicheng Ji. 2024. Comparing large language models and human programmers for generating programming code. Advanced Science (2024) 2412279. doi:10.1002\/advs.202412279","DOI":"10.1002\/advs.202412279"},{"key":"e_1_3_1_22_2","doi-asserted-by":"publisher","unstructured":"Mosh Levy Alon Jacoby and Yoav Goldberg. 2024. Same Task More Tokens: the Impact of Input Length on the Reasoning Performance of Large Language Models. doi:10.48550\/ARXIV.2402.14848 arXiv:2402.14848","DOI":"10.48550\/ARXIV.2402.14848"},{"key":"e_1_3_1_23_2","doi-asserted-by":"publisher","unstructured":"Yuhong Li Yingbing Huang Bowen Yang Bharat Venkitesh Acyr Locatelli Hanchen Ye Tianle Cai Patrick Lewis and Deming Chen. 2024. SnapKV:LLM Knows What You are Looking for Before Generation. doi:10.48550\/ARXIV.2404.14469 arXiv:2404.14469","DOI":"10.48550\/ARXIV.2404.14469"},{"key":"e_1_3_1_24_2","doi-asserted-by":"publisher","DOI":"10.1016\/j.infsof.2024.107458"},{"key":"e_1_3_1_25_2","doi-asserted-by":"publisher","DOI":"10.1162\/TACL_A_00638"},{"key":"e_1_3_1_26_2","doi-asserted-by":"publisher","DOI":"10.48550\/ARXIV.2406.07595"},{"key":"e_1_3_1_27_2","doi-asserted-by":"publisher","unstructured":"Daniel Machlab and Rick Battle. 2024. LLM In-Context Recall is Prompt Dependent. doi:10.48550\/ARXIV.2404.08865 arXiv:2404.08865","DOI":"10.48550\/ARXIV.2404.08865"},{"key":"e_1_3_1_28_2","doi-asserted-by":"publisher","DOI":"10.1007\/978-981-99-7962-2_30"},{"key":"e_1_3_1_29_2","unstructured":"MITRE. 2024. Common Vulnerabilities and Exposures (CVE) Catalog. https:\/\/www.cve.org. Accessed: 2024-06-03."},{"key":"e_1_3_1_30_2","unstructured":"MITRE Corporation. 2024. 2024 CWE Top 25 Most Dangerous Software Weaknesses. https:\/\/cwe.mitre.org\/top25\/archive\/2024\/2024_cwe_top25.html. [Online; accessed 5-February-2025]."},{"key":"e_1_3_1_31_2","doi-asserted-by":"publisher","DOI":"10.1145\/3597503.3639187"},{"key":"e_1_3_1_32_2","doi-asserted-by":"publisher","DOI":"10.1007\/S10664-022-10276-6"},{"key":"e_1_3_1_33_2","doi-asserted-by":"publisher","DOI":"10.1016\/J.INFSOF.2024.107406"},{"key":"e_1_3_1_34_2","doi-asserted-by":"publisher","unstructured":"Yaniv Nikankin Anja Reusch Aaron Mueller and Yonatan Belinkov. 2024. Arithmetic Without Algorithms: Language Models Solve Math With a Bag of Heuristics. CoRR abs\/2410.21272 (2024). doi:10.48550\/ARXIV.2410.21272 arXiv:2410.21272","DOI":"10.48550\/ARXIV.2410.21272"},{"key":"e_1_3_1_35_2","doi-asserted-by":"publisher","unstructured":"Arka Pal Deep Karkhanis Manley Roberts Samuel Dooley Arvind Sundararajan and Siddartha Naidu. 2023. Giraffe: Adventures in Expanding Context Lengths in LLMs. doi:10.48550\/ARXIV.2308.10882 arXiv:2308.10882","DOI":"10.48550\/ARXIV.2308.10882"},{"key":"e_1_3_1_36_2","doi-asserted-by":"publisher","DOI":"10.1080\/00220670209598786"},{"key":"e_1_3_1_37_2","doi-asserted-by":"publisher","DOI":"10.1109\/SCAM59687.2023.00026"},{"key":"e_1_3_1_38_2","doi-asserted-by":"publisher","DOI":"10.1287\/OPRE.45.5.758"},{"key":"e_1_3_1_39_2","doi-asserted-by":"publisher","DOI":"10.1109\/ISSREW60843.2023.00058"},{"key":"e_1_3_1_40_2","doi-asserted-by":"publisher","DOI":"10.2307\/1990888"},{"key":"e_1_3_1_41_2","unstructured":"Sonatype. 2023. State of the Software Supply Chain 9th Edition. https:\/\/www.sonatype.com\/state-of-the-software-supply-chain\/introduction. Accessed: 2024-06-03."},{"key":"e_1_3_1_42_2","doi-asserted-by":"publisher","unstructured":"Benjamin Steenhoek Md Mahbubur Rahman Monoshi Kumar Roy Mirza Sanjida Alam Earl T. Barr and Wei Le. 2024. A Comprehensive Study of the Capabilities of Large Language Models for Vulnerability Detection. (2024). doi:10.48550\/ARXIV.2403.17218 arXiv:2403.17218","DOI":"10.48550\/ARXIV.2403.17218"},{"key":"e_1_3_1_43_2","doi-asserted-by":"publisher","DOI":"10.1145\/3564625.3567985"},{"key":"e_1_3_1_44_2","doi-asserted-by":"publisher","DOI":"10.1109\/SP54263.2024.00210"},{"key":"e_1_3_1_45_2","doi-asserted-by":"publisher","DOI":"10.1109\/SANER.2018.8330195"},{"key":"e_1_3_1_46_2","doi-asserted-by":"publisher","DOI":"10.1145\/3639478.3647634"},{"key":"e_1_3_1_47_2","doi-asserted-by":"publisher","DOI":"10.18653\/V1\/2021.EMNLP-MAIN.685"},{"key":"e_1_3_1_48_2","doi-asserted-by":"publisher","unstructured":"Peng Xu Wei Ping Xianchao Wu Lawrence McAfee Chen Zhu Zihan Liu Sandeep Subramanian Evelina Bakhturina Mohammad Shoeybi and Bryan Catanzaro. 2023. Retrieval meets Long Context Large Language Models. doi:10.48550\/ARXIV.2310.03025 arXiv:2310.03025","DOI":"10.48550\/ARXIV.2310.03025"},{"key":"e_1_3_1_49_2","doi-asserted-by":"publisher","unstructured":"Chenyuan Zhang Hao Liu Jiutian Zeng Kejing Yang Yuhong Li and Hui Li. 2023. Prompt-Enhanced Software Vulnerability Detection Using ChatGPT. doi:10.48550\/ARXIV.2308.12697 arXiv:2308.12697","DOI":"10.48550\/ARXIV.2308.12697"},{"key":"e_1_3_1_50_2","doi-asserted-by":"publisher","unstructured":"Peitian Zhang Zheng Liu Shitao Xiao Ninglu Shao Qiwei Ye and Zhicheng Dou. 2024. Soaring from 4K to 400K: Extending LLM\u2019s Context with Activation Beacon. doi:10.48550\/ARXIV.2401.03462 arXiv:2401.03462","DOI":"10.48550\/ARXIV.2401.03462"},{"key":"e_1_3_1_51_2","doi-asserted-by":"publisher","DOI":"10.1109\/ASE56229.2023.00157"},{"key":"e_1_3_1_52_2","doi-asserted-by":"publisher","unstructured":"Xin Zhou Ting Zhang and David Lo. 2024. Large Language Model for Vulnerability Detection: Emerging Results and Future Directions. doi:10.48550\/ARXIV.2401.15468 arXiv:2401.15468","DOI":"10.48550\/ARXIV.2401.15468"},{"key":"e_1_3_1_53_2","doi-asserted-by":"publisher","unstructured":"Xin Zhou Ting Zhang and David Lo. 2024. Large language model for vulnerability detection: Emerging results and future directions. In Proceedings of the 2024 ACM\/IEEE 44th International Conference on Software Engineering: New Ideas and Emerging Results. 47\u201351. doi:10.1145\/3639476.3639762","DOI":"10.1145\/3639476.3639762"}],"container-title":["Proceedings of the ACM on Software Engineering"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3715758","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2026,8,23]],"date-time":"2026-08-23T11:00:13Z","timestamp":1787482813000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3715758"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2025,6,19]]},"references-count":52,"journal-issue":{"issue":"FSE","published-print":{"date-parts":[[2025,6,19]]}},"alternative-id":["10.1145\/3715758"],"URL":"https:\/\/doi.org\/10.1145\/3715758","relation":{},"ISSN":["2994-970X"],"issn-type":[{"value":"2994-970X","type":"electronic"}],"subject":[],"published":{"date-parts":[[2025,6,19]]}}}