Manuscript Offprint
arXiv:2611.03767Quantifying out-of-distribution data severity with Wasserstein distances: benchmarking large language models for alloy property prediction
Abstract
As general-purpose Large Language Models (LLMs), such as Gemini and DeepSeek, exhibit increasingly advanced reasoning capabilities, a critical question arises: how do their property prediction abilities compare to those of domain-specific pretrained materials models? In this study, we evaluate predictions for Ti, steels, high-entropy alloy (HEA) and Al, demonstrating that general-purpose LLMs surprisingly outperform SteelBERT, MatSciBERT, and SciBERT. To further enhance performance, we introduce a hybrid approach that utilizes numerical priors from a prior model, such as CatBoost or SteelBERT, to guide the general LLMs (Deepseek V3.1, Gemini-2.5-Flash). By inputting these initial estimates from a prior model as prompts, the LLM acts as a reasoning corrector, achieving accuracy superior to the prior model and “unguided mode”. Furthermore, we investigate the impact of data strategy using a similarity-based metric, revealing that data quality dominates quantity; using merely 5% of high-similarity reference data of training set as input yields performance similar to the results of using 100% of training set. Additionally, the LLMs demonstrate excellent uncertainty calibration, where self-reported "high" confidence strongly correlates with minimal deviation from ground truth. Our findings suggest that synergizing general-purpose LLMs with prior model numerical baselines and high-quality data curation creates a cost-effective and accurate paradigm for materials discovery, reducing the need for expensive domain-specific pretraining.
1 Introduction
The rapid advancement of machine learning in materials science has traditionally emphasized domain-specific models pretrained on vast corpora of specialized literature, such as journal articles, reports, and databases . This approach stems from the prevailing view that extensive, targeted data is essential for accurate predictions, with techniques such as fine-tuning and Retrieval-Augmented Generation (RAG) further refining these models for specific tasks . Pretrained models tailored to materials classes—such as SteelBERT for steels, MatSciBERT for broader materials science, and SciBERT for scientific text—have shown promise in encoding domain knowledge, enabling downstream tasks such as property prediction and synthesis protocol extraction .
However, recent developments in natural language processing have shifted this landscape. Optimization strategies, such as Reinforcement Learning (RL) during fine-tuning or pretraining, have endowed general-purpose Large Language Models (LLMs) with superior reasoning capabilities . Trained on diverse, internet-scale datasets encompassing trillions of tokens, Gemini and DeepSeek can perform complex inference without explicit domain adaptation . Recent studies suggest that a key to unlocking general-purpose LLMs lies in advanced prompt engineering and in-context learning (ICL). Few-shot learning shows that providing LLMs with a small number of high-quality examples can significantly mitigate data scarcity, allowing models to identify patterns without extensive retraining . For example, Polak and Morgan utilized conversational redundancy to extract accurate data from text without fine-tuning , while the MatAgent framework demonstrated that LLMs could orchestrate external tools for property retrieval . Despite these successes in text-based reasoning, applying general LLMs to direct numerical regression remains a complex hurdle. Nevertheless, Wang et al. evaluated the robustness of LLMs in predicting steel yield strengths, to reveal that while retrieving "nearest neighbor" examples improves accuracy, pretrained LLMs often suffer from "mode collapse"—a tendency to default to high-frequency training values when the input distribution shifts. Critically, their approach relies on the LLM to perform the regression task purely from the provided context, which exposes the model's inherent weakness in precise arithmetic and extrapolation. This raises a key question: can these general LLMs rival or surpass models pretrained for materials property prediction, particularly for metallic alloys where data scarcity and compositional and processing complexity pose challenges?
In this work, we address this issue by systematically comparing general-purpose LLMs against domain-specific pretrained models across datasets for several alloys including Titanium (Ti), High-entropy alloy (HEA), Aluminum (Al) and Steels. Unlike Wang et al., where ICL is used for direct prediction, we introduce a hybrid "Guided Mode" framework. This approach integrates computationally inexpensive prior models (e.g., CatBoost or pretrained encoders) to provide initial numerical priors as prompts to the LLM. This "guided mode" transforms the role of the LLM from a standalone calculator into a reasoning-based corrector, leveraging its semantic understanding of physical principles and strength-ductility trade-offs to refine estimates. We also employ RAG with semantic similarity or "Querying for Maximally Informative Samples" (via all-MiniLM-L6-v2 embeddings) to prioritize data quality over quantity, demonstrating that 5% of highly relevant reference samples can match or exceed the performance of full datasets. Our findings reveal that general-purpose LLMs not only match but often outperform domain-specific models, achieving R² values up to 0.886 for ultimate tensile strength (UTS) in Ti alloys—comparable to traditional ML baselines—while excelling in properties such as elongation (R² = 0.798) that are experimentally more difficult to measure accurately. This suggests that emergent reasoning from broad pretraining can implicitly capture materials knowledge without costly domain-specific efforts. In addition, for LLM predictions with self-reported confidence, we find that with multi-target prediction, the ultimate threshold strength (UTS) for which reliable data is available, outperforms its counterpart in the single-target setting. Moreover, the self-reported confidence indicates that higher confidence is associated with a larger proportion of low-error predictions. The impact on materials discovery is that this approach enables rapid, low-cost screening of alloys for applications in aerospace, energy, and biomedicine, democratizing access to predictive tools and accelerating innovation in data-limited fields.
Despite these advances, limitations exist. LLMs exhibit inherent stochasticity even at zero temperature, stemming from architectural factors which can introduce variability in outputs. The uncertainty primarily stems from non-deterministic computations inherent in the inference process, including floating-point rounding errors, differences in parallelism across distributed inference nodes, variable system cache states, and minor variations in tokenization boundaries. Additionally, performance dips in heterogeneous datasets (e.g., steels with inconsistent processing descriptions), highlights the need for standardized data formats. While our self-reported confidence calibration correlates well with accuracy, it relies on prompt engineering, which may not generalize across all models or tasks. Nonetheless, by synergizing general LLMs with given data strategies, this study paves the way for a more efficient, reasoning-driven approach in materials science.
2.1 Hybrid framework for Materials properties by few-shot prompts
The integration of Large Language Models (LLMs) into materials science marks a shift from traditional supervised learning toward semantic reasoning agents. This transition represents the next stage in the history of Active Learning³⁷, moving from the 'label-efficiency' goals of the 1990s toward the 'discovery-efficiency' goals of modern autonomous laboratories³⁸. Unlike previous encoder-only architectures such as SciBERT¹⁷, MatSciBERT¹⁶ or SteelBERT⁴, which rely on extensive pretraining or fine-tuning for specific tasks, generative models like Gemini and DeepSeek utilize in-context learning to perform few-shot reasoning. Recent literature demonstrates that when guided by structured prompts—specifically those employing Chain-of-Thought (CoT) reasoning—LLMs can effectively extract complex synthesis protocols from unstructured text²¹⁻²⁴,³⁹,⁴⁰. However, general-purpose LLMs remain limited by
"hallucinations". To mitigate this issue, we can build a RAG framework in which relevance-ranked contextual information is retrieved from an external materials dataset and incorporated into the LLM input. The retrieved context consists of alloy samples with similar chemical compositions and processing descriptions, providing experimentally grounded reference examples for the model. Similarity-based retrieval using the all-MiniLM-L6-v2 sentence embedding model, a lightweight transformer trained via contrastive learning to generate dense semantic representations of short texts, can then be used in information retrieval tasks. In this work, the composition-processing information of each alloy sample is converted into natural-language text and embedded into fixed-length vectors using all-MiniLM-L6-v2. For a given target sample, defined as an alloy composition-processing pair for which mechanical properties are to be predicted, cosine similarity (cos θ) is computed between its embedding and those of all training samples. The most similar samples are then retrieved and included as reference samples in the LLM prompt, enabling predictions to be conditioned on composition- and process-relevant experimental data.
We consider a three-stage workflow that transforms property prediction into an evidence-based reasoning exercise as shown in Figure 1 with Stage 1 (Retrieval-Augmented Generation - RAG) for a target sample to retrieve the Top-N most semantically similar samples from the database using embeddings from the all-MiniLM-L6-v2 model, Stage 2 (Prior Prediction) using a prior model (e.g., CatBoost, SteelBERT) to generate a baseline numerical prediction and Stage 3 (Reasoning Correction) in which the LLM (Gemini or DeepSeek) is prompted to execute a structured reasoning protocol. The framework operates in two distinct modes: "Unguided," where the LLM reasons from reference samples alone, and "Guided," where it is also provided with the prior model's estimate as a starting point for refinement. The detailed prompt templates for both Guided and Unguided modes are provided in Section 1 of the Supporting Information.
At the core of this framework is a reference-driven reasoning strategy that grounds LLM-based property prediction in the retrieved Reference samples, rather than relying solely on the model's internal knowledge. The LLM is explicitly conditioned on the reference samples retrieved in Stage 1, which are selected to be most similar to the target sample in terms of composition and processing route, and uses them as physically meaningful anchors during reasoning. Within the reasoning stage, the correction process follows a three-step structured protocol. First, during "Baseline Establishment", the LLM identifies the most relevant reference samples and establishes a comparative baseline for the target sample based on experimentally measured properties. Second, in the "Plausibility Assessment" step, the predicted properties are evaluated against fundamental metallurgical constraints, such as the strength-ductility trade-off, to ensure physical consistency and eliminate implausible predictions. Finally, in the "Interpolative Correction" step, the LLM estimates how differences in composition and processing parameters between the target sample and the reference baseline translate into quantitative adjustments of the predicted properties, constrained to interpolation or limited extrapolation supported by established materials science principles. By anchoring the reasoning process to reference samples and physical constraints, this approach transforms mechanical property prediction from stochastic text generation into a structured, interpretable, and evidence-based inference process.

Figure 1 Schematic overview of the three-stage closed-loop hybrid workflow for predicting mechanical properties. The framework predicts target properties (e.g., ultimate tensile strength and elongation) through three distinct stages. Stage 1 (RAG): Retrieves the Top-N most similar “Reference samples” from the database of composition and processing parameters. Stage 2 (Prior Prediction): A prior model (PD) generates an initial prediction and query embedding. Stage 3 (LLM Reasoning): A Large Language Model (LLM) performs physics-informed reasoning by contrasting the target sample with reference samples (e.g., analyzing precipitation hardening effects) to interpolate final values. The workflow operates in two modes: the “Guided mode”, which incorporates the PD prediction (Stage 1 & 2 → LLM), and the “Unguided mode”, which relies solely on reference samples (Stage 1 → LLM).
2.2 Data quality dominates quantity for LLM context
A central tenet of machine learning is that performance improves with more data. To evaluate the trade-off between dataset scale (quantity) and contextual relevance (quality), we conducted a comparative analysis between semantic similarity retrieval and random sampling for LLM-based material property prediction. The similarity-based approach serves as a proxy for "data quality" by isolating the Top n% of samples through cosine similarity (cosθ) calculations between training set and target sample instances within a learned embedding space. This process is assumed to capture latent relationships between alloy compositions and processing conditions. Conversely, random sampling represents a "quantity-first," brute-force strategy. As illustrated in Figure 2, the results reveal a distinct "quality-dominant" regime; the similarity-based method achieves rapid convergence, delivering high-accuracy predictions (e.g., for Ti and RMSE < 65 MPa for Al) using only 5% reference samples of the training set. This suggests that when the retrieved context is semantically and physically analogous to the target sample, the LLM requires minimal examples to establish a reliable reasoning baseline.
(a)

(b)
(c)
(d)
Figure 2 Impact of data selection strategy and dataset size on prediction performance. (a, b) Root Mean Square Error (RMSE) and (c, d) Coefficient of Determination ( score) for the ultimate tensile strength (UTS) of aluminum (Al) and titanium (Ti) alloys. The performance based on semantic similarity retrieval (blue circles) is compared against "Random" sampling (red squares). While the main plots focus on the initial reference ratio range (0.01–0.10), the insets display the performance trends across the full range (0.01–1.00). The vertical dotted line highlights the 5% reference ratio, demonstrating that the similarity-based approach achieves high prediction accuracy with minimal data, comparable to the performance of random sampling using much larger datasets.
In contrast, random sampling proves significantly inefficient. As indicated by the red curve, increasing data volume without filtering results leads to slow and unstable performance gains. Crucially, a 20-fold efficiency gap emerges: the performance of the similarity-based method using merely 5% of the data is statistically equivalent to—and often exceeds—that of random sampling utilizing the entire dataset (100%). These findings demonstrate that increased data volume cannot compensate for a lack of relevance. Random sampling introduces noise via irrelevant alloy systems, which dilutes the specific context required by the LLM. Therefore, in materials science, where high-fidelity experimental data are scarce, prioritizing data quality through semantic retrieval is superior to the brute-force pursuit of data quantity.

Figure 3 Visualization of semantic similarity-based data retrieval using the all-MiniLM-L6-v2 embedding model for the titanium alloy dataset. (a–c) t-SNE projections illustrating the distribution of the training set (green filled circles) and reference samples (colored stars) for two specific target samples (T#1, T#2) identified by circles surrounding their centers. The selection is performed at top 1%, 5%, and 10% similarity ratios based on embeddings from the all-MiniLM-L6-v2 model. (d–f) Histograms of ultimate tensile strength (UTS) comparing the distribution of the entire training set (gray) against the reference samples via semantic similarity (blue). The dashed blue vertical line and arrow indicate the ground truth property value of target sample T#1. The results demonstrate that as the selection ratio increases, the retrieved samples maintain a physical property distribution localized around the ground truth of target sample, validating the effectiveness of the embedding-based retrieval strategy.
To understand the mechanism underlying the performance of the similarity strategy, Figure 3(a–c) and Figs. S4-S6(a-c) visualize the spatial relationships between training data and test instances within the projected embedding space (via t-SNE). The all-MiniLM-L6-v2 model effectively structures the dataset such that semantically related alloys naturally cluster together. As observed in the Top 1%, Top 5% and Top 10% projections, the reference samples subsets (represented by colored stars) form tight, dense clusters in the immediate vicinity of their respective target samples (T#1 and T#2). This geometric proximity confirms that the embedding model captures latent material descriptors—such as composition and processing—mapping them into a continuous space where distance serves as a reliable proxy for material similarity. Even as the selection scope expands to 10%, the retrieved reference samples remain associated with the target's locality rather than dispersing randomly, thereby maintaining a “relevance gradient” that random sampling lacks.
The semantic similarity also translates into physical property alignment, with respect to the quality of the reference samples. Figure 3(d–f) and Figs. S4-S6(d-f) compare the property distributions of the entire training set (gray histograms) against those of the semantic reference samples (blue histograms) for UTS. While the global training dataset exhibits a broad, multimodal distribution characteristic of diverse and unrelated alloy systems, the reference samples subsets are localized. Notably, for target sample T#1, the distribution of reference samples aligns precisely with the ground-truth value (indicated by the blue dashed vertical line). This alignment demonstrates that embedding-based retrieval acts as a physics-aware filter: it effectively discards statistical "noise" from irrelevant material systems while preserving the "signal"—samples with analogous mechanical behavior. This provides the LLM with a consistent and physically accurate reference frame for property prediction.
2.3 Reproducibility with LLMs
(a)

(b)
(c)
(d)
(e)
(f)
(g)
(h)
(i)
Figure 4 Prediction performance and reproducibility in predicting the ultimate tensile strength (UTS) of the steel dataset. (a-c) shows the performance of a multilayer perceptron (MLP) model utilizing embeddings generated by SciBERT¹⁷, MatSciBERT¹⁶ and SteelBERT. (d-f) Results of three independent runs for Gemini-2.5-Flash and (g-i) Gemini-2.5-Pro, with the temperature set to zero. Points are color-coded by run-to-run consistency: blue (identical in all three runs), orange (identical in two), and green (differing in all).
Autoregressive inference in Large Language Models (LLMs) is modulated by temperature and sampling strategies, specifically Top-k and Top-p. Theoretically, as the temperature approaches zero, the model should achieve determinism via greedy decoding. Conversely, Top-k and Top-p sampling truncate the candidate pool based on fixed ranking and cumulative probability thresholds, respectively, to balance logical coherence with linguistic diversity. Notably, even under a zero-temperature setting, minor non-deterministic deviations may persist when the model is presented with identical prompts (Figure 4).
General-purpose LLMs offer a route to bypass the architectural complexities of domain-specific models. Employing a standard Multi-Layer Perceptron (MLP) as the downstream network for SciBERT, MatSciBERT, and SteelBERT yields limited performance (Figure 4a-c). The original SteelBERT study achieved superior results but relied on a hybrid network that is difficult to reproduce without the complete codebase, highlighting a barrier where specialized models often require intricate, task-specific downstream engineering. We utilized General-purpose LLMs on the same training set without architecture engineering, and Gemini-2.5-Pro (Figure 4g-i) outperforms the standard baselines (R² = 0.743-0.772 vs. 0.667-0.691) in Figure 4a-c. Advanced LLMs possess few-shot learning capabilities that lower the barrier to entry for materials property prediction, allowing non-experts to obtain high-fidelity results through natural language prompting.
However, this superior predictive performance comes with a trade-off in deterministic consistency. As illustrated in Figure 4d-i, even with the temperature parameter set to zero, LLM inference retains inherent stochasticity. We quantified this instability by conducting three independent runs on 136 target samples. Gemini-2.5-Flash exhibited high reproducibility, yielding identical outputs for 122 target samples (blue points) and varying in only 14 instances (including 2 partially consistent cases, red points). In contrast, the Gemini-2.5-Pro showed significantly higher volatility as only 34 target samples were fully consistent across all runs while 102 target samples exhibited variations with 60 of these showing partial consistency. Fig. S7 for the titanium alloy dataset shows a similar pattern when the temperature parameter is set to zero. This behavioral divergence stems from architectural distinctions because Gemini-2.5-Pro is engineered for high-dimensional reasoning and complex contextual understanding whereas Gemini-2.5-Flash is optimized for computational efficiency and low latency⁴¹. The Gemini-2.5-Pro model utilizes a substantially larger parameter space and deeper attention mechanisms to navigate intricate reasoning pathways. Although this expanded representational capacity allows the model to capture subtle nuances in materials data, it simultaneously amplifies sensitivity to microscopic floating-point perturbations during inference. Conversely, the streamlined architecture of the Gemini-2.5-Flash model restricts the search space to the most dominant probabilistic outcomes to favor stability over the nuanced exploration characteristic of the larger model. These findings reveal a paradoxical trend wherein increased model capability correlates with greater output uncertainty. This instability is likely attributable to the greater computational depth and complex activation patterns of larger models since these features enhance accuracy but also increase susceptibility to non-deterministic fluctuations . Since the results are different every time even when the temperature is 0, one can choose to run it multiple times to select the outcome with the most occurrences or the average.
2.4 Comparative Assessment: Materials Specific vs. General-Purpose LLMs
The construction of distinct pretrained models for every specific alloy family represents a significant burden in terms of time and computational resources. Consequently, it is pertinent to investigate whether a domain-specific model such as SteelBERT can effectively transfer its latent metallurgical knowledge to another alloy dataset despite being originally optimized for steel. A compelling counter-hypothesis arises from the rapid evolution of general-purpose LLMs such as the Deepseek and Gemini series. These models have been exposed to trillions of tokens covering vast scientific corpora and may possess emergent reasoning capabilities that allow them to perform complex property predictions solely based on their extensive pre-training. To rigorously benchmark these general models against domain-specific approaches while accounting for the stochastic behavior analyzed in the previous section, we performed three independent inference runs and selected the intermediate result to represent the typical predictive performance of each general LLM.

(b)
(c)
(d)
(e)
(f)
(g)
(h)
Figure 5 Comparative predictive performance of UTS for titanium alloys. The evaluation contrasts domain-specific approaches with general-purpose LLMs using full training set: (a) Traditional ML model using composition and processing parameters; MLP regressors utilizing embeddings from (b) SciBERT (general science), (c) MatSciBERT (materials science), and (d) SteelBERT (steel-specific); (e-h) General LLMs evaluated using the median output from three trials: (e) Deepseek V3.1, (f) Deepseek R1, (g) Gemini-2.5-flash, and (h) Gemini-2.5-pro.

(b)
(c)
(d)
(e)
(f)
(g)
(h)
Figure 6 Comparative predictive performance on elongation for titanium alloys. The evaluation contrasts domain-specific approaches with general-purpose LLMs using full training set: (a) Traditional ML model using composition and processing parameters; MLP regressors utilizing embeddings from (b) SciBERT (general science), (c) MatSciBERT (materials science), and (d) SteelBERT (steel-specific); (e-h) General LLMs evaluated using the median output from three trials: (e) Deepseek V3.1, (f) Deepseek R1, (g) Gemini-2.5-flash, and (h) Gemini-2.5-pro.
Figure 5 illustrates a performance stratification in the predictive results for ultimate tensile strength (UTS) for the titanium alloy dataset. General LLMs, such as Gemini-2.5 and the Deepseek series in Figure 5e-h, yield values primarily between 0.800 and 0.886 (Figure 5g). Gemini-2.5-Pro achieves an value of 0.886, larger than Gemini-2.5-Flash in Figure 5g,h, a result that corroborates the positive correlation between model intelligence and predictive capability. This observation implies that while higher intelligence in general-purpose LLMs does not unequivocally guarantee more accurate predictions, more advanced models generally achieve higher predictive fidelity. This general trend is corroborated by the quantitative analysis in Fig. S26, where Gemini-2.5-Pro consistently outperforms Gemini-2.5-Flash, maintaining a win rate exceeding 80% across diverse alloy systems. Top-tier general LLMs now rival the best domain-specific benchmarks. The performance in Figure 5h is an improvement over the traditional machine learning model in Figure 5a ( of 0.835) trained on explicit features. An even more significant breakthrough appears in the elongation prediction task shown in Figure 6 for the titanium alloy dataset. Although typically challenging due to microstructural uncertainties and difficulty in experimental control, this property is modeled effectively by LLMs. Gemini-2.5-pro attains an of 0.798 in Figure 6h, substantially outperforming embedding-based methods such as MatSciBERT and surpassing the traditional benchmark model in Figure 6a ( ). Fig. S16 and Figs. S17–S18 compare the performance of different models for UTS of aluminum alloys, as well as UTS and elongation of high-entropy alloys, respectively. Similar trends can be observed. In some cases, although the best-performing general LLM (Gemini-2.5-Pro) achieves a lower than traditional models, it yields a lower MAE. In addition, Fig. S25 also shows that elongation from general LLMs for the steel dataset has higher prediction accuracy. This demonstrates that even with inputs limited to composition and processing, large-scale models can leverage their vast pre-trained knowledge and high-dimensional internal representations to capture complex nonlinear dependencies. They implicitly appear to approximate the influence of unobserved microstructural factors more effectively than traditional explicit features, thereby overcoming bottlenecks in elongation prediction.
Enhancement of LLM performance using initial model estimates






Figure 7 Performance comparison of various models in predicting UTS for titanium alloys. (a-c) and (d-f) show the performance of Gemini-2.5-flash and Gemini-2.5-pro, respectively. These models were tested under different retrieval ratios (100%, 5%, and a “Best ratio”) and in two modes: “Unguided” (blue) and “Guided” (red). Unguided refers to no initial estimate for the target property, and the Guided uses the initial value from a prior model for the target property. The “Best ratio” corresponds to the best performance obtained across a range of reference samples ratios (0.01, 0.02, 0.03,
0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, and 1).

Figure 8 A statistical comparison of the Gemini-2.5-Pro model showing the percentage of cases in which the guided mode outperforms the unguided mode. The guided mode incorporates an initial estimate of the target property obtained from a prior model (CatBoost and SteelBERT for steel dataset). The statistics are aggregated over a set of Reference samples ratios ranging from 0 to 1 (0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1). The upper panel reports the percentage of cases with lower RMSE, while the lower panel reports the percentage of cases with higher , relative to the unguided baseline. The dashed line at 50% indicates parity between the two modes.
To enhance the predictive performance of general-purpose LLMs, we introduce a "Guided mode" reasoning strategy. Unlike the "Unguided mode", which predicts target properties without baseline estimates, the "Guided mode" incorporates prior knowledge derived from a model to anchor the LLM's reasoning process. For the "Guided mode", we choose the "best" model as the prior model for input to the LLMs. As shown in Fig. S1, CatBoost and XGBoost deliver the best performance for predicting UTS and elongation, respectively, on the titanium alloy dataset used in this study. With the exception of steel, which utilizes predictions from “SteelBERT+MLP”, the results for other alloys (e.g., aluminum and high-entropy alloys) are given in Figs. S2–S3.
The efficacy of this enhancement strategy is shown through the prediction of UTS in Ti alloys (Figure 7). By integrating prior knowledge, the "Guided mode" optimizes the performance of the Gemini-2.5-Pro model. Specifically, with the Gemini-2.5-Pro model operating at a 5% retrieval ratio of semantic similar samples, the “Guided mode” reduces the Mean Absolute Error from 87.72 MPa to 73.48 MPa and improves the coefficient of determination from 0.853 to 0.889 compared to the “Unguided mode”. Furthermore, this performance at a mere 5% ratio is remarkably competitive with and in some metrics superior to the results obtained using the full 100% dataset which yields a Mean Absolute Error of 82.14 MPa. Thus, the “Guided mode” effectively maximizes predictive capability and achieves high-fidelity results even with minimal data retrieval. This consistent trend can be seen in other datasets (e.g. UTS for aluminum alloy, high-entropy alloy and steels; yield strength for steels; elongation for titanium alloy, high-entropy alloy and steels) as illustrated in Figs. S19-S25. To statistically assess the impact of the number of reference samples on prediction performance, we evaluated reference sample ratios ranging from 0 to 1 (0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, and 1). As summarized in Figs. S8–S15 for different alloys (e.g. titanium alloy, aluminum alloy, high-entropy alloy and steels) for all reference sample ratios, a reference ratio of 5% is sufficient to achieve performance comparable to that obtained using the full dataset in the majority of cases. Across all tested ratios, we identify the best-performing one as the “Best ratio”. Importantly, the statistically optimal performance does not generally correspond to using the entire reference dataset. For the titanium system, the optimal results are shown in Figures. 7c and 7f, while corresponding results for other alloy systems are reported in Figs. S19–S25.
A broader statistical evaluation of this methodology for Gemini-2.5-pro is presented in Figure 8 which quantifies the effect of the “Guided mode” approach by calculating the percentage of cases where it surpasses the “Unguided mode” in terms of RMSE and R² within specific retrieval ratio ranges of 0 to 0.1 and 0.1 to 1. Figure 8 and Fig. S27 show statistical comparisons for the Gemini-2.5-Pro and Gemini-2.5-Flash models, respectively, in terms of the percentage of cases where the “Guided mode” outperforms the “Unguided mode”, the “Guided mode” delivers superior performance for the vast majority of material systems including aluminum, high-entropy alloy and titanium where improvement percentages frequently exceed 80% across both metrics. However, a limitation to this enhancement is observed in steel datasets, which exhibit lower improvement rates. This discrepancy arises from the unstructured nature of the steel processing data. Specifically, steel processing routes are described in free-form natural language rather than standardized, structured processing tables. In contrast, for the other materials, processing information is first organized in structured tables and then converted into natural language descriptions, which provides greater consistency and enables the “Guided mode” to operate more effectively.
2.5 “Confidence” from LLMs
UTS from LLMs with two targets
MAE = 93.19,

Elongation from LLMs with two targets
MAE = 7.95,
UTS
MAE = 93.85,
Elongation
MAE = 7.31,
UTS from LLMs with two targets
(e)
Elongation from LLMs with two targets
(f)
(h)
Figure 9 Multi-target and single-target property prediction of the high-entropy alloy dataset using Gemini-2.5-Flash. Predicted versus experimental values are shown for multi-target learning of (a) ultimate tensile strength (UTS) and (b) elongation, and for single-target learning of (c) ultimate tensile strength (UTS) and (d) elongation. Scatter plots report the coefficient of determination ( ) and mean absolute error (MAE) for data subsets stratified by LLM-reported confidence levels (High: blue; Medium: orange). Panels (e–h) present the corresponding relative error distribution histograms for (a–d), indicating the sample count and percentage within defined error intervals.
To evaluate the reliability of LLM predictions, we implemented a prompt that compels the model to anchor its predictions on a specific reference samples baseline rather than relying solely on the model's internal knowledge. Within this framework, the output confidence serves as a semantic self-assessment of the logical coherence characterizing the reasoning process instead of a simple measure of numerical interpolation distance. A high confidence designation indicates that the model successfully constructed a scientifically sound chain of thought linking the features of the target material to the reference samples via established physical principles such as strength-ductility trade-offs. Conversely, medium or low confidence implies that the model detected internal inconsistencies or lacked a sufficient theoretical basis to justify property adjustments. This mechanism ensures that the confidence metric reflects the internal certainty of the model regarding the scientific plausibility of its inference path.
The results presented in Figure 9 and Figs. S28-S29 illustrate this self-reported mechanism for different alloy datasets, such as titanium alloy, high-entropy alloy and steels, with high-confidence predictions consistently showing higher accuracies than medium-confidence categories across these diverse alloy systems. As the relative error histograms in Figures 9e–h show, the majority of high-confidence samples cluster within the 0–5% error range, which confirms that the logical certainty of the model correlates strongly with predictive precision. Furthermore, the multi-target learning framework achieves performance comparable to that of single-target models and, in several cases, yields superior results. For example, the multi-target model attains a higher coefficient of determination for UTS ( in Figure 9a) and competitive accuracy for elongation (Figure 9b) compared with their single-target counterparts. This improvement indicates that jointly predicting multiple mechanical properties enables the LLM to exploit shared physical constraints and intrinsic correlations amongst properties, such as the well-known strength–ductility trade-off in high-entropy alloy. By leveraging these coupled relationships, multi-target learning effectively regularizes the prediction space, reducing physically inconsistent outputs and enhancing robustness. Consequently, this self-reported confidence serves as a reliability metric for materials design by allowing researchers to prioritize predictions with high logical consistency when screening unknown materials.
3 Discussion

Figure 10 Comparison of two-target predictive performance for the steel dataset using Gemini-3.0-Flash and Gemini-2.5-Flash. Predicted versus experimental values obtained with Gemini-3.0-Flash are shown for (a) ultimate tensile strength (UTS) and (b) elongation, while corresponding results obtained with Gemini-2.5-Flash are shown for (c) ultimate tensile strength (UTS) and (d) elongation. Data points are grouped according to LLM-reported confidence levels (High: blue; Medium: orange), and the coefficient of determination ( ) and mean absolute error (MAE) are reported in each panel. Panels (e–h) present the corresponding relative error distributions for (a–d), respectively, including the sample count and percentage within each defined error range.
The results presented here challenge the prevailing "more is better" dogma in materials informatics. Our findings suggest that the bottleneck in property prediction is not necessarily a lack of domain-specific pretraining, but rather the inability of models to perform nuanced, physics-informed reasoning over relevant context. While models such as SteelBERT are "frozen" with latent knowledge of specific alloy families, general-purpose LLMs (Gemini, DeepSeek) exhibit an emergent ability to interpolate between metallurgical principles. Our "Guided Mode" effectively uses a numerical prior (e.g., CatBoost or SteelBERT) to "anchor" the LLM, transforming it from a stochastic text generator into a reasoning corrector. This hybrid approach allows the model to capture microstructural dependencies that are often missed by traditional regressive models.
Perhaps the most striking result is the "quality-dominant" regime identified in our similarity-based retrieval analysis. In materials science, where high-fidelity experimental data is a scarce and expensive resource, the ability to achieve state-of-the-art accuracy using only 5% of a dataset is transformative. By reducing reliance on expensive pretraining, this framework lowers barriers for rapid alloy screening, enabling cost-effective exploration in fields like sustainable energy and advanced manufacturing. This suggests that future "Self-Driving Labs" should focus on "Active Retrieval"—identifying and querying the most semantically relevant benchmarks—rather than the exhaustive collection of heterogenous data points.
Our analysis of Gemini-2.5-Pro versus Flash reveals a paradoxical trend: as models become more capable of high-dimensional reasoning, they also become more susceptible to microscopic floating-point perturbations. While the Pro model achieves higher accuracy, its lower determinism requires a "consensus-based" inference strategy (running multiple trials). However, the strong correlation between self-reported confidence and actual error provides a robust safety mechanism, allowing the model to flag its own "hallucinations" when encountering chemically novel or "out-of-distribution" materials.
At the same time, a clear capability–accuracy scaling trend emerges across model generations. Figure 10 and Figs. S30-S32 show the two-target predictive performance for the steel dataset and for titanium, aluminum and high-entropy alloy datasets, respectively. Upgrading from Gemini-2.5-Flash to Gemini-3.0-Flash improves predictive performance on the challenging steel dataset, as evidenced by higher R² values and lower MAE for both ultimate tensile strength and elongation. This improvement is observed across confidence strata, with the most pronounced gains appearing in high-confidence predictions, indicating that enhanced reasoning capacity translates directly into more reliable property estimation when the model is operating within its semantic comfort zone. Notably, the strong correlation between self-reported confidence and actual error persists across model versions, providing a robust safety mechanism that allows the model to flag potential hallucinations when encountering chemically novel or out-of-distribution materials.
The primary limitation observed was in the steel dataset, where high heterogeneity in text descriptions hindered the performance of the “Guided Mode”. Future improvements should focus on the standardization of metallurgical data formats—specifically transforming unstructured processing notes into structured, machine-readable tables. Furthermore, integrating multi-modal priors (such as micrograph images) directly into the LLM prompt could bridge the gap between semantic reasoning and physical reality, paving the way for AI accelerated discovery utilizing general intelligence with domain expertise.
4 Methods
4.1 Data preparation
Data for titanium alloys were compiled from the literature and supplemented with laboratory measurements conducted at XJTU. The dataset comprises 233 entries, each detailing alloy composition, heat treatment processes, and mechanical properties, specifically ultimate tensile strength and elongation. For aluminum alloys, experimental ultimate tensile strength datasets were derived and expanded from Reference , resulting in a total of 831 data points including composition, processing, and properties. The high-entropy alloy dataset was provided by Dr. Yasir Sohail , who assembled the dataset from the literature and experiments performed in his laboratory. It comprises 491 FCC based samples characterized by composition, heat treatment and properties. Finally, the steel dataset was adopted from Reference . This collection consists of 677 samples, each encompassing alloy composition, heat treatment types, and mechanical properties (yield strength, ultimate tensile strength, and elongation).
4.2 Model selection and hyperparameter optimization
To establish a rigorous predictive baseline, a systematic evaluation of five standard machine learning algorithms was conducted. When modeling, the property dataset is randomly divided into a training set and a testing set in 8:2 ratio. The candidate models included XGBoost, LightGBM, CatBoost, Random Forest (RF), and a Multi-Layer Perceptron (MLP). The evaluation protocol employed a 9-fold cross-validation scheme to ensure statistical robustness. Hyperparameter optimization was executed using the Optuna framework, involving 30 independent trials for each model to identify the optimal configuration. For the tree-based ensemble methods (XGBoost, LightGBM, CatBoost, and RF), key hyperparameters—specifically the number of estimators, maximum depth, and learning rate—were tuned. Conversely, the MLP model utilized the Adam optimizer. Its optimization search space encompassed the network architecture (e.g., the number and dimensions of hidden layers) and the regularization coefficient (alpha), with training capped at a maximum of 300 iterations. Model performance was quantified using Root Mean Squared Error (RMSE) and the coefficient of determination ( ). The score, which measures the proportion of variance in the dependent variable explained by the independent variables, is defined as: , where represents the observed value, denotes the predicted value, and is the mean of the observed values. score of 1.0 indicates a perfect prediction of the observed variance. We used the average performance across all trials as the baseline for comparison with other models.
In this work, a BERT-based embedding framework was further introduced to achieve a unified and expressive representation of both compositional and processing information. In this study, an artificial neural network (ANN) was developed by leveraging high-dimensional embeddings derived from pre-trained BERT models, such as SciBERT, MatSciBERT and SteelBERT. Specifically, chemical compositions and textual descriptions of processing routes were separately encoded using different pre-trained BERT-based language models. Each model generates a context-aware embedding vector with a dimensionality of 768, enabling the capture of semantic and structural information inherent in the corresponding textual inputs. The compositional and processing embeddings were then concatenated along the feature dimension to form a unified representation, which serves as the direct input to the prediction network.
The prediction model was implemented as a standard ANN composed of an input layer, multiple fully connected hidden layers, and an output layer. Nonlinear activation functions were employed in the hidden layers to model the complex relationships between the fused embeddings and the target mechanical properties. Notably, the network adopts a compact and streamlined architecture, without introducing additional branches or convolutional components, thereby enhancing robustness and interpretability. Model training was conducted using the mean squared error (MSE) as the loss function. Optimization was performed with the AdamW optimizer in conjunction with a linear learning rate decay schedule. To ensure optimal performance, both the network architecture and training hyperparameters were systematically optimized using the Optuna framework.
4.3 The use of LLMs
The Gemini series models were accessed via Google's free-tier API, while the DeepSeek models were utilized through their official API. To ensure consistency and scalability, we implemented a unified invocation interface using the LiteLLM package.
5 Data availability
The datasets used and analysed during the current study can be accessed at https://github.com/Jack-Liu0227/BERT_ML/tree/master/datasets.
6 Code availability
The source code used in this article can be accessed at \underline{\text{https://github.com/Jack-Liu0227/BERT_ML/tree/master/}} and https://github.com/Jack-Liu0227/MultiobjectPr ediction.
7 References
-
Weston, L. et al. Named Entity Recognition and Normalization Applied to Large-Scale Information Extraction from the Materials Science Literature. J. Chem. Inf. Model. 59, 3692–3702 (2019).
-
Huang, S. & Cole, J. M. BatteryBERT: A Pretrained Language Model for Battery Database Enhancement. J. Chem. Inf. Model. 62, 6365–6377 (2022).
-
Xu, C., Wang, Y. & Barati Farimani, A. TransPolymer: a Transformer-based language model for polymer property predictions. npj Computational Materials 9, 64 (2023).
-
Tian, S. et al. Steel design based on a large language model. Acta Materialia 285, 120663 (2025).
-
Chaudhari, A., Guntuboina, C., Huang, H. & Farimani, A. B. AlloyBERT: Alloy property prediction with large language models. Computational Materials Science 244, 113256 (2024).
-
Wang, P. et al. Generalizable descriptors for automatic titanium alloys design by learning from texts via large language model. Acta Materialia 296, 121275 (2025).
-
Zhao, J., Huang, S. & Cole, J. M. OpticalBERT and OpticalTable-SQA: Text- and Table-Based Language Models for the Optical-Materials Domain. J. Chem. Inf. Model. 63, 1961–1981 (2023).
-
Van Herck, J. et al. Assessment of fine-tuned large language models for real-world chemistry and material science applications. Chem. Sci. 16, 670–684 (2025).
-
Hu, E. J. et al. LoRA: Low-Rank Adaptation of Large Language Models. Preprint at https://doi.org/10.48550/arXiv.2106.09685 (2021).
-
Dettmers, T., Pagnoni, A., Holtzman, A. & Zettlemoyer, L. QLoRA: Efficient Finetuning of Quantized LLMs. Advances in Neural Information Processing Systems 36, 10088–10115 (2023).
-
Lewis, P. et al. Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. Preprint at https://doi.org/10.48550/arXiv.2005.11401 (2021).
-
M. Bran, A. et al. Augmenting large language models with chemistry tools. Nat Mach Intell 6, 525–535 (2024).
-
Lu, J. et al. Generative design of functional metal complexes utilizing the internal knowledge and reasoning capability of large language models. J. Am. Chem. Soc. jacs.5c02097 (2025) doi:10.1021/jacs.5c02097.
-
Kang, Y. & Kim, J. ChatMOF: an artificial intelligence system for predicting and generating metal-organic frameworks using large language models. Nat Commun 15, 4705 (2024).
-
Bazgir, A. & Zhang, Y. MATAGENT: A HUMAN-IN-THE-LOOP MULTI-AGENT LLM FRAMEWORK FOR ACCELERATING THE MATERIAL SCIENCE DISCOVERY CYCLE. (2025).
-
Gupta, T., Zaki, M., Krishnan, N. M. A., & Mausam. MatSciBERT: A materials domain language model for text mining and information extraction. npj Comput Mater 8, (2022).
-
Beltagy, I., Lo, K. & Cohan, A. SciBERT: A Pretrained Language Model for Scientific Text. in Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP) (eds Inui, K., Jiang, J., Ng, V. & Wan, X.) 3615–3620 (Association for Computational Linguistics, Hong Kong, China, 2019). doi:10.18653/v1/D19-1371.
-
Peng, Y. et al. Information fusion strategy integrating pre-trained language model and contrastive learning for materials knowledge mining. Preprint at https://doi.org/10.48550/arXiv.2506.12516 (2025).
-
Zhang, L., Liu, Z., Ni, B. & Wang, Q. Large Language Models (LLMs) for Materials Design. Adv Funct Materials e25897 (2025) doi:10.1002/adfm.202525897.
-
Van, M.-H., Verma, P., Zhao, C. & Wu, X. A Survey of AI for Materials Science: Foundation Models, LLM Agents, Datasets, and Tools. Preprint at https://doi.org/10.48550/arXiv.2506.20743 (2025).
-
Dagdelen, J. et al. Structured information extraction from scientific text with large language models. Nat Commun 15, 1418 (2024).
-
Vaucher, A. C. et al. Automated extraction of chemical synthesis actions from experimental procedures. Nat Commun 11, 3601 (2020).
-
Jablonka, K. M. et al. 14 examples of how LLMs can transform materials science and chemistry: a reflection on a large language model hackathon. Digital Discovery 2, 1233–1250 (2023).
-
Boiko, D. A., MacKnight, R., Kline, B. & Gomes, G. Autonomous chemical research with large language models. Nature 624, 570–578 (2023).
-
Polak, M. P. & Morgan, D. Extracting accurate materials data from research papers with conversational language models and prompt engineering. Nat Commun 15, 1569 (2024).
-
Gupta, S., Mahmood, A., Shetty, P., Adeboye, A. & Ramprasad, R. Data extraction from polymer literature using large language models. Commun Mater 5, 269 (2024).
-
Yuan, H., Zeng, J., Zuo, J., Wang, X. & Xu, D. A general LLM-powered text mining framework: Applied to extract high entropy alloys. Computational Materials Science 264, 114476 (2026).
-
DeepSeek-AI et al. DeepSeek-V3 Technical Report. Preprint at https://doi.org/10.48550/arXiv.2412.19437 (2025).
-
Ouyang, L. et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems 35, 27730–27744 (2022).
-
Wang, H. et al. Scientific discovery in the age of artificial intelligence. Nature 620, 47–60 (2023).
-
Zimmermann, Y. et al. 34 Examples of LLM Applications in Materials Science and Chemistry: Towards Automation, Assistants, Agents, and Accelerated Scientific Discovery. Preprint at https://doi.org/10.48550/arXiv.2505.03049 (2025).
-
Pyzer-Knapp, E. O. et al. Foundation models for materials discovery—current state and future directions. npj Comput Mater 11, 61 (2025).
-
Chen, Y. et al. Development and application of Few-shot learning methods in materials science under data scarcity. J. Mater. Chem. A 12, 30249–30268 (2024).
-
Hatakeyama-Sato, K., Yamane, N., Igarashi, Y., Nabae, Y. & Hayakawa, T. Prompt engineering of GPT-4 for chemical research: what can/cannot be done? Science and Technology of Advanced Materials: Methods 3, 2260300 (2023).
-
Lv, S. et al. Bridging language models and computational materials science: A prompt-driven framework for material property prediction. Materials Genome Engineering Advances 3, e70013 (2025).
-
Wang, H. et al. Evaluating the performance and robustness of LLMs in materials science Q&A and property predictions. Digital Discovery 4, 1612–1624 (2025).
-
Xue, D. et al. Accelerated search for materials with targeted properties by adaptive design. Nature Communications 7, 11241 (2016).
-
Lookman, T., Liu, Y. & Gao, Z. Materials Informatics: Emergence to Autonomous Discovery in the Age of AI. Advanced Materials e15941 (2026) doi:10.1002/adma.202515941.
-
Wei, J. et al. Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. Preprint at https://doi.org/10.48550/arXiv.2201.11903 (2023).
-
Wei, X. et al. ChatIE: Zero-Shot Information Extraction via Chatting with ChatGPT. Preprint at https://doi.org/10.48550/arXiv.2302.10205 (2024).
-
Team, G. et al. Gemini 1.5: Unlocking multimodal understanding across millions of tokens of context. Preprint at https://doi.org/10.48550/arXiv.2403.05530 (2024).
-
Yao, Z. et al. Are Reasoning Models More Prone to Hallucination? Preprint at https://doi.org/10.48550/arXiv.2505.23646 (2025).
-
Jiang, L. et al. Synchronously enhancing the strength, toughness, and stress corrosion resistance of high-end aluminum alloys via interpretable machine learning. Acta Materialia 270, 119873 (2024).
-
Sohail, Y. et al. Machine-learning design of ductile FeNiCoAlTa alloys with high strength. Nature 643, 119–124 (2025).
-
Akiba, T., Sano, S., Yanase, T., Ohta, T. & Koyama, M. Optuna: A Next-generation Hyperparameter Optimization Framework. Preprint at https://doi.org/10.48550/arXiv.1907.10902 (2019).
8 Acknowledgements
Z.G. acknowledges the support from the National Natural Science Foundation of China (No.52595632 and No.52250191), the Key Research and Development Program of the Ministry of Science and Technology (No.2023YFB4604100). T.L acknowledges the support from the National Natural Science Foundation of China (No.52350710205).
We also acknowledge the support by HPC Platform, Xi'an Jiaotong University.
9 Author information
Authors and Affiliations
State Key Laboratory for Mechanical Behavior of Materials, State Key Laboratory of Porous Metal Materials, School of Materials Science and Engineering, Xi'an Jiaotong University, Xi'an, China
YuJie Liu, Dezhen Xue, Jun Sun, Xiangdong Ding & Zhibin Gao
AiMaterial Research, Santa Fe, New Mexico, USA
Turab Lookman
Contributions
T.L. and Z.G. conceived the ideas and designed the overall research framework. Y.L. developed the hybrid "Guided Mode" workflow by integrating numerical priors with Large Language Models and implemented the semantic similarity-based retrieval algorithms. Y.L. also performed the comprehensive benchmarking of general-purpose LLMs against domain-specific models, evaluated the prediction accuracy and uncertainty calibration, and prepared the figures. D.X. provided the dataset of Titanium for the analysis. J.S. and X.D. contributed to valuable scientific discussions and provided feedback on the research. Y.L. and Z.G. drafted the manuscript. T.L. supervised the research and revised the text. All authors read and approved the final manuscript.
Corresponding author
Correspondence to Turab Lookman or Zhibin Gao.
10 Ethics declarations
Competing interests
The authors declare no competing interests.