Abstract
Fully autonomous precise control of qubits is crucial for quantum information processing, quantum communication, and quantum sensing applications. It requires minimal human intervention on the ability to model, to predict, and to anticipate the quantum dynamics, as well as to precisely control and calibrate single qubit operations. Here, we demonstrate single qubit autonomous calibrations via closedloop optimisations of electron spin quantum operations in diamond. The operations are examined by quantum state and process tomographic measurements at room temperature, and their performances against systematic errors are iteratively rectified by an optimal pulse engineering algorithm. We achieve an autonomous calibrated fidelity up to 1.00 on a time scale of minutes for a spin population inversion and up to 0.98 on a time scale of hours for a single qubit \(\frac{\pi }{2}\)rotation within the experimental error of 2%. These results manifest a full potential for versatile quantum technologies.
Introduction
The ability to precisely control and calibrate single qubit operations in solids is a key element for reliable and scalable highperformance quantum technologies, for instance quantumenhanced sensors and metrological devices. It is also the backbone of many quantum information processing tasks, which paves the way for the future realisation of quantum computation and communication. Together with efficient quantum system characterisations and dynamical predictions,^{1,2} where human intervention is minimised, autonomous calibration of a single spin qubit is necessary for the realisation of such advanced quantum technologies. We report here experimental demonstrations of the autonomous calibration of a single spin qubit in diamond using closedloop optimisation. Our spin qubit implementation is a single nitrogenvacancy (NV) colour centre in diamond. It provides a suitable platform for a precise qubit manipulation to be realised.^{3,4} Its remarkable features, such as optical initialisation and readout, and the ability to be manipulated by microwave fields at room temperature, make this physical system extremely attractive for many quantum technologies.^{5} We have witnessed a vast array of demonstrations of the NV centres showing a great potential for future technologies, ranging from sub picoTesla magnetometry,^{6} electric field and temperature sensing,^{7,8} to probing molecular dynamics,^{9} and singlecell magnetic imaging.^{10} Furthermore, intertwinements between quantum information and metrology using NV centrebased systems yield novel and effective techniques towards the realisation of highperformance technologies, e.g. applying quantum error correction^{11} and phase estimation^{12} to improve magnetic field sensitivity. One way to reach such technology is to apply the closedloop optimisation method for autocalibrating the controls required to drive the system in the presence of experimental limitations and noise. Closedloop optimal control has been already applied to quantum information processing.^{13,14} However, to date no realisation of such autonomous calibration in roomtemperature solids has been reported. Here, we apply a technique derived from optimal control theory, namely the dressed chopped random basis (DCRAB) algorithm,^{15,16} to perform realtime closedloop optimisations of two fundamental single qubit operations, a spin1/2 population inversion and a \(\frac{\pi }{2}\)rotation gate, against frequency detuning. The algorithm is adapted for use in the NV centrebased experiment and directly embedded in the experimental apparatus, allowing the autonomous spin qubit calibrations to be fully performed as illustrated by Fig. 1. In contrast to a simple feedback circuit where usually only a single degree of freedom is adjusted at a time based on continuous measurement, our framework considers the whole quantum dynamics and is capable of addressing multiple degrees of freedom at every instance in time.
Optimal control methods have been applied to several quantum information processing tasks with NV centres,^{17,18,19,20,21,22} affirming their necessity and significance for quantum technology. However, the previously reported experiments,^{17,18,19,20,21,22} utilise openloop optimisation techniques where the optimisation is performed before the actual experiment by separate computer simulations. The technique requires system–environment coupling information as detailed as possible to provide a robust solution. In contrast, the closedloop technique requires no explicit system–environment information. Hence, it is utmost practical for the realisation of versatile quantum devices. One significant feature of the DCRAB algorithm is that it makes such closedloop optimisation viable since the only quantity required from the experiment is a single figure of merit (e.g. state or gate fidelity). No further information, such as a gradient or a Hessian, is necessary. Moreover, recent theoretical work,^{23,24} points out that the relevant number of degrees of freedom in the control is rather small for few qubit systems. A reasonable number of degrees of freedom can be addressed through a suitable parametrisation.^{25,26,27} The DCRAB algorithm makes use of this foundation. It shapes high accuracy pulses with few iterations (or superiteration that is required for avoiding local optimisation traps), and maintains the robustness against noise and errors potentially occurred at any stage of experiments.^{16} The key ideas are to expand the pulses in a reasonable function basis and subsequent basis function changes to avoid local traps. We provide more detailed discussions of the algorithm and its implementations in the “Methods” section and in Section A in the Supplementary Material.
Results
High fidelity population inversion via closedloop control
In this experiment, we search for an optimal microwave pulse to transfer the NV spin state \(\left {m_{\rm s} = 0} \right\rangle\) to \(\left {m_{\rm s} =  1} \right\rangle\) with high fidelity. Therefore, we performed a state tomography after applying a parametrised microwave pulse. Subsequent measurement of the state transfer fidelity is then used as a figure of merit. To estimate the particular fidelity \(F_{{\rm ex}}^{{\rm cl}}\) we utilised quantum state tomography (see Sections B and C of the Supplementary Information). For convention, the subscripts of the fidelity \(F_i^j\) indicate either experimental (ex) or theoretical (th) data. The superscripts (cl) and (ol) refer to closedloop and openloop control, respectively. In Fig. 2 we show the results of our state transfer optimisation. In part (a), we first identify via an openloop simulation the expected performance of the employed optimisation method in presence of limited transfer time T and static detuning Δ. For relative process times T/T _{ π } exceeding ~1.5, our simulations identify robust solutions even up to a relative detuning of about \(\frac{{\mathrm{\Delta }}}{{\mathrm{\Omega }}} = 10\). Here the maximal Rabi frequency is determined by \({\mathrm{\Omega }} = \frac{1}{{2T_\pi }}\), which is connected to the maximal amplitude of the applied microwave pulse. We studied transfer times in the regime T/T _{ π } > 1 because the maximum speed of a quantum system evolution is bound in general by the quantum speed limit.^{28,29} Numerical simulations support this fact when a rectangular microwave pulse shape is assumed (see Supplementary Material Section G). In part (b), we show our experimental results achieved via closed loop optimisation, which support these results for small detuning, when T/T _{ π } = 1.5. For comparison, we show the corresponding crosssection of the numerical results of part (a) in (c). Each optimisation, performed for a certain gate time and a certain detuning, bases on a DCRAB algorithm with six superiterations. Exemplarily, we show in Fig. 2d, e the full closedloop optimisation process in the case of no detuning, and when a small detuning is applied. The blue curve shows the currently best found solution, while the red line is an internal algorithmic figure of merit quantity (for details see Supplementary Material Section A). The necessary time for achieving optimal fidelities depends on the accuracy of the tomography measurements \(\left( {F_{{\rm ex}}^{{\rm cl}}} \right)\) and on the initial optimisation parameters. In our case, a randomly chosen configuration (startsimplex) of the search algorithm was used. We achieve the maximal fidelity of 1.00 with an accuracy of 10^{−2} on a reliable timescale of about 2000 s in the case of no detuning and on a timescale of about 100 s with detuning. A faster optimisation with an offresonant pulse is here possible due to a fortunate choice of the initial searchconfiguration (optimal solution was already part of startsimplex). It is interesting to note, that all optimised pulses of the openloop simulation were not able to beat the results of our closedloop strategy in the case of moderate detuning. The best fidelity achieved via openloop techniques \(\left( {F_{{\rm th}}^{{\rm ol}}} \right)\) is marked in Fig. 2b and is only on the order of 0.6.
Autocalibration of a single qubit \(\frac{\pi }{2}\)rotation
A \(\frac{\pi }{2}\)rotation is the basic block of generating coherent quantum processeslike quantum metrology and quantum computing. To show the capabilities of our concept, we subsequently optimised the quantum gate
which is a typical experimental implementation of a Hadamard gate. Here, S _{ x } identifies the spin\(\frac{1}{2}\) xoperator. In accordance to the previous experiment, we first performed the experiment with no detuning and second, when a detuning of 8.125 MHz (relative detuning \(\frac{{\mathrm{\Delta }}}{{\mathrm{\Omega }}} = 0.7\)) was applied. The results are shown in Fig. 3. To quantify the performance of the evaluated microwave pulse with respect to the defined quantum gate G, quantum process tomography was used (for details see Supplementary Material Sections D and E). We observe after 99 evaluations a fidelity of 0.99 ± 0.01 and after 58 evaluations a fidelity of 0.98 ± 0.02 when the static microwave detuning was applied. The initial fidelity of the guess pulse was in both cases about 0.50. Compared to the previous experiment, the time needed for optimal results is about four times longer due to additional measurements, which are necessary for complete process tomography.
Discussions
Our experimental results demonstrate that the closedloop feedback control overcomes static and unknown system errors to achieve the highfidelity autonomous calibration of single quantum gates that is necessary for future quantum technologies with room temperature solids. Our approach of the closedloop optimisation uses minimal control resources and experimental knowledge that are accessible for users. The total time, required for autonomous calibration, is mainly determined by the duration of quantum tomography measurement and not by the optimisation algorithm. Hence, a significant speed up in the total time of calibration and its fidelity precision may potentially be achieved by employing fast and simplified tomography methods, for instance randomised benchmarking.^{30} In addition to the autonomous calibration, our demonstrated closedloop optimisation features stabilisation mechanism against experimental drifts, for instance due to fluctuations of the magnetic field strength and the resulting frequency detuning. Our procedure presented in this letter is not limited for application to singlequbit operations only. Further experimental implementations towards multipulse and multiqubit gate autonomous calibrations are in principle feasible using our closedloop optimisation method. Two qubit gates are often experimentally implemented with multiple pulses. In this case, each pulse could be parametrised individually or the overall pulse sequence can be parametrised by a proper basis function choice. The complexity will in general increase due to a more complex quantum process tomography or due to a larger parameter space. But the protocol itself, evaluation of a pulse sequence gate fidelity followed by a systematic pulse sequence update, can readily be extended as the algorithm does not require any a priori system knowledge and is therefore flexible in its use.
Methods
The twolevel quantum system considered in this work is composed of the NV ground spin states \(\left {m_{\rm s} = 0} \right\rangle\) and \(\left {m_{\rm s} =  1} \right\rangle\). Electron spin initialisation and readout are performed on a home built confocal microscopy setup at room temperature. To perform quantum operations on the NV spin with high fidelity, the microwave field source is controlled by an arbitrary waveform generator (AWG, Keysight M8195A), with a timing resolution of 65 GS/s and an amplitude resolution of 8 bit. In combination, we used a 50 W amplifier with a frequency bandwidth of about 4 GHz. The microwave field was created with a copper wire close to the NV. By controlling the amplitude and the phase of the microwave, we are able to rotate the system spin around arbitrary axis on the Bloch sphere. The timedependent control Hamiltonian is given by
while the system Hamiltonian in the rotating frame is \(H_0 = 2\pi {\mathrm{\Delta }}\hat S_z,\) where \(\hat S_x\), \(\hat S_y\), and \(\hat S_z\) are the spin operator of a twolevel system. The functions X(t) and Y(t) define the corresponding microwave pulse, where Ω is the Rabi frequency and Δ is the microwave frequency detuning. In our experiments the following conditions were fulfilled:
The two functions X(t) and Y(t) are optimised simultaneously using the DCRAB algorithm, where both start off from an initial guess (randomly chosen startsimplex). At the core of the algorithm there is the use of superiterations, which are composed again of an iterative update scheme that maps the time dynamics of all control input variables to a parameter variational problem via a suitable basis expansion. A brief introduction along with more general explanations can be found in SI/A. In this work, X(t) and Y(t) were expanded in (sub) iteration denoted by j of each superiteration denoted by k as
The two frequencies \(\omega _{n = 1}^{\,j,k} \in [0.5 4.5]\) and \({\mathrm{\Omega }}_{n = 1}^{\,j,k} \in [0.5 4.5]\) are randomly chosen at the beginning of each superiteration k and only updated after all the containing j = 1,...,N _{s} (sub) iterations were proceeded. This is where, in our case, the four coefficients \(a_{n = 1}^{\,j,k},b_{n = 1}^{\,j,k},c_{n = 1}^{\,j,k},d_{n = 1}^{\,j,k}\) are optimised using a direct search method (here Nelder–Mead, see Supplementary Material Section A). When j = N _{s} and thus a (sub) iteration terminates, a basis update is done by updating (redrawing of random numbers) \(\omega _{n = 1}^{\,j,k}\) and \(\Omega _{n = 1}^{\,j,k}\) and hence facilitating further improvement (see also Supplementary Material/Fig. 2). The subsequent superiteration (k + 1) search bases on the previous superiteration by calculating X(t)/Y(t)^{*,k−1} with the optimised (denoted by *) coefficients \(a_{n = 1}^{*,k},b_{n = 1}^{*,k},c_{n = 1}^{*,k},d_{n = 1}^{*,k}\) from the previous kth superiteration. The algorithm terminates once the maximum number of superiterations set is reached.
Data availability
The authors declare that the main data supporting the finding of this study are available within the article and its Supplementary Information files. Additional data can be provided upon request.
Code availability
The code that contributed to the results of this study is available on request from the authors.
References
 1.
Mavadia, S., Frey, V., Sastrawan, J., Dona, S. & Biercuk, M. J. Prediction and realtime compensation of qubit decoherence via machine learning. Nat. Commun. 8, 14106 (2017).
 2.
Wang, J. et al. Experimental quantum hamiltonian learning. Nat. Phys. 13, 551 (2017).
 3.
Doherty, M. W. et al. The nitrogenvacancy colour centre in diamond. Phys. Rep. 528, 1–45 (2013).
 4.
Wrachtrup, J. & Jelezko, F. Processing quantum information in diamond. J. Phys. 18, S807–S824 (2006).
 5.
Hemmer, P. & Wrachtrup, J. Where is my quantum computer? Science 324, 473–474 (2009).
 6.
Wolf, T. et al. Subpicotesla diamond magnetometry. Phys. Rev. X 5, 041001 (2015).
 7.
Dolde, F. et al. Electricfield sensing using single diamond spins. Nat. Phys. 7, 459–463 (2011).
 8.
Neumann, P. et al. Highprecision nanoscale temperature sensing using single defects in diamond. Nano Lett. 13, 2738–2742 (2013).
 9.
Staudacher, T. et al. Probing molecular dynamics at the nanoscale via an individual paramagnetic centre. Nat. Commun. 6, 8527 (2015).
 10.
Glenn, D. R. et al. Singlecell magnetic imaging using a quantum diamond microscope. Nat. Methods 12, 736–738 (2015).
 11.
Unden, T. et al. Quantum metrology enhanced by repetitive quantum error correction. Phys. Rev. Lett. 116, 230502 (2016).
 12.
Bonato, C. et al. Optimized quantum sensing with a single electron spin using realtime adaptive measurements. Nat. Nanotechnol. 11, 247–252 (2016).
 13.
Rosi, S. et al. Fast closedloop optimal control of ultracold atoms in an optical lattice. Phys. Rev. A 88, 021601 (2013).
 14.
Brif, C., Chakrabarti, R. & Rabitz, H. Control of quantum phenomena: past, present and future. New J. Phys. 12, 075008 (2010).
 15.
Doria, P., Calarco, T. & Montangero, S. Optimal control technique for manybody quantum dynamics. Phys. Rev. Lett. 106, 190501 (2011).
 16.
Rach, N., Müller, M. M., Calarco, T. & Montangero, S. Dressing the choppedrandombasis optimization: a bandwidthlimited access to the trapfree landscape. Phys. Rev. A 92, 062343 (2015).
 17.
Häberle, T., SchmidLorch, D., Karrai, K., Reinhard, F. & Wrachtrup, J. Highdynamicrange imaging of nanoscale magnetic fields using optimal control of a single qubit. Phys. Rev. Lett. 111, 170801 (2013).
 18.
Dolde, F. et al. Highfidelity spin entanglement using optimal control. Nat. Commun. 5, 3371 (2014).
 19.
Waldherr, G. et al. Quantum error correction in a solidstate hybrid spin register. Nature 506, 204–207 (2014).
 20.
Wang, Y. et al. Quantum simulation of helium hydride cation in a solidstate spin register. ACS Nano 9, 7769–7774 (2015).
 21.
Scheuer, J. et al. Precise qubit control beyond the rotating wave approximation. New J. Phys. 16, 093022 (2014).
 22.
Nöbauer, T. et al. Smooth optimal quantum control for robust solidstate spin magnetometry. Phys. Rev. Lett. 115, 190801 (2015).
 23.
Lloyd, S. & Montangero, S. Information theoretical analysis of quantum optimal control. Phys. Rev. Lett. 113, 010502 (2014).
 24.
Caneva, T. et al. Complexity of controlling quantum manybody dynamics. Phys. Rev. A 89, 042322 (2014).
 25.
Viola, L. & Lloyd, S. Dynamical suppression of decoherence in twostate quantum systems. Phys. Rev. A 58, 2733–2744 (1998).
 26.
O’Hara, K. M., Gehm, M. E., Granade, S. R. & Thomas, J. E. Scaling laws for evaporative cooling in timedependent optical traps. Phys. Rev. A 64, 051403 (2001).
 27.
Wigley, P. B. et al. Fast machinelearning online optimization of ultracoldatom experiments. Sci. Rep. 6, 25890 (2016).
 28.
Hegerfeldt, G. C. Driving at the quantum speed limit: optimal control of a twolevel system. Phys. Rev. Lett. 111, 260501 (2013).
 29.
Bhattacharyya, K. Quantum decay and the mandelstamtammenergy inequality. J. Phys. A 16, 2993 (1983).
 30.
Knill, E. et al. Randomized benchmarking of quantum gates. Phys. Rev. A 77, 012307 (2008).
Acknowledgements
We acknowledge financial supports from European Union FET Projects DIADEMS, RYSQ, and SIQS, German Research Foundation (DFG) through the SFB/TRR21 projects, German Federal Ministry of Education and Research (BMBF) via the Q.Com projects, and the Center for Integrated Quantum Science and Technology (IQST). We thank S. Zaiser, P. Neumann, and J. Wrachtrup in Stuttgart University for their valuable support and discussions. S.M. gratefully acknowledges the support of the DFG via a Heisenberg fellowship.
Author information
Affiliations
Contributions
F.F., T.U., and J.Z. contributed equally to this work. F.F., T.U., and B.N. carried out the experiment and analysed the data. J.Z. and R.S.S. provided theoretical supports and performed numerical simulations and analyses. F.F., T.U., J.Z., and R.S.S. wrote the manuscript with feedback from all authors. T.C., S.M., B.N., and F.J. supervised and managed the project.
Corresponding author
Ethics declarations
Competing interests
The authors declare no competing financial interests.
Additional information
Publisher's note: Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Electronic supplementary material
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Frank, F., Unden, T., Zoller, J. et al. Autonomous calibration of single spin qubit operations. npj Quantum Inf 3, 48 (2017). https://doi.org/10.1038/s4153401700498
Received:
Revised:
Accepted:
Published:
Further reading

tqix: A toolbox for Quantum in X
Computer Physics Communications (2021)

SelfConsistent Calibration of QuantumGate Sets
Physical Review Applied (2020)

Assessing three closedloop learning algorithms by searching for highquality quantum control pulses
Physical Review A (2020)

Introduction to quantum optimal control for quantum sensing with nitrogenvacancy centers in diamond
AVS Quantum Science (2020)

Quantum optimal control using phasemodulated driving fields
Physical Review A (2020)