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."
Methods
The authors developed OceanCoder, based on the Qwen3-8B architecture, using a two-stage training approach:
- 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.
- 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:
- Input Layer: Checks if the model correctly applied the requested physical parameters (geometry, properties, loads).
- Process Layer: Confirms that the required simulation stages (static or dynamic) actually completed.
- 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.
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.
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