大型语言模型能否重塑基础算法?
Can Large Language Models Reinvent Foundational Algorithms?
April 7, 2026
作者: Jian Zhao, Haoren Luo, Yu Wang, Yuhan Cao, Pingyue Sheng, Tianxing He
cs.AI
摘要
大语言模型已展现出推动科学发现的强大潜力,但其是否具备基础性创新能力仍存争议。本研究聚焦基础创新的先决条件:大语言模型能否重新发明计算机科学中的基础算法?我们提出的"遗忘-重构"框架首先通过LLM遗忘技术从预训练知识中移除特定基础算法(如Dijkstra或Euclid算法),随后在受控环境中测试模型重构该算法的能力。为实现有效遗忘,我们采用基于GRPO的策略性遗忘方法。在涵盖10个目标算法、3个强开源模型和3级提示强度的实验中发现:(1)最强模型Qwen3-4B-Thinking-2507在无提示时成功重构50%算法,一级提示达70%,二级提示达90%;(2)少量高层级提示可提升重构成功率,但逐步提示对复杂算法仍失效;(3)测试时强化学习使Strassen算法在二级提示下实现成功重构。通过输出轨迹分析和消融实验,我们发现重构阶段的生成验证器对维持模型推理能力至关重要,可有效避免"思维坍缩"现象。这些发现为理解大语言模型创新思维的潜力与局限提供了新见解。
English
LLMs have shown strong potential to advance scientific discovery. Whether they possess the capacity for foundational innovation, however, remains an open question. In this work, we focus on a prerequisite for foundational innovation: can LLMs reinvent foundational algorithms in computer science? Our Unlearn-and-Reinvent pipeline applies LLM unlearning to remove a specific foundational algorithm, such as Dijkstra's or Euclid's algorithm, from an LLM's pretrained knowledge, and then tests whether the model can reinvent it in a controlled environment. To enable effective unlearning, we adopt a GRPO-based, on-policy unlearning method. Across 10 target algorithms, 3 strong open-weight models, and 3 hint levels, our experiments demonstrate that (1) the strongest model Qwen3-4B-Thinking-2507 successfully reinvents 50% of the algorithms with no hint, 70% at hint level 1, and 90% at hint level 2; (2) a few high-level hints can enhance the reinvention success rate, but even step-by-step hints fail for those complicated algorithms; and (3) test-time reinforcement learning enables successful reinvention for the Strassen algorithm at hint level 2. Through analyses of output trajectories and ablation studies, we find that generative verifier in the reinvention phase plays a critical role in sustaining models' reasoning strength, helping to avoid the ``thought collapse'' phenomenon. These findings offer insights into both the potential and current limits of LLMs' innovative thinking.