GPT-4.1在复杂实验自动化中表现卓越,代码生成成功率100%。
GPT-4.1 Sets the Standard in Automated Experiment Design Using Novel Python Libraries
- 用零样本提示引导LLM生成代码,测试其对陌生API的理解能力。
- GPT-4.1在两项任务中均实现100%成功,其他模型多低于50%。
- 揭示了第三方库文档缺陷,适合科研自动化研究者参考。
大型语言模型(LLMs)在科学计算代码自动生成方面进展迅速,但其对陌生Python API在复杂实验中的理解能力仍不明确。本研究系统评估了一批顶尖LLM在两个逐步复杂的场景下的表现:使用ParShift库进行对话式数据分析,以及利用pyclugen和scikit-learn生成合成数据并聚类。所有实验采用结构化零样本提示,明确指定需求但未提供示例。通过多次运行量化评估代码功能正确性与提示遵循度,并定性分析执行失败时的错误。结果显示,仅少数模型能持续生成可运行代码。GPT-4.1在两项任务中均达到100%成功率,而多数模型成功率不足一半,仅有Grok-3和Mistral-Large接近该水平。此外,该方法还暴露出第三方库如文档不清或实现隐晦的问题。研究揭示了当前LLMs在端到端科研自动化中的局限,强调需优化提示设计、完善库文档及提升模型能力。
原文摘要 · Abstract (English)
Large Language Models (LLMs) have advanced rapidly as tools for automating code generation in scientific research, yet their ability to interpret and use unfamiliar Python APIs for complex computational experiments remains poorly characterized. This study systematically benchmarks a selection of state-of-the-art LLMs in generating functional Python code for two increasingly challenging scenarios: conversational data analysis with the \textit{ParShift} library, and synthetic data generation and clustering using \textit{pyclugen} and \textit{scikit-learn}. Both experiments use structured, zero-shot prompts specifying detailed requirements but omitting in-context examples. Model outputs are evaluated quantitatively for functional correctness and prompt compliance over multiple runs, and qualitatively by analyzing the errors produced when code execution fails. Results show that only a small subset of models consistently generate correct, executable code. GPT-4.1 achieved a 100\% success rate across all runs in both experimental tasks, whereas most other models succeeded in fewer than half of the runs, with only Grok-3 and Mistral-Large approaching comparable performance. In addition to benchmarking LLM performance, this approach helps identify shortcomings in third-party libraries, such as unclear documentation or obscure implementation bugs. Overall, these findings highlight current limitations of LLMs for end-to-end scientific automation and emphasize the need for careful prompt design, comprehensive library documentation, and continued advances in language model capabilities.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。