Source-linked AI summary

Generative artificial intelligence for reliable mechanistic reasoning for corrosion

Bharath M N, R K Singh Raman, Alankar Alankar

arXiv:2609.00099v1cs.LGcond-mat.mtrl-sci

TL;DR

Corrosion models need mechanistically defensible reasoning because conventional ML and claim-level factuality checks do not provide it. The paper develops a domain-adapted retrieval-augmented framework with proposition-graph auditing for magnesium alloy corrosion. Retrieval improved Token F1 by 143–194%, while Reason Map exposed causal reversals and unsupported inferential leaps that flat factuality metrics missed.

  • Problem

    Conventional corrosion ML operates on narrow datasets without accumulated mechanistic knowledge, while claim-level factuality metrics cannot evaluate the reasoning chains connecting propositions.

  • Method

    The framework fine-tunes open-weight language models on expert-verified magnesium-corrosion literature, adds hybrid retrieval, and audits generated reasoning against independently constructed evidence graphs.

  • Results

    Retrieval augmentation increased Token F1 by 143–194%, and Reason Map detected causal reversals and unsupported inferential leaps despite individually supported generated claims.

  • Takeaways & Limitations

    Reliable corrosion knowledge synthesis requires evaluating both individual claim correctness and the mechanistic reasoning structure connecting claims.

  • Takeaways & Limitations

    The benchmark focuses on magnesium alloy corrosion, while external validation used six examples and broader validation remains necessary before generality can be claimed.

Abstract

from arXiv · show

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 mechanistically 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.

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

Corrosion ML has improved prediction but generally lacks access to the mechanistic knowledge needed for interpretable, generalizable explanations. This framework combines retrieval-grounded synthesis with Reason Map auditing to detect reasoning errors that claim-level factuality metrics miss.

  • Machine-learning corrosion models predict from narrow datasets without accessing accumulated mechanistic knowledge, limiting generalisation and scientific interpretability.
  • Retrieval-augmented generation synthesizes evidence across dispersed corrosion literature instead of interpolating patterns within a fixed training distribution.
  • Existing factuality metrics verify atomic claims independently but cannot assess errors in the reasoning chains connecting those claims.
  • The proposed framework fine-tunes three open-weight models on 3,309 expert-verified Q-A pairs from 840 magnesium-corrosion papers and combines them with hybrid dense–lexical retrieval.
  • Reason Map compares generated-answer proposition graphs with independently constructed evidence graphs to expose causal inversions and unsupported inferential leaps.

2. Results

The three fine-tuned models were evaluated as generation baselines and within a hybrid RAG pipeline. Retrieval consistently improved lexical and semantic performance, strengthened grounding, and supported high automated and expert-assessed quality, while Reason Map exposed causal errors that claim-level metrics missed.

  • 2.1 Domain-adapted language models as generation baselines: LoRA fine-tuned Llama-3.1-8B, Qwen-2.5-7B, and Mistral-7B models were evaluated on a held-out test set of 140 questions under identical hyperparameter configurations.The models were trained on 2,604 question-answer pairs, and their domain-adapted parametric knowledge supplied the RAG generation components.
  • 2.1 Domain-adapted language models as generation baselines: Llama-3.1-8B achieved the strongest no-retrieval baseline across all metrics, including Token F1 of 0.635, ROUGE-L of 0.581, BLEU of 0.413, and BERTScore F1 of 0.924.Figure 2 reports that Llama significantly outperformed Mistral 7B v0.3 and Qwen 2.5 7B across all evaluation metrics.
  • 2.2 Retrieval augmentation transforms factual grounding across all three architectures: RAG increased Token F1 by 143–194% across models, with Mistral reaching 0.737, Llama leading BLEU at 0.480, and Mistral reaching BERTScore F1 of 0.951.The hybrid pipeline combined dense and lexical retrieval, rank fusion, reranking, and diversification over 68,039 paper chunks.
  • 2.2 Retrieval augmentation transforms factual grounding across all three architectures: Retrieval reduced the semantic–lexical grounding gap from approximately 0.60 without retrieval to 0.259 for Llama, 0.346 for Qwen, and 0.214 for Mistral.The reduction was driven mainly by Token F1 gains, alongside modest BERTScore F1 increases of approximately 8–10%.
  • 2.3 Automated and expert evaluation reveals reliable grounding and model-specific trade-offs: RAGAS evaluation found high faithfulness and context recall across models, while blinded experts rated Llama highest overall at 3.93 out of 5.00.Mistral achieved the highest Answer Correctness at 0.9204 and Context Recall at 0.9933; expert evaluations identified completeness and practical relevance as recurring limitations.
  • 2.4 Out-of-distribution validation confirms trend-level generalisation with residual weaknesses in fine-grained mechanistic fidelity: Blind validation showed Llama scoring 24/36, Qwen 20/36, and Mistral 10/36, while Reason Map detected causal reversals and unsupported inferential leaps despite strong claim-level support.In the rare-earth case, seven of nine proposition nodes were NLI-supported; the framework also identified a hallucinated quantitative claim and causal errors.

3. Discussion

Retrieval augmentation substantially improves factual grounding in corrosion-focused language models, but does not guarantee mechanistically sound reasoning. The study therefore pairs retrieval with reasoning-structure auditing and identifies narrow validation limits.

  • Retrieval improves grounding: 143–194% Token F1 gains across three fine-tuned architectures show that retrieval augmentation substantially improves corrosion-answer reliability.RAG reduced semantic–lexical grounding gaps from approximately 0.60 without retrieval to 0.21–0.35.
  • Retrieval improves grounding: High faithfulness and context recall indicate that hybrid retrieval consistently retrieves relevant evidence and anchors generated answers to it.The leading system achieved high RAGAS faithfulness and context recall, while retrieval reduced but did not eliminate grounding gaps.
  • Reasoning remains a separate challenge: Retrieval alone does not guarantee mechanistically sound reasoning, because models may preserve incorrect causal sequences after unsupported structures are generated.The discussion motivates using Reason Map signals, unsupported leaps, causal reversals, and NEI rates as future training-time alignment objectives.
  • Scope limitations: The study’s validation scope is limited by its magnesium-alloy focus, six external examples, and compact experimental dataset covering one alloy, one electrolyte, and four timepoints.Broader validation should include other alloy systems, degradation mechanisms, environments, microscopy, surface characterisation, and longer-term datasets.

4. Methods

The methods build a magnesium-corrosion knowledge-synthesis pipeline from an expert-reviewed corpus and Q–A dataset, fine-tune compact open models, retrieve hybrid evidence, and evaluate both answers and reasoning structure.

  • Corpus and dataset: 840 open-access magnesium corrosion papers were assembled to cover mechanisms, electrochemical behaviour, surface films, detection methods, and protective technologies.Structured extraction succeeded for 99.9% of documents, with remaining documents processed using PyMuPDF.
  • Corpus and dataset: 3,309 question–answer pairs were generated from structured text and retained only after expert review for accuracy, precision, completeness, and duplication.Failed pairs were revised or removed, producing the final verified JSONL dataset.
  • Model adaptation: Three 7–8B open-weight instruction models were fine-tuned with LoRA on the curated Q–A pairs while their original weights remained frozen.The models were Llama-3.1-8B-Instruct, Qwen-2.5-7B-Instruct, and Mistral-7B-Instruct-v0.3; LoRA used rank 16, scaling factor 32, and dropout 0.1.
  • Evaluation: RAG was compared with no-RAG prompting on 140 held-out questions using Token F1, ROUGE-L, BLEU, BERTScore F1, statistical tests, and effect sizes.The RAG condition supplied top-10 retrieved passages from 200 candidates, capped at 3,000 context tokens.
  • Hybrid retrieval: The retrieval pipeline combined dense scientific embeddings and BM25 lexical indices, preserving chunk metadata for source attribution at inference.Paper text was segmented into overlapping chunks and indexed for complementary approximate-nearest-neighbour and sparse retrieval.
  • Evaluation: Evaluation combined automated RAGAS scoring, blinded expert assessment, blind external literature tests, and independent electrochemical validation.External testing used six questions from post-cutoff papers, while experiments used undisclosed Mg–Ca/HBSS electrochemical data across four immersion times.
  • Reason Map auditing: Reason Map decomposed answers into propositions, classified six typed relations, and grounded propositions against retrieved chunks with NLI verdicts.The framework produces proposition-level evidence coverage and hallucination-risk measures for auditing inferential structure.

Conclusion

The work presents retrieval-augmented language models and Reason Map as complementary tools for more reliable mechanistic reasoning in safety-critical corrosion applications. Its domain-agnostic design supports extension to other engineering contexts where trustworthy explanations matter.

  • Retrieval-augmented language models support more reliable use in safety-critical corrosion applications when evaluation considers reasoning integrity alongside individual-claim correctness.
  • Reason Map audits how corrosion evidence is organised into mechanistic reasoning chains, including reaction direction and sequence, oxide-film formation, hydrogen evolution, transport, and degradation pathways.
  • Reason Map exposes causal reversals and unsupported inferential leaps that claim-level evaluation may not reveal.
  • The combined framework is designed for extension beyond corrosion to materials-science and engineering settings requiring trustworthy mechanistic explanation.

Supplementary document

The supplementary material documents the study’s corpus, data and model configuration, evaluation setup, and selected validation outcomes. It also reports model behavior on corrosion-mechanism examples and supporting electrochemical data.

  • Study resources and evaluation: The study compares fine-tuned language models and their RAG implementations using corrosion-focused datasets, configurations, rankings, and per-epoch performance records.The supplementary tables cover architectural comparison, hyperparameters, training performance, and model ranking.
  • Study resources and evaluation: The blind validation set scores six mechanistically non-trivial questions across condition classification, trend ranking, and mechanistic explanation, with a maximum of 6 points per example.Performance is color-coded as green for ≥ 4/6, amber for 3/6, and red for ≤ 2/6.
  • Study resources and evaluation: The ground-truth electrochemical table reports 0.01 Hz impedance magnitudes and end-of-immersion open-circuit potentials for Mg–Ca alloy in HBSS at 37°C.Solution resistance is defined as the high-frequency intercept.
  • RAG performance: RAG outperforms the no-RAG baseline across token F1, BERTScore F1, ROUGE-L, and BLEU for Llama-3.1-8B on 140 Mg-alloy corrosion questions.The figure reports mean scores with one-standard-deviation error bars.
  • Mechanistic validation: The validation examples show that fresh crack-tip films can delay stress-corrosion cracking while prolonged exposure allows chelation or complex formation to disrupt protective films and increase corrosion activity.This mechanism explains decreased SCC despite increased icorr in protein-containing conditions.
  • Mechanistic validation: AZ31 > AZ61 > AZ62 > AZ91 > AZ63 is the reported overall corrosion-resistance order, while AZ91 shows the most localized corrosion and AZ63 the most uniform but fastest corrosion.The explanation links the AZ63 behavior to its eutectic α phase and distinguishes localized from uniform attack.

LLAMA — Score: 3/6

The Llama response partially captured the AZ-series corrosion behavior but contained major alloy-chemistry and mechanism errors. It identified AZ31 as best and AZ63 as very poor, while misranking AZ91 and confusing the governing compositions.

  • LLAMA — Score: 3/6: The response correctly identified AZ31 as the best alloy and AZ63 as very poor or fast-corroding.These correct elements earned only partial credit because the overall ranking remained wrong.
  • LLAMA — Score: 3/6: The response wrongly made AZ91 the worst alloy and attributed its behavior mainly to high Zn, although AZ91 is the high-Al alloy and AZ63 is Zn-rich.This reverses the paper’s key AZ63-versus-AZ91 chemistry distinction.
  • LLAMA — Score: 3/6: The response mentioned eutectic α and fresh-surface exposure but incorrectly claimed AZ63 has more β-Mg17Al12 than AZ91.That claim contradicts the paper’s central explanation of the AZ63–AZ91 paradox.

QWEN — Score: 4/6

The Qwen example is evaluated against the paper’s EIS behavior for AZ91 under free-corrosion, anodic, and cathodic conditions. The supplied evidence emphasizes that anodic polarization preserves all three loops, whereas strong cathodic polarization leaves only one capacitive loop.

  • Question setup: The blind AZ91 EIS question specifies measurements in 3.5 wt.% NaCl after 24 h at free corrosion potential and ±120 mV polarization.The requested answer uses loop features and one mechanism involving θ and CMg+.
  • Mechanistic criteria: The evaluation asks models to distinguish condition classification, loop persistence, and the roles of θ and CMg+ in the EIS mechanism.The prompt explicitly requires explaining why one state variable no longer contributes under strong cathodic polarization.
  • Free-corrosion EIS: At free corrosion potential, the gold answer reports two capacitive loops and one inductive loop, while the Qwen answer incorrectly describes three capacitive loops.The loops correspond to corrosion-product films and double-layer or charge-transfer behavior in the supplied model answers.
  • Polarization response: Under +120 mV anodic polarization, all three loops persist, but Qwen incorrectly predicts three capacitive loops rather than retaining the inductive loop.The scoring passage identifies removal of the inductive loop under anodic polarization as the principal error.
  • Polarization response: Under −120 mV cathodic polarization, only one capacitive loop remains because anodic dissolution to Mg+ is suppressed and θ no longer varies with potential.The extra capacitive and inductive responses associated with anodic-state variables therefore disappear.

Mistral — Score: 1/6

The Mistral response received 1/6 because its cathodic-polarization interpretation was incorrect. It failed to preserve the inductive loop under anodic polarization and misassigned the roles of the two state variables.

  • Mistral — Score: 1/6: Under +120 mV anodic polarization, the inductive loop should persist, but the response incorrectly removes it.The paper reports two capacitive loops plus one inductive loop under anodic polarization.
  • Mistral — Score: 1/6: The response mentions θ and CMg+ without correctly assigning θ to the capacitive response and CMg+ to the inductive response.This produces zero credit for the state-variable mapping.
  • Mistral — Score: 1/6: The cathodic explanation is wrong because the extra loops disappear when anodic-state-variable responses are lost, not because of hydroxide consumption or pH reduction.Strong cathodic polarization suppresses the anodic dissolution pathway to Mg+ and eliminates the additional responses.

Llama — Score: 3/6

Qwen correctly identifies the single capacitive loop under strong cathodic polarization but misreads the loop pattern at free corrosion and anodic polarization, and assigns the state variables incorrectly.

  • B = 0/2: Qwen incorrectly assigns the loops to inner film, outer film, and double layer instead of mapping θ to capacitive and CMg+ to inductive responses.

Qwen — Score: 1/6

Qwen’s responses repeatedly confuse the experimentally supported corrosion trends and mechanisms, including alloy ranking, polarization-loop interpretation, and friction-stir-processed ZE52 behavior.

  • AZ91 EIS reasoning: Qwen misidentifies the EIS loop and state-variable behavior under cathodic polarization, despite recognizing that CMg+ is suppressed.
  • ZE52 grain size and corrosion resistance: Qwen incorrectly identifies 1200–200 as the finest-grained condition and reverses the supported middle ranking of FSP corrosion resistance.
  • ZE52 grain size and corrosion resistance: Qwen offers an unsupported protective mechanism for 1200–50 instead of the paper’s explanation involving precipitate homogenization, solute redistribution, and stable oxide-enriched films.
  • ZE52 corrosion-product films: Qwen misassigns the thicker corrosion-product layer to FSP rather than BM and gives an incorrect resistance mapping.
  • ZE52 corrosion-product films: Qwen fails to distinguish porous Mg(OH)2-rich BM products from the compact alloy-oxide/RE-oxide-enriched FSP film that better limits electrolyte ingress and charge transfer.

Llama — Score: 5/6

Llama’s answer correctly identifies BM as forming the thicker corrosion-product layer and FSP as forming the more protective film, but misassigns film resistance.

  • A = 2/2: Llama correctly identifies BM as forming the thicker corrosion-product layer and FSP as forming the more protective film.
  • B = 1/2: Llama correctly assigns higher Rct and Rp to FSP but incorrectly assigns higher Rf to FSP instead of BM.
  • C = 2/2: Llama correctly links BM’s porous Mg(OH)2-rich products with electrolyte ingress and FSP’s compact oxide-enriched film with reduced charge transfer.

Qwen — Score: 4/6

Qwen correctly assigns the key resistance pattern and gives the supported thickness–protection mechanism, but reverses which sample forms the thicker layer.

  • A = 0/2: Qwen reverses the core thickness result by assigning the thicker corrosion-product layer to FSP rather than BM.
  • B = 2/2: Qwen correctly assigns higher Rf to BM and higher Rct and Rp to FSP.
  • C = 2/2: Qwen correctly explains that thicker porous Mg(OH)2-rich products can be less protective than compact RE-oxide/alloy-oxide-enriched films.

Mistral — Score: 0/6

The response failed all evaluated criteria by reversing the paper’s conclusions about film thickness, electrochemical resistance, and protection mechanisms.

  • 0/2: The response incorrectly assigns the thicker corrosion-product layer to FSP rather than BM.
  • 0/2: It wrongly assigns Rct and Rp to BM, although the paper reports much higher values for FSP 1200–200.
  • 0/2: The mechanism is inverted because the paper identifies FSP, not BM, as forming the more protective alloy-oxide/RE-oxide-enriched film.

Supplementary Note S2: Experimental validation using electrochemical datasets

The electrochemical validation indicates non-monotonic film evolution in HBSS: initial film breakdown is followed by partial protection, then renewed degradation and persistent activity.

  • The low-frequency impedance trajectory is non-monotonic, decreasing initially, increasing as protective deposits form, and declining again as chloride degrades the film.The turning point is associated with partial film sealing after initial breakdown and later film dissolution.
  • From 1 to 7 days, chloride continues degrading the calcium-phosphate film, causing impedance to decrease after the intermediate protective stage.
  • Mg(OH)₂ forms rapidly but chloride attack dissolves it, while calcium-phosphate deposits subsequently increase impedance by partially sealing surface pores.The cited reaction is Mg(OH)₂ + 2Cl⁻ → MgCl₂ + 2OH⁻.
  • The stable OCP reflects a dynamic balance among magnesium dissolution, hydrogen evolution, and film formation and dissolution rather than passivation.
  • At 7 days, the persistent inductive loop and fewer than 5 capacitive points out of 81 indicate ongoing active corrosion rather than true passivity.
  • −1.834 V is the most negative OCP recorded, while OCP drift remains less than 1 mV over 3,600 seconds, combining strong activity with apparent stability.
Loading 2609.00099v1…