Adaptive Bayesian algorithm for achieving desired quantum transition

Bayesian methods which utilize Bayes' theorem to update the knowledge of desired parameters after each measurement, are used in a wide range of quantum science. For various applications in quantum science, efficiently and accurately determining a quantum transition frequency is essential. However, the exact relation between a desired transition frequency and the controllable experimental parameters is usually absent. Here, we propose an efficient scheme to search the suitable conditions for a desired quantum transition via an adaptive Bayesian algorithm, and experimentally demonstrate it by using coherent population trapping in an ensemble of laser-cooled $^{87}$Rb atoms. The transition frequency is controlled by an external magnetic field, which can be tuned in realtime by applying a d.c. voltage. Through an adaptive Bayesian algorithm, the voltage can automatically converge to the desired one from a random initial value only after few iterations. In particular, when the relation between the target frequency and the applied voltage is nonlinear, our algorithm shows significant advantages over traditional methods. This work provides a simple and efficient way to determine a transition frequency, which can be widely applied in the fields of precision spectroscopy, such as atomic clocks, magnetometers, and nuclear magnetic resonance.


Introduction
The Bayesian approach, which relies on updating the knowledge of the probability distribution after each measurement through Bayes' theorem, can achieve a better precision [1,2,3,4]. Bayesian methods have been widely used in quantum information applications and experiments, such as quantum phase/frequency estimation [5,6], quantum state discrimination or estimation [7,8], Hamiltonian learning [9,10] and etc [11,12,13,14,15]. Energy levels are the distinctive property of a quantum system, which can be used as a reference for studying its structure. Conversely, given the energy levels of a quantum system, one can manipulate the transitions among different levels via applying external fields [16]. In order to observe and explore most quantum phenomena, certain desired transitions should be achieved, in which the external fields are required to be tuned in a sophisticated manner [17].
On one hand, the external fields are associated with some specific experimental parameters and their exact relation needs to be determined by fitting a large amount of results. On the other hand, the windows of the experimental parameters are usually very narrow compared to the adjustable range. Nevertheless, tuning these parameters in manual makes it inconvenient to find the optimal conditions. An essential question therefore arises: is there any efficient way to automatically obtain the suitable experimental parameters for a desired transition?
As one of the notable phenomena, coherent population trapping (CPT) has been extensively studied [38,39,40,41,42,43] and widely used for realizing compact high-precision atomic clocks and magnetometers. The CPT is often produced by a two-photon Raman excitation process. At the two-photon resonance, atoms are optically pumped into a dark state, which can be used for frequency estimation. By applying external magnetic fields, the magnetic sublevels are split and one can observe magneto-sensitive CPT signals. The tunable external fields act the role of additional control parameters, and adaptive protocol provides a tool to search the optimal conditions. In this article, we propose an efficient scheme to automatically search a desired quantum transition via an adaptive Bayesian algorithm, and experimentally demonstrate it via CPT in an ensemble of laser-cooled 87 Rb atoms. In our experiment, the desired quantum transition is the magneto-sensitive one between the two hyperfine levels of the 5 2 S 1/2 ground state. We use the lin||lin CPT configuration to realize a highcontrast of dark resonance. When the frequency difference between the bichromatic field components matches the hyperfine splitting, two-photon dark resonances of Λ-type systems on the hyperfine levels will be induced. Here, the two-photon resonance of |F g = 1, m F = −1 and |F g = 2, m F = −1 is used and its transition is controlled by an external magnetic field. Through an adaptive Bayesian algorithm, the voltage (which determines the amplitude of external magnetic field), can automatically converge from a random initial value to the desired one only after few iterations. We experimentally demonstrate our adaptive Bayesian algorithm and find it is effective and efficient. If the relation between the target frequency and the controlled voltage is linear, similar to the traditional method, our algorithm can automatically search the desired voltage. The robustness of our algorithm against noises come from observed CPT spectra as well as the fluctuation of controlled voltage is also demonstrated. While in the situation where the relation between the target frequency and the controlled voltage is nonlinear, the converged standard deviation obtained via our algorithm show a significant improvement compared to the traditional method.
2 Magneto-sensitive coherent population trapping of Rubidium atoms Under the lin||lin CPT configuration, the directions of linear polarization of the two CPT frequency components are parallel each other and orthogonal to a tiny static magnetic field [38,40,42]. Fig. 1 (a) shows the coupled energy levels of 87 Rb atoms. For magneto-insensitive transitions, the bichromatic field simultaneously coupled the atoms via two separate Λ systems of σ + and σ − transitions connecting the ground state sublevels |F g = 1, m F = ±1 and |F g = 2, m F = ∓1 with the excited state |F e = 1, m F = 0 , respectively. The first-order Zeeman shifts of the two Λ systems have equal strength but with opposite sign. Both Λ systems contribute to the central magneto-insensitive resonance (red solid arrows). For magneto-sensitive transitions, the bichromatic field accordingly couples the atoms via a Λ system connecting the ground state sublevels |F g = 1, m F = −1 (|F g = 1, m F = 1 ) and |F g = 2, m F = −1 (|F g = 2, m F = 1 ). Therefore, the CPT resonances yield two microwave magneto-sensitive transitions between |F g = 1, m F = ±1 and |F g = 2, m F = ±1 (dashed arrows). We use a five-level model to describe the system and label the five levels as (see Fig. 1 (a)): The time-evolution of the system is governed by the Liouville equation for the density matrix [44], where the Hamiltonian with the parameters Here, Ω a and Ω b are the Rabi frequencies, ∆ = δ 1 − δ 2 and δ = (δ 1 + δ 2 )/2 where δ 1 and δ 2 correspond to the single-photon detuning of the two laser fields. g 1 = −0.5017 and g 2 = 0.4997 are the effective Landé g-factors, µ B is the Bohr magneton, and B z is the magnetic field along the z axis that causes the Zeeman shifts. Under the weak magnetic field B z involved in experiment, the Zeeman sublevels are assumed to undergo only the linear Zeeman shifts. The termρ src accounts for the influx of atoms into the ground states due to the decay from excited state, which is defined aṡ where Γ 1 and Γ 2 are the damping rates decaying from the excited states to the ground states |F = 1 and |F = 2 . Generally, Γ 1 + Γ 2 = Γ. The decay between the ground states are neglected here.
We can solve the time-dependent element ρ ij (t) (i, j = 1, 2, 3, 4, 5) according to Eq. (2). For 87 Rb atom, the damping rates Γ = 2π × 6 MHz, Γ 1 = Γ/4, Γ 2 = 3Γ/4, and the Rabi frequencies Ω a = √ 3Ω 0 , Ω b = Ω 0 with Ω 0 = 2 MHz. Initially, the atoms are equally populated in the four ground states |1 , |2 , |3 , and |4 . The duration of the CPT pulse is set as τ = 1 ms, which is sufficiently long to reach the steady state. 1 − ρ 55 characterizes the absorption of light after passing through the atoms. Through calculating the final population in the excited state ρ 55 (τ ) for different detuning ∆, we can use the normalized amplitude of (1 − ρ 55 ) to describe the CPT resonances. The observed CPT spectra is shown in Fig. 1 (b). Fig. 1 (c) depicts the schematic of the experimental apparatus. The system consists of a three-dimensional magneto-optical trap (MOT), a CPT laser system and an adaptive controller. The MOT apparatus comprises an ultra-high vacuum cell with pressure of 10 −8 Pa, a quadruple magnetic field produced from a pair of magnetic coils, and laser beams. Typically, the MOT can trap about 10 7 87 Rb atoms with a 100 ms cooling period. The CPT beam is generated by a single laser passing through an electro-optic phase modulator (EOM). The CPT laser source is an ECDL tuned to the 87 Rb D1 transitions at 795 nm. The laser beam is split into two parts by a half-wave plate and a polarization beam splitter (PBS). One beam is used to offset lock the laser frequency to the transition between |F g = 2 and |F e = 1 with saturated absorption spectroscopy (SAS). The other beam is sent to a fiber-coupled EOM modulated by a microwave at 6.835 GHz. The positive first-order sideband forms the Λ systems with the carrier. The output of the EOM is split into two parts by a half-wave plate and a PBS. The reflected beam is sent to a Fabry-Pèrot (FP) cavity that monitors the intensity of sidebands generated by the EOM, and the powers of the first-order sidebands are set equal to that of the carrier signal. Due to far detuned from any resonances, the extra sidebands do not contribute to the CPT signal. The transmitted beam is sent to a double-pass acousto-optic modulator (AOM) that shifts the optical frequencies to resonances and switches on or off the CPT beam. Then the beam is coupled into a PMF. After the fiber, the CPT beam is collimated to an 8-mmdiameter beam and sent through a Glan prism to purify the linear polarization.
After the Glan prism, the available laser power is hundreds of microWatt. Then, the CPT beam is separated equally into two beams by a halfwave plate and a PBS. One beam is sent to the normalization photodetector (PD2) which is used as a normalization signal to reduce the effect of intensity noise on the CPT signals. Another beam is sent to interrogate the cold atoms, and the transmitted light is collected on the other photodetector (PD1). The coherent beam is turned on with 1 ms latency time after turning off the MOT. The transmitted and normalized beams are synchronously measured with corresponding photodetectors (denoted by S T and S N ) during the CPT pulse. Finally, the CPT spectra are obtained from the signal S T /S N . In order to eliminate the stray magnetic field, three pairs of Helmholtz coils are used for compensation. To create the bias magnetic field, we employ an additional pair of Helmholtz coils aligned with the direction of the CPT laser beams. By controlling the coils (whose currents are determined by a d.c voltage U ), the strength of the bias magnetic field can be precisely tuned.
We focus on the magneto-sensitive CPT resonances. Since the spectrum is symmetric with respect to ∆ = 0, we only consider the magnetosensitive transition in the negative detuning regime. In Fig. 2, the observed experimental results (blue dots) and the corresponding numerical calculations (red lines) for the magneto-sensitive CPT resonance are shown. The numerical simulation matches well with the experimental results. In the middle of the peak, the spectrum is in Lorentz lineshape, which can be fitted by a Lorentz function. The location of the center is the target frequency we desire. We denote the desired frequency (corresponding to a certain detuning value) as f d , which we need to achieve in experiment.
Generally in experiments, the magnetic field amplitude B z is proportional to the applied voltage U , i.e., B z ∝ U . In order to find out the desired voltage U d corresponding to the target frequency f d , we can calculate the normalized transmission spectrum for different B z and extract the relation f d = g(U d ) numerically. However, in practice, one should adjust the voltage and measure the corresponding frequency to obtain a relation f d = g(U d ), and finally determine the applied voltage by the inverse function, i.e., In order to collect sufficient data for fitting the relation f = g(U ), a large amount of center frequency f should be experimentally measured at different values of voltage U in manual, and the value of f d should be averaged over a large amount of data to reduce the deviation. Besides, if the relation between the target frequency and the voltage is not linear, this traditional method becomes inconvenient in finding suitable fitting function g(U ), as shown in the following Sec. 3.

Adaptive Bayesian algorithm for searching a desired transition frequency
In this section, we will show how to automatically obtain the suitable experimental parameters for a desired transition via the adaptive Bayesian algorithm. We accomplish this task in virtue of an adaptive controller. The adaptive controller is realized with the help of a computer that includes an adaptive Bayesian algorithm and controls over the experimental parameters via digital I/O devices (NI 6536 and NI 6733). The bias magnetic field strength is set via a voltage controlled current source and the applied voltage U is controlled by the computer. The control system is implemented in both Python and LabVIEW which transfer data via TCP sockets. The Lab-VIEW program controls the digital I/O devices to obtain the CPT spectra and change the applied voltage value automatically. The Python program operates the adaptive Bayesian algorithm that updates the applied voltage in realtime. The adaptive Bayesian algorithm could automatically find the suitable voltage U d for generating the bias magnetic field corresponding to the magnetosensitive CPT transition centered at f d . In the following, we introduce the algorithm procedure in detail and present the experimental demonstration.

Adaptive Bayesian algorithm
Our adaptive Bayesian algorithm for each iteration includes the following key steps [22,32].
• Step 1: Input a voltage (the k-th voltage is denoted by U k , the initial input voltage U 0 is randomly chosen) and sweep the detuning to obtain the magneto-sensitive CPT signal, which is fitted by a Lorentz lineshape function involving four fitting parameters A k , w k , k and B k . • Step 2: Normalize L k (f ) asL k (f ), wherẽ L k (f ) becomes ranging from 0 to 1, i.e., RegardL k (f ) as a probability distribution.
If the probability at the target frequencỹ L k (f d ) > 0.5, the likelihood function remains the same, i.e.,L k (f ) =L k (f ). If the probability at the target frequencyL k (f d ) ≤ 0.5, the likelihood function becomesL k (f ) = 1 −L k (f ).
• Step 3: Calculate the normalized likelihood probability distribution, According to the measured probability distribution P k (f ), obtain the posterior probability distribution, where the k-th prior probability distribution is the (k − 1)-th posterior probability distribution, i.e., P P rior k (f ) = P P ost k−1 (f ). Usually, there is no pre-knowledge about the unknown parameter available, the initial uninformative prior is a uniform probability distribution, i.e., P P rior  (10) and its standard deviation Step 5: Adjust the voltage of the next step according to the measured probability distribution P k .
The rule for adjusting the voltage at each step is given as where and δU is a variation step for the voltage, δf is a frequency deviation from the desired frequency f d .
Here, the voltage for the next iteration is adapted according to the current likelihood. The direction of the variation is determined by s which is related to the two probabilities located oppositely respect to P k (f d ), and the frequency deviation δf can be feasibly chosen. h reflects the competition between the difference If the mean of the current likelihood is far from f d , h becomes large and vice versa. In practice, h is restricted in a modest range, i.e., h min ≤ h ≤ h max . The variation step δU/k is decreased as k, and δU can be chosen feasibly in experiment. This rule guarantees the efficiency of our adaptation.
When k is modestly large, the mean frequencȳ f k will converge to the desired frequency f d with reduced standard deviation ∆f k . Meanwhile, the converged voltage will be close to the desired condition for achieving the magneto-sensitive transition with frequency f d . Finally, the average of the converged voltage for the last few iteration num- ber can be given as the suggested applied voltage U d .
In Fig. 3, we perform the numerical simulation to see how it works. First, the initial voltage is chosen as U 0 = 8.5 V. The prior for the first iteration P P rior 1 (f ) is a flat distribution, see the blue line in Fig. 3 (a). We obtain the magnetosensitive CPT signal and normalize it as the like-lihoodL k (f ). SinceL k (f d ) > 0.5, the likelihood remains asL k (f ) =L k (f ). According to Eq. (8), we calculate the normalized likelihood probability distribution P 1 (f ), see the orange line in Fig. 3 (b). Then, according to Eq. (9), we obtain the posterior P P ost 1 (f ) and the posterior becomes the prior for the second iteration. The voltage for the second iteration U 2 is determined by P 1 (f ). Since P 1 (f d − δf ) < P 1 (f d + δf ), the central frequency is on the right side of f d . Thus, s = 0 and U 2 should be increased according to Eq. (12). h controls the variation amplitude. We choose h min = 0.2 and h max = 2 to restrict the minimum and maximum variation amplitude for simulation. Similarly, the probability distributions for other iterations can be obtained step by step, see Fig. 3 (b)-(f). Here, we choose δU = 2 V, δf = 42 kHz.

Experimental demonstration
Next, we perform the experimental demonstration. Through implementing the adaptive Bayesian algorithm, we can obtain the suggested voltage for a desired magneto-sensitive transition frequency, as shown in Fig. 4.
Initially, there is no prior knowledge. The mean and standard deviation for N = 1 are calculated from a CPT spectrum of random initial voltage. Generally, its standard deviation is large and its mean deviates severely from the target. At this moment, we get a rough information for the target frequency and the applied voltage. Continually, more CPT spectra for different applied voltage are observed in experiment. Based on the earlier outcomes within the measurement sequence, the knowledge of the target frequency on the applied voltage can be gradually acquired.
As the iteration number becomes larger, more CPT spectra close to the target frequency are observed, the mean of the estimated frequency will locate closer and closer to the target frequency, and the voltage tends to be stable (see Fig. 4). Meanwhile, the standard deviation of target frequency can be reduced dramatically after limited number of iteration [see Fig. 5 (a)]. Due to involving multiple products among many similar probability distributions, the posterior probability distribution becomes narrower when the iteration number increases, see Fig. 5 (b). If the posterior probability after iteration is standardized to ranging from 0 to 1, a narrower CPT spectrum for the desired magneto-sensitive transition will be obtained. The average of the voltage for the last few iteration number U d = M N =K U N /(M − K + 1) can be used for achieving the desired magnetosensitive transition at target frequency f d . Here, we choose the last ten iteration number, where K = 41 and M = 50. Our method is simple and straightforward. Be-fore the experiment, one can know little about the relation between the applied voltage and the target frequency. The initial voltage can be chosen randomly. The random choice of initial conditions provides huge feasibility for practical applications, even in other experimental systems. In addition, the standard deviation always dramatically decreases after limited iterations for different trials. Here, our algorithm is verified in the standard case where the relation between the target frequency and the applied voltage is linear.
To test the robustness of our algorithm, we take into account the noises in two different ways. Firstly, we consider the observed CPT spectra become noisy, see the lower inset of Fig. 6 (b) whose signal-to-noise ratio of the CPT spectra is reduced compared to the one of Fig. 6 (a). Despite the CPT spectra become noisy, it can still converge to the target frequency and the corresponding standard deviation remains the same level after limited iterations compared to the case with normal CPT spectra as shown in Fig. 6 (a). Secondly, we proactively add a small amount of stochastic white noise to each of the applied voltage, i.e., U k → U k + U where U ∈ [−0.05V, 0.05V ] and U = 0. As shown in Fig. 6 (c), the applied voltage can still converge to the desired one. By contrast, using traditional method that manually extracting the relation f d = g(U d ) by fitting [see the inset of Fig. 6 (c)], the standard deviation (the red errorbar) is about 6.2 kHz, which is nearly 6 times larger than the one obtained via our algorithm. The experimental results show that our algorithm is more robust against different noises. Furthermore, the advantage of our adaptive Bayesian algorithm becomes significant when the relation between the target frequency and the applied voltage becomes nonlinear. To test its validity, we consider the situation where the target frequency f d is a quadratic function of the applied voltage U d , i.e. f ∝ U 2 . To get this relation, we set the voltage-controlled current as a quadratic function of U d via LabVIEW program. As shown in inset of Fig. 6 (d), by manually varying the applied voltage and obtained the corresponding CPT spectra, one can roughly extract the relation f d = g(U d ) by fitting. The obtained standard deviation is about 16.3 kHz (the red errorbar). Instead, by using our algorithm, although the speed

Conclusions and discussions
We have experimentally demonstrated how to automatically search a desired quantum transition by an adaptive Bayesian algorithm. Our algorithm is based on the Bayes' theorem that the main features can be inferred effectively through updating the probability distribution after each measurement. The adaptivity can effectively search the desired magneto-sensitive transition condition from a random initial one only after few iterations. In particular, if the relation between the target frequency and the controlled parameter is nonlinear, our algorithm can be much more effective and efficient than the traditional methods. Our adaptive Bayesian algorithm can be applied in many practical scenarios.
Firstly, this simple and efficient method for determining a desired transition frequency can be widely applied to precision frequency measurement such as developing practical CPT-based clocks [45,46,47,48]. On one hand, the narrower posterior probability can improve spectral resolution. On the other hand, our adaptive Bayesian algorithm can optimize the experimental conditions to reduce the systemic shifts, such as searching the zero magnetic field point.
Secondly, exchanging the roles of the transition frequency and the magnetic field, our CPT experiment with adaptive Bayesian algorithm can be inversely designed to probe an unknown static magnetic field B s . For the magnetosensitive transition we used, the target frequency f d = −2γB z with γ the gyromagnetic ratio of 87 Rb atom [49]. By implementing our adaptive Bayesian algorithm, the measured magnetic field B z = −f d /(2γ) is the sum of the unknown static magnetic field B s and the applied magnetic field B d . Since B d is proportional to U d , the unknown static magnetic field can be deduced by the rela- Thirdly, the adaptive Bayesian algorithm can be widely extended to various physical systems where some certain controllable parameters can be introduced for adaptation. Our algorithm may be improved to the cases of multiple controlled parameters. The adaptation of controllable parameters can be modified according to the idea of gradient descent and so that the Bayesian method can further speed up the iteration procedure. For more complicated cases, the experiment-design heuristics for the adaption can also be efficiently obtained via neural-network techniques [17].