OceanCoder: A Verification-Guided Large Language Model for Automated Simulation Modelling in Ocean Engineering

Can Xue, Changhong He, Ziyi Sun, Anliang Ge, Shimin Yu, Bingchen LiangarXiv 2026

TL;DR

OceanCoder is a specialized large language model (LLM) designed to automate the complex task of building numerical simulation models for ocean engineering. By integrating a three-layer engineering verification framework into its training process, it ensures that generated programs are not just syntactically correct, but physically sound and aligned with specific engineering requirements.

What Problem Does This Paper Address?

Numerical simulations are the backbone of ocean engineering, used to assess everything from mooring systems to subsea installations. However, building these models in specialized software like OrcaFlex requires deep domain expertise to correctly define physical properties, environmental conditions, and analysis steps.

While general-purpose LLMs are great at writing code, they often fall into the "verification gap." A generated script might execute perfectly without errors, yet be fundamentally wrong from an engineering perspective—perhaps by using the wrong line diameter or extracting data from the wrong simulation stage. This paper tackles the challenge of moving beyond "code that runs" to "code that works for engineers."

Figure 1. The verification gap between executable code and complete engineering task acceptance. In a two-point lowering task involving a 65 t payload, the reference and OceanCoder programs after SFT both execute, but their line properties and seabed-contact responses differ. At 𝑡= 35.50 s, the reference retains 32.2 mm clearance while the SFT model has 12.5 mm penetration. The predicted first-contact times differ by 0.9301 s, exceeding the 0.010 s task tolerance. Here, 𝑑denotes line diameter and 𝐸𝐴axial stiffness; the reference is a checked simulation solution.

Methods

The authors developed OceanCoder, based on the Qwen3-8B architecture, using a two-stage training approach:

  1. Supervised Fine-Tuning (SFT): The model was first trained on 12,000 high-quality, verified pairs of engineering tasks and their corresponding OrcaFlex (Python API) programs.
  2. Verification-Guided Reinforcement Learning: To further refine the model, the authors used Group Relative Policy Optimisation (GRPO). The key innovation here is a three-layer verification framework:
  3. Input Layer: Checks if the model correctly applied the requested physical parameters (geometry, properties, loads).
  4. Process Layer: Confirms that the required simulation stages (static or dynamic) actually completed.
  5. Output Layer: Verifies that the extracted results are numerically plausible and match the requested quantities.

Instead of a simple pass/fail, the model receives graded rewards (0, 0.1, 0.4, or 1.0) based on how far it got through these verification layers. This provides a much richer training signal than standard execution feedback.

Figure 2. Overview of the OceanCoder framework for engineering-constrained data construction, supervised fine-tuning, online GRPO and independent evaluation.

Datasets

  • Training Corpus: 12,000 verified SFT examples across 12 categories, including static analysis, dynamic response, and offshore operations (e.g., S-lay pipelay, cable lifting). These were generated using an extensible pipeline that ensures physical consistency between task descriptions and code.
  • OceanCoder Benchmark: A newly introduced 665-task evaluation set. It is divided into three strata:
  • Core parameter variations: Changing values within a known setup.
  • Structural variations: Modifying the physical configuration (e.g., adding supports).
  • Engineering context: Real-world scenarios adapted from industry documentation and project descriptions.

Key Insights and Ideas

  • The "Verification Gap" is Real: The authors demonstrate that execution success does not equal engineering acceptance. In their audit, execution checks alone would have incorrectly accepted 31% of failing programs that had subtle physical configuration errors.
  • Graded Rewards Matter: By rewarding "code that runs but fails engineering checks" (reward 0.4) differently than "code that fails to run" (reward 0.1), the model learns the hierarchical nature of engineering tasks. This approach led to a significant performance boost over binary (0/1) reward schemes.
  • Physical Consistency in Data: To train an engineering model, the data itself must be physically plausible. The authors' "seed-based" generation ensures that parameters like water depth, line length, and endpoint coordinates describe a compatible geometry, preventing the model from learning "garbage" physics.
Figure 4. Verification-guided GRPO training in OceanCoder. Four candidate programs are generated for each engineering requirement. Execution and engineering verification provide graded rewards for policy updates.

Key Results

  • Zero to Hero: The base Qwen3-8B model failed every single task in the benchmark (0% Pass@1). After SFT, it reached 46.77%, and the final GRPO-tuned OceanCoder achieved 51.43%.
  • Outperforming General Models: OceanCoder significantly outperformed a closed-source comparison, ChatGPT-6 Sol, which only achieved a 7.82% Pass@1 on the same benchmark.
  • Stratified Success: The model is highly proficient at parameter variations (88.83% success) but finds structural modifications (11.25%) and complex engineering contexts (3.51%) much more challenging, highlighting where future research should focus.

Limitations and Future Work

While OceanCoder excels at adjusting parameters in familiar setups, it struggles with structural complexity—tasks that require changing the fundamental layout of a model or handling multi-step offshore operations.

The authors note that the current model is limited to the specific categories and assumptions present in their training corpus. Future work will aim to expand the variety of engineering scenarios and explore ways to help the model better generalize to novel structural configurations. Additionally, while the model is verified against simulation "truth," it does not yet validate results against real-world field data.

Summary updated

Abstract

Numerical simulation is important in ocean engineering, but model construction requires expert knowledge. Large language models support automated modelling, but code syntax and successful execution alone do not establish whether generated models and results meet engineering requirements. We present OceanCoder, a Qwen3-8B-based large language model for automated simulation modelling in ocean engineering. To address specialised programming requirements and scarce training data, we develop an extensible data construction pipeline producing 12,000 verified supervised fine-tuning (SFT) examples across 12 engineering task categories. A three-layer verification framework checks model inputs against engineering parameters and task constraints, verifies completion of required simulation analyses, and assesses the engineering plausibility of computed outputs. Its outcomes provide graded rewards for group relative policy optimisation (GRPO), guiding the model towards engineering task completion. We also construct the first benchmark for automated modelling in ocean engineering, covering out-of-distribution tasks and real-world engineering cases. Experiments and ablation studies demonstrate the effectiveness of the data pipeline, verification framework and reward design. OceanCoder outperforms both base models and the closed-source comparison, with Pass@1 increasing from 0% for the base model to 46.77% after SFT and 51.43% after GRPO. These results support engineering verification as a training signal for automated simulation modelling.
BibTeX
@misc{xue2026oceancoder,
  author = {Can Xue and Changhong He and Ziyi Sun and Anliang Ge and Shimin Yu and Bingchen Liang},
  title = {{OceanCoder: A Verification-Guided Large Language Model for Automated Simulation Modelling in Ocean Engineering}},
  year = {2026},
  eprint = {2611.26333},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.26333},
}
Figure