arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2606.17648cs.AI
收藏

从酝酿到解析:追踪LLM中代码推理的内部生命周期

From Brewing to Resolution: Tracing the Internal Lifecycle of Code Reasoning in LLMs

South China University of Technology(华南理工大学);Sun Yat-sen University(中山大学);Tsinghua University(清华大学);Shanghai Jiao Tong University(上海交通大学);Nanjing University(南京大学);The Chinese University of Hong Kong, Shenzhen(香港中文大学(深圳));Hangzhou Dianzi University(杭州电子科技大学);Guangzhou College of Technology and Business(广州工商学院)

Siyue Chen, Yifu Guo, Yuquan Lu, Zishan Xu, Jiaye Lin, Jianbo Lin, Siyu Zhang, Cheng Yang, Junxin Li, Yujia Li, Yu Huo, Ruixuan Wang

AI总结:

提出双重诊断框架(逐层线性探针与上下文剥离解码),揭示LLM在代码推理中先酝酿答案后进入四种解析结果(已解析、过度处理、错误解析、未解析)的内部生命周期,发现酝酿支架稳定而解析成功随能力变化。

摘要:

标准准确率指标无法解释为什么LLM能处理变量追踪但在语义等价的循环上失败。我们研究了代码推理的内部生命周期,其中模型首先酝酿答案,使其在变得可自解码之前的许多层就线性可恢复,然后分化为四种解析结果之一:已解析、过度处理、错误解析或未解析。理解这一生命周期很重要,因为相似的任务准确率可能掩盖表面评估无法检测的根本不同的失败模式。我们引入了一个双重诊断框架,将逐层线性探针与上下文剥离解码(CSD)配对,并将其应用于跨越Qwen、Llama和DeepSeek架构的16个模型的六个代码推理任务族。所有四种结果在每个任务族中都占有显著比例:总体已解析仅为41.5%,多个任务低于30%。对结构、深度和算子的受控扫描揭示了特定任务的失败瓶颈:函数调用已解析率随着调用深度从一层增加到三层而从61.1%骤降至2.5%。跨架构和规模,酝酿支架保持稳定,所有16个模型的归一化酝酿持续时间为24-42%,而解析成功随能力变化。这表明该支架是测试的解码器-only Transformer家族中稳定的经验规律,而解析成功与能力、规模和训练共变。代码:此 https URL

英文摘要:

Standard accuracy metrics cannot explain why LLMs handle variable tracking but fail on semantically equivalent loops. We study an internal lifecycle of code reasoning in which models first brew the answer, making it linearly recoverable many layers before it becomes self-decodable, and then diverge into one of four resolution outcomes: Resolved, Overprocessed, Misresolved, or Unresolved. Understanding this lifecycle matters because similar task accuracies can mask fundamentally different failure modes that surface-level evaluation cannot detect. We introduce a dual diagnostic framework pairing layer-wise linear probing with Context-Stripped Decoding (CSD) and apply it to six code-reasoning task families across 16 models spanning Qwen, Llama, and DeepSeek architectures. All four outcomes carry substantial mass in every task family: overall Resolved is only 41.5%, with multiple tasks below 30%. Controlled sweeps over structure, depth, and operators expose task-specific failure bottlenecks: Function Call Resolved plunges from 61.1% to 2.5% as call depth increases from one to three. Across architectures and scales, the brewing scaffold remains stable, with normalized brewing duration 24-42% across all 16 models, while resolution success varies with capability. This indicates that the scaffold is a stable empirical regularity across the tested decoder-only Transformer families, whereas resolution success covaries with capability, scale, and training. Code: https://github.com/euyis1019/llm-brewing

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

↑