MatExpert: Decomposing Materials Discovery By Mimicking Human Experts

## Abstract

Abstract Material discovery is a critical research area with profound implications for various industries. In this work, we introduce MatExpert , a novel framework that leverages Large Language Models (LLMs) and contrastive learning to accelerate the discovery and design of new solid-state materials. Inspired by the workflow of human materials design experts, our approach integrates three key stages: retrieval, transition, and generation. First, in the retrieval stage, MatExpert identifies an existing material that closely matches the desired criteria. Second, in the transition stage, MatExpert outlines the necessary modifications to transform this material formulation to meet specific requirements outlined by the initial user query. Third, in the generation state, MatExpert performs detailed computations and structural generation to create new materials based on the provided information. Our experimental results demonstrate that MatExpert outperforms state-of-the-art methods in material generation tasks, achieving superior performance across various metrics including validity, distribution, and stability. As such, MatExpert represents a meaningful advancement in computational material discovery using langauge-based generative models.

## 1 Introduction

The discovery and design of new materials are central challenges in modern materials science, driven by the need for materials with tailored properties for applications in energy, electronics, and catalysis. Traditional methods for material discovery, such as high-throughput experiments and density functional theory (DFT) simulations, are computationally expensive and often require significant domain expertise to achieve accurate predictions (Miret et al., ). Recent advancements in artificial intelligence (AI), particularly large language models (LLMs), have opened new possibilities for automating and accelerating the materials design process (Miret & Krishnan, ; Jablonka et al., ; Song et al., ; ; Zhang et al., ; Ramos et al., ).

LLMs such as GPT-4 OpenAI () have demonstrated remarkable success in natural language processing tasks and have shown potential for application in scientific problems beyond language, including chemistry and materials science Flam-Shepherd & Aspuru-Guzik (); Gruver et al. (); Schilling-Wilhelmi et al. (); Mirza et al. (); Delétang et al. (). For example, LLMs have been used to generate molecular structures Gruver et al. () and predict material properties from textual descriptions Alampara et al. (). In the context of material generation, models like Crystal Diffusion Variational Autoencoders (CDVAE) Xie et al. (), as well as fine-tuned LLMs such as LLaMA-2 Gruver et al. (), CrystaLLM Antunes et al. (), and LM-AC/LM-CH, have made significant progress in generating crystal structures directly from Crystallographic Information Files (CIFs) Antunes et al. (). Together, these models aim to accelerate materials design by predicting stable structures and optimizing key properties, such as energy above hull for stability Riebesell et al. ().

Despite the significant progress made in applying AI models to materials science, current methods for material generation still face critical limitations Miret & Krishnan (); Alampara et al. (); Mirza et al. (). Most approaches generate material structures in a single step, often resulting in static outputs that lack the flexibility for iterative refinement and optimization based on intermediate feedback. Moreover, these models struggle to integrate multimodal data—such as textual descriptions of desired properties and structural information like atomic coordinates from Crystallographic Information Files (CIFs)—in a meaningful and cohesive way. Consequently, they fall short of replicating the complex, reasoning-driven processes employed by human experts, limiting their ability to generate materials that meet specific target properties.

In contrast to AI models, human experts follow a methodical, multi-step process when designing new materials. They begin by identifying an existing material with properties closely matching the desired specifications. From there, they apply a series of logical modifications—such as altering atomic arrangements or chemical compositions—to iteratively refine the material. Only after extensive refinement do they finalize the structural details, ensuring that the material is both feasible and aligned with the target properties.

To overcome the limitations of current models, we propose MatExpert, a framework that mimics this expert-driven workflow by breaking down the material generation process into three stages: retrieval, transition, and generation. Using a text-structure retrieval approach combined with chain-of-thought reasoning Wei et al. (), MatExpert can iteratively refine materials based on intermediate feedback, leading to more accurate and interpretable material designs that meet desired specifications.

To comprehensively assess the performance of MatExpert, we assembled a large-scale dataset from the NOMAD database Scheidgen et al. (), which contains a total of $2,886,120$ materials. This extensive evaluation on a large-scale testbed demonstrates the robustness and generalizability of MatExpert in addressing real-world materials discovery challenges.

Concretely, our paper makes the following contributions:

- 1.
We propose MatExpert, a novel framework that mimics the expert-driven workflow for material discovery by decomposing the generation process into three stages: retrieval, transition, and generation. By leveraging a text-structure retrieval mechanism and a chain-of-thought reasoning approach, MatExpert enables the design of accurate and interpretable materials.
- 2.
We curated a large-scale dataset from the NOMAD Scheidgen et al. () database, which serves as a comprehensive testbed for evaluating MatExpert across diverse material compositions. We will publicly release the datasets and source codes upon publication.
- 3.
We conducted extensive experiments on both the Material Project Jain et al. () and the curated NOMAD datasets. Our results demonstrate that MatExpert significantly outperforms state-of-the-art baseline methods in material generation, showcasing its effectiveness and generalizability.

Figure: Figure 1: MatExpert achieves remarkable performance on all metrics compared with baselines, especially metrics of distances. See Table 1 for details.
Refer to caption: x1.png

## 2 Related Work

The use of AI and large language models (LLMs) in materials science has gained traction as a means to accelerate material discovery, which traditionally relies on computationally intensive methods like DFT simulations Duval et al. (); Govindarajan et al. (). Miret & Krishnan () provide an extensive review of the limitations of current LLMs in materials science, particularly their inability to handle multi-modal data and iteratively refine structures based on feedback.

Early work, such as the Crystal Diffusion Variational Autoencoder (CDVAE) Xie et al. (), generated crystal structures by incorporating physical stability constraints to produce valid periodic materials. Recent work has expanded on CDVAE’s approach by exploring alternative representations for diffusion-based models Jiao et al. (); Yang et al. (); Zeni et al. (), as well as flow-matching models Miller et al. (). Further advancements include the fine-tuning of LLMs for materials generation. Gruver et al. () fine-tuned LLaMA-2, improving metastable material generation rates, while CrystaLLM Antunes et al. () employs an autoregressive model trained on CIF files to generate inorganic crystal structures, leveraging Monte Carlo Tree Search for refinement. Flam-Shepherd & Aspuru-Guzik () proposed LM-AC and LM-CH, which explore generating 3D molecular structures directly from CIF, XYZ, and PDB formats, pushing the boundaries of LLM applications in material science. In addition to generative models for materials discovery, as well as the development domain-specific LLMs for diverse language tasks materials science (Song et al., ; ; Xie et al., ; Zhang et al., ), LLMs are also being used to automate the extraction of structured data from scientific literature, streamlining the creation of datasets for machine learning Hira et al. (); Mishra et al. (); Schilling-Wilhelmi et al. ().

In summary, while LLMs show great promise, challenges remain in integrating multi-modal data and refining material designs iteratively. Most prior work has focused on unconditioned material generation, but current methods lack the ability to iteratively refine and reason like human experts. Our MatExpert framework addresses this shortcoming by mimicking an expert-driven workflow, employing multi-stage iterative refinement through retrieval, transition, and generation processes, and achieves remarkable performance compared to state-of-the-art methods, particularly in metrics of distances (see Figure 1).

Figure: Figure 2: We utilize a contrastive learning framework to train two encoders for reference material retrieval. For a given sample material (e.g., Na3MnCoNiO6), we extract both its property description and structural description using [PyMatgen](https://pymatgen.org/) Ong et al. () and [Robocrystallographer](https://github.com/hackingmaterials/robocrystallographer) Ganose & Jain (), respectively. The model employs two T5-based encoders Raffel et al. (), which are trained to minimize the distance between these two representations.
Refer to caption: x2.png

## 3 Methodology

Our MatExpert framework simplifies the complex process of material discovery by emulating human experts through three key stages: retrieval, transition, and generation. First, we retrieve a reference material from a database that closely aligns with the desired properties. Next, using a fine-tuned large language model (LLM) with Low-Rank Adaptation (LoRA) Hu et al. (), we generate insights on how to modify the reference material to meet the target specifications. Finally, we generate the new material’s structure based on the reference and transition steps. The framework employs a T5-based Raffel et al. () model for the retrieval stage and a fine-tuned LLM for the transition and generation stages.
A comprehensive illustration of the MatExpert framework pipeline is shown in Figure 3.

Figure: Figure 3: Pipeline of MatExpert: Given a description of the desired material, MatExpert first retrieves the most similar material from the database (e.g., $\text{Na}_{3}\text{MnCoNiO}_{6}$). Next, the LLM provides transition pathways to modify the retrieved material into the desired material (e.g., replacing Na with Li). Finally, the LLM generates the detailed structural information of the desired material ($\text{Li}_{3}\text{MnCoNiO}_{6}$). See Figure 7 for a full case of conditional material generation.
Refer to caption: x3.png

### 3.1 First Stage: Retrieval

The retrieval stage is the foundational step of our framework, aimed at identifying the material in the database that best matches the desired property description provided by the user.

To bridge the gap between the representation of the desired properties and the relevant material, we apply contrastive learning. Contrastive learning Chen et al. () is a self-supervised method that learns representations by bringing positive pairs closer together while pushing negative pairs farther apart in the embedding space. Contrastive learning was first applied in the domain Radford et al. (); Singh et al. (), recent works have successfully applied similar methods to domains to materials design, such as molecular Liu et al. () and protein modeling Xu et al. (). In the context of material retrieval, we use this method to embed material properties and structures in a shared space, enabling the efficient retrieval of materials that closely match specific queries.

To implement this, we employ a contrastive learning framework (see Figure 2), using two parallel T5-based encoders to process and embed both property and structure descriptions. The property descriptions include key characteristics such as composition, space group number, formation energy, band gap, and energy above hull. Structural descriptions are extracted using RoboCrystallographer, which provides detailed linguistic descriptions of the structure for each material.

The primary objective is to ensure that the embedding of the property description ($\mathbf{q}_{i}$) is closely aligned with the embedding of the corresponding structure description ($\mathbf{m}_{i}$), while distinctly separating it from embeddings of other materials ($\mathbf{m}_{k}$).
To quantitatively enforce this alignment, a contrastive loss function is defined as:

$$ $\mathcal{L}=-\log\frac{\exp(\text{sim}(\mathbf{q}_{i},\mathbf{m}_{i})/\tau)}{ \sum_{k=1}^{N}\exp(\text{sim}(\mathbf{q}_{i},\mathbf{m}_{k})/\tau)}.$ (1) $$

Here, $\text{sim}(\mathbf{q}_{i},\mathbf{m}_{i})$ denotes the similarity between the property and structure embeddings, $\tau$ is a temperature parameter that controls the sharpness of the distribution, and $N$ is the size of negative sampling. The output of this stage is the best matching material, which serves as a candidate for further refinement.

### 3.2 Second Stage: Transition

The transition stage focuses on developing a detailed and viable method for modifying the retrieved material to meet the desired properties. This stage bridges the gap between the existing material and the target material by outlining specific structural or compositional changes required to achieve the desired specifications.

To build a model capable of generating transition pathways that describe how to transform the existing reference material into the desired target material, two key steps are necessary: (1) constructing a training dataset consisting of <source material, transition pathways, target material> triples, and (2) fine-tuning a model that can produce transition pathways given an source material as a reference.

In this stage, we utilize two LLMs in a sequential process. First, during the training phase, we employ GPT-4 to generate ground-truth transition pathways, which provide comprehensive, step-by-step instructions for transforming the retrieved material to meet the target properties. Subsequently, we fine-tune a second, smaller LLM using these ground-truth pathways. In practical applications, including our experiments, this fine-tuned LLM is deployed to generate the potential transition pathways, offering a more efficient solution while maintaining accuracy.

Ground-Truth Pathway Generation with GPT-4:
During the training phase, we utilize GPT-4 to generate detailed transition pathways by providing it with carefully designed prompts. These prompts are constructed to ensure that GPT-4 receives all necessary information about both the source material and the target material, enabling it to produce accurate and comprehensive modification pathways. An example template of such a prompt is:

I have two materials: <formula_source> and <formula_target>. Based on the descriptions and properties of the two materials below, can you summarize the main reasons for the differences in properties when transitioning from <formula_source> to <formula_target>? The description of <formula_source>: <description_source>. The description of <formula_target>: <description_target>.

Fine-Tuning the Second LLM:
The ground-truth transition pathways generated by GPT-4 form the basis for the supervised fine-tuning of a second LLM. This model is trained to learn and replicate the detailed modification steps provided by GPT-4, allowing it to generate potential transition pathways in practical applications. An example prompt template used for fine-tuning is:

I am looking to design a new material with the following properties: <property_list>. The closest existing material I found in the database is <formula_source>, which has similar properties. Below is the structure description of <formula_source>. \n <description_source> \n How should I modify <formula_source> to develop a new material with the desired properties?

### 3.3 Third Stage: Generation

The generation stage is focused on producing the CIF (Crystallographic Information File) representation of the predicted material. Specifically, we first generate a detailed description of the lattice vectors and atomic coordinates, which we refer to as the ALX representation. This ALX representation is then automatically converted into CIF format using the pymatgen library, which serves as the final output of our framework.

Fine-Tuning:
The generation process builds upon the conversation initiated during the earlier stages of the framework. The output from the transition stage serves as input for the generation stage. An additional prompt is introduced to extend the conversation, guiding the model to generate the ALX representation based on the transition pathway provided in the previous stage. The prompt for the generation stage is:

Based on the information, for the new material, could you generate a description of the lengths and angles of the lattice vectors and then the element type and coordinates for each atom within the lattice?

ALX Representation:
After fine-tuning, the LLM generates the ALX representation for the material based on the transition pathways (as shown in the final response in Figure 3). This representation includes:

- •
Lattice Vectors: The lengths and angles of the lattice vectors that define the unit cell of the material.
- •
Atomic Coordinates: The precise atomic types and their coordinates within the lattice, ensuring that the generated structure aligns with the desired material properties.

Final Output in CIF Format:
Once the ALX representation is generated, it is converted into CIF format using the pymatgen library. The CIF file contains the complete structural information of the predicted material and serves as the final output of the generation stage. This file can be utilized for further computational studies, experimental validation, or integration into material databases.

## 4 Data Collection & Pre-processing

To rigorously evaluate the performance of MatExpert, we assembled a comprehensive dataset from the NOMAD database Scheidgen et al. (), utilizing its API. This extensive dataset serves as the large-scale testbed for assessing the capabilities of our framework.

#### Data Collection from NOMAD

NOMAD (Novel Materials Discovery) Scheidgen et al. () is a vast repository of material data, providing access to millions of entries with detailed structural and property information. For our data collection, we applied specific filters to refine the dataset. We excluded materials containing inert elements to focus on those with more active chemical properties, which are of greater interest in materials science research. Additionally, we restricted the dataset to materials whose structures were simulated using the Vienna Ab initio Simulation Package (VASP) Kresse & Hafner (), ensuring high-quality computational data. To further improve computational efficiency during training and analysis, we also excluded materials with more than 30 atoms in their original structures.

By applying these filtering criteria, we obtained a dataset of $2,886,120$ materials. This large-scale dataset provides a rich foundation for training and evaluating our models, enabling us to explore a wide range of material compositions and properties.

#### Pre-processing

Each filtered material was converted into CIF format, ensuring the structural integrity of the original data was preserved. CIF files are widely used in materials science to represent crystal structures and are compatible with various computational tools, facilitating seamless integration into our framework.

In addition to structural data, we enriched our dataset with linguistic descriptions of each material, generated using RoboCrystallographer Ganose & Jain (), a tool that automatically produces human-readable summaries of crystallographic information. This step allows for the integration of language-based processing within our framework, leveraging the strengths of large language models.
We also extracted key material properties—such as formation energy, total energy, and elemental composition—using the M3GNet Chen & Ong () and PyMatgen Ong et al. () libraries in Python. These properties provide essential inputs for condition-based material design and evaluation within MatExpert.

By leveraging this meticulously curated dataset, we ensure that MatExpert is evaluated on a robust and diverse set of large-scale materials, facilitating comprehensive assessments of its performance and effectiveness.

## 5 Experiments

### 5.1 Datasets and Baselines

Material Project: We leverage datasets from the Materials Project database similar to prior studies Xie et al. (); Gruver et al. (). The MP-20 dataset (Xie et al., ) for unconditional generation contains 45,231 stable materials, filtered to exclude structures with over 30 atoms per unit cell for computational efficiency.

NOMAD: We also collected a large-scale dataset from the NOMAD database, consisting of 2,928,355 materials. The dataset was filtered to exclude structures with inert atoms and more than 30 atoms per unit cell, and it only includes structures computed using VASP in the database.

To evaluate the effectiveness of our framework, we compare its performance against state-of-the-art baselines in material generation:

Crystal-LLM Gruver et al. (): A state-of-the-art approach fine-tuning large language models (LLaMA-2 Touvron et al. ()) for generating stable inorganic materials. It excels in generating valid crystal structures and serves as a primary baseline due to its pioneering use of LLMs for material generation.

CDVAE Xie et al. (): A Crystal Diffusion Variational Autoencoder tailored for periodic material generation. It combines generative models within a continuous VAE latent space, widely used for generating stable materials and considered a strong benchmark.

LM-CH and LM-AC Flam-Shepherd & Aspuru-Guzik (): Transformer-based models for 3D crystal structure generation. LM-CH uses character-level tokenization, while LM-AC uses atom and coordinate-level tokens, both demonstrating strong performance in generating valid and diverse crystal structures.

**Table 1: MatExpert shows general outperformance compared to baseline methods for unconditional generation on Materials Project based on various metrics like validity checks, coverage, property distribution, and stability. The best results are in bold, while the second-best results are underlined.**
| Method | Validity Check | Coverage | Distribution | Metastable | Stable |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
|  | Struc↑ | Comp↑ | Rec↑ | Prec↑ | wdist($\rho$)↓ | wdist(Nel)↓ | M3GNet↑ | DFT↑ |
| CDVAE | 1.00 | 0.867 | 0.991 | 0.995 | 0.68 | 1.43 | 28.8% | 5.4% |
| LM-CH | 0.848 | 0.835 | 0.992 | 0.978 | 0.86 | 0.13 | n/a | n/a |
| LM-AC | 0.958 | 0.889 | 0.996 | 0.985 | 0.69 | 0.09 | n/a | n/a |
| Crystal-LLM with LLaMA-2 |  |  |  |  |  |  |  |  |
| 7B ($\tau=1.0$) | 0.918 | 0.879 | 0.969 | 0.960 | 3.85 | 0.96 | 35.1% | 6.7% |
| 7B ($\tau=0.7$) | 0.964 | 0.933 | 0.911 | 0.949 | 3.61 | 1.06 | 35.0% | 6.2% |
| 70B ($\tau=1.0$) | 0.965 | 0.863 | 0.968 | 0.983 | 1.72 | 0.55 | 35.4% | 10.0% |
| 70B ($\tau=0.7$) | 0.996 | 0.954 | 0.858 | 0.989 | 0.81 | 0.44 | 49.8% | 10.6% |
| MatExpert with LLaMA-2 |  |  |  |  |  |  |  |  |
| 7B ($\tau=1.0$) | 0.920 | 0.908 | 0.984 | 0.994 | 0.49 | 0.11 | 37.5% | 7.8% |
| 7B ($\tau=0.7$) | 0.946 | 0.943 | 0.952 | 0.986 | 0.51 | 0.13 | 36.2% | 8.0% |
| 70B ($\tau=1.0$) | 0.968 | 0.878 | 0.982 | 0.986 | 0.23 | 0.06 | 50.2% | 11.3% |
| 70B ($\tau=0.7$) | 0.998 | 0.959 | 0.969 | 0.993 | 0.23 | 0.07 | 50.9% | 11.8% |
| MatExpert with LLaMA-3 |  |  |  |  |  |  |  |  |
| 8B ($\tau=1.0$) | 0.933 | 0.910 | 0.992 | 0.995 | 0.36 | 0.07 | 39.1% | 8.1% |
| 8B ($\tau=0.7$) | 0.975 | 0.959 | 0.988 | 0.990 | 0.38 | 0.10 | 39.5% | 8.4% |
| 70B ($\tau=1.0$) | 0.970 | 0.880 | 0.980 | 0.988 | 0.21 | 0.05 | 50.5% | 11.0% |
| 70B ($\tau=0.7$) | 0.998 | 0.961 | 0.986 | 0.991 | 0.18 | 0.04 | 51.0% | 12.0% |

**Table 2: Comparison results of conditional generation on NOMAD datasets with MatExpert outperforming baseline methods. The best results are in bold.**
| Method | Validity Check | Coverage | Distribution |  |  |  |
| --- | --- | --- | --- | --- | --- | --- |
|  | Struc↑ | Comp↑ | Rec↑ | Prec↑ | wdist($\rho$)↓ | wdist(Nel)↓ |
| Crystal-LLM with LLaMA-2 |  |  |  |  |  |  |
| 70B ($\tau=1.0$) | 0.983 | 0.892 | 0.979 | 0.984 | 1.63 | 0.53 |
| 70B ($\tau=0.7$) | 0.997 | 0.971 | 0.873 | 0.988 | 0.77 | 0.42 |
| MatExpert with LLaMA-2 |  |  |  |  |  |  |
| 70B ($\tau=1.0$) | 0.991 | 0.913 | 0.986 | 0.992 | 0.18 | 0.08 |
| 70B ($\tau=0.7$) | 0.998 | 0.981 | 0.982 | 0.994 | 0.21 | 0.08 |
| MatExpert with LLaMA-3 |  |  |  |  |  |  |
| 70B ($\tau=1.0$) | 0.996 | 0.922 | 0.991 | 0.997 | 0.15 | 0.08 |
| 70B ($\tau=0.7$) | 0.999 | 0.986 | 0.989 | 0.985 | 0.14 | 0.09 |

### 5.2 Unconditional Generation

In the unconditional generation task, we aim to assess the ability of MatExpert to produce novel and stable material structures without any specific property constraints. This stage serves as a benchmark for evaluating the intrinsic generative capabilities of the model, focusing on the validity, diversity, and stability of the generated materials. For unconditional generation, we randomly select a material from the database during the first stage of MatExpert.

The comparison results are shown in Table 1. As evident from the table, the MatExpert family with LLaMA-3 (Dubey et al., ) outperforms all other methods across all metrics except metrics of coverage. Traditional models such as CDVAE, LM-CH, and LM-AC excel in coverage and structural validity. When compared to the state-of-the-art LLM-based model Crystal-LLM, our MatExpert method consistently outperforms Crystal-LLM across all settings, including the same model size and temperature as well as DFT-based stability. Notably, MatExpert achieves remarkable results in distribution metrics, benefiting from the transition from an existing material in the database. While Crystal-LLM may struggle with the hallucinations of LLM, thus generating out-of-distribution materials.

Figure: Figure 4: Conditional satisfaction rates of common property constraints. MatExpert consistently outperforms baseline methods.
Refer to caption: x4.png

### 5.3 Conditional Generation

In the conditional generation task, we evaluate MatExpert’s ability to generate material structures that meet specific property constraints using the large-scale NOMAD dataset. This task is crucial for practical applications, where researchers often require materials with targeted properties, such as specific band gaps, space groups, and chemical compositions, etc. As shown in Table 2, MatExpert significantly outperforms the baseline Crystal-LLM for all metrics. MatExpert also excels in property distribution, achieving much lower Wasserstein distances, which reflects its ability to generate materials with property distributions closely aligned with the training data. Notably, the stability metric like the energy above the hull is treated as an input property in this task and is not separately evaluated as a performance metric.

To rigorously evaluate the effectiveness of MatExpert in satisfying user-defined property constraints, we also conducted additional experiments aimed at quantifying the percentage of generated materials that meet specific property criteria set by users.

We selected a set of common property constraints, including:

- •
Formula: We parse the composition from the generated CIF. We show the results in three levels by atom numbers: $\leq$ 5 atoms, $\leq$ 10 atoms, and $\leq$ 15 atoms.
- •
Energy above hull: We use M3GNet Chen & Ong () to estimate the energy above hull. We bin
stability as $\hat{E}^{hull}<0.1$ for metastable and $\hat{E}^{hull}\geq 0.1$ for unstable.
- •
Space Group Number: We use PyMatgen’s SpacegroupAnalyzer with a precision of 0.2 angstroms. Ong et al. ()

For each constraint, we generated 10,000 materials using MatExpert and the baselines. We then calculated the percentage of materials that met the specified property criteria. The results of the condition satisfaction experiments are summarized in Figure 4. MatExpert consistently outperformed the baselines across all property constraints, demonstrating its superior capability to generate materials that meet user-defined specifications.

## 6 Analysis

Figure: Figure 5: Scores of diversty and novelty normalized to testing samples. MatExpert consistently achieves remarkable scores on all metrics. Notably, compared with Crystal-LLM, MatExpert consistently maintains high novelty regardless of model size.
Refer to caption: x5.png

**Table 3: Choices of encoders in retrieval stage. We use top-1 and top-5 accuracy, along with the average rank of the ground-truth materials as metrics.**
| Encoder | Accuracy | Avg Rank |  |
| --- | --- | --- | --- |
| Top-1 (%) | Top-5 (%) |  |  |
| Bert | 59.96 | 84.51 | 2.36 |
| T5 (ours) | 71.35 | 93.54 | 1.59 |

### 6.1 Analysis of Diversity and Novelty

To evaluate the MatExpert framework, we use metrics that assess the diversity and novelty of generated materials. Following Xie et al. (), diversity is calculated as the pairwise distance between samples using a featurization of structure and composition. Novelty is determined by comparing the distance to the nearest element of the training set for each sample, with a sample considered novel if this distance exceeds a threshold. We also assess the overall novelty, defined as having either a new structure or composition. To further understand the gaps between MatExpert and baselines, we illustrate the score of each metric normalized to testing samples in Figure 5. As we can see, MatExpert consistently achieves high-level scores in both structure and composition diversity compared to CDVAE and various Crystal-LLM configurations. This indicates MatExpert’s superior ability to explore a broad chemical space. In terms of novelty, MatExpert demonstrates a strong capacity to generate structures and compositions not found in existing databases, as evidenced by its high novelty scores. Notably, Crystal-LLM faces challenges in balancing model size and novelty, with larger models exhibiting lower novelty. In contrast, MatExpert consistently maintains high novelty regardless of model size.

### 6.2 Ablation Studies

To understand the contribution of different components of our framework, we conduct ablation studies by systematically removing or modifying key elements of MatExpert and observing the impact on performance.

Impact of Transition (CoT) Stage
The transition stage, which involves generating modification pathways using Chain of Thought (CoT) reasoning Wei et al. (), plays a crucial role in the overall performance of MatExpert. To evaluate the impact of this component, we conducted experiments where the CoT reasoning was removed entirely. The results in Figure 6 highlight its effectiveness of CoT reasoning.

Figure: Figure 6: Impact of Transition (CoT) and Retrieval Stages. We sequentially remove the transition (CoT) stage and the retrieval stage to demonstrate changes in condition satisfaction rates.
Refer to caption: x6.png

Impact of Retrieval Stage
We assess the impact of the retrieval stage with the contrastive learning framework. By removing the retrieval stage, we observe a noticeable decline in the quality of the retrieved materials (See Figure 6). This confirms that the retrieval stage is crucial for identifying high-quality reference materials, which are essential for effective subsequent modifications.

Choices of Encoders in Retrieval Stage
In the retrieval stage, we explored various encoder architectures to determine their impact on the quality of material retrieval (See Table 3). We compared T5-based encoders with BERT Devlin et al. (). Our findings indicate that T5-based encoders consistently outperform BERT, providing more accurate embeddings for both property and structure descriptions, making it more effective for capturing the most similar material aligned with the desired properties in the database.

### 6.3 Case study

To showcase the capabilities of MatExpert, we present a comprehensive example of conditional generation under property constraints in Figure 7. This case illustrates the process of generating a predicted material and its adherence to the specified properties.

Figure: Figure 7: A comprehensive example of MatExpert for conditional generation: Enter the desired properties, and MatExpert will generate the CIF representation of the material.
Refer to caption: x7.png

## 7 Conclusion

In this work, we introduced MatExpert, a novel framework leveraging LLMs and contrastive learning for the material discovery process. By emulating the workflow of a human materials science expert, MatExpert integrates retrieval, transition, and generation stages to design new materials. Our experiments show that MatExpert significantly outperforms state-of-the-art methods in material generation tasks, thereby exhibiting its potential to become a scalable tool for accelerating material discovery with higher-quality crystal generation.

## Appendix A Reproduciblity

### A.1 Environment

The experiments were conducted on machines with the following specifications.

Machine 1 for MatExpert with Llama-2 8B and Llama-3 8B:

- •
Hardware: NVIDIA A5000 GPU (24 GB on-board memory) GPU x 4, AMD Ryzen Threadripper PRO 3975WX CPU, 256 GB RAM
- •
Software: Ubuntu 22.04, Python 3.11, PyTorch 2.3.1+cu121, CUDA 12.4

Machine 2 for MatExpert with Llama-2 70B and Llama-3 70B:

- •
Hardware: NVIDIA L40S GPU (48 GB on-board memory) x 4, INTEL(R) XEON(R) GOLD 6526Y x 2, 512 GB RAM
- •
Software: Ubuntu 22.04, Python 3.11, PyTorch 2.3.1+cu121, CUDA 12.4

The list of environment requirements for the Python library will be made publicly available alongside the release of the open-source code of MatExpert.

### A.2 Implementation Details

**Table 4: Hyperparameters for training T5-based encoders in the retrieval stage.**
| Hyperparameter | Value | Description |
| --- | --- | --- |
| Model Architecture | t5-base | Pretrained model to use as the base encoder. |
| Learning Rate | 1e-4 | Learning rate for the optimizer. |
| Number of epochs | 100 | Number of epochs to train for. |
| Temperature | 0.1 | Temperature parameter for the NT-Xent loss. |
| Batch Size | 32 | Batch size for training. |
| Gradient Accumulation Steps | 8 | Number of batches for gradient accumulation. |

**Table 5: Hyperparameters for finetuning Llama family in the transition and generation stage.**
| Hyperparameter | Llama-3 8B | Llama-3 70B |
| --- | --- | --- |
| Model Architecture | Meta-Llama-3-8B-Instruct | Meta-Llama-3-70B-Instruct |
| Learning Rate | $1e^{-4}$ | $1e^{-4}$ |
| Batch Size | 4 | 4 |
| Batch Size per Device | 1 | 1 |
| Number of Epochs | 70 | 10 |
| Optimizer | AdamW | AdamW |
| Sequence Length | 2048 | 1024 |
| LoRA Rank | 8 | 8 |
| LoRA Alpha | 16 | 16 |
| LoRA Dropout | 0.1 | 0.1 |
| Warmup Ratio | 0.1 | 0.1 |
| Gradient Accumulation Steps | 8 | 8 |

The proposed MatExprt framework consists of two training stages: 1) Training T5-based encoders of the contrastive learning framework in the stage Retrieval. 2) Finetuning the Llama-2/Llama-3 based LLMs in the stage Transition and stage Generation.

#### Training T5-based encoders

In the retrieval stage, two T5-based encoders are employed. The model uses the ”t5-base” architecture in Huggingface Wolf () as its foundational structure. The training process is governed by a learning rate of 0.0001. It undergoes training for 100 epochs with early stopping. A temperature parameter of 0.1 is utilized, which affects the NT-Xent loss function, a common choice for contrastive learning. The batch size is set to 32 and gradient accumulation occurs over 8 steps, effectively simulating a larger batch size and allowing for more stable updates.

#### Finetuning Llama family

In the transition and generation stages, the Llama family of models is finetuned. Two variants are used: Llama-3 8B and Llama-3 70B, both with specific architectures designed for instruction-based tasks named “Meta-Llama-3-8B-Instruct” and “Meta-Llama-3-70B-Instruct” in Huggingface Wolf (). The learning rate is set to 0.0001. Each device processes a batch size of 1, with an overall batch size of 4. The 8B model is trained for 70 epochs, while the 70B model undergoes 10 epochs, reflecting differences in their complexity and training needs. The AdamW optimizer is employed for parameter updates. Sequence lengths differ, with the 8B model handling sequences of 2048 tokens, and the 70B model processing 1024 tokens limited by the on-board memory of GPUs. LoRA settings include a rank of 8, an alpha of 16, and a dropout rate of 0.1, facilitating efficient adaptation. A warmup ratio of 0.1 helps stabilize initial training and gradient accumulation is set to 8 steps for both models, ensuring robust learning.

### A.3 Efficiency

We utilize the open-source LLM training framework named LLaMA-Factory Zheng et al. () to finetune the LLMs. With the advantages of LoRA Hu et al. () and FlashAttention Dao et al. () mechanism, it takes around 30 and 120 hours to fine-tune Llama-3 8B and Llama-3 70B in MatExpert, respectively.

The generation speed of MatExpert on our machines is as follows:

- •
MatExpert with Llama-3 8B: $\sim$40 minutes per 10,000 samples.
- •
MatExpert with Llama-3 70B: $\sim$5 hours per 10,000 samples.

## Appendix B Datasets Details

Two datasets are included in our experiments: Material Project and NOMAD for unconditional generation and conditional generation, respectively.

#### Material Project

This dataset also named as MP-20 consisting of 45,231 materials is publicly available and was first proposed in Ong et al. (). We follow the data-split setting proposed in Gruver et al. () and  Xie et al. ().

#### NOMAD

This large-scale dataset consisting of 2,886,120 materials is collected by ourselves and will be publicly available. We collect the datasets via NOMAD API as the following script:

We filter out the materials with elements in excluded_elements and only include the materials with structures computing by VASP Kresse & Hafner ().

Then we further convert the structure in JSON to CIF files via the following script:

We randomly select 10,000 samples and another 10,000 samples as the validation and testing set, respectively. The remaining samples are all included in the training set.

## Appendix C Evaluation Metrics

### C.1 Validity

Validity is evaluated based on the structural and compositional integrity of the generated materials. Following Xie et al. (), a structure is considered valid if the shortest distance between any pair of atoms is greater than 0.5 Å, ensuring atomic stability. Furthermore, the overall charge of the material must be neutral to satisfy chemical feasibility. These criteria ensure that the generated materials conform to realistic physical and chemical constraints.

### C.2 Coverage

Following the methods outlined in Xie et al. () and Gruver et al. (), we measure coverage using two metrics: COV-R (Recall) and COV-P (Precision). These metrics quantify how well the generated materials resemble the ground truth materials in the test set. COV-R (Recall) measures the percentage of ground truth materials accurately represented by the generated set, while COV-P (Precision) evaluates the quality of the generated materials in replicating the true material diversity. These metrics ensure that the generated materials not only capture the diversity of the test set but also maintain high-quality representations. Both validity and coverage are computed over 10,000 materials randomly sampled from the generated set.

### C.3 Distribution

The distribution of properties is compared between the generated materials and the test set using the Wasserstein distance. The key properties evaluated are density ($\rho$, measured in g/cm^3) and the number of unique elements ($N_{el}$). The property distribution is computed over 1,000 valid materials, randomly sampled from those that pass the validity test. This method ensures that the generated materials exhibit realistic physical properties comparable to those in the test set.

### C.4 Diversity

Diversity is assessed by calculating the pairwise distances between samples, based on structural and compositional features as described by Court et al. (). This metric quantifies how distinct each generated sample is relative to others in the dataset, offering insights into the variety of structures and compositions. Diversity is specifically measured on samples deemed metastable by M3GNet, as these are more likely to contribute meaningful variation. All diversity values are normalized against corresponding metrics from the test set, providing a clear comparison of the underlying data distributions.

### C.5 Novelty

Novelty is calculated by comparing each generated sample to its nearest neighbor in the training set. A sample is considered novel if its nearest neighbor exceeds a predefined threshold distance. Specifically, we use a structural distance cutoff of 0.1 and a compositional distance cutoff of 2. Novelty is assessed both in terms of structure and composition, with overall crystal novelty determined by the presence of a new structure or composition. These metrics provide insights into the uniqueness of the generated samples, particularly those identified as metastable. Novelty values are normalized by corresponding values for the test set to effectively convey the characteristics of the data distribution.

### C.6 Stability

We assess the stability of materials using a combination of machine learning potentials and density functional theory (DFT) to ensure a consistent evaluation framework. Specifically, we employ the M3GNet model Chen & Ong (), trained on total energy data from VASP calculations within the Materials Project dataset. This aligns the results with established correction schemes and absolute energy values. For consistency with Materials Project settings and prior works Xie et al. (); Gruver et al. (), including the PBE functional and DFT/DFT+U, we perform a single relaxation for each candidate structure using the default MPRelaSet parameters.

To determine the percentage of metastable compounds, we first filter out samples that fail basic structural and compositional validity checks. The remaining samples are then relaxed using M3GNet to obtain final relaxation energies. The stability calculation includes the validity rate from initial filtering and the rate of compounds with relaxed hull energy $\hat{E}_{\text{hull}}<0.1$. For stable materials, those identified as metastable by M3GNet undergo further DFT relaxation, and the percentage with $\hat{E}_{\text{hull}}<0.0$ is reported. This comprehensive approach integrates both machine learning and traditional DFT methods for a robust stability evaluation.

## Appendix D Cases of unconditional generation

Please see Figure 8.

Figure: Figure 8: Cases of unconditional generation.
Refer to caption: x8.png

## Appendix E Cases of conditional generation

Please see Figure 9.

Figure: Figure 9: Cases of conditional generation.
Refer to caption: x9.png

## Peer Reviews

confidence: 3
contribution: 2
initial_rating: 6
presentation: 3
questions: The heavy reliance on specific material databases, such as NOMAD, might lead to overfitting or model bias toward these datasets. Testing MatExpert on unseen data sources or a wider array of material properties could offer better insights into its generalization capabilities.
soundness: 3
strengths: 1. The design of MatExpert mirrors the expert-driven process in material science, breaking down material generation into retrieval, transition, and generation stages. This structured approach allows for iterative refinement.

2. The transition stage uses a CoT reasoning process, enabling the model to outline logical, step-by-step modifications to meet target properties. This sequential reasoning contributes to the model's ability to achieve high accuracy in conditional generation tasks.

3. By compiling a dataset of over 2 million materials from NOMAD, MatExpert provides a large-scale testbed to assess its performance.
summary: MatExpert is designed to streamline the discovery of new materials using LLMs and contrastive learning. Inspired by the traditional workflow of human experts, MatExpert operates in three stages: retrieval, transition, and generation. Experimental results demonstrate that MatExpert outperforms current sota models in material generation tasks.
weaknesses: 1. While the multi-stage design of MatExpert improves accuracy, it adds computational complexity and potentially increases training time compared to single-step models. 

2. The proposed framework will have cumulative errors. If the result retrieved in the first step is far away from the target, it will be difficult to correct it later, thus affecting the results of subsequent steps.

3. This paper focuses on innovation in application scenarios, and the technological innovation is relatively limited.

---

confidence: 3
contribution: 3
initial_rating: 5
presentation: 3
questions: - The paper mentions that the wdist density and wdist number of elements metrics are greatly improved compared to CrystalLLM but if the model is given a template from the database does that undermine these metrics? Is there a way to test this? For example, how often does the generated structure change the number of elements compared to the retrieved/given material? 
- Can you compute the S.U.N metric from Zeni et al. (https://arxiv.org/abs/2312.03687)?
- How does the inference speed of MatExpert compare to CrystalLLM?
soundness: 2
strengths: - The application of LLM to materials is interesting and materials discovery is important
- The evaluation metrics includes stability computed with DFT not just proxy metrics 
- Writing style and related work are good
summary: The paper describes a novel LLM based framework for materials discovery (MatExpert). There are three stages to the MatExpert methodology: retrieval, transition, and generation. First, a material is retrieved from the database that most closely matches the description given (similarly was trained with contrastive learning). Next during transition, the model determines how to alter the retrieved material to match the desired properties. Lastly, in the generation phase the model produces a ALX representation that is converted into a CIF representation. The main contribution of the paper is the MatExpert framework and the accompanying benchmarking and ablation study.
weaknesses: - Lacking details on what data was used for which tasks? For the unconditional results on MP-20, it is unclear if the NOMAD data was also used for training MatExpert. For the conditional results, were CrystalLLM and MatExpert trained on the same data?
- The results in Figure 5 are not well quantified i.e. it is not clear MatExpert is better. Also, there are 11 bars but only 9 labels, not sure if I missed something? The colors are very similar in some cases, hard to parse quickly.   
- There is no discussion on the limitations of using the retrieval stage. My interpretation is that the retrieved material is like a template. Before generative models, new materials were searched for using templating/substitution methods. One of the critiques of those methods is that materials generated are still quite similar to the template, would that also be a limitation here?

---

confidence: 4
contribution: 3
initial_rating: 5
presentation: 3
questions: * Follow up on W1, given the reproducibility challenges in LLM-generated content, how does the framework handle multiple potential pathways for synthesizing a target material?
* Follow up on W3, I wonder what’s MatExpert’s the success rate on each step? Specifically, the success rate for generating accurate ALX representation.
* Can this method be useful for user query without specifying formation energy and band gap for the target material? For instance, can the user prompt the model like, I want to material composed of Mn, Ge and with high electrical conductivity.
* What will the model response if the target material doesn’t exist?

[1] Miret, Santiago, et al. “Are LLMs Ready for Real-World Materials Discovery?”

[2] Zhang, Huan, et al. “HoneyComb: A Flexible LLM-Based Agent System for Materials Science”

[3] Chiang, Yuan, et al. “LLaMP: Large Language Model Made Powerful for High-fidelity Materials Knowledge Retrieval and Distillation”

[4] Microsoft Research AI4Science. “The Impact of Large Language Models on Scientific Discovery: a Preliminary Study using GPT-4”
soundness: 2
strengths: * The integration of Robocrystallographer enriches crystal data with textual descriptions, enhancing the retrieval process and interpretability.
* MatExpert achieves impressive performance on benchmarks, demonstrating its reliability in generating valid and diverse material structures.
* Contrastive learning effectively maps structure and property embeddings, which is a novel approach for aligning multimodal material data.
summary: The paper presents MatExpert, a framework that leverages large language models (LLMs) and contrastive learning to automate materials discovery. The proposed approach mimics human experts by breaking the process into three stages: retrieval, transition, and generation. MatExpert first identifies a closely related material, then suggests modifications to meet target specifications, and finally generates new material structures. The authors test MatExpert with large datasets from NOMAD and the Materials Project, showing that it performs better than current methods on key measures like stability, validity, and how well it meets diversity and novelty.
weaknesses: * The novelty of multi-stages material generation is a bit limited as it’s being studied in other works [1, 2, 3].  In the introduction, the author mention the drawback of the current method is the single step material structure generation. However, some cited paper include multi-steps material generation and property query already [1, 2, 3]. It will be helpful to have more discussion on those methods.
* The paper could benefit from more clarity on the pathway generation process. Specifically, it is unclear how the pathways generated by GPT-4 can be reliably reproduced in real-world lab settings. The authors might find [4] useful as a reference for evaluating the quality and safety of generated pathways.
* Due to the complexity of multi-steps framework, the paper could discuss more on how the authors prevent the error propagation.
* The visualization for Figure 6 is not clear enough. If there’s a table include the numerical value of the ablation study, it can better show the improvement of each component.

---

confidence: 3
contribution: 2
initial_rating: 3
presentation: 2
questions: 1. In Figure 5, are all the structures relaxed or not? Does it contain all generated samples, or samples that passed the validity test? Please provide the details.

2. Have you checked the energy value difference between the model inputs and generated samples? If there are OOD samples, does it pass the validity test or relaxation steps?

3. Regarding Equation (1), what do you use as the similarity function?

4. What prompts have you given to the model? Concretely, how much overlap is there between the conditioned properties and the NOMAD data?
soundness: 2
strengths: 1. This paper presents a novel approach by modeling crystal structures with a chain-of-experts framework that utilizes multiple LLMs. As far as I know, this approach is novel, and appears effective in generating stable materials.
2. Additionally, the use of fine-tuning methods, such as LoRA and distillation, enhances the framework’s efficiency and scalability, making it practical for real-world adaptation.
summary: The paper proposes MatExpert framework, designed to enhance LLM-based crystal structure generation through a 3-stage inference. The first stage searches an existing structure that closely resembles the user's input via T5 model trained with a contrastive learning objective on property and structure descriptions. Then, the fine-tuned LLM suggests modifications to the physical properties and structural attributes to achieve the target composition and characteristics. Finally, the LLM generates an ALX representation, which is converted to the final crystal structure. The authors also introduce a curated, large-scale dataset for training and demonstrate that this iterative, feedback-driven approach improves all evaluation metrics.
weaknesses: 1. The authors mentioned in the paper that “In the unconditional generation task, we aim to assess the ability of MatExpert to produce novel and stable material structures without any specific property constraints”, while at the same time “... For unconditional generation, we randomly select a material from the database during the first stage of MatExpert.” According to the second referred sentence, the second, transition stage would take samples of training set embeddings or raw data would be given as input. This is contradictory to the claim that no structure or property is given to generate. For this reason, I believe the evaluation scheme is unfair. Please fix me in the author response if I understood incorrectly.

2.  Following this concern, the performance improvement on generation is also questionable. The authors are encouraged to provide stabilities (Predicted energy over convex hull values, or DFT relaxation success rate) of the generated samples that are out-of-distribution. Also, stability measurements on Table 2 are also needed.

3. There are stronger baselines following the CDVAE research, as the authors stated. However, comparisons between them, which is necessary, are missing in Table 1.  Furthermore, the authors also need to specify which dataset was used, or, the source of the CDVAE model. If the CDVAE model is trained only on MP-20, that would not be a fair comparison.

Meta-review: The paper introduces MatExpert, a framework that leverages Large Language Models (LLMs) and contrastive learning to streamline the discovery of new solid-state materials. By emulating expert workflows through retrieval, transition, and generation stages, MatExpert demonstrates superior performance over existing methods on large-scale datasets like NOMAD. 

**[Strengths]**
- The three-stage approach effectively mimics expert-driven material discovery, enhancing generation quality.
- MatExpert outperforms state-of-the-art models in validity, distribution alignment, and stability metrics.

**[Weaknesses]**
- Sequential stages may lead to cumulative errors if the initial retrieval is suboptimal.
- The multi-stage process results in higher computational overhead compared to single-step models.

**[Decision]**
The authors extensively addressed most of the reviewers’ concerns in their rebuttal. I recommend accepting the paper. I encourage the authors to integrate the addressed concerns into the final manuscript.

Decision: Accept (Poster)