2025-07-09 · 专家 · 计算机视觉 · 机器学习

Coding Triangle: How Does Large Language Model Understand Code?

该论文提出了一种名为“编码三角形”的框架,用于系统地评估大型语言模型(LLMs)在代码生成、编辑分析和测试用例生成三个维度的能力,并探讨了模型认知与人类专业知识的差距。

更新于 2025-07-09。作者:Taolin Zhang、Zihan Ma、Maosong Cao、Junnan Liu、Songyang Zhang、Kai Chen。

中文摘要

大型语言模型(LLMs)在代码生成方面取得了显著的进步,但它们的真正编程能力仍被低估。我们引入了代码三角形框架,该框架系统地评估LLMs在三个基本维度上的表现:编辑分析、代码实现和测试用例生成。通过在编程竞赛基准上的大量实验,我们发现尽管LLMs可以在这些维度上形成一个自洽的系统,但它们的解决方案通常缺乏人类程序员的多样性和鲁棒性。我们识别出模型认知与人类专业知识之间存在显著的分布差异,模型错误倾向于因训练数据偏差和有限的推理迁移而聚集。我们的研究表明,通过结合人类生成的编辑、解决方案和多样化的测试用例,以及利用模型混合,可以显著提高LLMs的性能和鲁棒性。此外,我们还揭示了LLMs认知中的一致性和不一致性,这可能有助于自我反思和自我改进,为开发更强大的编码模型提供了潜在的方向。

英文摘要

Large language models (LLMs) have achieved remarkable progress in code generation, yet their true programming competence remains underexplored. We introduce the Code Triangle framework, which systematically evaluates LLMs across three fundamental dimensions: editorial analysis, code implementation, and test case generation. Through extensive experiments on competitive programming benchmarks, we reveal that while LLMs can form a self-consistent system across these dimensions, their solutions often lack the diversity and robustness of human programmers. We identify a significant distribution shift between model cognition and human expertise, with model errors tending to cluster due to training data biases and limited reasoning transfer. Our study demonstrates that incorporating human-generated editorials, solutions, and diverse test cases, as well as leveraging model mixtures, can substantially enhance both the performance and robustness of LLMs. Furthermore, we reveal both the consistency and inconsistency in the cognition of LLMs that may facilitate self-reflection and self-improvement, providing a potential direction for developing more powerful coding models.

解读

一句话总结

该论文提出了一种名为“编码三角形”的框架,用于系统地评估大型语言模型(LLMs)在代码生成、编辑分析和测试用例生成三个维度的能力,并探讨了模型认知与人类专业知识的差距。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源

机器可读索引:llms.txt