# Poster 31192

- Kind: Poster
- Talk page and recording: https://iclr.cc/virtual/2025/poster/31192

> Transcript of the talk's recording (session_asr), made by speech recognition or taken from the host's captions. It may contain errors. The words are the speakers'; listen to the recording on the talk's page before quoting it.

So I'll be presenting our 2025 I clear paper about distilling ML force fields with energy Hessians. So a brief overview of the domain, we're looking at atomistic systems, specifically molecules and materials, and we want to predict the energies and forces on these atomistic systems to understand properties and dynamics.
There's two ways of traditionally doing this. One is classical force fields, which are fast but less precise, while quantum methods like DMT provide high accuracy at significant computational cost. Recently, ML force fields have proven to be a promising method that deliver quantum level accuracy with near classical efficiency, which could potentially enable breakthroughs in materials discovery, drug design, and simulation of complex chemical reactions.
So a brief overview of L4s fields. You have a data set with quantum mechanical calculations. You use this to train an L4s field and hopefully the L4s field will scale much more gracefully with system size than a quantum mechanical calculation like DFT.
In general, ML force fields have been moving to the direction of foundation models, where instead of training on individual systems, you cover vast swaths of chemical space and hopefully have quantum level accuracy over many different types of systems. However, as foundation models have grown, they've become bigger and slower, defeating the purpose of having vast models in the first place where you can simulate for billions of time steps.
Also, practitioners tend to only care about a small subset of the entire chemical space. A fast model specialized to the area of study might be a better alternative to a slower general purpose model. Another thing we care about in MOForceFields is constraints, particularly energy conservation. It's really important that while simulating with a force field, the model conserves energy and makes realistic predictions, and we want these constraints for our downstream tasks.
However, enforcing constraints like energy conservation is slow. So that leads to the question, is there a way to train a foundation model with no constraints saving compute while somehow enforcing constraints at inference time? One way to increase speed at inference time is through knowledge distillation, where you transfer knowledge from a large computationally expensive more accurate model, the teacher, to a smaller more efficient model, a student. In vanilla KD, you match the student and teacher logits or often the intermediate.
immediate features. This gives more information than just training on the labels. In this work, we choose to do knowledge distillation by matching the force gradients, otherwise known as the negative Hessian of the energy, of the teacher with that of the student. We can get these terms using auto-rad or finite differences, and the Hessian is a three n by three n matrix, where n is the number of atoms in the system.
To speed things up because computing the Hessian is really slow, we choose the sub-sample from the Hessian matrix at each iteration of training. We can also do stuff like B-map over autograd to accelerate things further, and in practice only one to four samples are needed. So this is a schematic of our method. We have a foundation model trained on a lot of different subsets of data. Then we make a training data subset. We compute the Hessians of the foundation model on this subset.
set of training data and we use this and compare it to student Hessens during training to get a student model that is specialized to this
subset of training data, we can then use these student models for downstream tasks like MD simulation, geometry optimization, and free energy calculations. One experiment we did was to distill the MACE-OFF foundation model on SPICE. We noted that training with Hessian distillation led to improved energy and force performance. Additionally, our student models could be up to 50 times faster than the foundation models, and oftentimes we outperformed the teacher model with our distilled student model.
Here's a diagram of the Pareto frontier of speed versus accuracy, and you can clearly see that performing distillation during training makes the models more accurate while being faster.
We also performed simulation as a sanity check and noted that our distilled bottles were a lot more stable during MD simulation than our undistilled bottles. We also looked at the case where our teacher model did not conserve energy while our student model did. We saw that doing this distillation still led to improved student performance and as you can see in this graph the student conserves energy while the teacher does not.
So the code and the paper are both available online and I did this work with my co-authors Sanjeev Raja and Aditya Krishnapriyan at UC Berkeley. Thanks for listening.
