Autonomous Calibration of Single Spin Qubit Operations

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 [1,2], as well as to precisely control and calibrate single qubit operations. Here, we demonstrate single qubit autonomous calibrations via closed-loop 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 Hadamard gate within the experimental error of 2%. These results manifest a full potential for versatile quantum nanotechnologies.

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 [1,2], as well as to precisely control and calibrate single qubit operations. Here, we demonstrate single qubit autonomous calibrations via closed-loop 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 Hadamard gate within the experimental error of 2%. These results manifest a full potential for versatile quantum nanotechnologies.
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 pico-Tesla magnetometry [6], electric field and temperature sensing [7,8], to probing molecular dynamics [9], and single-cell magnetic imaging [10]. Furthermore, intertwinements between quantum information and metrology using NV centre based systems yield novel and effective techniques towards the realisation of high-performance 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 closed-loop optimisation method for auto-calibrating the controls required to drive the system in the presence of experimental limitations and noise. Closed-loop optimal control has been already applied to quantum infor-FIG. 1: Schematics of the experiment. The closed-loop optimisation of electron spin qubit operations interfaced to a nitrogen-vacancy (NV) centre in diamond (nitrogen atom in yellow) (a) is performed on a homebuilt confocal microscope (c). The spin state is initialised and readout optically, and microwave pulses are applied to manipulate the state and can be used to create gates. To start an optimisation process, a guess pulse is applied to the sample through a microwave antenna and the figure of merit is evaluated by state tomography on the spin state. This fidelity estimate is then fed to an DCRAB based algorithm and a new test-pulse is generated. The spin trajectory (blue arrow) corresponding to an optimised pulse is shown on the Bloch sphere (b). As sketched, these steps are iteratively repeated until a previously definded fidelity is reached. mation processing [13,14]. However, to date no realisation of such autonomous calibration in room-temperature 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 real-time closed-loop optimisations of two fun-damental single qubit operations, a spin-1 /2 population inversion and a Hadamard gate, against frequency detuning. The algorithm is adapted for use in the NV centre based experiment and directly embedded in the experimental apparatus, allowing the autonomous spin qubit calibrations to be fully performed as illustrated by Fig. 1.
Closed-loop optimisation. Optimal control methods have been applied to several quantum information processing tasks with NV centres [17][18][19][20][21], affirming their necessity and significance for quantum technology. However, the previously reported experiments [17][18][19][20][21], utilise open-loop 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 closed-loop technique requires no explicit systemenvironment 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 closed-loop 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 [22,23], 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 [24][25][26]. 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]. We provide detailed discussions of the algorithm and its implementations in Sec. A in the supplementary material.
Experimental setup. The two-level quantum system considered in this work is built by the spin states |m s = 0 and |m s = −1 of the ground electronic state of an NV. 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. 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 time dependent control Hamiltonian is given by while the system Hamiltonian in the rotating frame is H 0 = 2π∆Ŝ z , whereŜ x ,Ŝ y andŜ z are the spin operator of a two-level system. The functions X(t) and Y (t) define the corresponding microwave pulse, where Ω is the Rabi frequency and ∆ is the microwave frequency detuning from energy splitting of our two level system. In our experiments the following conditions were fulfilled, For further proceeding, we define the relative detuning ∆ Ω and the relative process time T Tπ , with T π = 1 2Ω and the overall process time is T .
High fidelity population inversion via closed-loop control. In this experiment we search for an optimal microwave pulse to transfer the NV spin state |m s = 0 to |m s = −1 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 cl ex we utilised quantum state tomography (see Sec. B and Sec. C the supplementary information). For convention, the subscripts of the fidelity F j i indicate either experimental (ex) or theoretical (th) data. The superscripts (cl) and (ol) refer to closed-loop and open-loop control, respectively. In Fig. 2 we show the results of our state transfer optimisation. In panel (a), we first identify via an open-loop simulation the expected performance of the employed optimisation method in presence of limited transfer time 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 ∆ Ω = 10. Our experimental results (see panel b) achieved via closed loop optimisation support these results for small detuning, when T /T π = 1.5. Each optimisation, performed for a certain gate time and a certain detuning, bases on a DCRAB algorithm with 6 superiterations. Exemplarily, we show in Fig. 2 (c,d) the full closed-loop 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 Supp. Mat. Section A). The necessary time for achieving optimal fidelities depends on the accuracy of the tomography measurements (F cl ex ). We achieve the maximal fidelity of 1.00 with an accuracy of 10 −2 on a reliable timescale of about 2000 seconds. It is interesting to note, that any optimal pulse of the open-loop simulation was not able to beat the results of our closed-loop strategy in the case of moderate detuning. The best fidelity achieved via open-loop techniques (F ol th ) is marked in Fig. 2 (b) and is only on the order of 0.6.
Hadamard gate fidelity auto-calibration. A π 2 -gate is the basic block of generating coherent quantum processes like quantum metrology and quantum computing. To show the capabiliites of our concept, we subsequently optimized the quantum gate which is a Hadamard gate up to a global phase. In accordance to the first experiment, we first performed the experiment with no detuning and second, when a detuning of 8.125 MHz (relative detuning ∆ Ω = 0.7) was applied. The results are shown in Fig.3. To quantify the perfo- mance of the evaluated microwave pulse with respect to the defined quantum gate G, quantum process tomography was used (for details see Supp. Mat. Section 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 4 times longer due to additional measurements, which are necessary for complete process tomography.
Discussion and Outlook. Our experimental results demonstrate that the closed-loop feedback control overcomes static and unknown system errors to achieve the high fidelity autonomous calibration of single quantum gates that is necessary for future quantum technologies with room temperature solids. Our approach of the closed-loop optimisation uses minimal control resources and experimental knowledge that are accessible for users. The total time, required for autonomous cal-ibration, is mainly determined by the duration of quantum tomography measurement and not by the optimisation algorithm. Hence, a significant speedup 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 [27]. In addition to the autonomous calibration, our demonstrated closed-loop optimisation features stabilisation mechanism against experimental drifts, for instance due to a misalignment of the permanent magnet used to lift the ground state degeneracy. Our procedure presented in this letter is not limited for application to single-qubit operations only. Further experimental implementations towards multi-qubit gate autonomous calibrations are in principle feasible using our closed-loop optimisation method.
istry 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 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.

A. Dressed CRAB Algorithms
The chopped random-basis algorithm (CRAB) is originally proposed to provide one simple yet powerful numerical optimisation method for controlling complex quantum many-body dynamics, where the gradient of the figure of merit to be optimised is hard to obtain and the controlling apparatus is realistically bandwidthlimited [1,2]. Recently, an extended version of the algorithm, namely the dressed CRAB (DCRAB), has been developed to tackle possible local minima or false traps in the optimisation landscape [3]. The standard version of CRAB algorithm has experimentally been implemented and adapted in various physical systems, for instance in nitrogen-vacancy (NV) centre in diamond for precise spin controls beyond rotating-wave-approximation (RWA) [4], in ultra-cold atoms in optical lattice for controlling quantum phase-transition from a superfluid to a Mott insulator [5], in a non-classical state of Bose-Einstein condensate (BEC) [6], in superconducting qubits [7,8], and in a hybrid system of BECs and cold atoms in optical lattice [9]. A theoretical relation to quantum speed limit in many-body quantum system has also been studied [10].
Here, we elaborate the DCRAB algorithms adapted for our current work on the real-time close-loop optimisation of NV electron spin control. To begin with, we provide in Fig. 4 a sketch of the open-loop and closed-loop optimisation methods.The closed-loop method offers users the ability to obtain an optimised control pulse for manipulating the system without having a full access to the complete information about it.
Given an unoptimised microwave pulse as a guess pulse Γ 0 (t), that controls the NV electron spin ground state, the DCRAB algorithm iteratively finds an updating pulse g j,k c (t), which gives an optimal pulse Γ(t) j,k = Γ 0 (t) × g j,k c (t), such that a certain figure of merit F j,k = F j,k [Γ(t) j,k ] is maximised (or minimised, if one uses 1 − F j,k ), for a predetermined and fixed duration of time t = T . Here, we use j to denote the update which can be either function evaluation or iteration, [24] and k to represent super-iteration. In a direct search method introduced later in this section, the figure of merit does not necessarily improve over a number of increasing function evaluations, nevertheless, it is not decreasing. The typical examples of figure of merit are state-to-state or state fidelity, quantum gate fidelity, and entropy of entanglement [2]. Following Ref. [3], one may expand the updating pulse g j,k c (t), as a j,k n sin ω j,k n t + b j,k n cos ω j,k n t.
where N is commonly termed as a number of DCRAB frequency components, and ω j,k n = 2π(n + r)/T is a ran- An optimised or a guess pulse Γ0 (t), is fed into an optimal control algorithm (as gold, and in our work this is DCRAB algorithm). For each update (denoted by j, and can be either function evaluation or iteration), the open-loop method (red) uses a system dynamics simulator, e.g. a personal computer (PC) or a cluster of PCs, to numerically provide a single optimised figure of merit F j . The simulator requires a set of information obtained indirectly from the actual physical system: a controllable Hamiltonian H, a systemenvironment interaction model L, and a description of noises or errors E. If the numerical F j reaches a certain target value, the process is terminated and the final optimised pulse Γ (t), is passed to the actual physical process. In case the set of information from the actual physical system is not available or can only be partially obtained, one can resort to the closed-loop optimisation method (blue). The actual physical system acts as a simulator which outputs the actual F j . If the target F j is satisfied, the desired process is directly started. In principle, both methods can be used complementarily as a hybrid method.
domised frequency due to a random number |r| < 0.5 [4]. The function λ(t) is a predetermined function limiting the update pulse to be zero at t = 0 and t = T . It allows for a smooth ramping at the beginning and at the end of the pulse. This limiting function is flexibly chosen and its parameters depend on some experimental factors, e.g. the resolution of the controlling apparatus (see Ref. [4] for further details). For each super-iteration (after a certain number of function evaluation j = J), DCRAB performs re-optimisations by transforming the updating pulse g J,k−1 c → g J,k−1 c + g J,k c , where the parameters {a J,k n , b J,k n } remain the same, while the randomised frequencies are updated ω J,k−1 n → ω J,k n . From Eq. 4, one finds that the optimisation problem is reduced to a search problem: "Find a set of parameters {a j,k n , b j,k n }, which maximises F j,k , given that the DCRAB frequency components does not change at every function evaluations or iterations (i.e. {a j,k n , b j,k n , ω j,k n } → {a j+1,k n , b j+1,k n , ω j,k n })." In principle, any direct search algorithm can be employed to solve this problem, such as Nelder-Mead or simplex algorithm [11], Powell algorithm [12], and pattern search algorithm [13]. Here, we employ the Nelder-Mead (NM) algorithm since it has shown its strength in optimizing various unconstrained minimization problems [14,15], and has been implemented and efficiently tested in many code libraries, e.g. PYTHON [16] or MATLAB [17]. We encode the DCRAB method with the NM algorithm in PYTHON, and directly embed it on a PC interfaced with the microwave control apparatuses, for instance an arbitrary wave generator (AWG) [18]. A numerical evidence of the DCRAB capabilities is depicted in Fig. 5 which shows two instances of a control landscape. Control landscapes display the quality (e.g. fidelity) of an optimisation as a function of the control variables [19][20][21]. Here, the control variables are the amplitude and phase of a sinusoidal curve. Due to the limited function space to be explored at a time, the algorithm might get trapped at a sup-optimal point in the landscape. Further sub-optimal points may be induced by restrictions unavoidably imposed by the lab environment such as limited bandwidth, control power limitations, and noise occurring at various stages throughout the experiment. By moving on to the next super-iteration and hence doing a basis change (see arrow in the figure), the trap is unlocked with probability one allowing the algorithm to proceed and converge to a global optimum [3].

B. Quantum State Tomography
In our experiments the quantum system of interest is defined by the NV centre's ground state spin levels |m s = 0 and |m s = −1 . An experimentally prepared density matrix ρ, is measured by performing two Rabi experiments each with orthogonal rotation-axis x and y, and initial state ρ. The rotation axis is controlled by the phase of the resonant microwave control. In the case of the x-rotation [22], after measuring the popula-tion P (|0 , t) in the state |m s = 0 , we observe that In the case of the y-rotation, we have Here, the applied microwave duration is denoted by t, and the initial density matrix is given by Therefore, we identify the entries of the initial density matrix ρ by fitting the experimentally observed Rabi oscillations to the described model. To guarantee an allowed density matrix, we use quadratic maximum likelihood estimation to extract the density matrix, which is parameterised accordingly by Here, S x and S y are the spin-1/2 operators. We identify the error of the estimation of a single entry of ρ, by

C. Fidelity Estimation: Optimising State Transfer
The fidelity of the state transfer |m s = 0 → |m s = −1 (|−1 ), is estimated by the following tasks: (i) initialising the system in |m s = 0 (|0 ), (ii) applying the gate, and (iii) performing quantum state tomography. The fidelity is given by

D. Fidelity Estimation: Optimising a Hadamard Gate
The fidelity of a gate is estimated by firstly initialising the system in one of the four states, ψ 1 = |0 , ψ 2 = |−1 , . It is then followed by applying the gate, and applying the inverse of the ideal gate. Lastly, the population according to the initial state ψ i , is measured by quantum state tomography. If the final state matches the initial state, the the actual gate reaches the ideal gate. After applying this process for the full set of initial states ψ i , the fidelity F , is estimated by where E(·) denotes the expectation value, and σ(·) is the standard deviation. The single qubit rotations that is necessary for the initialisation are repetitively calibrated. The corresponding fidelity is above 99.8%.

F. Realistic Parameters Analysis
We perform numerical simulations on the optimised population inversion for a certain range of predetermined detuning ω, and control time T , to demonstrate the robustness of the DCRAB algorithm. The simulated detuning is in the unit of Rabi frequency ω r , and we use T π , to denote the control time of the theoretical rectangular π-pulse with no detuning. The result of the simulations is presented in Fig. 2(a) in the main manuscript. The Hamiltonian used in the simulations is The control amplitudes Γ x (t) and Γ y (t), are constrained by a condition of |Γ x (t) + Γ y (t)| ≤ 1, ∀t, which corresponds to the voltage output limit of the AWG used in the experiment. In performing the simulations, the algorithm and its parameters (e.g. the total number of function evaluations and super-iterations, the update parameters, the algorithm stopping criteria, and the pulses bandwidth) are taken to be the same as those used for generating the real pulse in the closed-loop optimisation experiment. Each of the fidelities, shown in Fig. 2(a) in the main manuscript, are the average fidelities over 20 independent runs of initialisation and optimisation.
Finally, the set of pulses obtained from the simulation for T = 1.5 × T π , are directly applied to the experiment without any further closed-loop optimisation, and yields a state inversion fidelity of less than 0.6. This significant drop in fidelity is due to the experimental imperfections, the unknown system parameters, and the possible further constraints which are always present at any realistic setup. On the contrary, the closed-loop control optimisations take all the above-mentioned factors into account, and hence provide far better results.