A Large Language Model-Empowered Agent for Reliable and Robust Structural Analysis

Jiachen Liu, Ziheng Geng, Ran Cao, Lu Cheng, Paolo Bocchini, Minghui ChengarXiv 2025 · DOI

Introduction

While Large Language Models (LLMs) have demonstrated impressive capabilities in qualitative reasoning, their application in high-precision fields like structural engineering has been limited by a tendency toward "hallucinations" and mathematical inconsistency. In civil engineering, where structural integrity is paramount, the reliability and robustness of automated analysis tools are non-negotiable. This research explores a novel framework to transition LLMs from error-prone text generation to rigorous code-based structural analysis.

Methodology: From Text to Code

The core innovation of this work is the reframing of structural analysis as a code-generation task rather than a direct answer-generation task. By acting as a "language-to-action" bridge, the proposed agent leverages Llama-3.3 70B to generate Python scripts utilizing OpenSeesPy, a specialized finite element analysis library.

The agent's architecture is built upon five pillars of structured prompting:

  1. Role Specification: Establishing the LLM as an expert structural engineer.
  2. Chain-of-Thought (CoT): Requiring the model to outline nodes, elements, and loads before coding.
  3. Complete Examples: Providing full problem-to-code references, which ablation studies identified as the most critical component for reliability.
  4. Modular Function Examples: Offering snippets for specific OpenSeesPy functions.
  5. Prescriptive Constraints: Enforcing rules to prevent the modification of essential structural logic.

The generated code is automatically executed, and the OpsVis package is used to visualize results, such as shear and moment diagrams, providing a feedback loop for verification.

Experimental Setup and Datasets

To rigorously test the agent, the authors developed a benchmark of eight representative beam problems. These problems vary in support conditions (simply supported vs. overhang) and loading types (point loads, uniformly distributed loads, and combinations).

A simply supported beam with a moving point load used for robustness testing.

Reliability was assessed by running each problem 500 times independently. Robustness was evaluated by shifting load positions in 1-meter increments across the entire 10-meter span of the beams.

Results and Discussion

The LLM-empowered agent achieved a significant performance leap over standard prompting methods. While the baseline Llama-3.3 70B model's reliability dropped as low as 10% on complex overhang problems, the agent maintained >99.0% reliability across all tasks.

An overhang beam with a fixed UDL and a moving point load, representing a complex test case for the agent.

The agent also exhibited a robustness score of 0.996, indicating near-perfect performance regardless of load placement. Furthermore, the system generalized well to "unseen" scenarios, such as cantilever beams and upward loads, maintaining accuracy between 99.6% and 100%. This suggests that the agent is not merely memorizing patterns but is successfully applying structural mechanics principles through code.

Conclusion and Future Directions

By offloading quantitative calculations to a specialized computational engine, the LLM agent overcomes the inherent mathematical limitations of language models. However, challenges remain, such as occasional "boundary hallucinations" where the model defaults to more common support configurations. Future research aims to integrate Vision-Language Models (VLMs) to allow the agent to interpret structural sketches directly, further enhancing its spatial reasoning and reducing errors in complex configurations.

Summary updated

BibTeX
@misc{liu2025large,
  author = {Jiachen Liu and Ziheng Geng and Ran Cao and Lu Cheng and Paolo Bocchini and Minghui Cheng},
  title = {{A Large Language Model-Empowered Agent for Reliable and Robust Structural Analysis}},
  year = {2025},
  eprint = {2507.02938},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.02938},
}
Figure