# An automated approach for developing neural network interatomic potentials
with FLAME

Hossein Mirhosseini  Dynamics of Condensed Matter and Center for Sustainable
Systems Design, Chair of Theoretical Chemistry, University of Paderborn, 33098
Warburger Str. 100, Paderborn, Germany<EMAIL_ADDRESS>Hossein
Tahmasbi  Leiden Institute of Chemistry, Gorlaeus Laboratories, Leiden
University, P.O. Box 9502, 2300 RA Leiden, The Netherlands  Sai Ram Kuchana
Dynamics of Condensed Matter and Center for Sustainable Systems Design, Chair
of Theoretical Chemistry, University of Paderborn, 33098 Warburger Str. 100,
Paderborn, Germany  S. Alireza Ghasemi  Dynamics of Condensed Matter and
Center for Sustainable Systems Design, Chair of Theoretical Chemistry,
University of Paderborn, 33098 Warburger Str. 100, Paderborn, Germany  Thomas
D. Kühne  Dynamics of Condensed Matter and Center for Sustainable Systems
Design, Chair of Theoretical Chemistry, University of Paderborn, 33098
Warburger Str. 100, Paderborn, Germany<EMAIL_ADDRESS>
###### Abstract

The performance of machine learning interatomic potentials relies on the
quality of the training dataset. In this work, we present an approach for
generating diverse and representative training data points which initiates
with _ab initio_ calculations for bulk structures. The data generation and
potential construction further proceed side-by-side in a cyclic process of
training the neural network and crystal structure prediction based on the
developed interatomic potentials. All steps of the data generation and
potential development are performed with minimal human intervention. We show
the reliability of our approach by assessing the performance of neural network
potentials developed for two inorganic systems.

###### keywords:

Interatomic potentialsNeural network potentialsMachine learning

##  1 Introduction

In the context of molecular dynamics (MD) simulation, the classical force
field and _ab initio_ MD are the two limits. While the former is known to be
more efficient and the method of choice for large-scale simulations, the
latter has proved to be a more accurate method and is applicable for the
short-scale simulation of systems with less than a few hundred atoms.
Atomistic modeling based on machine learning interatomic potentials (MLIPs),
on the other hand, has the advantages of both methods. Meaning, MLIPs can
potentially enable performance of large-scale simulations (large length scales
and long time scales) with quantum accuracy orders of magnitude faster than
current methods based on density functional theory (DFT).

The success of MD simulations relies on the accuracy of the potential energy
surface (PES). In the context of MLIPs, the PES is described as a function of
atomic coordinates through local environment descriptors 1. MLIPs employ
machine learning (ML) algorithms and local environment descriptors to describe
atomic interactions. Numerous MLIPs have emerged in recent years. Examples of
such potentials include high-dimensional neural network potentials (NNPs) 2
and Gaussian approximation potential (GAP) 3, among others 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14. The remarkable performance of MLIPs has already been
demonstrated for inorganic solids 2, 15, 16, 17, 18, 19, 20, hybrid materials
21, water 22, 23, interfaces 24, 25, 26, 27, 28, and the dynamics of defects
in crystalline and amorphous materials 29, 30, 31, 32.

A key component for developing reliable potentials in ML-based PES models is
building a robust and representative reference dataset for model training. The
training dataset is usually composed of atomic configurations with
corresponding energies, forces, and/or stress tensors from DFT calculations. A
diverse and extensive dataset consists of not only data points for
configurations close to equilibrium but also those for energetically less
favorable configurations to avoid the tendency of developing biased potentials
and overfitted models. Often, training datasets are generated by performing MD
calculations at various temperatures and/or densities, followed by electronic
structure calculations for snapshots extracted from MD trajectories. _Ab
initio_ MD calculations for large systems, however, are demanding, making the
development of MLIPs slow and computationally expensive.

In this work, we adopt a different approach to generating robust and
representative training datasets. Namely, we perform _ab initio_ geometry
optimization solely for periodic bulk structures and extract samples from
geometry optimization calculations to initiate training of neural network (NN)
interatomic potentials. The bulk structures are taken from the Materials
Project database (MPDB) 33, 34. In addition, crystal structure prediction
based on ionic substitution 35 is performed to increase the diversity of bulk
structures. NN interatomic potentials are further trained in iterative
training cycles by including data from crystal structure prediction based on
the minima hopping method 36, 37. Although hops from one local minimum to
another in minima hopping is based on MD calculations, these calculations are
performed with generated NNPs, therefore, they are not computationally
demanding.

Generating extensive training datasets requires performing a substantial
number of calculations and handling a large amount of data. An important task
in modern computational materials science is to accomplish these tasks
automatically. In this respect, our Python-based script generates NNPs with
minimal human intervention. To demonstrate the performance of NNPs constructed
with our approach, we compare the results of molecular statics and molecular
dynamics calculations using the NNPs to reference DFT results.

##  2 Computational details

All DFT calculations were carried out by the Vienna Ab initio Simulation
Package (VASP) 38, 39, 40 employing projector augmented wave (PAW)
pseudopotentials 41. A plane-wave cutoff of $520$ eV and the Perdew-Burke-
Ernzerhof 42 (PBE) form of the generalized gradient approximation for the
exchange-correlation potential were used for geometry optimization and single
point energy calculations.

Phonon dispersion relations were calculated using the frozen phonon approach
as implemented in the PHONOPY package 43. Convergence tests were performed to
obtain converged force constants and phonon density of states. For calculating
lattice thermal conductivity, we used the ShengBTE code 44, which solves the
Boltzmann transport equation for phonons. This code requires the second- and
third-order interatomic force constants (IFCs), which were computed with
PHONOPY and thirdorder.py 44, respectively. The second- and third-order IFCs
were calculated with $3\times 3\times 3$ (for CuInSe2) and $4\times 4\times 4$
(for the anatase phase of TiO2) supercells. For the third-order IFCs, the
interactions up to eleventh nearest neighbors were considered, for which the
lattice thermal conductivity of both structures are converged.

To minimize human control in the training process, we took advantage of
atomate 45, an open-source Python framework for materials science simulation
and analysis with an emphasis on automation. Atomate is built on top of open-
source libraries such as pymatgen 46 (an open-source Python library for
materials analysis), Custodian (a just-in-time job management framework), and
FireWorks 47 (a code for defining, managing, and executing workflows),
allowing automatic job submission and result collection. Atomic configurations
are taken from the MPDB, which makes its data available through the open
Materials Application Programming Interface (API) and the pymatgen materials
analysis package.

We trained and utilized high-dimensional NNPs using algorithms implemented in
FLAME 48, an open-source software package 49 that enables performance of a
wide range of atomistic simulations for the construction and exploration of
PESs. FLAME has been used in several development and application studies in
the context of MLIPs 50, 51, 52, 53, 54, 55. We refer to Reference 48 for more
details.

In our approach, two crystal structure prediction methods are employed to
increase the diversity of the training dataset: crystal structure prediction
based on minima hopping 36, 37 and that on ionic substitutions 35. Minima
hopping is a method for finding the global minimum of a PES. It not only
searches for the global minimum but also explores low-energy configurations.
Ionic-substitution crystal structure prediction is based on the common
approach to proposing new compounds by replacing one ion with another
chemically similar ion. The mathematical model provides a probability
distribution for ionic substitutions that it has learned from a database of
experimentally observed crystal structures.

To compare atomic configurations generated during the potential development
process, the distances between structural fingerprints 56, 1 are calculated.
If the distance between two fingerprints is less than a defined value, then
the structures are considered similar.

##  3 Workflow

In the following sections, we describe the workflow of our script, which is
shown in Figure 1. In the course of constructing NNPs, the script keeps track
of its steps. If a failure occurs and the script cannot advance, the user can
restart the script from the last successfully accomplished step. It is noted
that the user can always restart the script from a previous step with
different parameters.

Figure 1: The workflow diagram of the automated algorithm to generate
reference datasets and train neural network interatomic potentials.

###  3.1 Input data

The input file is in YAML format 57. The composition of the system is
determined by providing either a) a Materials Project ID (mp-id), b) a species
(element symbols and their oxidation states, e.g. (Ag, +1)), or c) a single
element symbol. In the last case, only structures with the given element
available in the MPDB will be considered. If the user provides an mp-id or
species, then all compounds containing the specified elements with the given
oxidation states are considered. For example, CuInSe2 and CuIn5Se8 will be
included in the training process for the (In, +3)-(Cu, +1)-(Se, -2) system,
because the oxidation states of the constituent elements are the same in both
compounds. It should be noted that the transferability of NNPs with no
restriction on the stoichiometry of training systems needs a careful
examination 58, 59. There is an option to limit training data points to
systems with a fixed stoichiometry.

The size of the system is established by specifying the maximum number of
atoms in bulk structures. Structures containing less than 4 atoms are
discarded. If the training dataset should include clusters, then the minimum
and maximum number of atoms in clusters should be specified in the input file.

Parameters needed for training cycles, such as the number of nodes in hidden
layers of the NN and temperatures for performing minima hopping, can be
specified in the input file. Parameters that are needed for structure
diversity check, such as the minimum allowed distance between atoms and the
average of distances between the fingerprints of sample structures, are
calculated based on the given composition. We discuss these parameters in the
corresponding sections.

###  3.2 Crystal structure prediction

The next step after selecting the system is crystal structure prediction based
on ionic substitution 35. The aim of this step is to include as many bulk
structures as possible in the data generation process. After new bulk
structures are found, the duplicated structures are removed from the final
list and the remaining structures are optimized until the residual force on
each atom is less than 0.05 eV/Å.

In addition to ionic substitution for crystal structure prediction, the user
can substitute a fraction of atoms to include more elements in the system. The
purpose of this ion substitution is to extend the chemical space to systems
that do not exist in databases. For example, a given percentage of In in the
In-Cu-Se system can be replaced with Tl to build the quaternary system of In-
Tl-Cu-Se.

###  3.3 Perturbed structures creation

To expand the reference training dataset, periodic bulk structures are
perturbed. That is, atoms are randomly displaced from their optimized
positions by translating sites along a vector and/or rotating sites by an
angle around a vector. In addition, stressed structures (expanded/contracted
bulk structures) are generated. All these structures are loosely optimized,
and samples are taken from the different steps of the geometry optimization
calculations. The structure relaxation stops when the residual forces on the
atoms are less than $0.5$ eV/Å. Up to four samples are taken from each
geometry optimization calculation: when the maximum total force on atoms is
between $2$ and $3$ eV/Å, between $1$ and $2$ eV/Å, and between $0.5$ and $1$
eV/Å. One sample is taken from the optimized structure.

###  3.4 Training cycle

The training cycle has five steps: potential training, minima hopping,
structure diversity check, single point energy calculations, and data
collection. The first three steps are performed as implemented in FLAME. For
training NNPs, the data obtained from the previous step is divided into $90$%
for training and $10$% for validation. The generated NNP in each cycle are
used for performing minima hopping. Seed configurations for minima hopping are
the bulk structures from the crystal structure prediction step.

In the diversity check step, the snapshots taken from minima hopping
trajectories are screened to remove similar and nonphysical structures (due to
the small distance of atoms or an unacceptable density). To remove similar
structures, the distances between all structural fingerprints of atomic
configurations are computed. If the distance between a pair of fingerprints is
smaller than the accepted value, then one of the configurations is discarded.
It is noted that parameters for structure diversity check are adjusted for
each cycle of training. That is, the allowed minimum distance between atoms in
the earlier cycles of training (when the model is not yet well-trained) is
larger than that in the later steps of training (when NNPs are more reliable).
In contrast, while during the early cycles of training, the tolerance for
identifying similar structures is large (loose), the tolerance becomes smaller
in the later cycles of training to select only structures with a large
distance from the previously selected structures.

The structures that pass diversity check are sent for single point energy
calculations at the DFT level. In the data collection step, the forces and
energies calculated by VASP are collected to be used in the next cycle of
training. Configurations for which the residual force on their atoms is less
than $0.10$ eV/Å are stored for minima hopping in the next cycle. The training
cycle is repeated until the desired number of training cycles, specified in
the input file, is reached.

##  4 Validation of the approach

In the following sections, we demonstrate the validity of our approach for
developing interatomic potentials by comparing DFT and NNP results for the
(Ti, +4)-(O, -2) and (In, +3)-(Cu, +1)-(Se, -2) systems.

###  4.1 The (Ti, +4)-(O, -2) system

We have developed a NNP for the (Ti, +4)-(O, -2) system with a fixed
stoichiometry that limits the composition to titanium dioxide (TiO2). The
diverse structures of TiO2 makes it an ideal benchmark material to evaluate
the performance of the generated NNP. Among the many applications of TiO2, the
ability of TiO2 to photocatalyze water splitting reactions makes it
interesting for sustainable energy applications 60, 61, 62.

For developing (Ti, +4)-(O, -2) potentials, $4606$ VASP geometry optimization
calculations were performed for $223$ dissimilar structures. Of these
structures, $77$ were taken from the MPDB and the rest was found by crystal
structure prediction. The training process started with $16696$ data points
and stopped after five steps, as it was specified in the input file. The total
number of training points after five cycles of training was $67248$.

To asses the performance of the developed potentials for the (Ti, +4)-(O, -2)
system, first, the equation of states (EOS) for two phases of TiO2 were
calculated (see Figure 2). The agreement between _ab initio_ and NNP results
is very good. The rutile phase of TiO2 is more stable than the anatase phase.
DFT calculations with PBE, however, predict anatase to be more stable than
rutile 54. The phonon dispersion relation calculated for a $4\times 4\times 4$
supercell of anatase TiO2 is shown in Figure 3. The main contribution to
lattice thermal conductivity is coming from acoustic branches 63. In this
frequency range, the agreement between DFT and NNP results is very good.
Therefore, a good agreement between lattice thermal conductivity calculated by
DFT and by the trained NNP is expected (see Figure 4). Phonon dispersion
relations and lattice thermal conductivity values calculated for TiO2 by
different exchange-correlation functionals agree less with each other 64, 65,
66. For example, the lattice thermal conductivity of anatase calculated with
the local density approximation functional at 300 K is 3.6 Wm-1K-1 larger than
that calculated with PBE (7.2 Wm-1K-1). The difference between the PBE and NNP
results is well below this value.

Figure 2: Comparison of equation of state for anatase and rutile TiO2
calculated by the NNP and DFT. Figure 3: Phonon dispersion relation of anatase
TiO2 calculated by DFT and the NNP. Figure 4: Lattice thermal conductivity of
the anatase phase of TiO2 calculated with DFT and the NNP.

To evaluate the accuracy of Ti-O potentials for MD simulations, NVT MD
calculations at various temperatures were performed by employing MD algorithms
implemented in EON 67. To perform MD calculations with NNPs, EON is coupled
with FLAME. A comparison between radial distribution functions calculated by
DFT and by the constructed NNP for a 108-atom supercell of anatase is shown in
Figure 5. MD calculations were performed at $1000$ K for $35000$ MD steps
after equilibration. The very good agreement between the DFT and NNP results
shows the reliability of the developed NNP for MD simulations.

Figure 5: The radial distribution functions for anatase TiO2 computed with DFT
and the NNP at T= 1000 K.

As mentioned earlier, only periodic bulk structures have been used for
training NN interatomic potentials. It is interesting to see whether the
developed potentials could produce reasonable results for non-periodic
systems, like slabs. Therefore, we calculated the energy per atom for a 2D
phase of TiO2 that was recently discovered by crystal structure prediction 54.
For a single layer of this 2D structure with 12 atoms, the difference between
the energy per atom calculated with DFT and that with the NNP is as small as
3.4 meV. It is worth noting that this structure was not in the training
dataset. In addition, we have calculated the surface energies of the non-polar
(001) surface of rutile and anatase. The surface energy for the (001) surface
of rutile calculated by DFT and the NNP is 0.13 eV/Å2 (2.10 J/m2) and 0.13
eV/Å2 (2.04 J/m2), respectively. For the anatase phase, the surface energies
were computed as 0.13 eV/Å2 (2.07 J/m2) and 0.13 eV/Å2 (2.06 J/m2) by DFT and
the NNP, respectively.

###  4.2 The (In, +3)-(Cu, +1)-(Se, -2) system

The representative of the (In, +3)-(Cu, +1)-(Se, -2) system is copper indium
selenide (CuInSe2), one of the most promising absorbers for thin-film solar
cells 68, 69. The applications of CuInSe2 and its alloy with Ga in conversion
of solar energy into sustainable energy are not limited to photovoltaics 70,
71. Furthermore, in the last few years, we and many other groups have studied
the characteristics of CuInSe2 using first-principle methods 72, so a large
amount of _ab initio_ data is available for this system to benchmark against.

The process of developing the NNP started with finding structures that contain
(In, +3), (Cu, +1), and (Se, -2). For this system, there are six known
structures with less than 40 atoms in the MPDB. Two of these six structures
have oxidation states that do not match the oxidation states of the species
specified in the input file (In2CuSe4 and In8Cu7Se16). In the crystal
structure prediction step, $52$ dissimilar structures were found. The first
cycle of training started with the data obtained from the optimization of
perturbed/stressed structures. In total, $1729$ VASP geometry optimization
calculations for bulk structures were performed, which resulted in $5563$ data
points. The total number of training points after seven cycles of training was
32690. We stopped the training process in the seventh step. The reason for
slower growing of data points for the In-Cu-Se system compared with the Ti-O
system is the smaller number of seed structures for minima hopping.

Comparing the EOS for two phases of CuInSe2 (Figure 6) confirms the good
agreement between DFT and NNP results. The most stable structure of CuInSe2 is
chalcopyrite, and the lattice parameters of this structure predicted by DFT
are very close to those predicted by the NNP. For the less stable structure of
CuInSe2, the lattice parameters predicted by the trained NNP are about $1$%
larger than those computed by DFT. It is noted that the difference between the
lattice parameters of this structure calculated with the local density
approximation functional and that with the PBE is about 2.5%. The phonon
dispersion relation for chalcopyrite CuInSe2 was calculated for a $3\times
3\times 3$ supercell and is shown in Figure 7. It is expected that the good
agreement between phonon dispersion relations calculated by DFT and by NNP
results in a good agreement between calculated values for the lattice thermal
conductivity (see Figure 8).

Figure 6: Comparison of the equation of states of two structures of CuInSe2
calculated by DFT and the NNP. The structures are labeled by their Materials
Project ID.  Figure 7: Phonon dispersion relation of chalcopyrite CuInSe2
computed by DFT and the NNP. Figure 8: Lattice thermal conductivity of
chalcopyrite CuInSe2 calculated with DFT and the NNP.

To evaluate the accuracy of the constructed NNP for MD simulations, MD
calculations at various temperatures were carried out. Figure 9 shows the
comparison between the radial distribution functions of a 64-atom supercell
for a NVT ensemble at $1000$ K for $35000$ MD steps after equilibration.
Additionally, we used the climbing image nudged elastic band 73 method to
calculate the energy barriers for some known diffusion mechanisms in a
supercell of CuInSe2. Saddle points computed with _ab initio_ and the NNP are
listed in Table 1. Jumping of a Cu atom from a Cu lattice to a Cu vacancy
(VCu) site (VCu $\rightarrow$ V${}^{\prime}_{\rm Cu}$) is the most frequent
event for diffusion of Cu atoms 74. The diffusion barriers calculated for this
event with DFT and with the generated NNP are in excellent agreement. Another
event observed in this system is jumping of an InCu antisite atom to the VCu
site. The difference between diffusion barriers calculated by DFT and by the
NNP for this event is about 5.5%.

Table 1: Comparison between diffusion barriers calculated by DFT and the NNP for CuInSe2. Process | Diffusion barrier (eV)
---|---
| DFT | NN
VCu $\rightarrow$ V${}^{\prime}_{\rm Cu}$ | 1.15 | 1.15
InCu \+ VCu $\rightarrow$ In${}^{\prime}_{\rm Cu}$ \+ V${}^{\prime}_{\rm Cu}$ | 1.10 | 1.16
Figure 9: The radial distribution functions for the chalcopyrite CuInSe2
supercell computed with DFT and the NNP at T= 1000 K.

Regarding surface calculations, the surface energy of the (001) surface
calculated by DFT and by the NNP is 0.04 eV/Å2 (0.65 J/m2) and 0.04 eV/A2
(0.69 J/m2), respectively. It should be mentioned that the (001) surface of
CuInSe2 is a relatively ‘simple’ surface. For more ‘complicated’ surfaces, it
is necessary to include structures that resemble the surface structure (for
example clusters) in the training data 55.

##  5 Summary

We introduced a Python script for constructing NN interatomic potentials with
minimal human intervention. The potential development is performed with
algorithms implemented in FLAME. The only data that needs to be provided by
the user is the species of the system of interest. The rest of the training
process is performed without human control by taking advantage of open-source
codes developed for computational materials science such as atomate,
Custodian, and WorkFlow. The script keeps track of its steps, and if a failure
occurs, the user can continue the potential developing process from the last
successfully completed step. The validity of our approach is shown by
comparing results of various molecular statics and molecular dynamics
calculations based on DFT and NNPs.

##  6 Acknowledgements

The authors from UPB gratefully acknowledge funding of this project by
computing time provided by the Paderborn Center for Parallel Computing (PC2).

## References

  * Behler 2011 Behler, J. Atom-centered symmetry functions for constructing high-dimensional neural network potentials. _The Journal of Chemical Physics_ 2011, _134_ , 074106
  * Behler and Parrinello 2007 Behler, J.; Parrinello, M. Generalized Neural-Network Representation of High-Dimensional Potential-Energy Surfaces. _Phys. Rev. Lett._ 2007, _98_ , 146401
  * Bartók et al. 2010 Bartók, A. P.; Payne, M. C.; Kondor, R.; Csányi, G. Gaussian Approximation Potentials: The Accuracy of Quantum Mechanics, without the Electrons. _Phys. Rev. Lett._ 2010, _104_ , 136403
  * Botu and Ramprasad 2015 Botu, V.; Ramprasad, R. Adaptive machine learning framework to accelerate ab initio molecular dynamics. _International Journal of Quantum Chemistry_ 2015, _115_ , 1074–1083
  * Thompson et al. 2015 Thompson, A.; Swiler, L.; Trott, C.; Foiles, S.; Tucker, G. Spectral neighbor analysis method for automated generation of quantum-accurate interatomic potentials. _Journal of Computational Physics_ 2015, _285_ , 316 – 330
  * Li et al. 2015 Li, Z.; Kermode, J. R.; De Vita, A. Molecular Dynamics with On-the-Fly Machine Learning of Quantum-Mechanical Forces. _Phys. Rev. Lett._ 2015, _114_ , 096405
  * Hansen et al. 2015 Hansen, K.; Biegler, F.; Ramakrishnan, R.; Pronobis, W.; von Lilienfeld, O. A.; Müller, K.-R.; Tkatchenko, A. Machine Learning Predictions of Molecular Properties: Accurate Many-Body Potentials and Nonlocality in Chemical Space. _The Journal of Physical Chemistry Letters_ 2015, _6_ , 2326–2331
  * Brockherde et al. 2017 Brockherde, F.; Vogt, L.; Li, L.; Tuckerman, M. E.; Burke, K.; Müller, K.-R. Bypassing the Kohn-Sham equations with machine learning. _Nature Communications_ 2017, _8_ , 872
  * Smith et al. 2017 Smith, J. S.; Isayev, O.; Roitberg, A. E. ANI-1: an extensible neural network potential with DFT accuracy at force field computational cost. _Chem. Sci._ 2017, _8_ , 3192–3203
  * Yao et al. 2018 Yao, K.; Herr, J. E.; Toth, D.; Mckintyre, R.; Parkhill, J. The TensorMol-0.1 model chemistry: a neural network augmented with long-range physics. _Chem. Sci._ 2018, _9_ , 2261–2269
  * Podryabinkin and Shapeev 2017 Podryabinkin, E. V.; Shapeev, A. V. Active learning of linearly parametrized interatomic potentials. _Computational Materials Science_ 2017, _140_ , 171 – 180
  * Zhang et al. 2018 Zhang, L.; Han, J.; Wang, H.; Car, R.; E, W. Deep Potential Molecular Dynamics: A Scalable Model with the Accuracy of Quantum Mechanics. _Phys. Rev. Lett._ 2018, _120_ , 143001
  * Bereau et al. 2018 Bereau, T.; DiStasio, R. A.; Tkatchenko, A.; von Lilienfeld, O. A. Non-covalent interactions across organic and biological subsets of chemical space: Physics-based potentials parametrized from machine learning. _The Journal of Chemical Physics_ 2018, _148_ , 241706
  * Schütt et al. 2019 Schütt, K. T.; Kessel, P.; Gastegger, M.; Nicoli, K. A.; Tkatchenko, A.; Müller, K.-R. SchNetPack: A Deep Learning Toolbox For Atomistic Systems. _Journal of Chemical Theory and Computation_ 2019, _15_ , 448–455
  * Khaliullin et al. 2010 Khaliullin, R. Z.; Eshet, H.; Kühne, T. D.; Behler, J.; Parrinello, M. Graphite-diamond phase coexistence study employing a neural-network mapping of the ab initio potential energy surface. _Phys. Rev. B_ 2010, _81_ , 100103
  * Eshet et al. 2010 Eshet, H.; Khaliullin, R. Z.; Kühne, T. D.; Behler, J.; Parrinello, M. Ab initio quality neural-network potential for sodium. _Phys. Rev. B_ 2010, _81_ , 184107
  * Artrith et al. 2011 Artrith, N.; Morawietz, T.; Behler, J. High-dimensional neural-network potentials for multicomponent systems: Applications to zinc oxide. _Phys. Rev. B_ 2011, _83_ , 153101
  * Khaliullin et al. 2011 Khaliullin, R. Z.; Eshet, H.; Kühne, T. D.; Behler, J.; Parrinello, M. Nucleation mechanism for the direct graphite-to-diamond phase transition. _Nature Mater._ 2011, _10_ , 693
  * Eshet et al. 2012 Eshet, H.; Khaliullin, R. Z.; Kühne, T. D.; Behler, J.; Parrinello, M. Microscopic Origins of the Anomalous Melting Behavior of Sodium under High Pressure. _Phys. Rev. Lett._ 2012, _108_ , 115701
  * Artrith N. 2016 Artrith N., U. A. An implementation of artificial neural-network potentials for atomistic materials simulations: Performance for TiO2. _Comput. Mater. Sci._ 2016, _114_ , 135
  * Eckhoff and Behler 2019 Eckhoff, M.; Behler, J. From Molecular Fragments to the Bulk: Development of a Neural Network Potential for MOF-5. _Journal of Chemical Theory and Computation_ 2019, _15_ , 3793–3809
  * Morawietz et al. 2016 Morawietz, T.; Singraber, A.; Dellago, C.; Behler, J. How van der Waals interactions determine the unique properties of water. _Proceedings of the National Academy of Sciences_ 2016, _113_ , 836–8373
  * Sukuba et al. 2018 Sukuba, I.; Chen, L.; Probst, M.; Kaiser, A. A neural network interface for DL_POLY and its application to liquid water. _Molecular Simulation_ 2018, _0_ , 1–6
  * Natarajan and Behler 2016 Natarajan, S. K.; Behler, J. Neural network molecular dynamics simulations of solid–liquid interfaces: water at low-index copper surfaces. _Phys. Chem. Chem. Phys._ 2016, _18_ , 28704–28725
  * Quaranta et al. 2017 Quaranta, V.; Hellström, M.; Behler, J. Proton-Transfer Mechanisms at the Water–ZnO Interface: The Role of Presolvation. _The Journal of Physical Chemistry Letters_ 2017, _8_ , 1476–1483, PMID: 28296415
  * Quaranta et al. 2019 Quaranta, V.; Behler, J.; Hellström, M. Structure and Dynamics of the Liquid–Water/Zinc-Oxide Interface from Machine Learning Potential Simulations. _The Journal of Physical Chemistry C_ 2019, _123_ , 1293–1304
  * Hellström et al. 2019 Hellström, M.; Quaranta, V.; Behler, J. One-dimensional vs. two-dimensional proton transport processes at solid–liquid zinc-oxide–water interfaces. _Chem. Sci._ 2019, _10_ , 1232–1243
  * Ludwig et al. 2019 Ludwig, T.; Gauthier, J. A.; Brown, K. S.; Ringe, S.; Nørskov, J. K.; Chan, K. Solvent–Adsorbate Interactions and Adsorbate-Specific Solvent Structure in Carbon Dioxide Reduction on a Stepped Cu Surface. _The Journal of Physical Chemistry C_ 2019, _123_ , 5999–6009
  * Li et al. 2017 Li, W.; Ando, Y.; Minamitani, E.; Watanabe, S. Study of Li atom diffusion in amorphous Li3PO4 with neural network potential. _The Journal of Chemical Physics_ 2017, _147_ , 214106
  * Korolev et al. 2020 Korolev, V. V.; Mitrofanov, A. A.; Nevolin, Y. M.; Krotov, V. V.; Ul’yanov, D. K.; Protsenko, P. V. Neural Network Based Modeling of Grain Boundary Complexions Localized in Simple Symmetric Tilt Boundaries $\Sigma$3 (111) and $\Sigma$5 (210). _Colloid Journal_ 2020, _82_ , 689–695
  * Elbaz et al. 2020 Elbaz, Y.; Furman, D.; Caspary Toroker, M. Modeling Diffusion in Functional Materials: From Density Functional Theory to Artificial Intelligence. _Advanced Functional Materials_ 2020, _30_ , 1900778
  * Xu et al. 2020 Xu, N.; Shi, Y.; He, Y.; Shao, Q. A Deep-Learning Potential for Crystalline and Amorphous Li–Si Alloys. _The Journal of Physical Chemistry C_ 2020, _124_ , 16278–16288
  * Jain et al. 2013 Jain, A.; Ong, S. P.; Hautier, G.; Chen, W.; Richards, W. D.; Dacek, S.; Cholia, S.; Gunter, D.; Skinner, D.; Ceder, G.; Persson, K. A. Commentary: The Materials Project: A materials genome approach to accelerating materials innovation. _APL Materials_ 2013, _1_ , 011002
  * Ong et al. 2015 Ong, S. P.; Cholia, S.; Jain, A.; Brafman, M.; Gunter, D.; Ceder, G.; Persson, K. A. The Materials Application Programming Interface (API): A simple, flexible and efficient API for materials data based on REpresentational State Transfer (REST) principles. _Computational Materials Science_ 2015, _97_ , 209 – 215
  * Hautier et al. 2011 Hautier, G.; Fischer, C.; Ehrlacher, V.; Jain, A.; Ceder, G. Data Mined Ionic Substitutions for the Discovery of New Compounds. _Inorganic Chemistry_ 2011, _50_ , 656–663, PMID: 21142147
  * Goedecker 2004 Goedecker, S. Minima hopping: An efficient search method for the global minimum of the potential energy surface of complex molecular systems. _The Journal of Chemical Physics_ 2004, _120_ , 9911–9917
  * Amsler and Goedecker 2010 Amsler, M.; Goedecker, S. Crystal structure prediction using the minima hopping method. _J. Chem. Phys._ 2010, _133_ , 224104
  * Kresse and Hafner 1993 Kresse, G.; Hafner, J. Ab initio molecular dynamics for liquid metals. _Phys. Rev. B_ 1993, _47_ , 558–561
  * Kresse and Furthmüller 1996 Kresse, G.; Furthmüller, J. Efficient iterative schemes for ab initio total-energy calculations using a plane-wave basis set. _Phys. Rev. B_ 1996, _54_ , 11169–11186
  * Kresse and Furthmüller 1996 Kresse, G.; Furthmüller, J. Efficiency of ab-initio total energy calculations for metals and semiconductors using a plane-wave basis set. _Computational Materials Science_ 1996, _6_ , 15 – 50
  * Blöchl 1994 Blöchl, P. E. Projector augmented-wave method. _Phys. Rev. B_ 1994, _50_ , 17953–17979
  * Perdew et al. 1996 Perdew, J. P.; Burke, K.; Ernzerhof, M. Generalized Gradient Approximation Made Simple. _Phys. Rev. Lett._ 1996, _77_ , 3865–3868
  * Togo and Tanaka 2015 Togo, A.; Tanaka, I. First principles phonon calculations in materials science. _Scripta Materialia_ 2015, _108_ , 1–5
  * Li et al. 2014 Li, W.; Carrete, J.; A. Katcho, N.; Mingo, N. ShengBTE: A solver of the Boltzmann transport equation for phonons. _Comput. Phys. Commun._ 2014, _185_ , 1747–1758
  * Mathew et al. 2017 Mathew, K. et al. Atomate: A high-level interface to generate, execute, and analyze computational materials science workflows. _Computational Materials Science_ 2017, _139_ , 140 – 152
  * Ong et al. 2013 Ong, S. P.; Richards, W. D.; Jain, A.; Hautier, G.; Kocher, M.; Cholia, S.; Gunter, D.; Chevrier, V. L.; Persson, K. A.; Ceder, G. Python Materials Genomics (pymatgen): A robust, open-source python library for materials analysis. _Computational Materials Science_ 2013, _68_ , 314 – 319
  * Jain et al. 2015 Jain, A.; Ong, S. P.; Chen, W.; Medasani, B.; Qu, X.; Kocher, M.; Brafman, M.; Petretto, G.; Rignanese, G.-M.; Hautier, G.; Gunter, D.; Persson, K. A. FireWorks: a dynamic workflow system designed for high-throughput applications. _Concurrency and Computation: Practice and Experience_ 2015, _27_ , 5037–5059, CPE-14-0307.R2
  * Amsler et al. 2020 Amsler, M.; Rostami, S.; Tahmasbi, H.; Khajehpasha, E. R.; Faraji, S.; Rasoulkhani, R.; Ghasemi, S. A. FLAME: A library of atomistic modeling environments. _Computer Physics Communications_ 2020, _256_ , 107415
  * fla 2018 FLAME: a library of atomistic modeling environments. 2018; https://flame-code.org and https://github.com/flame-code/FLAME
  * Ghasemi et al. 2015 Ghasemi, S. A.; Hofstetter, A.; Saha, S.; Goedecker, S. Interatomic potentials for ionic systems with density functional accuracy based on charge densities obtained by a neural network. _Phys. Rev. B_ 2015, _92_ , 045131
  * Rostami et al. 2018 Rostami, S.; Amsler, M.; Ghasemi, S. A. Optimized symmetry functions for machine-learning interatomic potentials of multicomponent systems. _J. Chem. Phys._ 2018, _149_ , 124106
  * Faraji et al. 2017 Faraji, S.; Ghasemi, S. A.; Rostami, S.; Rasoulkhani, R.; Schaefer, B.; Goedecker, S.; Amsler, M. High accuracy and transferability of a neural network potential through charge equilibration for calcium fluoride. _Phys. Rev. B_ 2017, _95_ , 104105
  * Rasoulkhani et al. 2017 Rasoulkhani, R.; Tahmasbi, H.; Ghasemi, S. A.; Faraji, S.; Rostami, S.; Amsler, M. Energy landscape of ZnO clusters and low-density polymorphs. _Phys. Rev. B_ 2017, _96_ , 064108
  * Eivari et al. 2017 Eivari, H. A.; Ghasemi, S. A.; Tahmasbi, H.; Rostami, S.; Faraji, S.; Rasoulkhani, R.; Goedecker, S.; Amsler, M. Two-Dimensional Hexagonal Sheet of TiO2. _Chem. Mater._ 2017, _29_ , 8594
  * Faraji et al. 2019 Faraji, S.; Ghasemi, S. A.; Parsaeifard, B.; Goedecker, S. Surface reconstructions and premelting of the (100) CaF2 surface. _Phys. Chem. Chem. Phys._ 2019, _21_ , 16270
  * Oganov and Valle 2009 Oganov, A. R.; Valle, M. How to quantify energy landscapes of solids. _The Journal of Chemical Physics_ 2009, _130_ , 104504
  * 57 The Official YAML Web Site. https://yaml.org/
  * Mangold et al. 2020 Mangold, C.; Chen, S.; Barbalinardo, G.; Behler, J.; Pochet, P.; Termentzidis, K.; Han, Y.; Chaput, L.; Lacroix, D.; Donadio, D. Transferability of neural network potentials for varying stoichiometry: Phonons and thermal conductivity of MnxGey compounds. _Journal of Applied Physics_ 2020, _127_ , 244901
  * Benoit et al. 2021 Benoit, M.; Amodeo, J.; Combettes, S.; Khaled, I.; Roux, A.; Lam, J. Measuring transferability issues in machine-learning force fields: the example of gold–iron interactions with linearized potentials. _Machine Learning: Science and Technology_ 2021, _2_ , 025003
  * FUJISHIMA and HONDA 1972 FUJISHIMA, A.; HONDA, K. Electrochemical Photolysis of Water at a Semiconductor Electrode. _Nature_ 1972, _238_ , 37–38
  * Ma et al. 2014 Ma, Y.; Wang, X.; Jia, Y.; Chen, X.; Han, H.; Li, C. Titanium Dioxide-Based Nanomaterials for Photocatalytic Fuel Generations. _Chemical Reviews_ 2014, _114_ , 9987–10043
  * Ni et al. 2007 Ni, M.; Leung, M. K.; Leung, D. Y.; Sumathy, K. A review and recent developments in photocatalytic water-splitting using TiO2 for hydrogen production. _Renewable and Sustainable Energy Reviews_ 2007, _11_ , 401 – 425
  * Slack 1973 Slack, G. Nonmetallic crystals with high thermal conductivity. _Journal of Physics and Chemistry of Solids_ 1973, _34_ , 321–335
  * Shojaee and Mohammadizadeh 2009 Shojaee, E.; Mohammadizadeh, M. R. First-principles elastic and thermal properties of TiO2: a phonon approach. _Journal of Physics: Condensed Matter_ 2009, _22_ , 015401
  * Arrigoni and Madsen 2019 Arrigoni, M.; Madsen, G. K. Comparing the performance of LDA and GGA functionals in predicting the lattice thermal conductivity of III-V semiconductor materials in the zincblende structure: The cases of AlAs and BAs. _Computational Materials Science_ 2019, _156_ , 354 – 360
  * Torres and Rurali 2019 Torres, P.; Rurali, R. Thermal Conductivity of Rutile and Anatase TiO2 from First-Principles. _The Journal of Physical Chemistry C_ 2019, _123_ , 30851–30855
  * 67 EON: Long timescale dynamics. https://theory.cm.utexas.edu/eon/index.html
  * Fro 2019 Solar Frontier, Solar Frontier Achieves World Record Thin-Film Solar Cell Efficiency of 23.35%. 2019; http://www.solar-frontiercom/eng/news/2019/0117_press.html, Solar Frontier KK. Press release 17.01.2019
  * Regmi et al. 2020 Regmi, G.; Ashok, A.; Chawla, P.; Semalti, P.; Velumani, S.; Sharma, S. N.; Castaneda, H. Perspectives of chalcopyrite-based CIGSe thin-film solar cell: a review. _Journal of Materials Science: Materials in Electronics_ 2020, _31_ , 7286–7314
  * Kim et al. 2019 Kim, B.; Park, G. S.; Hwang, Y. J.; Won, D. H.; Kim, W.; Lee, D. K.; Min, B. K. Cu(In,Ga)(S,Se)2 Photocathodes with a Grown-In CuxS Catalyst for Solar Water Splitting. _ACS Energy Letters_ 2019, _4_ , 2937–2944
  * Hu et al. 2020 Hu, Z.; Gong, J.; Ye, Z.; Liu, Y.; Xiao, X.; Yu, J. C. Cu(In,Ga)Se2 for selective and efficient photoelectrochemical conversion of CO2 into CO. _Journal of Catalysis_ 2020, _384_ , 88 – 95
  * Mirhosseini et al. 2020 Mirhosseini, H.; Kormath Madam Raghupathy, R.; Sahoo, S. K.; Wiebeler, H.; Chugh, M.; Kühne, T. D. In silico investigation of Cu(In,Ga)Se2-based solar cells. _Phys. Chem. Chem. Phys._ 2020, _22_ , 26682–26701
  * Henkelman et al. 2000 Henkelman, G.; Uberuaga, B. P.; Jónsson, H. A climbing image nudged elastic band method for finding saddle points and minimum energy paths. _The Journal of Chemical Physics_ 2000, _113_ , 9901–9904
  * Kormath Madam Raghupathy et al. 2019 Kormath Madam Raghupathy, R.; Kühne, T. D.; Henkelman, G.; Mirhosseini, H. Alkali Atoms Diffusion Mechanism in CuInSe2 Explained by Kinetic Monte Carlo Simulations. _Advanced Theory and Simulations_ 2019, _2_ , 1900036


# Real-time two-axis control of a spin qubit

Fabrizio Berritta<EMAIL_ADDRESS>Center for Quantum Devices,
Niels Bohr Institute, University of Copenhagen, 2100 Copenhagen, Denmark
Torbjørn Rasmussen  Center for Quantum Devices, Niels Bohr Institute,
University of Copenhagen, 2100 Copenhagen, Denmark  Jan A. Krzywda  Lorentz
Institute and Leiden Institute of Advanced Computer Science, Leiden
University, P.O. Box 9506, 2300 RA Leiden, The Netherlands  Joost van der
Heijden  QDevil, Quantum Machines, 2750 Ballerup, Denmark  Federico Fedele
Center for Quantum Devices, Niels Bohr Institute, University of Copenhagen,
2100 Copenhagen, Denmark  Saeed Fallahi  Department of Physics and Astronomy,
Purdue University, West Lafayette, Indiana 47907, USA  Birck Nanotechnology
Center, Purdue University, West Lafayette, Indiana 47907, USA  Geoffrey C.
Gardner  Birck Nanotechnology Center, Purdue University, West Lafayette,
Indiana 47907, USA  Michael J. Manfra  Department of Physics and Astronomy,
Purdue University, West Lafayette, Indiana 47907, USA  Birck Nanotechnology
Center, Purdue University, West Lafayette, Indiana 47907, USA  Elmore Family
School of Electrical and Computer Engineering, Purdue University, West
Lafayette, Indiana 47907, USA  School of Materials Engineering, Purdue
University, West Lafayette, Indiana 47907, USA  Evert van Nieuwenburg  Lorentz
Institute and Leiden Institute of Advanced Computer Science, Leiden
University, P.O. Box 9506, 2300 RA Leiden, The Netherlands  Jeroen Danon
Department of Physics, Norwegian University of Science and Technology, NO-7491
Trondheim, Norway  Anasua Chatterjee<EMAIL_ADDRESS>Center for
Quantum Devices, Niels Bohr Institute, University of Copenhagen, 2100
Copenhagen, Denmark  Ferdinand Kuemmeth<EMAIL_ADDRESS>Center for Quantum
Devices, Niels Bohr Institute, University of Copenhagen, 2100 Copenhagen,
Denmark  QDevil, Quantum Machines, 2750 Ballerup, Denmark

(February 5, 2024)

###### Abstract

Optimal control of qubits requires the ability to adapt continuously to their
ever-changing environment. We demonstrate a real-time control protocol for a
two-electron singlet-triplet qubit with two fluctuating Hamiltonian
parameters. Our approach leverages single-shot readout classification and
dynamic waveform generation, allowing full Hamiltonian estimation to
dynamically stabilize and optimize the qubit performance. Powered by a field-
programmable gate array (FPGA), the quantum control electronics estimates the
Overhauser field gradient between the two electrons in real time, enabling
controlled Overhauser-driven spin rotations and thus bypassing the need for
micromagnets or nuclear polarization protocols. It also estimates the exchange
interaction between the two electrons and adjusts their detuning, resulting in
extended coherence of Hadamard rotations when correcting for fluctuations of
both qubit axes. Our study highlights the role of feedback in enhancing the
performance and stability of quantum devices affected by quasistatic noise.

##  I Introduction

Feedback is essential for stabilizing quantum devices and improving their
performance. Real-time monitoring and control of quantum systems allows for
precise manipulation of their quantum states [1, 2]. In this way, it can help
mitigate the effects of quantum decoherence and extend the lifetime of quantum
systems for quantum computing and quantum sensing applications [3], for
example in superconducting qubits [4, 5, 6, 7, 8], spins in diamond [9, 10,
11, 12, 13, 14], trapped atoms [15, 16], and other platforms [17, 18, 19, 20,
21, 22].

Among the various quantum-information processing platforms, semiconductor spin
qubits [23, 24] are promising for quantum computing because of their long
coherence times [25] and foundry compatibility [26]. Focusing on spin qubits
hosted in gate-controlled quantum dots (QDs), two-qubit gate fidelities of
99.5% and single-qubit gate fidelities of 99.8% have recently been achieved in
silicon [27]. In germanium, a four-qubit quantum processor based on hole spins
enabled all-electric qubit logic and the generation of a four-qubit
Greenberger-Horne-Zeilinger state [28]. In gallium arsenide, simultaneous
coherent exchange rotations and four-qubit measurements in a 2$\times$2 array
of singlet-triplets were demonstrated without feedback, revealing site-
specific fluctuations of nuclear spin polarizations [29]. In silicon, a six-
qubit processor was operated with high fidelities enabling universal
operation, reliable state preparation and measurement [30].

Achieving precise control of gated qubits can be challenging due to their
sensitivity to environmental fluctuations, making feedback necessary to
stabilize and optimize their performance. Because feedback-based corrections
must be performed within the correlation time of the relevant fluctuations,
real-time control is essential. Continuous feedback then allows to calibrate
the qubit environment and to tune the qubit in real time to maintain high-
fidelity gates and improved coherence, for instance by suppressing low-
frequency noise and improving $\pi$-flip gate fidelity [31]. An active reset
of a silicon spin qubit using feedback control was demonstrated based on
quantum non-demolition readout [32]. Real-time operation of a charge sensor in
a feedback loop [33] maintained the sensor sensitivity for fast charge sensing
in a Si/SiGe double quantum dot, compensating for disturbances due to gate-
voltage variation and 1/$f$ charge fluctuations. A quantum state with higher
confidence than what is achievable through traditional thermal methods was
initialized by real-time monitoring and negative-result measurements [34].

This study implements real-time two-axis control of a qubit with two
fluctuating Hamiltonian parameters that couple to the qubit along different
directions on its Bloch sphere. The protocol involves two key steps: first,
rapid estimation of the instantaneous magnitude of one of the fluctuating
fields (nuclear field gradient) effectively creates one qubit control axis.
This control axis is then exploited to probe in real time the qubit frequency
(Heisenberg exchange coupling) across different operating points (detuning
voltages). Our procedure allows for counteracting fluctuations along both
axes, resulting in an improved quality factor of coherent qubit rotations.

Our protocol integrates a singlet-triplet (ST0) spin qubit implemented in a
gallium arsenide double quantum dot (DQD) [29] with Bayesian Hamiltonian
estimation [35, 36, 37, 38, 39]. Specifically, an FPGA-powered quantum
orchestration platform (OPX [40]) repeatedly separates singlet-correlated
electron pairs using voltage pulses and performs single-shot readout
classifications to estimate on-the-fly the fluctuating nuclear field gradient
within the double dot [41]. Knowledge of the field gradient in turn enables
the OPX to coherently rotate the qubit between S and T0 by arbitrary, user-
defined target angles. Differently from previous works, we let the gradient
freely fluctuate, without pumping the nuclear field [42], and instead program
the OPX to adjust the baseband control pulses accordingly.

An adaptive second-axis estimation is performed to also probe the exchange
interaction between the two electrons. This exchange interaction estimation
scheme is not simply an independent repetition of the single-axis estimation
protocol [35, 36, 37, 38, 39]: the design of the exchange-based free induction
decay (FID) pulse sequence depends on the outcome of the first-axis estimation
and needs to be computed on the fly. Finally, fluctuations along both axes are
measured and corrected, enabling the stable coherent rotation of the qubit
around a symmetric axis, essential for performing the Hadamard gate.

Our work introduces a versatile method for enhancing coherent control and
stability of spin qubits by harnessing low-frequency environmental
fluctuations coupling to the system. As such, it is not limited to the
operation of ST0 qubits in GaAs. Our implementation of real-time reaction to
fluctuating Hamiltonian parameters can find application in other materials and
qubit encodings, as it is not necessarily limited to nuclear noise.

##  II Results

###  II.1 Device and Bayesian estimation

Figure 1:  A singlet-triplet (ST0) qubit with two fluctuating control axes. a
The dots’ electrical detuning $\varepsilon$ tunes from a regime of low qubit
frequency, $\Omega_{\text{L}}$, to a regime of high frequency,
$\Omega_{\text{H}}$. States outside the computational space are not plotted. b
In the first (second) regime, the Overhauser gradient $|\Delta B_{z}|$ (the
exchange coupling $J$) dominates the qubit frequency $\Omega_{\text{L}}$
($\Omega_{\text{H}}$) and the polar angle $\varphi$ of the qubit rotation
axis. c SEM image of the GaAs device [29], implementing a two-electron double
quantum dot (black circles) next to its sensor dot (SD) for qubit readout. d
$J$ and $\Delta B_{z}$ drive rotations of the qubit around two orthogonal
axes, providing universal qubit control, as depicted in the Bloch sphere. e
Uncontrolled fluctuations of the Larmor frequencies $\Omega_{\text{L}}$ and
$\Omega_{\text{H}}$, estimated in real time on the OPX and plotted with a
$30\text{\,}\mathrm{m}\mathrm{s}$ moving average.

We use a top-gated GaAs DQD array from [29] and tune up one of its ST0 qubits
using the gate electrodes shown in Fig. 1c, at $200\text{\,}\mathrm{mT}$ in-
plane magnetic field in a dilution refrigerator with a mixing-chamber plate
below $30\text{\,}\mathrm{mK}$. Radio-frequency reflectometry off the sensor
dot’s ohmic contact distinguishes the relevant charge configurations of the
DQD [43].

The qubit operates in the (1,1) and (0,2) charge configuration of the DQD.
(Integers indicate the number of electrons in the left and right dot.) The
electrical detuning $\varepsilon$ quantifies the difference in the
electrochemical potentials of the two dots, which in turn sets the qubit’s
spectrum as shown in Fig. 1a. We do not plot the fully spin-polarized triplet
states, which are independent of $\varepsilon$ and detuned in energy by the
applied magnetic field. We define $\varepsilon=0$ at the measurement point
close to the interdot (1,1)-(0,2) transition, with negative $\varepsilon$ in
the (1,1) region. In the ST0 basis, we model the time-dependent Hamiltonian by

$\mathcal{H}(t)=J(\varepsilon(t))\,\frac{\sigma_{z}}{2}+g^{*}\mu_{\text{B}}\Delta
B_{z}(t)\,\frac{\sigma_{x}}{2},$ (1)

which depends on the detuning $\varepsilon$ that controls the exchange
interaction between the two electrons, $J(\varepsilon(t))$, and the component
of the Overhauser gradient parallel to the applied magnetic field between the
two dots, $\Delta B_{z}(t)$. $\sigma_{i}$ are the Pauli operators, $g^{*}$ is
the effective g-factor, and $\mu_{\text{B}}$ is the Bohr magneton. In the
following, we drop the time dependence of the Hamiltonian parameters for ease
of notation. On the Bloch sphere of the qubit (Fig. 1d), eigenstates of the
exchange interaction, $|\text{S}\rangle$ and $|\text{T}_{0}\rangle$, are
oriented along $Z$, while $\Delta B_{z}$ enables rotations along $X$.

The qubit is manipulated by voltage pulses applied to the plunger gates of the
DQD, and measured near the interdot (1,1)-(0,2) transition by projecting the
unknown spin state of (1,1) onto either the (1,1) charge state
($|\text{T}_{0}\rangle$) or the (0,2) charge state ($|\text{S}\rangle$). Each
single-shot readout of the DQD charge configuration involves generation,
demodulation, and thresholding of a few-microsecond-long radio-frequency burst
on the OPX (see Supplementary Fig. 1).

The OPX allows for real-time calculation of the qubit Larmor frequency
$\Omega(\varepsilon)=\sqrt{\Delta B^{2}_{z}+J(\varepsilon)^{2}}$ at different
detunings, based on real-time estimates of $\Delta B_{z}$ and
$J(\varepsilon)$.

Inspecting the exchange coupling in a simplified Fermi-Hubbard hopping model
[23] and inserting $J(\varepsilon)$ into equation 1 suggests two physically
distinct regimes [Fig. 1b]: At low detuning, in the (1,1) charge state
configuration, the Overhauser gradient dominates the qubit dynamics. In this
regime, the qubit frequency reads $\Omega_{\text{L}}\equiv\sqrt{\Delta
B^{2}_{z}+J^{2}_{\text{res}}}$, where we have added a small phenomenological
term $J_{\text{res}}$ to account for a constant residual exchange between the
two electrons at low detuning. Such a term may become relevant when precise
knowledge of $\Delta B_{z}$ is required, for example for the Hadamard protocol
at the end of this study. At high detuning, close to the (1,1)-(0,2) interdot
charge transition, exchange interaction between the two electrons dominates,
and the qubit frequency becomes
$\Omega_{\text{H}}(\varepsilon)\equiv\sqrt{\Delta
B^{2}_{z}+J(\varepsilon)^{2}}$. As shown in Fig. 1b, the detuning affects both
the Larmor frequency $\Omega$ and the polar angle $\varphi$ of the qubit
rotation axis $\boldsymbol{\hat{\omega}}$, with $\varphi$ approaching $0$ in
the limit $J(\varepsilon)\gg\Delta B_{z}$ and $\pi/2$ if
$J(\varepsilon)\ll\Delta B_{z}$.

Without the possibility of turning off either $J$ or $\Delta B_{z}$, the
rotation axes of the singlet-triplet qubit are tilted, meaning that pure $X$\-
and $Z$-rotations are unavailable. In their absence, the estimation of the
qubit frequency at different operating points is crucial for navigating the
whole Bloch sphere of the qubit. Figure 1e tracks Larmor frequencies
$\Omega_{\text{H}}$ and $\Omega_{\text{L}}$, both fluctuating over tens of MHz
over a period of several seconds, using a real-time protocol as explained
later. The presence of low-frequency variations in time traces of
$\Omega_{\text{H}}$ and $\Omega_{\text{L}}$ suggests that qubit coherence can
be extended by monitoring these uncontrolled fluctuations in real time and
appropriately compensating qubit manipulation pulses on-the-fly.

To estimate the frequency of the fluctuating Hamiltonian parameters on the
OPX, we employ a Bayesian estimation approach based on a series of free-
induction-decay experiments [35]. Using $m_{i}$ to represent the outcome
($|\text{S}\rangle$ or $|\text{T}_{0}\rangle$) of the $i$-th measurement after
an evolution time $t_{i}$, the conditional probability $P(m_{i}|\Omega)$ is
defined as the probability of obtaining $m_{i}$ given a value of $\Omega$:

$P\left(m_{i}|\Omega\right)=\frac{1}{2}\left[1+r_{i}\left(\alpha+\beta\cos\left(2\pi\Omega
t_{i}\right)\right)\right],$ (2)

where $r_{i}$ takes a value of 1 ($-1$) if $m_{i}=\ket{\text{S}}$
($\ket{\text{T}_{0}}$), and $\alpha$ and $\beta$ are determined based on the
measurement error and axis of rotation on the Bloch sphere.

Applying Bayes’ rule to estimate $\Omega$ based on the observed measurements
$m_{N},\ldots m_{1}$, which are assumed to be independent of each other,
yields the posterior probability distribution $P\left(\Omega\ |m_{N},\ldots
m_{1}\right)$ in terms of a prior uniform distribution
$P_{0}\left(\Omega\right)$ and a normalization constant $\mathcal{N}$:

$\displaystyle P\left(\Omega\ |m_{N},\ldots m_{1}\right)=$ $\displaystyle
P_{0}\left(\Omega\right)\mathcal{N}$ (3)
$\displaystyle\times\prod_{i=1}^{N}\left[1+r_{i}\left(\alpha+\beta\cos\left(2\pi\Omega
t_{i}\right)\right)\right].$

Based on previous works [35, 38, 39], we fix $\alpha=0.25$ and $\beta=\pm
0.5$, with the latter value positive when estimating $\Omega_{\text{L}}$ and
negative when estimating $\Omega_{\text{H}}$. The expectation value
$\langle\Omega\rangle$, calculated over the posterior distribution after all
$N$ measurements, is then taken as the final estimate of $\Omega$.

###  II.2 Controlled Overhauser gradient driven rotations

Figure 2:  Controlled Overhauser gradient driven rotations of a ST0 qubit by
real-time Bayesian estimation. One loop (solid arrows) represents one
repetition of the protocol. a For each repetition, the OPX estimates
$\Omega_{\text{L}}$ by separating a singlet pair for $N$ linearly spaced probe
times $t_{i}$ and updating the Bayesian estimate (BE) distribution after each
measurement, as shown in the inset of b for one representative repetition. For
illustrative purposes, each single-shot measurements $m_{i}$ is plotted as a
white/black pixel, here for $N$=101 $\Omega_{\text{L}}$ probe cycles, and the
fraction of singlet outcomes in each column is shown as a red dot. b
Probability distribution $P(\Omega_{\text{L}})$ after completion of each
repetition in a. Extraction of the expected value
$\langle\Omega_{\text{L}}\rangle$ from each row completes $\Omega_{\text{L}}$
estimation. c For each repetition, unless $\langle\Omega_{\text{L}}\rangle$
falls below a user-defined minimum (here $50\text{\,}\mathrm{MHz}$), the OPX
adjusts the separation times $\tilde{t}_{j}$, using its real-time knowledge of
$\langle\Omega_{\text{L}}\rangle$, to rotate the qubit by user-defined target
angles $\theta_{j}=\tilde{t}_{j}\,\langle\Omega_{\text{L}}\rangle$. d To
illustrate the increased coherence of Overhauser gradient driven rotations, we
task the OPX to perform $M$=80 evenly spaced $\theta_{j}$ rotations. Single-
shot measurements $m_{j}$ are plotted as white/black pixels, and the fraction
of singlet outcomes in each column is shown as a red dot.

We first implement qubit control using one randomly fluctuating Hamiltonian
parameter, through rapid Bayesian estimation of $\Omega_{\text{L}}$ and
demonstration of controlled rotations of a ST0 qubit driven by the prevailing
Overhauser gradient. Notably, this allows coherent control without a
micromagnet [44, 45] or nuclear spin pumping [42].

$\Omega_{\text{L}}$ is estimated from the pulse sequence shown in Fig. 2a: for
each repetition a singlet pair is initialized in (0,2) and subsequently
detuned deep in the $(1,1)$ region ($\varepsilon_{\rm
L}\approx$-40\text{\,}\mathrm{mV}$$) for $N$=101 linearly spaced separation
times $t_{i}$ up to $100\text{\,}\mathrm{ns}$. After each separation, the
qubit state, $|\text{S}\rangle$ or $|\text{T}_{0}\rangle$, is assigned by
thresholding the demodulated reflectometry signal $V_{\text{rf}}$ near the
(1,1)-(0,2) interdot transition and updating the Bayesian probability
distribution of $\Omega_{\text{L}}$ according to the outcome of the
measurement. After measurement $m_{N}$, the initially uniform distribution has
narrowed [inset of Fig. 2b, with white and black indicating low and high
probability], allowing the extraction of $\langle\Omega_{\text{L}}\rangle$ as
the estimate for $\Omega_{\text{L}}$. For illustrative purposes, we plot in
Fig. 2a the $N$ single-shot measurements $m_{i}$ for 10,000 repetitions of
this protocol, which span a period of about $20\text{\,}\mathrm{s}$, and in
Fig. 2b the associated probability distribution $P(\Omega_{\text{L}})$ of each
repetition. The quality of the estimation seems to be lower around a
laboratory time of 6 seconds, coinciding with a reduced visibility of the
oscillations in panel 2a. We attribute this to an enhanced relaxation of the
triplet state during readout due to the relatively high $|\Delta B_{z}|$
gradient during those repetitions [46]. The visibility could be improved by a
latched or shelved read-out [47, 48] or energy-selective tunneling-based
readout [38].

Even though the rotation speed around $\boldsymbol{\hat{\omega}}_{\text{L}}$
at low detuning is randomly fluctuating in time, knowledge of
$\langle\Omega_{\text{L}}\rangle$ allows controlled rotations by user-defined
target angles. To show this, we task the OPX in Fig. 2d to adjust the
separation times $\tilde{t}_{j}$ in the pulse sequence to rotate the qubit by
$M$=80 different angles
$\theta_{j}=\tilde{t}_{j}\,\langle\Omega_{\text{L}}\rangle$ between 0 and
8$\pi$. In our notation, the tilde in a symbol $\tilde{x}$ indicates that the
waveform parameter $x$ is computed dynamically on the OPX. To reduce the FPGA
memory required for preparing waveforms with nanosecond resolution, we perform
controlled rotations only if the expected $\Omega_{\text{L}}$ is larger than
an arbitrarily chosen minimum of 50 MHz. (The associated if statement and
waveform compilation then takes about $40\text{\,}\mathrm{\SIUnitSymbolMicro
s}$ on the FPGA.) This reduces the number of precomputed waveforms needed for
the execution of pulses with nanosecond-scale granularity, for which we use
the OPX baked waveforms capability. Accordingly, the number of rows in Fig. 2d
(1,450) is smaller than in panel a, and we only label a few selected rows with
their repetition number.

To show the increased rotation-angle coherence of controlled $|\Delta
B_{z}|$-driven rotations, we plot the average of all 1,450 repetitions of Fig.
2d and compare the associated quality factor, $Q\gtrsim 7$, with that of
uncontrolled oscillations, $Q\sim 1$ (we define the quality factor as the
number of oscillations until the amplitude is $1/\mathrm{e}$ of its original
value). The average of the uncontrolled S-T0 oscillations in Fig. 2a can be
fit by a decay with Gaussian envelope (solid line), yielding an inhomogeneous
dephasing time $T^{*}_{2}\approx$30\text{\,}\mathrm{ns}$$ typical for ST0
qubits in GaAs [49]. We associate the relatively smaller amplitude of
stabilized qubit oscillations with the low-visibility region around 6 seconds
in Fig. 2d, discussed earlier. Excluding such regions by post selection
increases the visibility and quality factor of oscillations (see Supplementary
Fig. 4). Overall, the results presented in this section exemplify how adaptive
baseband control pulses can operate a qubit reliably, out of slowly
fluctuating environments.

###  II.3 Real-time two-axis estimation

Figure 3:  Real-time Bayesian estimation of two control axes. a One repetition
of the two-axis estimation protocol. After estimating $\Omega_{\text{L}}$ from
$N$=101 $t_{i}$ probe cycles (Fig. 2a), the OPX computes on-the-fly the pulse
duration $\tilde{t}_{\pi/2}$ required to initialize the qubit near the equator
of the Bloch sphere by a diabatic $\Omega_{\text{L}}(\pi/2)$ pulse. After the
$\Omega_{\text{L}}(\pi/2)$ pulse, the qubit evolves for time $t_{j}$ under
exchange interaction before another $\Omega_{\text{L}}(\pi/2)$ pulse initiates
readout. After each single-shot measurement $m_{j}$, the OPX updates the BE
distribution of $\Omega_{\text{H}}$. Similar to $t_{i}$ in the
$\Omega_{\text{L}}$ estimation, $t_{j}$ is spaced evenly between 0 and 100 ns
across $M=101$ exchange probe cycles. b Qubit evolution on the Bloch sphere
during one exchange probe cycle. c Each column plots $P(\Omega_{\text{L}})$
after completion of the $\Omega_{\text{L}}$ estimation in each protocol
repetition. d Each column plots $P(\Omega_{\text{H}})$ after completion of the
$\Omega_{\text{H}}$ estimation in each protocol repetition.

In addition to nuclear spin noise, ST0 qubits are exposed to electrical noise
in their environment, which affects the qubit splitting in particular at
higher detunings. It is therefore important to examine and mitigate low-
frequency noise at different operating points of the qubit. In the previous
section, the qubit frequency $\Omega_{\text{L}}$ was estimated entirely at low
detuning where the Overhauser field gradient dominates over the exchange
interaction. In order to probe and stabilize also the second control axis,
namely $J$-driven rotations corresponding to small $\varphi$ in Fig. 1d, we
probe the qubit frequency $\Omega_{\text{H}}$ at higher detunings, using a
similar protocol with a modified qubit initialization.

Free evolution of the initial state $|\text{S}\rangle$ around
$\boldsymbol{\hat{\omega}}_{\text{L}}$ would result in low-visibility
exchange-driven oscillations because of the low value of $\varphi$. To
circumvent this problem, we precede the $\Omega_{\rm H}$ estimation by one
repetition of $\Omega_{\rm L}$ estimation, as shown in Fig. 3a. This way,
real-time knowledge of $\langle\Omega_{\rm L}\rangle$ allows the initial state
$|\text{S}\rangle$ to be rotated to a state near the equator of the Bloch
sphere, before it evolves freely for probing $\Omega_{\rm H}$. This rotation
is implemented by a diabatic detuning pulse from (0,2) to $\varepsilon_{\rm
L}$ (diabatic compared to the interdot tunnel coupling) for time
$\tilde{t}_{\pi/2}$, corresponding to a rotation of the qubit around
$\boldsymbol{\hat{\omega}}_{\text{L}}$ by an angle $\Omega_{\rm
L}\tilde{t}_{\pi/2}=\pi/2$. After evolution for time $t_{j}$ under finite
exchange, another $\pi/2$ rotation around
$\boldsymbol{\hat{\omega}}_{\text{L}}$ rotates the qubit to achieve a high
readout contrast in the ST0 basis, as illustrated on the Bloch sphere in Fig.
3b.

As a side note, we mention that in the absence of knowledge of the Overhauser
field gradient, the qubit would traditionally be initialized near the equator
by adiabatically reducing detuning from (0,2) to the (1,1) charge
configuration, and a reverse ramp for readout. Such adiabatic ramps usually
last several microseconds each, while our $\tilde{t}_{\pi/2}$ pulses typically
take less than $10\text{\,}\mathrm{n}\mathrm{s}$, thereby significantly
shortening each probe cycle.

For the estimate of $\Omega_{\rm H}$, the Bayesian probability distribution of
$\Omega_{\text{H}}$ is updated after each of the $M$=101 single-shot
measurement $m_{j}$, each corresponding to a separation time $t_{j}$ that is
evenly stepped from 0 to $100\text{\,}\mathrm{ns}$. The Bayesian probability
distributions of both $\Omega_{\text{L}}$ and $\Omega_{\text{H}}$ are shown in
Fig. 3c and d, respectively, with the latter being conditioned on
$$20\text{\,}\mathrm{MHz}$<\langle\Omega_{\text{L}}\rangle<$40\text{\,}\mathrm{MHz}$$
to reduce the required FPGA memory.

This section demonstrated a real-time baseband control protocol that enables
manipulation of a spin qubit on the entire Bloch sphere.

###  II.4 Controlled exchange-driven rotations

Figure 4:  Real-time-controlled exchange-driven qubit rotations. a One
repetition of the exchange rotation protocol. After estimation of
$\Omega_{\text{L}}$ and $\Omega_{\text{H}}$ as in Fig. 3, the OPX adjusts
exchange duration times $\tilde{t}_{l}$, using real-time knowledge of
$\langle\Omega_{\text{H}}\rangle$, to rotate the qubit by user-defined target
angles $\theta_{l}=\tilde{t}_{l}\,\langle\Omega_{\text{H}}\rangle$. Pulse
durations $\tilde{t}_{\pi/2}$ for qubit initialization and readout use real-
time knowledge of $\langle\Omega_{\text{L}}\rangle$. b Each row plots
measurements $m_{j}$ from one protocol repetition, here $M$=101 exchange probe
outcomes. c Each row plots measurement $m_{l}$ from one protocol repetition,
here $K$=101 controlled-exchange-rotation outcomes. To illustrate the
increased coherence of controlled exchange rotations, we also plot in b and c
the fraction of singlet outcomes of each column.

Using Bayesian inference to estimate control axes in real-time offers new
possibilities for studying and mitigating qubit noise at all detunings. Figure
4a describes the real-time controlled exchange-driven rotations protocol aimed
at stabilizing frequency fluctuations of the qubit at higher detunings.
Following the approach of Fig. 3, we first estimate $\Omega_{\text{L}}$ and
$\Omega_{\text{H}}$ using real-time Bayesian estimation. We then use our
knowledge of $\Omega_{\text{H}}$ to increase the rotation angle coherence of
the qubit where the exchange coupling is comparable with the Overhauser field
gradient.

As illustrated in Fig. 4a, the qubit control pulses now respond in real time
to both qubit frequencies $\Omega_{\text{L}}$ and $\Omega_{\text{H}}$. Similar
to the previous section, after determining $\langle\Omega_{\text{L}}\rangle$
and confirming that
$$30\text{\,}\mathrm{MHz}$<\langle\Omega_{\text{L}}\rangle<$50\text{\,}\mathrm{MHz}$$
is fulfilled, the qubit is initialized near the equator of the Bloch sphere by
fast diabatic $\Omega_{\text{L}}(\pi/2)$ pulses, followed by an exchange-based
FID that probes $\Omega_{\text{H}}$. Based on the resulting
$\langle\Omega_{\text{H}}\rangle$, the OPX adjusts the separation times
$\tilde{t}_{l}$ to rotate the qubit by user-defined target angles
$\theta_{l}=\tilde{t}_{l}\,\langle\Omega_{\text{H}}\rangle$.

To show the resulting improvement of coherent exchange oscillations, we plot
in Fig. 4c the interleaved $K$=101 measurements $m_{l}$ and compare them in
Fig. 4b to the $M$=101 measurements $m_{j}$. Fitting the average of the
uncontrolled rotations by an oscillatory fit with Gaussian envelope decay
yields $T_{\text{el}}^{*}\approx$60\text{\,}\mathrm{n}\mathrm{s}$$ and
$Q\approx 3$, presumably limited by electrical noise [49], while the quality
factor of the controlled rotations is enhanced by a factor of two, $Q\approx
6$.

The online control of exchange-driven rotations using Bayesian inference
stabilizes fluctuations of the qubit frequency at higher detunings, where
fluctuations are more sensitive to detuning noise. Indeed, we attribute the
slightly smaller quality factor, relative to Overhauser-driven rotations in
Fig. 2d, to an increased sensitivity to charge noise at larger detuning,
which, owing to its high-frequency component, is more likely to fluctuate on
the estimation timescales [36].

This section established for the first time stabilization of two rotation axes
of a spin qubit. This advancement should allow for stabilized control over the
entire Bloch sphere, which we demonstrate in the next section.

###  II.5 Hadamard rotations

Figure 5:  Real-time universal ST0 control demonstrated by Hadamard rotations.
a Hadamard rotation protocol. After estimating $\Omega_{\text{L}}$,
$\varepsilon$ is chosen in real-time such that $J(\varepsilon)=|\Delta
B_{z}|$, based on a linearized offline model from panel c. If
$$40\text{\,}\mathrm{MHz}$<\langle|\Delta
B_{z}|\rangle<$60\text{\,}\mathrm{MHz}$$, the detuning is adjusted to account
for deviations of the prevailing $J$ from the offline model. Real-time
knowledge of $\Omega_{\text{Had}}=\sqrt{2}\,|\Delta B_{z}|$ then dictates
$\tilde{t}_{i}$ to achieve a user-defined Hadamard rotation angle. b Averaged
exchange driven FID as a function of detuning and evolution time. Here, a
diabatic $\Omega_{\text{L}}(\pi/2)$ pulse initializes the qubit near the
equator of the Bloch sphere, prior to free exchange evolution, and
subsequently prepares it for readout. c $J$ as a function of $\varepsilon$
extracted offline from b, as well as a linearized model (dashed line) used in
the two feedback steps of panel a. d Hadamard rotation depicted on the Bloch
sphere. e Measurement of Hadamard rotations with $|\Delta B_{z}|$ and $J$
estimation (purple, top panel), only $|\Delta B_{z}|$ estimation (light gray,
middle panel), and without the feedback shown in a (dark gray, bottom panel).

In this experiment, we demonstrate universal ST0 control that corrects for
fluctuations in all Hamiltonian parameters. We execute controlled Hadamard
rotations around $\boldsymbol{\hat{\omega}}_{\text{Had}}$, as depicted by the
trajectory on the Bloch sphere of Fig. 5d, by selecting the detuning
$\varepsilon_{\text{Had}}$ in real time such that
$J(\varepsilon_{\text{Had}})=|\Delta B_{z}|$. To achieve this, we do not
assume that $\Delta B_{z}=\Omega_{\text{L}}$ (i.e. we allow contributions of
$J_{\text{res}}$ to $\Omega_{\text{L}}$) or that $J=\Omega_{\text{L}}$ (i.e.
we allow contributions of $\Delta B_{z}$ to $\Omega_{\text{H}}$). The full
protocol is detailed in Supplementary Discussion.

Real-time knowledge of both $\Delta B_{z}$ and $J$ would potentially benefit
two-qubit gate fidelities [50] and the resonant-driving approach of previous
works [35, 38, 39]. In the resonant implementation, constrained to the
operating regime $|\Delta B_{z}|\gg J$, low-frequency fluctuations of $J$
result in transverse noise that causes dephasing and phase shifts of the Rabi
rotations [51, 52].

In previous sections, we have shown how to probe the qubit Larmor frequencies
$\Omega_{\text{H}}$ and $\Omega_{\text{L}}$ at different detunings in real
time and correct for their fluctuations. Now, we simultaneously counteract
fluctuations in $J$ and $|\Delta B_{z}|$ on the OPX in order to perform the
Hadamard gate. As we do not measure the sign of $\Delta B_{z}$, we identify
the polar angle of $\boldsymbol{\hat{\omega}}_{\text{Had}}$ as either
$\varphi=\pi/4$ or $-\pi/4$.

In other words, starting from the singlet state, the qubit rotates towards
$+X$ on the Bloch sphere for one sign of $\Delta B_{z}$, and towards $-X$ for
the other sign. The sign of the gradient may change over long time scales due
to nuclear spin diffusion (on the order of many seconds [41]), but the
measurement outcomes of our protocol are expected to be independent of the
sign.

The relative sign of Overhauser gradients becomes relevant for multi-qubit
experiments [53], and could be determined following [54] by comparing the
relaxation time of the ground state (e.g. $\ket{\uparrow\downarrow}$) of
$\Delta B_{z}$ with its excited state ($\ket{\downarrow\uparrow}$). Such
diagnostic sign-probing cycles on the FPGA should not require more than a few
milliseconds, negligible compared to the expected time between sign reversals.

In preparation for our protocol, we first extract the time-averaged exchange
profile by performing exchange oscillations as a function of evolution time
[Fig. 5b]. Removing contributions of $\Delta B_{z}$ to $\Omega_{\text{H}}$
then yields $J(\varepsilon)$ in Fig. 5c. A linear approximation in the target
range $$40\text{\,}\mathrm{MHz}$<\langle J\rangle<$60\text{\,}\mathrm{MHz}$$
(dashed blue line) is needed later on the OPX to allow initial detuning
guesses when tuning up $J(\varepsilon)=|\Delta B_{z}|$. We also provide the
OPX with a value for the residual exchange at low detuning,
$J_{\text{res}}\approx$20\text{\,}\mathrm{MHz}$$, determined offline as
described in Supplementary Fig. 5.

As illustrated in Fig. 5a, the Hadamard rotation protocol starts by estimating
$|\Delta B_{z}|$ from $\Omega_{\text{L}}$, taking into account a constant
residual exchange by solving $\Delta
B_{z}^{2}=\Omega_{\text{L}}^{2}-J_{{\text{res}}}^{2}$.

Next, an initial value of $\varepsilon_{\text{Had}}$ is chosen based on the
linear offline model to fulfill $J(\varepsilon_{\text{Had}})=|\Delta B_{z}|$
[feedback ① in panel (a,c)]. To detect any deviations of the prevailing $J$
from the offline model, an exchange-driven FID is performed at
$\varepsilon_{\text{Had}}$ to estimate $J$ from $\Omega_{\text{H}}$, using
$J^{2}=\Omega_{\text{H}}^{2}-\Delta B_{z}^{2}$.

Any deviation of $\langle J\rangle$ from the target value $|\Delta B_{z}|$ is
subsequently corrected for by updating $\varepsilon_{\text{Had}}$ based on the
linearized $J(\varepsilon)$ model [feedback ② in panels (a,c)]. Matching $J$
to $|\Delta B_{z}|$ in the two detuning feedback steps each takes about
$400\text{\,}\mathrm{ns}$ on the OPX. Finally, real-time knowledge of
$\Omega_{\text{Had}}\equiv\sqrt{2}|\Delta B_{z}|$ is used to generate the free
evolution times $\tilde{t}_{i}$, spent at the updated value
$\tilde{\varepsilon}_{\text{Had}}$, in order to perform Hadamard rotations by
$K$ user defined target angles.

The resulting Hadamard oscillations are shown in Fig. 5e (top panel) and
fitted with an exponentially decaying sinusoid, indicating a quality factor
$Q>5$. (According to this naive fit, the amplitude drops to 1/e over
approximately 40 rotations, although we have not experimentally explored
rotation angles beyond 9$\pi$.) In comparison to exchange-controlled rotations
from Fig. 4c, the Hadamard rotations are more stable, which we attribute to
the additional feedback on detuning that fixes the oscillation axis and
decreases sensitivity to charge noise.

To illustrate the crucial role of real-time estimation for this experiment, we
also performed rotation experiments that do not involve any real-time
estimation and feedback cycles (dark gray data, bottom panel), as follows.
Within minutes after performing the controlled Hadamard rotations (purple
data), we executed Hadamard rotations assuming a fixed value of $|\Delta
B_{z}|=\overline{|\Delta B_{z}|}$, i.e. by pulsing to a fixed detuning value
corresponding to $J(\varepsilon_{\text{H}})=\overline{|\Delta B_{z}|}$
according to the offline model. Here, $\overline{|\Delta B_{z}|}\approx 40$
MHz is the average Overhauser gradient that we observed just before executing
the Hadamard protocol. Not surprisingly, the quality factor of the resulting
Hadamard-like oscillations is low and the rotation angle deviates from the
intended target angle, likely due to the Overhauser gradient having drifted in
time. As a side note, we mention that the purple data in Fig. 5e constitutes
an average over 5,000 repetitions, corresponding to a total acquisition time
of 2 minutes including Overhauser and exchange estimation cycles. In contrast,
the dark gray data also constitutes an average over 5,000 repetitions, but
only required 15 seconds because of the omission of all estimation and
feedback cycles.

To verify that the enhancement in $Q$ is not solely due to the more accurate
knowledge of $|\Delta B_{z}|$, we also performed Hadamard rotations only using
the estimation of $|\Delta B_{z}|$. The FPGA was programmed to perform a
measurement where the initialized singlet is pulsed to a fixed detuning
$J(\varepsilon_{\text{H}})\approx$20\text{\,}\mathrm{MHz}$$ to perform a
Hadamard rotation, only if the estimated $|\Delta B_{z}|$ on the FPGA
satisfies $$17\text{\,}\mathrm{MHz}$<\langle|\Delta
B_{z}|\rangle<$23\text{\,}\mathrm{MHz}$$. We then post select the repetitions
where $$19.5\text{\,}\mathrm{MHz}$<\langle|\Delta
B_{z}|\rangle<$20.5\text{\,}\mathrm{MHz}$$. Fitting this by an oscillatory fit
with Gaussian envelope decay yields
$T_{\text{el}}^{*}\approx$70\text{\,}\mathrm{n}\mathrm{s}$$, $Q\approx 2.0$
and frequency $\approx$29\text{\,}\mathrm{MHz}$$.

In Figure 5e we compare these data (light gray, middle panel) with the cases
where the FPGA estimated both $|\Delta B_{z}|$ and $J$ (purple, top panel) and
where the microprocessor does not perform any estimation but simply pulses to
$J(\varepsilon_{\text{H}})$ to perform the rotations (dark gray, bottom
panel). (In the middle panel the horizontal axis was rescaled to the Hadamard
evolution time using the fitted frequency $\approx$29\text{\,}\mathrm{MHz}$$.)
We see that (i) a reduction of the uncertainty in $|\Delta B_{z}|$ from
$\approx$30\text{\,}\mathrm{MHz}$$ (r.m.s.) to
$\approx$2\text{\,}\mathrm{MHz}$$ (dark gray to light gray) does not yield a
proportional gain in $Q$ and (ii) the improvement in $Q$ when including
estimation of $J$ (light gray to purple) is much larger than can be justified
solely by the slight further reduction of the uncertainty in $|\Delta B_{z}|$
(roughly from $\approx$2\text{\,}\mathrm{MHz}$$ to
$\approx$1\text{\,}\mathrm{MHz}$$). This demonstrates the crucial contribution
of the estimations along both axes in the improvement of our Hadamard gate
quality factor.

Further evidence for the fluctuating nature of non-stabilized Hadamard
rotations is discussed in Supplementary Fig. 6.

The stabilized Hadamard rotations demonstrate real-time feedback control based
on Bayesian estimation of $J$ and $|\Delta B_{z}|$, and suggest a significant
improvement in coherence for ST0 qubit rotations around a tilted control axis.
Despite the presence of fluctuations in all Hamiltonian parameters, we report
effectively constant amplitude of Hadamard oscillations, with a reduced
visibility that we tentatively attribute to estimation and readout errors.

##  III Discussion

Our experiments demonstrate the effectiveness of feedback control in
stabilizing and improving the performance of a singlet-triplet spin qubit. The
protocols presented showcase two-axis control of a qubit with two fluctuating
Hamiltonian parameters, made possible by implementing online Bayesian
estimation and feedback on a low-latency FPGA-powered qubit control system.
Real-time estimation allows control pulses to counteract fluctuations in the
Overhauser gradient, enabling controlled Overhauser-driven rotations without
the need for micromagnets or nuclear polarization protocols. Notably, even in
the absence of a deterministic component of the Hamiltonian purely noise-
driven coherent rotations of a two-level quantum system were demonstrated.

The approach is extended to the real-time estimation of the second rotation
axis, dominated by exchange interaction, which we then combine with an
adaptive feedback loop to generate and stabilize Hadamard rotations. In
particular, executing the Hadamard gate involves (i) sequentially executing
two distinct estimation cycles, where the design of the second cycle relies on
the outcomes of the first, (ii) correlating the detected frequencies to
distinguish independent fluctuations of the two control axes, and (iii)
utilizing this correlated information to dynamically construct and execute a
Hadamard gate. These steps demand real-time adaptive estimations and signal
generations throughout the protocol, which has not been demonstrated before. A
constant Overhauser field gradient, whether stemming from nuclear spin pumping
or a micromagnet, is expected to further improve the feedback control. From
this perspective, our work represents a worst-case scenario, demonstrating the
effectiveness of our experimental technique.

Our protocols assume that $\Delta B_{z}$ does not depend on the precise dot
detuning in the (1,1) configuration and remains constant on the time scale of
one estimation. Similarly, stabilization of exchange rotations is only
effective for electrical fluctuations that are slow compared to one
estimation. Therefore, we expect potential for further improvements by more
efficient estimation methods, for example through adaptive schemes [55] for
Bayesian estimation from fewer samples, or by taking into account the
statistical properties of a time-varying signal described by a Wiener process
[56] or a nuclear spin bath [57]. Machine learning could be used to predict
the qubit dynamics [58, 59, 60], possibly via long short-term memory
artificial neural networks as reported for superconducting qubits [61]. While
our current qubit cycle time (approximately
$30\text{\,}\mathrm{\SIUnitSymbolMicro s}$) is dominated by readout and qubit
initialization, it can potentially be reduced to a few microseconds through
faster qubit state classification, such as enhanced latched readout [48], and
faster reset, such as fast exchange of one electron with the reservoir [62].
Our protocol could be modified for real-time non-local noise correlations [63]
or in-situ qubit tomography using fast Bayesian tomography [64] to study the
underlying physics of the noisy environment, thereby providing qualitatively
new insights into processes affecting qubit coherence and multi-qubit error
correction.

Beyond ST0 qubits, our protocols uncover new perspectives on coherent control
of quantum systems manipulated by baseband pulses. This work represents a
significant advancement in quantum control by implementing an FPGA-powered
technique to stabilize in real time the qubit frequency at different
manipulation points.

##  IV Methods

###  IV.1 Experimental setup

We use an Oxford Instruments Triton 200 cryofree dilution refrigerator with
base temperature below $30\text{\,}\mathrm{mK}$. The experimental setup
employs a Quantum Machines OPX+ for radio-frequency (RF) reflectometry and
gate control pulses. The RF carrier frequency is
$\approx$158\text{\,}\mathrm{MHz}$$ and the gate control pulses sent to the
left and right plunger gates of the DQD are filtered with low-pass filters
($\approx$220\text{\,}\mathrm{MHz}$$) at room temperature, before being
attenuated at different stages of the refrigerator. Low-frequency tuning
voltages (high-frequency baseband waveforms) are applied by a QDAC [65] (OPX)
via a QBoard high-bandwidth sample holder [66].

###  IV.2 Measurement details

Before qubit manipulation, an additional reflectometry measurement is taken as
a reference to counteract slow drifts in the sensor dot signal. At the end of
each qubit cycle, a $\approx$1\text{\,}\mathrm{\SIUnitSymbolMicro s}$$ long
pulse is applied to discharge the bias tee. As the qubit cycle period (tens of
$\text{\,}\mathrm{\SIUnitSymbolMicro s}$) is much shorter than the bias tee
cutoff ($\approx$300\text{\,}\mathrm{Hz}$$), we do not correct the pulses for
the transfer function of the bias tee.

##  V Data availability

The datasets generated and analyzed during the current study are available
from the corresponding authors (F.B., A.C., and F.K.) upon request.

## References

  * [1] Wiseman, H. M.  Quantum theory of continuous feedback.  _Physical Review A_ 49, 2133–2150 (1994).
  * [2] Wiseman, H. M. & Milburn, G. J.  _Quantum Measurement and Control_ (Cambridge University Press, 2009).
  * [3] Zhang, J., xi Liu, Y., Wu, R.-B., Jacobs, K. & Nori, F.  Quantum feedback: Theory, experiments, and applications.  _Physics Reports_ 679, 1–60 (2017).
  * [4] Vijay, R. _et al._ Stabilizing Rabi oscillations in a superconducting qubit using quantum feedback.  _Nature_ 490, 77–80 (2012).
  * [5] Campagne-Ibarcq, P. _et al._ Persistent control of a superconducting qubit by stroboscopic measurement feedback.  _Physical Review X_ 3, 021008 (2013).
  * [6] de Lange, G. _et al._ Reversing quantum trajectories with analog feedback.  _Physical Review Letters_ 112, 080501 (2014).
  * [7] Masuyama, Y. _et al._ Information-to-work conversion by Maxwell’s demon in a superconducting circuit quantum electrodynamical system.  _Nature Communications_ 9 (2018).
  * [8] Vepsäläinen, A. _et al._ Improving qubit coherence using closed-loop feedback.  _Nature Communications_ 13 (2022).
  * [9] Blok, M. S. _et al._ Manipulating a qubit through the backaction of sequential partial measurements and real-time feedback.  _Nature Physics_ 10, 189–193 (2014).
  * [10] Bonato, C. _et al._ Optimized quantum sensing with a single electron spin using real-time adaptive measurements.  _Nature Nanotechnology_ 11, 247–252 (2015).
  * [11] Hirose, M. & Cappellaro, P.  Coherent feedback control of a single qubit in diamond.  _Nature_ 532, 77–80 (2016).
  * [12] Cramer, J. _et al._ Repeated quantum error correction on a continuously encoded qubit by real-time feedback.  _Nature Communications_ 7, 11526 (2016).
  * [13] Wu, S.-H., Turner, E. & Wang, H.  Continuous real-time sensing with a nitrogen-vacancy center via coherent population trapping.  _Physical Review A_ 103, 042607 (2021).
  * [14] Turner, E., Wu, S.-H., Li, X. & Wang, H.  Spin-based continuous Bayesian magnetic-field estimations aided by feedback control.  _Physical Review A_ 106, 052603 (2022).
  * [15] Bushev, P. _et al._ Feedback cooling of a single trapped ion.  _Physical Review Letters_ 96, 043003 (2006).
  * [16] Singh, K. _et al._ Mid-circuit correction of correlated phase errors using an array of spectator qubits.  _Science_ 380, 1265–1269 (2023).
  * [17] Steck, D. A., Jacobs, K., Mabuchi, H., Bhattacharya, T. & Habib, S.  Quantum feedback control of atomic motion in an optical cavity.  _Physical Review Letters_ 92, 223004 (2004).
  * [18] Sayrin, C. _et al._ Real-time quantum feedback prepares and stabilizes photon number states.  _Nature_ 477, 73–77 (2011).
  * [19] Wilson, D. J. _et al._ Measurement-based control of a mechanical oscillator at its thermal decoherence rate.  _Nature_ 524, 325–329 (2015).
  * [20] Rossi, M., Mason, D., Chen, J., Tsaturyan, Y. & Schliesser, A.  Measurement-based quantum control of mechanical motion.  _Nature_ 563, 53–58 (2018).
  * [21] Magrini, L. _et al._ Real-time optimal quantum control of mechanical motion at room temperature.  _Nature_ 595, 373–377 (2021).
  * [22] Tebbenjohanns, F., Mattana, M. L., Rossi, M., Frimmer, M. & Novotny, L.  Quantum control of a nanoparticle optically levitated in cryogenic free space.  _Nature_ 595, 378–382 (2021).
  * [23] Burkard, G., Ladd, T. D., Pan, A., Nichol, J. M. & Petta, J. R.  Semiconductor spin qubits.  _Rev. Mod. Phys._ 95, 025003 (2023).
  * [24] Chatterjee, A. _et al._ Semiconductor qubits in practice.  _Nature Reviews Physics_ 3, 157–177 (2021).
  * [25] Stano, P. & Loss, D.  Review of performance metrics of spin qubits in gated semiconducting nanostructures.  _Nature Reviews Physics_ 4, 672–688 (2022).
  * [26] Zwerver, A. M. J. _et al._ Qubits made by advanced semiconductor manufacturing.  _Nature Electronics_ 5, 184–190 (2022).
  * [27] Noiri, A. _et al._ Fast universal quantum gate above the fault-tolerance threshold in silicon.  _Nature_ 601, 338–342 (2022).
  * [28] Hendrickx, N. W. _et al._ A four-qubit germanium quantum processor.  _Nature_ 591, 580–585 (2021).
  * [29] Fedele, F. _et al._ Simultaneous operations in a two-dimensional array of singlet-triplet qubits.  _PRX Quantum_ 2, 040306 (2021).
  * [30] Philips, S. G. J. _et al._ Universal control of a six-qubit quantum processor in silicon.  _Nature_ 609, 919–924 (2022).
  * [31] Nakajima, T. _et al._ Coherence of a driven electron spin qubit actively decoupled from quasistatic noise.  _Physical Review X_ 10, 011060 (2020).
  * [32] Kobayashi, T. _et al._ Feedback-based active reset of a spin qubit in silicon.  _npj Quantum Information_ 9, 52 (2023).
  * [33] Nakajima, T. _et al._ Real-time feedback control of charge sensing for quantum dot qubits.  _Phys. Rev. Appl._ 15, L031003 (2021).
  * [34] Johnson, M. A. I. _et al._ Beating the thermal limit of qubit initialization with a Bayesian Maxwell’s demon.  _Phys. Rev. X_ 12, 041008 (2022).
  * [35] Shulman, M. D. _et al._ Suppressing qubit dephasing using real-time Hamiltonian estimation.  _Nature Communications_ 5, 5156 (2014).
  * [36] Dial, O. E. _et al._ Charge noise spectroscopy using coherent exchange oscillations in a singlet-triplet qubit.  _Physical Review Letters_ 110, 146804 (2013).
  * [37] Cerfontaine, P. _et al._ Closed-loop control of a GaAs-based singlet-triplet spin qubit with 99.5% gate fidelity and low leakage.  _Nature Communications_ 11, 4144 (2020).
  * [38] Kim, J. _et al._ Approaching ideal visibility in singlet-triplet qubit operations using energy-selective tunneling-based Hamiltonian estimation.  _Physical Review Letters_ 129, 040501 (2022).
  * [39] Yun, J. _et al._ Probing two-qubit capacitive interactions beyond bilinear regime using dual Hamiltonian parameter estimations.  _npj Quantum Information_ 9, 30 (2023).
  * [40] Quantum Machines model OPX+, www.quantum-machines.co.
  * [41] Malinowski, F. K. _et al._ Spectrum of the nuclear environment for GaAs spin qubits.  _Physical Review Letters_ 118, 177702 (2017).
  * [42] Foletti, S., Bluhm, H., Mahalu, D., Umansky, V. & Yacoby, A.  Universal quantum control of two-electron spin quantum bits using dynamic nuclear polarization.  _Nature Physics_ 5, 903–908 (2009).
  * [43] Vigneau, F. _et al._ Probing quantum devices with radio-frequency reflectometry.  _Applied Physics Reviews_ 10, 021305 (2023).
  * [44] Wu, X. _et al._ Two-axis control of a singlet–triplet qubit with an integrated micromagnet.  _Proceedings of the National Academy of Sciences_ 111, 11938–11942 (2014).
  * [45] Jang, W. _et al._ Individual two-axis control of three singlet-triplet qubits in a micromagnet integrated quantum dot array.  _Applied Physics Letters_ 117, 234001 (2020).
  * [46] Barthel, C. _et al._ Relaxation and readout visibility of a singlet-triplet qubit in an Overhauser field gradient.  _Physical Review B_ 85, 035306 (2012).
  * [47] Yang, C. H. _et al._ Charge state hysteresis in semiconductor quantum dots.  _Applied Physics Letters_ 105, 183505 (2014).
  * [48] Harvey-Collard, P. _et al._ High-fidelity single-shot readout for a spin qubit via an enhanced latching mechanism.  _Phys. Rev. X_ 8, 021046 (2018).
  * [49] Martins, F. _et al._ Noise suppression using symmetric exchange gates in spin qubits.  _Phys. Rev. Lett._ 116, 116801 (2016).
  * [50] Petit, L. _et al._ Design and integration of single-qubit rotations and two-qubit gates in silicon above one kelvin.  _Communications Materials_ 3, 82 (2022).
  * [51] Koppens, F. H. L. _et al._ Universal phase shift and nonexponential decay of driven single-spin oscillations.  _Physical Review Letters_ 99, 106803 (2007).
  * [52] Ramon, G. & Cywiński, Ł.  Qubit decoherence under two-axis coupling to low-frequency noises.  _Physical Review B_ 105, l041303 (2022).
  * [53] Cerfontaine, P., Otten, R., Wolfe, M. A., Bethke, P. & Bluhm, H.  High-fidelity gate set for exchange-coupled singlet-triplet qubits.  _Physical Review B_ 101, 155311 (2020).
  * [54] Cai, X., Connors, E. J., Edge, L. F. & Nichol, J. M.  Coherent spin-valley oscillations in silicon.  _Nature Physics_ 19, 386–393 (2023).
  * [55] Sergeevich, A., Chandran, A., Combes, J., Bartlett, S. D. & Wiseman, H. M.  Characterization of a qubit Hamiltonian using adaptive measurements in a fixed basis.  _Physical Review A_ 84, 052315 (2011).
  * [56] Bonato, C. & Berry, D. W.  Adaptive tracking of a time-varying field with a quantum sensor.  _Physical Review A_ 95, 052348 (2017).
  * [57] Scerri, E., Gauger, E. M. & Bonato, C.  Extending qubit coherence by adaptive quantum environment learning.  _New Journal of Physics_ 22, 035002 (2020).
  * [58] Mavadia, S., Frey, V., Sastrawan, J., Dona, S. & Biercuk, M. J.  Prediction and real-time compensation of qubit decoherence via machine learning.  _Nature Communications_ 8, 14106 (2017).
  * [59] Gupta, R. S. & Biercuk, M. J.  Machine learning for predictive estimation of qubit dynamics subject to dephasing.  _Physical Review Applied_ 9, 064042 (2018).
  * [60] Fiderer, L. J., Schuff, J. & Braun, D.  Neural-network heuristics for adaptive Bayesian quantum estimation.  _PRX Quantum_ 2, 020303 (2021).
  * [61] Koolstra, G. _et al._ Monitoring fast superconducting qubit dynamics using a neural network.  _Phys. Rev. X_ 12, 031017 (2022).
  * [62] Botzem, T. _et al._ Tuning methods for semiconductor spin qubits.  _Physical Review Applied_ 10, 054026 (2018).
  * [63] Szańkowski, P., Trippenbach, M. & Cywiński, Ł.  Spectroscopy of cross correlations of environmental noises with two qubits.  _Physical Review A_ 94, 012109 (2016).
  * [64] Evans, T. _et al._ Fast Bayesian tomography of a two-qubit gate set in silicon.  _Phys. Rev. Appl._ 17, 024068 (2022).
  * [65] QDevil model QDAC-II, www.quantum-machines.co.
  * [66] QDevil model QBoard-I, www.quantum-machines.co.

##  VI Acknowledgments

This work received funding from the European Union’s Horizon 2020 research and
innovation programme under grant agreements 101017733 (QuantERA II) and 951852
(QLSI), from the Novo Nordisk Foundation under Challenge Programme
NNF20OC0060019 (SolidQ), from the Inge Lehmann Programme of the Independent
Research Fund Denmark, from the Research Council of Norway (RCN) under
INTFELLES-Project No 333990, as well as from the Dutch National Growth Fund
(NGF) as part of the Quantum Delta NL programme.

##  VII Author contributions

F.B. lead the measurements and data analysis, and wrote the manuscript with
input from all authors. F.B., T.R., J.v.d.H., A.C. and F.K. performed the
experiment with theoretical contributions from J.A.K., J.D. and E.v.N. F.F.
fabricated the device. S.F., G.C.G. and M.J.M. supplied the heterostructures.
A.C. and F.K. supervised the project.

##  VIII Competing interests

The authors declare no competing interests.

##  IX Additional information

Correspondence and requests for materials should be addressed to F.B., A.C.,
and F.K.