Manuscript Offprint

arXiv:2609.00099

Generative artificial intelligence for reliable mechanistic reasoning for corrosion

Bharath M N, R K Singh Raman, Alankar Alankar

Abstract

Corrosion accounts for approximately 4% of global GDP, and reliable prediction is essential for timely mitigation. Machine learning effectively predicts corrosion rates from composition, microstructure, and environmental variables, but cannot explain the underlying mechanisms. A reliable approach in safety-critical materials engineering requires not only accurate retrieval but also mechanically defensible reasoning, a capability that existing factuality metrics cannot assess. This work presents a domain-adapted retrieval-augmented generation framework for corrosion knowledge synthesis, demonstrated on magnesium alloy corrosion. Three open-weight language models (Llama-3.1-8B, Qwen-2.5-7B, Mistral-7B) are fine-tuned on 3,309 expert-verified question-answer pairs from 840 peer-reviewed papers and integrated with a hybrid dense-lexical retrieval pipeline. Retrieval augmentation produces Token F1 gains of 143–194%, with system faithfulness of 0.964 and context recall of 0.988. Blind external validation on newly published literature and in-house electrochemical data confirms trend-level generalisation. Reason Map, a proposition-graph framework, is further introduced; it independently constructs directed evidence graphs from generated answers and retrieved literature, enabling systematic detection of causal direction inversions and unsupported inferential leaps that flat factuality metrics cannot expose. The modular architecture can be applied across domains, offering a generalizable blueprint for trustworthy AI-assisted knowledge synthesis to circumvent corrosion, which can also be applied to other engineering domains.

Keywords: corrosion informatics, artificial intelligence, reasoning validation, materials informatics.

1. Corrosion assessment in the age of data-driven methods: from pattern recognition to mechanistic reasoning

Artificial intelligence (AI) is beginning to show promise in understanding complex corrosion phenomena, including the adsorption of aggressive species and inhibitors on corroding surfaces. 1,2^{1,2} This progress is important because corrosion remains a major global challenge, costing approximately US2.5 trillion annually and affecting infrastructure, energy systems, transport networks, and biomedical devices worldwide. 3^{3} Reliable assessment requires integrating electrochemical, chemical, and transport processes that interact simultaneously across alloy composition, microstructure, electrolyte chemistry, and exposure conditions. This combinatorial complexity is something conventional experimental methods, for all their mechanistic rigour, cannot scale across. 3^{3} This has motivated a sustained transition toward machine learning (ML) for corrosion rate prediction, structure-property modelling, and risk-informed design, with methods including gradient boosting, neural networks, and vision-based quantification now applied across multiple alloy systems. 4−7^{4-7} Yet most deployed models operate within a knowledge-based paradigm wherein predictions are derived from patterns embedded in narrow, domain-specific datasets, without access to the mechanistic reasoning accumulated across decades of published corrosion science, limiting both generalisation and scientific interpretability (Table S1). 4,7^{4,7}

Large language models (LLMs) coupled with retrieval-augmented generation (RAG) offer a qualitatively different capability: evidence-grounded synthesis across dispersed textual knowledge, instead of pattern interpolation within a fixed training distribution. 8,9^{8,9} For corrosion science, where authoritative evidence is distributed across thousands of peer-reviewed papers, technical standards, and experimental databases, this raises the prospect of systems that assemble evidence across composition, environment, and degradation pathway to produce mechanically meaningful explanations. Recent work has begun to establish the feasibility of this approach: domain-adapted transformers have improved literature-based candidate discovery and structured knowledge extraction, 10−14^{10-14} fine-tuned LLMs with RAG have demonstrated competitive accuracy on corrosion-specific question answering, 9^{9} and LLM-driven electrochemical impedance spectroscopy interpretation has achieved classification accuracies exceeding 90% on experimental coating datasets. 15^{15} However, all existing systems share a critical limitation: none has been validated on literature published after training and indexing, the only test that distinguishes genuine generalisation from sophisticated memorisation. More fundamentally, retrieval does not guarantee sound reasoning. A model may retrieve relevant evidence yet still invert causal relationships, omit the inferential steps linking evidence to conclusions, or combine claims from mutually inconsistent sources. In safety-critical engineering, such failures can directly affect design, monitoring, and qualification decisions.

Existing evaluation frameworks are not equipped to detect these errors. Factuality metrics such as FActScore, SAFE, and RAGAS break a generated answer into atomic claims and verify each claim independently against retrieved evidence. 16−18^{16-18} Knowledge-based approaches similarly test consistency against structured fact repositories, rather than the coherence of the underlying inference. 19,20^{19,20} Both approaches share the same blind spot: they evaluate propositions one at a time and cannot see errors in the reasoning chain that links them. This matters even more in mechanistic domains. Figure 1 presents a representative case from this study, involving a generated answer on the effect of a rare-earth element on magnesium alloy corrosion. The answer achieved a RAGAS faithfulness score of 0.964, and seven of nine proposition nodes were individually supported by retrieved evidence, with entailment scores ranging from 0.919 to 0.998. Nonetheless, the response contained a causal inversion. It claimed that denser rare-earth-oxide surface films caused coherent growth along the MgO (002) plane, whereas the retrieved evidence supported the reverse causal relationship. The relevant propositions passed independent natural language inference (NLI) verification, making the error invisible to flat factuality metrics. It became detectable only by comparing the directed structure of the answer with an independently constructed evidence graph. In corrosion science, such structural errors are consequential. The direction and sequence of electrochemical and surface processes can determine whether a practitioner treats film nucleation mode or film density as the primary design variable.

Here we present an end-to-end framework for domain-adapted corrosion knowledge synthesis, validated across automatic metrics, blinded expert human assessment, blind external evaluation on newly published literature, and independent experimental electrochemical data. Three open-weight language models, Llama-3.1-8B instruct, Qwen-2.5-7B instruct, and Mistral-7B instruct, are fine-tuned via low-rank adaptation on 3,309 expert-verified question-answer (Q-A) pairs derived from 840 peer-reviewed papers in magnesium alloy corrosion, a mechanically rich and safety-critical proof-of-concept domain, and integrated with a hybrid dense-lexical retrieval pipeline combining reciprocal rank fusion and cross-encoder reranking. We introduce Reason Map, a proposition-graph framework that compares the reasoning structure of generated answers against independently constructed evidence graphs from retrieved literature. This structural comparison enables systematic detection of causal inversions and unsupported inferential leaps that flat factuality metrics miss. Built on a modular, open-weight and domain-agnostic architecture, Reason Map offers a replicable blueprint for trustworthy AI-assisted knowledge synthesis in corrosion science and related engineering fields, where scientifically defensible reasoning has crucial practical consequences.

(a)

Figure

(b)

Figure

(c)

ClaimOutgoing relationNLI verdict
P1Rare earth elements form stable RE oxides and solid solutions in Mg alloys.mechanistic causesupported
P2RE oxides lower cathodic polarization potential of Mg alloys.impliessupported
P3RE additions reduce hydrogen evolution during Mg corrosion.supportssupported
P4RE oxides create denser surface films on Mg alloys.mechanistic causesupported
P5RE oxides grow coherently along the (002) plane of MgO.supportssupported
P6The corrosion product film on aged WE43 alloy is a three-layer structure.mechanistic causesupported
P7The three-layer film consists of RE2O3RE_{{2}}O_{{3}}, MgO doped with RE2O3RE_{{2}}O_{{3}}, and Mg(OH)2\text{Mg(OH)}_{{2}} doped with RE2O3RE_{{2}}O_{{3}}.mechanistic causesupported
P8The RE2O3RE_{{2}}O_{{3}} layer provides the highest protection with PBR of 1.1653.-weak / NEI
P9RE improves mechanical properties through second-phase hardening, solid solution strengthening, and precipitation strengthening.mechanistic causeweak / NEI

Figure 1. Reason Map detects a causal inversion missed by claim-level factuality checking.

Reason Map output for the query “What is the role of rare-earth elements in Mg alloy corrosion?”, generated by Llama-3.1-8B-Instruct with hybrid retrieval and Phase 1 + Phase 2 validation. (a) Answer graph. Nine proposition nodes, P1–P9, were extracted from the generated answer and connected by nine typed inference edges. Node colour indicates the natural language inference (NLI) verdict against retrieved evidence: blue indicates supported claims and amber indicates not enough information (NEI). Seven nodes were NLI-supported, with entailment scores ranging from 0.919 to 0.998, whereas P8 and P9 were NEI. Edge style indicates alignment with the independently constructed evidence graph (EG): solid green denotes an EG-validated relation, dashed grey denotes an unsupported inferential leap, and solid red denotes a causal reversal. The red dashed box marks the only causal reversal detected, P4→P5. The answer graph asserts that denser rare-earth-oxide surface films cause coherent growth along the MgO (002) plane, whereas the retrieved evidence supports the reverse direction. Two edges are EG-validated (P9→P1 and P3→P4), six are unsupported inferential leaps (P1→P2, P2→P3, P5→P6, P6→P7, P7→P8 and P9→P8), and one is a causal reversal (P4→P5). (b) Evidence graph. The evidence graph, built independently from the top five retrieved chunks without reference to the generated answer, contains the evidence-supported edge EG(P5)→EG(P4): coherent rare-earth-oxide growth along the MgO (002) plane as the mechanistic cause of dense protective film formation. This confirms that the answer-graph direction P4→P5 is inverted relative to the evidence. P4 and P5 both pass NLI verification individually, with entailment scores of 0.995 and 0.919, respectively; the causal error is therefore undetectable by flat claim-level checking and is exposed only by dual-graph alignment. (c) Proposition key. Claim text, outgoing inference relation and NLI verdict for each proposition node. Overall, seven of nine propositions were evidence-supported, two were NEI, no node was directly contradicted, one causal reversal was detected, and six of nine inference edges were unsupported by the evidence graph.

References (47)