scicode-lint: Detecting Methodology Bugs in Scientific Python Code with LLM-Generated Patterns
Organizations: Authentic Research Partners, Princeton, NJ
Abstract
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.
Figures & tables
| Tool | Patterns | Status |
| dslinter ( Haakman et al., 2022 ) | 25 | PyPI, Jun 2022; broken by pylint 3.0 |
| MLScent ( Shivashankar and Martini, 2025 ) | 76 | Not on PyPI |
| mllint ( van Oort, 2022 ) | N/A | “No longer maintained” |
| DyLin ( Eghbali et al., 2025 ) | 15 (3 ML) | Not on PyPI; requires Docker |
| Yang et al. (2022) | 3 (leakage) | GitHub only; 92.9% validation acc. |
| scicode-lint | 66 | PyPI + GitHub; 97.7% controlled; 65% P, 100% R on labeled notebooks |
| Layer | Optimized? | Key result |
|---|---|---|
| Pattern evals | Yes | 97.7% accuracy |
| Integration (n=50) | No | 58% P, 85% R |
| Kaggle labeled ( Yang et al., 2022 ) | No | 65% P, 100% R (preprocessing leakage) |
| PapersWithCode (feedback) ( Papers with Code, 2025 ) | Feedback iter. | 62% P |
| PapersWithCode (holdout) ( Papers with Code, 2025 ) | No | 54% P |
| Severity | Findings | Valid | Precision |
|---|---|---|---|
| Critical | 21 | 5 | 24% |
| High | 77 | 52 | 68% |
| Medium | 39 | 28 | 72% |
| Layer | What it checks | Cost |
|---|---|---|
| Deterministic (15 checks) | Structure, syntax, file sync, data leakage in test files | Free, seconds |
| Diversity check | Redundant tests, non-diverse negatives (semantic similarity) | Local vLLM |
| Semantic validation | Detection question test file documentation consistency | Frontier model tokens |
| Pattern evals | Detection accuracy (P, R, F1) | Local vLLM |
| Integration tests | Generalization to LLM-generated code (50 scenarios) | Local vLLM + frontier |
| Real-world validation | Precision on actual scientific code | Local vLLM + frontier |
Static Code Analysis
Static code analysis examines source code without running it to find defects, security risks, and maintainability problems.
See all 55 papers