scicode-lint: 使用LLM生成的模式检测科学Python代码中的方法论错误
scicode-lint: Detecting Methodology Bugs in Scientific Python Code with LLM-Generated Patterns
AI总结:
提出scicode-lint,通过两级架构(构建时使用前沿模型生成模式,运行时使用小型本地模型执行)自动检测科学Python代码中的方法论错误,如数据泄露、交叉验证错误和缺失随机种子。
摘要:
科学Python代码中的方法论错误会产生看似合理但实际不正确的结果,传统的linter和静态分析工具无法检测到这些错误。多个研究团队构建了特定于ML的linter,证明了检测的可行性。然而,这些工具存在可持续性问题:依赖于特定的pylint或Python版本、有限的打包方式,以及每个新模式都需要手动工程。随着AI生成代码增加了科学软件的数量,对自动化方法论检查(如检测数据泄露、不正确的交叉验证和缺失随机种子)的需求日益增长。我们提出了scicode-lint,其两级架构将模式设计(构建时的前沿模型)与执行(运行时的小型本地模型)分离。模式是生成的,而非手工编码;适应新的库版本花费的是token,而非工程时间。在带有手动标注真实值的Kaggle笔记本上,预处理泄露检测在100%召回率下达到了65%的精确率;在38篇应用AI/ML的已发表科学论文中,精确率为62%(由LLM评判),不同模式类别之间存在显著差异;在一个保留的论文集上,精确率为54%。在受控测试中,scicode-lint在66个模式上达到了97.7%的准确率。
英文摘要:
Methodology bugs in scientific Python code produce plausible but incorrect results that traditional linters and static analysis tools cannot detect. Several research groups have built ML-specific linters, demonstrating that detection is feasible. Yet these tools share a sustainability problem: dependency on specific pylint or Python versions, limited packaging, and reliance on manual engineering for every new pattern. As AI-generated code increases the volume of scientific software, the need for automated methodology checking (such as detecting data leakage, incorrect cross-validation, and missing random seeds) grows. We present scicode-lint, whose two-tier architecture separates pattern design (frontier models at build time) from execution (small local model at runtime). Patterns are generated, not hand-coded; adapting to new library versions costs tokens, not engineering hours. On Kaggle notebooks with human-labeled ground truth, preprocessing leakage detection reaches 65% precision at 100% recall; on 38 published scientific papers applying AI/ML, precision is 62% (LLM-judged) with substantial variation across pattern categories; on a held-out paper set, precision is 54%. On controlled tests, scicode-lint achieves 97.7% accuracy across 66 patterns.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。