MDAgent2:分子動力学におけるコード生成と知識Q&Aのための大規模言語モデル
MDAgent2: Large Language Model for Code Generation and Knowledge Q&A in Molecular Dynamics
January 5, 2026
著者: Zhuofan Shi, Hubao A, Yufei Shao, Mengyan Dai, Yadong Yu, Pan Xiang, Dongliang Huang, Hongxu An, Chunxiao Xin, Haiyang Shen, Zhenyu Wang, Yunshan Na, Gang Huang, Xiang Jing
cs.AI
要旨
分子動力学(MD)シミュレーションは材料科学における原子スケールの挙動を理解するために不可欠であるが、LAMMPSスクリプトの作成は依然として高度に専門的で時間を要する作業である。大規模言語モデル(LLM)はコード生成やドメイン特化の質問応答で有望な可能性を示しているものの、MD分野での性能は、ドメインデータの不足、最新LLMの高い導入コスト、コードの低い実行可能性によって制限されている。我々の以前の研究MDAgentを発展させ、本論文ではMD分野において知識Q&Aとコード生成の両方を実行可能な初のエンドツーエンドフレームワークであるMDAgent2を提案する。MD知識、質問応答、コード生成の3つの高品質データセットを構築するドメイン特化データ構築パイプラインを開発した。これらのデータセットに基づき、継続事前学習(CPT)、教師ありファインチューニング(SFT)、強化学習(RL)の3段階のポストトレーニング戦略を採用し、ドメイン適応モデルMD-InstructとMD-Codeを訓練した。さらに、シミュレーション結果を報酬信号として活用し、低報酬軌道を継続的な改善のために再利用する閉ループRL手法MD-GRPOを導入する。コード生成、実行、評価、自己修正を統合した導入可能なマルチエージェントシステムMDAgent2-RUNTIMEを構築した。本論文で提案するLAMMPSコード生成と質問応答の初のベンチマークMD-EvalBenchと併せ、我々のモデルとシステムは複数の強力なベースラインを上回る性能を達成した。本研究は、産業シミュレーションタスクにおける大規模言語モデルの適応性と汎化能力を体系的に実証し、AI for Scienceおよび産業規模シミュレーションにおける自動コード生成の方法論的基盤を確立するものである。URL: https://github.com/FredericVAN/PKU_MDAgent2
English
Molecular dynamics (MD) simulations are essential for understanding atomic-scale behaviors in materials science, yet writing LAMMPS scripts remains highly specialized and time-consuming tasks. Although LLMs show promise in code generation and domain-specific question answering, their performance in MD scenarios is limited by scarce domain data, the high deployment cost of state-of-the-art LLMs, and low code executability. Building upon our prior MDAgent, we present MDAgent2, the first end-to-end framework capable of performing both knowledge Q&A and code generation within the MD domain. We construct a domain-specific data-construction pipeline that yields three high-quality datasets spanning MD knowledge, question answering, and code generation. Based on these datasets, we adopt a three stage post-training strategy--continued pre-training (CPT), supervised fine-tuning (SFT), and reinforcement learning (RL)--to train two domain-adapted models, MD-Instruct and MD-Code. Furthermore, we introduce MD-GRPO, a closed-loop RL method that leverages simulation outcomes as reward signals and recycles low-reward trajectories for continual refinement. We further build MDAgent2-RUNTIME, a deployable multi-agent system that integrates code generation, execution, evaluation, and self-correction. Together with MD-EvalBench proposed in this work, the first benchmark for LAMMPS code generation and question answering, our models and system achieve performance surpassing several strong baselines.This work systematically demonstrates the adaptability and generalization capability of large language models in industrial simulation tasks, laying a methodological foundation for automatic code generation in AI for Science and industrial-scale simulations. URL: https://github.com/FredericVAN/PKU_MDAgent2