Skip to content
Beaconby Winda
FactInspection, Testing and Monitoring · Corrosion monitoring

How is machine learning used to predict corrosion rates?

·4 sources

Short answer

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.

By , Editor·Researched and drafted by ·Checked by , Editor·Last checked ·Next review

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)DataModelReported resultLimit or caveat
Atmospheric corrosion of steel and zinc, 1999 1Worldwide exposure dataANNTesting R² 0.548 (steel), 0.608 (zinc)Interpolates from past data
Atmospheric corrosion of low-alloy steels 1Outdoor exposure dataRandom forest and two boosting modelsR² 0.93 to 0.96 in training, 0.69 to 0.77 in testingAccurate only at low corrosion rates
Internal corrosion of pipelines 1Pipe geometry, multiphase flow and deterministic model outputsSingle ANN vs ensemble of ANNsTesting R² 0.689 vs 0.884 for corrosion rateSmall training sample
Carbon dioxide (CO2) corrosion of pipeline steels with impurities, 2024 3248 laboratory data points from 41 articles, 10 inputsRandom forest, best of sixR² 0.92 training, 0.88 testingLaboratory tests compiled from published papers; water was the dominant factor in that dataset
External corrosion of two transmission pipelines, 2025 2ILI runs and soil dataBayesian neural networkGrowth of depth and length with uncertainty bandsUncertainty 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 wellWhat it can miss or get wrongIn the Library
Links between soil conditions and external corrosion along a buried line 2Trends hidden by mismatched ILI runs, changed tool accuracy or reporting rules, or repairs between runs 2What is soil corrosion?, What is in-line inspection (ILI) and pigging?
Defect growth with an uncertainty band over the next interval 2Longer horizons, where uncertainty grows sharply and models need new inspection data 2What happens after an in-line inspection run?
Rates inside the range of the training data, such as compiled CO2 laboratory tests 3Rates outside that range; one reviewed model was accurate only at low rates 1What is carbon dioxide (CO2) corrosion?
Topics where reviewed models generalized well, such as marine corrosion of steel 1Localized attack: predictions of rebar corrosion were the most scattered in the review, with the largest errors where pitting occurred 1What is pitting corrosion?

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

Common questions

Does a machine learning model replace inspection?
The PHMSA-funded study concluded that its models need repeated updating with data from regular inspections, and US gas rules require operators to account for the uncertainty in ILI results that such models use.
How accurate is machine learning corrosion prediction?
There is no single figure. Testing R² values in the 2022 review ranged from about 0.34 to 0.97, depending on topic, data and model.
Is machine learning the same as a physics-based corrosion model?
No. Physics-based models compute corrosion from mechanisms such as electrochemistry and mass transfer, while machine learning fits patterns in data.

Beacon explains these concepts in its own words for education. It does not reproduce or replace the standards cited, and Winda is not affiliated with or endorsed by the organizations that publish them. Engineering decisions need the current edition of the standard and a qualified engineer.

Sources

  1. 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) ·
  2. 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
  3. 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 ·
  4. 4.49 CFR 192.921, How is the baseline assessment to be conducted? · eCFR, US Office of the Federal Register