This repository includes the codes for manuscript: https://arxiv.org/abs/2608.15928
“Synthesizing like a chemist: an iterative, feedback-driven loop for materials discovery”
SpinSynth is a closed-loop framework for iterative materials synthesis optimization that integrates large language models (LLMs), high-throughput hyperspectral imaging, and multi-objective Bayesian optimization (MOBO). The framework is designed to place human tacit synthesis knowledge in the loop while reducing the time and effort for synthesizing a novel material. The framework consists of three main components:
- LLM-assisted initialization — synthesis knowledge is extracted from the literature and used to define a chemically informed parameter space and propose initialization conditions for MOBO.
- High-throughput characterization — hyperspectral imaging and auto-charaterization algorithm provide rapid quantitative experimental feedback of film coverage, uniformity, and a phase-purity proxy.
- Iterative Bayesian optimization — multi-objective Bayesian optimization uses high-throughput charaterization results to propose synthesis conditions over successive rounds.
We demonstrate the workflow using the spin-coating synthesis of the perovskite-inspired composition Rb₃BiI₆ which has not been reported before and compare LLM-assisted Bayesian optimization (LLM-BO) with conventionally Bayesian optimization initialized by Latin Hypercube Sampling (LHS).
SpinSynth/
├── README.md
├── LICENSE
├── requirements.txt
├── FAPbI3_Test/
├── Phase_Purity_Proxy_Test/
├── LLM_BO/ # LLM-assisted initialization and MOBO workflows
├── Regular_BO/ # Conventional MOBO baseline
├── Example_Data/ # Dataset to demo the code
├── High-throughput Characterization/ # Hyperspectral characterization pipelines
├── film_coverage.ipynb
├── film_uniformity.ipynb
└── phase_purity_proxy.ipynb
The code was developed and tested on:
- macOS 12.6
- Apple Silicon (M1 Pro)
- Python 3.11.8
All the codes are written in Python. Other operating systems have not been systematically tested.
The MOBO code was adapted from https://github.com/PV-Lab/MOBO-Kit. Please see the repo for detailed requirements.
The high-throughput characterization analysis was performed in Python. Major dependencies include:
requests
matplotlib
numpy
pandas
scikit-learn
scipy
shapely
spectral
seaborn
Exact package versions used for the manuscript analyses are provided in requirements.txt.
git clone https://github.com/PV-Lab/SpinSynth.git
cd SpinSynthWe recommend creating a dedicated environment rather than installing into an existing base environment.
conda create -n spinsynth python=3.11.8
conda activate spinsynthpip install -r requirements.txtOpen the repository directly in VS Code and select the spinsynth environment as the notebook kernel to use the supplied Jupyter notebooks.
The repository contains Jupyter notebooks for calculating the three hyperspectral-imaging-derived objectives:
- film coverage;
- film uniformity;
- phase purity proxy.
Example test datasets are provided in Example_Data folder.
The repository also includes MOBO codes for both LLM-BO group and regular BO group.
Open:
[exact path]/film_coverage.ipynb
Set the correct datapath and savepath in the notebook and run all notebook cells.
Open:
[exact path]/film_uniformity.ipynb
Set the correct datapath and savepath in the notebook and run all notebook cells.
Open:
[exact path]/phase_purity_proxy.ipynb
Set the correct datapath and savepath in the notebook and run all notebook cells.
Download the notebooks in the folder LLM-BO/Reugular BO and run all notebook cells.
The expected outputs for each cell can be found on uploaded notebooks.
To analyze a thin-film sample:
- Place the hyperspectral data in an accessible local directory.
- Open the corresponding characterization notebook.
- Modify the datapath and savepath. Modify the corresponding parameters in the functions based on the hypercube quality and the material types.
- Run the notebook sequentially.
- Record the resulting coverage, uniformity, and phase purity-proxy values.
The resulting objective values can then be supplied to the Bayesian optimization workflow as experimental feedback.
All the data supporting the manuscript are available at https://osf.io/cbrk2/overview.
This repository is distributed under the MIT License. See LICENSE for details.