Graph neural networks for materials, explained
Composition-based models cannot tell polymorphs apart. A graph neural network that reads crystal structure finally can. How GNNs work for materials.
There is one problem that quietly defeats most machine learning on materials, and once you see it you cannot unsee it. It is not the model. It is the way we describe the material to the model.
Graph neural networks are the fix, and they are the second of six ways to put physics into machine learning (the full map is here). Where a physics-informed network puts knowledge in the loss, a graph network puts it in the architecture: the structure of the material is built into the shape of the model itself.
The ceiling almost nobody names
Most models see a material as its composition: which elements, in what fractions. SiO2 is one silicon for every two oxygens, and that is the whole input.
The trouble is polymorphs. The same formula can crystallise into genuinely different structures, quartz, cristobalite, and others, with different properties. But they all have identical composition. So to a composition-based model, every form of SiO2 is the exact same input, and the best it can possibly do is predict their average property. It cannot tell them apart, because as far as it can see, they are not different.
This ceiling shows up everywhere once you look: as a cap on accuracy, as a flat streak in a predicted-versus-true plot, as a source of data leakage. It is never a weakness of the model. It is a limit of the representation.
Change what the model sees
A crystal is not really a bag of elements. It is a graph. Atoms are the nodes, and nearby atoms are joined by edges, the bonds. Two polymorphs of SiO2 have the same atoms but genuinely different graphs: different bonds, different geometry. A model that reads that graph sees them as different, at last.
Building the graph from real crystal data takes two steps, and both are worth understanding:
- A periodic neighbour search. A crystal repeats forever, so an atom can be bonded to a copy of another atom in a neighbouring image of the unit cell. You check the surrounding cell images and keep atom pairs within a cutoff distance, around 5 Angstrom. That turns a lattice plus atom positions into a concrete graph of bonds.
- Message passing. This is the heart of a graph neural network. In each layer, every atom gathers information from its bonded neighbours and updates its own vector. After a few layers, each atom’s vector summarises its local chemical environment, who it is bonded to and how. You then average over all atoms in the crystal and predict the property. This is the idea behind CGCNN, the crystal graph convolutional network.
The result: the ceiling cracks
Testing a composition ceiling against a structure-aware graph network on the same polymorph-heavy dataset:
| Model | Test R2 (band gap) |
|---|---|
| Composition ceiling (best a composition model can do) | 0.269 |
| Structure-aware GNN | 0.440 |
Structure lifted the score by about 0.17, because the graph network could finally use information the composition never carried. The clearest way to see it is SiO2 itself. Seven of its polymorphs landed in the test set, and their true band gaps span a huge range, from about 0.36 to 5.71 eV, for one formula.
- A composition model predicts one single number for all of them, around 4.3 eV. A flat line. That is the ceiling made literal.
- The graph network predicts a range, one value per polymorph, lifting off the flat line and mostly tracking the real gaps.
It is not perfect. On limited data it over-predicts the lowest-gap forms, and it is a small network. But the thing that was impossible for a composition model just happened: the polymorphs stopped being identical to it.
The lesson worth keeping
There is a subtle point hiding in how you split the data. Putting different polymorphs of one formula into both the training and test sets is cheating for a composition model, because it is really testing the model on inputs nearly identical to ones it trained on. For a graph model, the exact same split is fair, because those polymorphs are genuinely different graphs. Same data, same split, opposite verdict.
That tells you something important: “data leakage” is not a property of the data alone. It depends on what the model can see. And that is the deepest lesson of this whole line of work, in one sentence: your result is limited less by your model than by what your data lets the model see.
Choose the representation carefully, and half the outcome is decided before training even starts. Graph networks are what let a materials model finally see structure, and they are why the best interatomic potentials today, models like MACE and NequIP, are built on graphs with the symmetries of space baked in.
For where this fits among the other five approaches, start with the map of the six methods, or read the previous deep-dive on physics-informed neural networks.
Found a mistake? Good, tell me. This publication flags its own suspect values. Reach me on LinkedIn.