Text2Struc: Programmatic Crystal Structure Generation with Fine-Tuned Large Language Models

13 February 2025, Version 2
This content is a preprint and has not undergone peer review at the time of posting.

Abstract

Accelerating computational materials science relies not only on hardware advances but also on software that increases the ease of working with the relevant abstractions. Creation and manipulation of crystal structures is a part of many routine materials science workflows. In this work, we demonstrate how fine tuning large language models can be used to generate crystal structures from textual descriptions. By fine-tuning a CodeGen model with low-rank adaptation, we developed an interface that reduces errors and enables more flexible and powerful input, particularly for larger or more complex structures. Our model, which we call Text2Struc, is used to compare structure generation from the Materials Project database against LLM-generated and API-executed outputs. We show that API calls have higher accuracy, especially for supercells or defected crystals, as evidenced by an increase in the number of matches with original structures. Furthermore, removing Crystallographic Information File (CIF) outputs during training enhances generation fidelity, as the model trained without CIFs has a higher success rate than the model that prints CIFs in addition to the generating code. We hypothesize this may be owed to the base model being oriented towards generating code. Our findings highlight the effectiveness of fine-tuning and API integration for automating crystal structure generation in materials science.

Keywords

Large Language Models
Generative Models
Crystal Structures

Supplementary materials

Title
Description
Actions
Title
Supplementary Information for Text2Struc: Programmatic Crystal Structure Generation with Fine-Tuned Large Language Models
Description
Supplementary Information contains examples of dataset and additional details of the method.
Actions

Comments

Comments are not moderated before they are posted, but they can be removed by the site moderators if they are found to be in contravention of our Commenting Policy [opens in a new tab] - please read this policy before you post. Comments should be used for scholarly discussion of the content in question. You can find more information about how to use the commenting feature here [opens in a new tab] .
This site is protected by reCAPTCHA and the Google Privacy Policy [opens in a new tab] and Terms of Service [opens in a new tab] apply.