arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.00324cs.SEcs.IRcs.LG
收藏

在LLM-as-a-Judge代码检索场景下,哪种编程语言与模型表现最佳?

Which Programming Language and Model Work Best With LLM-as-a-Judge For Code Retrieval?

Independent Researcher(独立研究者);New York University(纽约大学)

Lucas Roberts, Denisa Roberts

AI总结:

本研究针对代码搜索人工标注成本高的问题,对比不同检索表示、编程语言与LLM-as-a-Judge模型的适配性,提出用转译器构建多语言代码基准,验证了人工与AI判定一致性可达最差人-人一致水平。

摘要:

代码搜索是一类重要的信息检索应用,更优质的代码搜索可加快新开发者上手速度、降低软件维护成本、降低大型代码仓库的理解难度。尽管搜索算法与搜索基准已有进展,代码搜索领域的发展仍相对滞后,原因之一是代码查询与答案的人工标注成本极高:通用文本问答系统的搜索结果可由普通人标注,但代码标注需要掌握特定编程语言(PL)的专业知识,以及特定领域的软件工程知识。\n本研究探索使用大语言模型(LLM)开展函数级代码检索,并为代码搜索结果生成标注。我们通过对比C、Java、Javascript、Go、Python这几种主流编程语言的人工标注结果,分析检索器表示方式(稀疏表示vs语义表示)、编程语言、LLM三类因素的影响。研究聚焦于实现通用数据结构的代码仓库——这类结构通常可在任意编程语言中实现。\n基于同一批人工标注数据,我们对比了多种LLM-as-a-Judge(大语言模型作为评判者)模型,以评估编程语言与LLM之间的适配性等关联特性。研究发现,所选检索器与编程语言存在适配性,可利用该特性提升人工与AI相关性判定的一致性,且对性能有显著影响;同时不同编程语言在表示方式(稀疏vs语义)上存在差异,也会影响人工与AI相关性判定的一致性。\n我们提出使用转译器(transpiler)来构建其他编程语言的可扩展代码搜索基准数据集,并通过案例研究证明,人工与AI的相关性一致率基本与本研究中(最差情况的)人与人之间的一致率相当。本研究使用的应用代码可在该GitHub仓库获取:https://github.com/rlucas7/code-searcher/。

英文摘要:

Code search is an important information retrieval application. Benefits of better code search include faster new developer on-boarding, reduced software maintenance, and ease of understanding for large repositories. Despite improvements in search algorithms and search benchmarks, the domain of code search has lagged behind. One reason is the high cost of human annotation for code queries and answers. While humans may annotate search results in general text QA systems, code annotations require specialized knowledge of a programming language (PL), as well as domain specific software engineering knowledge. In this work we study the use of Large Language Models (LLMs) to retrieve code at the level of functions and to generate annotations for code search results. We compare the impact of the retriever representation (sparse vs. semantic), programming language, and LLM by comparing human annotations across several popular languages (C, Java, Javascript, Go, and Python). We focus on repositories that implement common data structures likely to be implemented in any PLs. For the same human annotations, we compare several LLM-as-a-Judge models to evaluate programming language and other affinities between LLMs. We find that the chosen retriever and PL exhibit affinities that can be leveraged to improve alignment of human and AI relevance determinations, with significant performance implications. We also find differences in representation (sparse vs. semantic) across PLs that impact alignment of human and AI relevance determinations. We propose using transpilers to bootstrap scalable code search benchmark datasets in other PLs and in a case study demonstrate that human-AI relevance agreement rates largely match the (worst case) human-human agreement under study. The application code used in this work is available at \href{https://github.com/rlucas7/code-searcher/}{this github repo}.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑