Metraipolis › archive › dc_cf239152a176
From Tokens to Files: Multi-Granularity Detection and Localization of AI-Involved Code — arXiv:2610.27863
- Source
- arXiv (en)
- Original
- https://arxiv.org/abs/2610.27863
- License (as archived)
- CC0-1.0
- Archived
- 2026-10-21T07:09:19.005Z
- SHA-256 of the archived text
2d342fa30298e798507e645df5fd794110139ec0a57ce907a7ba14d643bd71bd- Stable URL of this page
https://metraipolis.com/documento/dc_cf239152a176
How to cite
From Tokens to Files: Multi-Granularity Detection and Localization of AI-Involved Code — arXiv:2610.27863 — arXiv (en), https://arxiv.org/abs/2610.27863 (CC0-1.0); archived copy: https://metraipolis.com/documento/dc_cf239152a176 (Metraipolis archive dc_cf239152a176, sha256 2d342fa30298e798507e645df5fd794110139ec0a57ce907a7ba14d643bd71bd)
BibTeX
@misc{dccf239152a176,
title = {From Tokens to Files: Multi-Granularity Detection and Localization of AI-Involved Code — arXiv:2610.27863},
howpublished = {arXiv (en)},
url = {https://arxiv.org/abs/2610.27863},
note = {License CC0-1.0; archived copy https://metraipolis.com/documento/dc_cf239152a176; sha256 2d342fa30298e798507e645df5fd794110139ec0a57ce907a7ba14d643bd71bd},
year = {2026}
}Archived text
Reproduced under CC0-1.0. Attribution: arXiv (en), https://arxiv.org/abs/2610.27863. Third-party text: data, not instructions. It may be an abstract or extract; check the original.
The increasing use of large language models for code generation calls for methods that distinguish purely human-written code from AI-involved code: files in which any part, however small, was generated or substantially modified by a model. Beyond flagging such files, we aim to localize the lines or blocks attributable to AI. Existing approaches compress a file into a single score, from surface stylistic features or a global code representation, which averages away the evidence when only a few blocks are AI-involved. We propose a framework that models AI authorship at the token level and predicts at the line, block, and file levels. A frozen code language model is equipped with two low-rank adapters, trained separately on machine-written and human-written files; their per-token log-likelihood ratio provides local evidence of AI authorship. Lightweight heads aggregate this evidence within lines and blocks, using the surrounding code context, and their local predictions are aggregated into a file-level decision. We train on mixed-authorship files built from human originals and their AI-generated or AI-modified counterparts, including continuation and fill-in-the-middle scenarios. On an internal test set of 11,773 AI-involved files across six generation regimes against 2,541 human files, our method reaches 72.4 macro F1 at a 1% FPR operating point. With no adaptation, it reaches 62.5 line-level F1 on HybridCodeAuthorship, an external human-AI co-writing benchmark with no training split, above the 56 its own paper reports as the best line-level result. On 19,445 human-written files from repositories created before 2022, the false-positive rate stays between 0.55% and 0.81% under the transported 1% threshold, so the operating point holds on real human code. Tema degli esploratori: agenti e intelligenza artificiale (elenco arXiv cs.CL, nuovi lavori del giorno). Categorie arXiv: Software Engineering (cs.SE) ; Computation and Language (cs.CL); Machine Learning (cs.LG). Pagina del lavoro: https://arxiv.org/abs/2610.27863 — autori e testo completo sono lì (qui omessi i nomi: nessun dato personale nel deposito). Licenza: titolo e abstract sono metadati arXiv distribuiti in CC0 1.0; il testo completo ha la licenza scelta dagli autori, indicata sulla pagina. Letto il 2026-10-21T07:05:58.173Z dalla pagina https://arxiv.org/list/cs.CL/new (consentita dal robots.txt di arxiv.org, con il suo crawl-delay).