# How is machine learning used to predict corrosion rates?

> Machine learning predicts corrosion rates by training statistical models, such as neural networks or random forests, on measured corrosion data. Inputs include material, environment, operating conditions and past inspection results. Peer-reviewed and government-funded studies report close fits within the range of their training data, and weaker, more uncertain results outside it or further ahead.

- Label: Fact
- Type: Explainer
- Published: 2026-11-13T09:39:01+09:00
- By: Jun Zhong
- Researched and drafted by: Beacon's AI newsroom
- Checked by: Jun Zhong on 2026-11-13
- Topics: Pipelines, Upstream and offshore
- Canonical: https://beacon.winda.ai/library/machine-learning-corrosion-prediction/

## Why does it matter?

A model that fits past data well can still fail outside it. In one atmospheric corrosion study covered by a 2022 review, three tree-based models predicted low corrosion rates accurately but not high ones, because the data held few high-rate samples [1]. A 2025 university report for the US Pipeline and Hazardous Materials Safety Administration (PHMSA) found that pipeline corrosion growth predictions lost reliability over longer horizons and needed updating from regular inspections [2]. The review also describes corrosion data as typically incomplete, noisy and mixed in format, one reason the field has gained less from data-driven methods than others [1].

## What data and models are used?

**Inputs.** Published models draw on four kinds of variable [1][2][3]:

- environment, such as temperature, time of wetness, sulfur dioxide, chloride, pH and dissolved oxygen; [1][2][3]
- material, such as the content of chromium, carbon, silicon, phosphorus and sulfur in steel; [1][2][3]
- system and operating data, such as operating pressure, pipe geometry and flow, or soil moisture, pH and redox potential along a buried line; [1][2][3]
- time and inspection history, such as defect depth and length from successive in-line inspection (ILI) runs. [1][2][3]

**Models.** Studies use artificial neural networks (ANNs), random forests, gradient boosting, support vector machines and Bayesian neural networks, which also estimate their own uncertainty [1][2]. The 2022 review screened 164 records and kept 19 papers with 34 models that reported comparable scores. Across them, ensembles of several learners generally scored best, and adding time as an input raised performance [1]. Atmospheric corrosion was the most studied topic [1].

| Study (source) | Data | Model | Reported result | Limit or caveat |
|---|---|---|---|---|
| Atmospheric corrosion of steel and zinc, 1999 [1] | Worldwide exposure data | ANN | Testing R² 0.548 (steel), 0.608 (zinc) | Interpolates from past data |
| Atmospheric corrosion of low-alloy steels [1] | Outdoor exposure data | Random forest and two boosting models | R² 0.93 to 0.96 in training, 0.69 to 0.77 in testing | Accurate only at low corrosion rates |
| Internal corrosion of pipelines [1] | Pipe geometry, multiphase flow and deterministic model outputs | Single ANN vs ensemble of ANNs | Testing R² 0.689 vs 0.884 for corrosion rate | Small training sample |
| Carbon dioxide (CO2) corrosion of pipeline steels with impurities, 2024 [3] | 248 laboratory data points from 41 articles, 10 inputs | Random forest, best of six | R² 0.92 training, 0.88 testing | Laboratory tests compiled from published papers; water was the dominant factor in that dataset |
| External corrosion of two transmission pipelines, 2025 [2] | ILI runs and soil data | Bayesian neural network | Growth of depth and length with uncertainty bands | Uncertainty grows sharply over longer horizons |

R² is the coefficient of determination: 1 means a perfect fit to the test data. The review cautions that scores come from different datasets and settings, so they compare approaches broadly, not models directly [1].

## How is it applied to pipelines?

The PHMSA-funded study, led by Rutgers University, used ILI data from two operators [2]. One 12-mile line built in 1974 had magnetic flux leakage runs in 2005, 2012 and 2016, which reported 792, 1,345 and 2,508 external corrosion defects. A second line, 112 km of grade X52 pipe in service since 1969, had a magnetic flux leakage run in 2005, an ultrasonic run in 2010 and soil data along the route [2].

The study reported that defects near girth welds or close to other defects were more likely to be severe, and that corrosion was more likely in soils with high moisture, low pH and high redox potential [2]. Grouping defects by soil zone improved accuracy and reduced uncertainty. The team also built reinforcement learning models to plan inspection and repair, and noted that these rest on assumed costs and repair effectiveness that still need field validation [2].

US gas pipeline rules already require operators using ILI to account for uncertainties such as tool tolerance, detection threshold, probability of detection and sizing accuracy [4]. A model trained on those results inherits them.

## What limits the predictions?

- **Small datasets.** The review found small training sets, which can lead to overfitting, among the most common departures from good practice; one study had only 8 samples and did not split them into training and test sets [1].
- **Extrapolation.** Models generalize poorly beyond the range of their data, and some were validated only in the laboratory [1].
- **Horizon.** Uncertainty in predicted growth rose sharply for longer-term forecasts [2].
- **Inspection data quality.** Depths from different ILI runs did not always increase as expected; the study attributes this to changes in tool accuracy and reporting criteria, distance mismatches between runs, and repairs [2].
- **Interpretability.** Ensemble methods are hard to interpret mechanistically, which has driven work on more interpretable algorithms [1].

## How does it relate to physics-based models?

For CO2 corrosion, the 2024 paper describes three earlier model families: empirical models fitted to laboratory and field data, semi-empirical models, and mechanistic models built on electrochemistry and mass transfer [3]. Machine learning needs no explicit mechanism, which the authors present as its advantage [3]. The 2022 review also describes a hybrid use: training a model to capture the gap between measurements and a deterministic model's output [1].

## Where integrity problems show up

| What it finds well | What it can miss or get wrong | In the Library |
|---|---|---|
| Links between soil conditions and external corrosion along a buried line [2] | Trends hidden by mismatched ILI runs, changed tool accuracy or reporting rules, or repairs between runs [2] | What is soil corrosion?, What is in-line inspection (ILI) and pigging? |
| Defect growth with an uncertainty band over the next interval [2] | Longer horizons, where uncertainty grows sharply and models need new inspection data [2] | What happens after an in-line inspection run? |
| Rates inside the range of the training data, such as compiled CO2 laboratory tests [3] | Rates outside that range; one reviewed model was accurate only at low rates [1] | What is carbon dioxide (CO2) corrosion? |
| Topics where reviewed models generalized well, such as marine corrosion of steel [1] | Localized attack: predictions of rebar corrosion were the most scattered in the review, with the largest errors where pitting occurred [1] | [What is pitting corrosion?](/library/pitting-corrosion/) |

Sources: Coelho et al., 2022 [1]; Rutgers University report for PHMSA, 2025 [2]; Dong et al., 2024 [3].

## Sources

1. [Reviewing machine learning of corrosion prediction in a data-oriented perspective (L. B. Coelho, D. Zhang, Y. Van Ingelgem, D. Steckelmacher, A. Nowé, H. Terryn), npj Materials Degradation 6:8, Springer Nature (open access)](https://www.nature.com/articles/s41529-022-00218-4), 2022-01-26
2. [Pipeline Risk Management Using Artificial Intelligence-Enabled Modeling and Decision Making, CAAP Final Report, contract 693JK32150001CAAP (H. Wang, B. Cui, Q. Huang, A. Khatami, X. Yang), Rutgers University, for the US Pipeline and Hazardous Materials Safety Administration (PHMSA) Competitive Academic Agreement Program](https://primis.phmsa.dot.gov/rd/FileGet/22500/693JK32150001CAAP__Final_Report_12.29.2025.docx)
3. [Development of a Predictive Model for Carbon Dioxide Corrosion Rate and Severity Based on Machine Learning Algorithms (Z. Dong, M. Zhang, W. Li, F. Wen), Materials 17(16):4046, MDPI, via PubMed Central](https://pmc.ncbi.nlm.nih.gov/articles/PMC11356124/), 2024-08-14
4. [49 CFR 192.921, How is the baseline assessment to be conducted?, eCFR, US Office of the Federal Register](https://www.ecfr.gov/current/title-49/section-192.921)

Published by Winda Beacon (https://beacon.winda.ai).
