The rapid adoption of LLM-powered code generation has dramatically accelerated software development, yet effective verification methods remain severely underdeveloped. Existing bug localization techniques are either prohibitively expensive, requiring minutes of agentic reasoning and thousands of generated tokens per file, and/or operate at coarse function-level granularity unsuitable for precise debugging. While works that focus on line-level granularity and are more light-weight are often limited in their performance or context size. We introduce a novel line-level bug localization approach that addresses these limitations through three key contributions: (1) a token alignment algorithm that overcomes fundamental tokenization challenges in previous work, (2) a lightweight multi-task LLM for bug localization (MLC) enabling efficient line-level bug classification, and (3) an optimized training recipe for multi-line prediction. Our method achieves state-of-the-art performance among similar setups on line-level bug localization with full-file context. At the same time we reach comparable performance to agentic approaches on Defects4J and PypiBugs benchmarks while reducing inference latency by orders of magnitudes, requiring only a single generated token per file. We further demonstrate strong generalization by introducing and evaluating on a small out-of-domain evaluation datasets in Python. We will open source our code, models, and datasets upon acceptance.
翻译:基于大语言模型的代码生成技术的快速普及极大加速了软件开发进程,然而有效的验证方法仍严重滞后。现有缺陷定位技术要么成本过高——需在每个文件上进行数分钟的智能推理并生成数千个令牌;要么局限于函数级粗粒度分析,难以满足精准调试需求。虽然针对行级粒度且更轻量的方法已有研究,但其性能或上下文规模仍存在局限性。本文提出一种全新的行级缺陷定位方法,通过三项关键贡献突破上述限制:(1)提出令牌对齐算法,克服了此前研究中的基础性分词难题;(2)构建轻量级多任务缺陷定位大语言模型(MLC),实现高效的行级缺陷分类;(3)优化多行预测的训练策略。在基于全文件上下文的行级缺陷定位任务中,本方法在同类框架下达到最优性能。同时,在Defects4J与PypiBugs基准测试中,本方法在推理延迟降低数个数量级且仅需为每个文件生成单个令牌的条件下,取得了与智能体方法相当的性能。此外,我们通过引入并评估小规模Python跨域数据集,进一步验证了模型的强泛化能力。论文接收后,我们将开源全部代码、模型及数据集。