FEM-Bench: A Structured Scientific Reasoning Benchmark for Evaluating Code-Generating LLMs
Preprint
Abstract
As LLMs advance their reasoning capabilities about the physical world, the absence of rigorous benchmarks for evaluating their ability to generate scientifically valid physical models has become a critical gap. Computational mechanics, which develops and applies mathematical models and numerical methods to predict the behavior of physical systems under forces, deformation, and constraints, provides an ideal foundation for structured scientific reasoning evaluation. Problems follow clear mathematical structure, enforce strict physical and numerical constraints, and support objective verification. The discipline requires constructing explicit models of physical systems and reasoning about geometry, spatial relationships, and material behavior, connecting directly to emerging AI goals in physical reasoning and world modeling. We introduce FEM-Bench, a computational mechanics benchmark designed to evaluate the ability of LLMs to generate correct finite element method (FEM) and related code. FEM-Bench 2025 contains a suite of introductory but nontrivial tasks aligned with material from a first graduate course on computational mechanics. These tasks capture essential numerical and physical modeling challenges while representing only a small fraction of the complexity present in the discipline. Despite their simplicity, state-of-the-art LLMs do not reliably solve all of them. In a five attempt run, the best performing model at function writing, Gemini 3 Pro, completed 30/33 tasks at least once and 26/33 tasks all five times. The best performing model at unit test writing, GPT-5, had an Average Joint Success Rate of 73.8%. Other popular models showed broad performance variation. FEM-Bench establishes a structured foundation for evaluating AI-generated scientific code, and future iterations will incorporate increasingly sophisticated tasks to track progress as models evolve.Keywords
All Related Versions
This publication has 12 references indexed in Scilit:
- Towards robust surrogate models: Benchmarking machine learning approaches to expediting phase field simulations of brittle fractureComputer Methods in Applied Mechanics and Engineering, 2025
- Nine circles of elastic brittle fracture: A series of challenge problems to assess fracture modelsComputer Methods in Applied Mechanics and Engineering, 2025
- DeepSeek vs. ChatGPT vs. Claude: A comparative study for scientific computing and scientific machine learning tasksTheoretical and Applied Mechanics Letters, 2025
- Optimizing Instructions and Demonstrations for Multi-Stage Language Model Programs2024
- Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language ProcessingACM Computing Surveys, 2023
- Dynamic simulation of articulated soft robotsNature Communications, 2020
- Mechanical MNIST: A benchmark dataset for mechanical metamodelsExtreme Mechanics Letters, 2020
- Nonlinear Solid Mechanics: A Continuum Approach for Engineering ScienceMeccanica, 2002
- Matrix Structural AnalysisJournal of Mechanical Design, 1982
- Stiffness and Deflection Analysis of Complex StructuresJournal of the Aeronautical Sciences, 1956