Bayesian Optimisation for Automated Nuclear Magnetic Resonance Shimming
Abstract
Nuclear magnetic resonance (NMR) spectroscopy is one of the most powerful and widely used tools in molecular discovery, allowing researchers to determine the three-dimensional structure and monitor molecules in solution by analyzing how atomic nuclei absorb and re-emit radio-frequency radiation in a magnetic field. However, to this day, shimming remains a persistent experimental bottleneck in NMR spectroscopy, particularly in bench-top setups as the field moves toward autonomous and high-throughput workflows where continuous expert oversight is impractical. In this work, we propose using Bayesian Optimization (BO) with Variational Bayesian Last Layer (VBLL) neural network surrogates to automate shimming and experimentally validate the method on bench-top NMR machines. Firstly, we show that our proposed method can obtain optimal shimming in a fully automated fashion for static water systems, taking no longer than an experienced experimentalist would take for the same system. We then use our method on other systems, e.g., dmso and caffeine, and show it successfully shims multi-peak spectra. Most importantly, we extend our method to flow NMR experiments where continuous shimming is required due to drifting lab environments and continuously changing