Translating quantum many-body theory into scalable software traditionally requires months of effort. Zero-shot generation of tensor network algorithms by Large Language Models (LLMs) frequently fails due to spatial reasoning errors and memory bottlenecks. We resolve this using a multi-stage workflow that mimics a physics research group. By generating a mathematically rigorous LaTeX specification as an intermediate blueprint, we constrain the coding LLM to produce exact, matrix-free $\mathcal{O}(D^3)$ operations. We validate this approach by generating a Density-Matrix Renormalization Group (DMRG) engine that accurately captures the critical entanglement scaling of the Spin-$1/2$ Heisenberg model and the symmetry-protected topological (SPT) order of the Spin-$1$ AKLT model. Testing across 16 combinations of leading foundation models yielded a 100\% success rate. By compressing a months-long development cycle into under 24 hours ($\sim 14$ active hours), this framework offers a highly reproducible paradigm for accelerating computational physics research.
翻译:将量子多体理论转化为可扩展的软件传统上需要数月的努力。由于空间推理错误和内存瓶颈,大语言模型(LLMs)对张量网络算法的零样本生成常常失败。我们通过一种模仿物理研究组的多阶段工作流解决了这一问题。通过生成数学上严谨的LaTeX规范作为中间蓝图,我们将编码大语言模型约束为产生精确的、无矩阵的$\mathcal{O}(D^3)$操作。我们通过生成一个密度矩阵重正化群(DMRG)引擎来验证该方法,该引擎准确捕捉了自旋-$1/2$海森堡模型的关键纠缠标度以及自旋-$1$ AKLT模型的对称性保护拓扑(SPT)序。对16种主流基础模型的组合进行测试,获得了100%的成功率。通过将数月的开发周期压缩到24小时以内(约14个活动小时),该框架为实现可复现的计算物理研究提供了一种高度可复现的范例。