Quantum Force Sensing by Digital Twinning of Atomic Bose-Einstein Condensates

High sensitivity detection plays a vital role in science discoveries and technological applications. While intriguing methods utilizing collective many-body correlations and quantum entanglements have been developed in physics to enhance sensitivity, their practical implementation remains challenging due to rigorous technological requirements. Here, we propose an entirely data-driven approach that harnesses the capabilities of machine learning, to significantly augment weak-signal detection sensitivity. In an atomic force sensor, our method combines a digital replica of force-free data with anomaly detection technique, devoid of any prior knowledge about the physical system or assumptions regarding the sensing process. Our findings demonstrate a significant advancement in sensitivity, achieving an order of magnitude improvement over conventional protocols in detecting a weak force of approximately $10^{-25}~\mathrm{N}$. The resulting sensitivity reaches $1.7(4) \times 10^{-25}~\mathrm{N}/\sqrt{\mathrm{Hz}}$. Our machine learning-based signal processing approach does not rely on system-specific details or processed signals, rendering it highly applicable to sensing technologies across various domains.


Introduction
In recent decades, quantum technologies have made remarkable strides, culminating in the emergence of quantum sensing techniques that enable high-precision detection at the microscopic level.Quantum sensor leverages quantum resources to detect subtle changes in physical quantities such as time, force, and electromagnetic fields, providing extreme precision at the atomic scale [1][2][3].These implementations have been successfully realized across diverse platforms, including cold atoms [4,5], superconducting circuits [6], and solid-state spin systems [7].Recently, progresses in quantum sensing highlight its capability for real-world applications such as precision navigation [8], gravity detection [9], dark matter searches [10] and others [11,12].However, they are often facing challenges associated with both hardware setup and software processing, limiting the practical applications.While hardware upgrades have demonstrated the capability to enhance sensing performance [12][13][14][15], software approaches like information compilation and data analysis offer an alternative path to improve the sensitivity of high-precision detection.In this work, we are dedicated to improving sensitivity through a machine-learning-assisted method, emphasizing the crucial role of advanced information processing in sensing applications.
Earlier computational approaches have employed statistical learning of signal acquisition from sensing observable taking into account the inherent noise and variations [16][17][18].In recent years, machine learning approaches have been used for signal selection [9,20] and sensing-related analysis with anomaly detection [21,22].Nevertheless, these methods often demand a substantial amount of sensing data or rely on prior knowledge of signal and noise properties, thereby still limiting their applicability.More recently, the concept of digital twinning has gained significant attention as a powerful tool for simulating and understanding complex physical systems.Digital twinning involves creating a virtual replica or model that mirrors the behavior and properties of a physical system, allowing for real-time analysis, optimization, and prediction.By effectively bridging the physical and virtual realms, digital twinning provides a unique opportunity to improve the overall performance of quantum sensing application.
In this article, we propose an application of digital twinning for quantum force sensing in atomic Bose-Einstein condensates (BECs) [23].Leveraging the advancements in generative machine learning models, we create a digital twin that faithfully represents the atomic BEC system under investigation.The digital twin efficiently captures time-of-flight features affected by intricate correlations and non-linear dynamics of the physical system, enabling us to devise a data-driven approach for quantum force sensing based on anomaly detection.Conventional quantum force sensing techniques often rely on extracting basic statistical moments from high-dimensional experimental data, with the information hidden in the high moments wasted.In contrast, our digital twinning approach incorporates a generative machine learning model to construct a nonlinear function, which takes advantage of the valuable information hidden in the high-dimensional data.This approach allows for improved signal-to-noise ratio and enhanced sensitivity, without compromising the long-term stability of the sensing system.We anticipate that our anomaly detection technique, facilitated by digital twinning, can be broadly applied to sensing experiments involving high-dimensional data acquisition cycles.By maximizing the utilization of high-dimensional data, our approach surpasses conventional techniques that rely solely on basic statistical features, unlocking new avenues for quantum force sensing and precision measurements.

Results
The Bose-Einstein condensate system.We create a bosonic quantum system by trapping about 2 × 10 5 87 Rb atoms.This system forms a BEC at low temperature, about 50 nK in our experiment (Fig. 1).The atomic BEC is loaded in a triangular optical lattice to suppress unwanted real-space dynamics [23].After preparation of the lattice BEC system, the optical lattice and the trapping potential are shut-off, which then let the atoms expand ballistically.Performing the time-of-flight (TOF) technique (see Supplementary Note 2 [24]) in the experiment, we measure the momentum distribution n(k).It takes about T 0 = 38 s to complete one experimental cycle.Details of our experimental setup can be found at Ref. [23].
In the time-of-flight measurements, we have shot-to-shot noise.There are quantum shot-noises, which arise from quantum superposition of different momentum eigenstates due to atomic interactions, trapping potentials, and optical lattice confinement.There are thermal noises.Although the atomic BEC is cooled down to 50 nK, we still have thermally activated atoms.These atoms induce stochastic fluctuations in the measurement outcomes.There are also technological noises.The control of the atom numbers, the trapping potential, and the optical lattice depth are not perfect in the experiment.They may have noticeable or unnoticeable drifts in different experimental runs.As a result, the TOF measurement outcomes in the consecutive experimental runs would unavoidably fluctuate from shot to shot.We thus denote the measurement outcomes as n α (k), with α indexing different experimental runs.In detecting an external force acting on the BEC, a standard approach is to examine the response in the averaged center-of-mass (COM) momentum, i.e., Although the measurement outcome n α (k) is a two-dimensional image, which potentially involves very rich information, the conventional approach of data processing following Eq.(1) only consumes the zeroth and first order moments of the two-dimensional data, leaving behind higher-order correlations.
The digital replica.In order to incorporate the full information in the measurement outcomes, n α (k), one plausible way is to perform digital twinning of the physical system by matching the probability distributions.It then automatically takes into account high-order correlation effects.Since the atomic BEC system in the experiment has noises of various origins, it is impractical to simulate the experimental measurement outcomes using conventional modeling approaches, for example by simulating Gross-Pitaevskii equations [25,26].In this study, we create a digital twinning of the experimental system, by implementing a generative machine learning model, which incorporates quantum, thermal, and technical noise channels simultaneous at equal-footing in a purely data-driven approach.
We implement a generative adversarial network (GAN) [27] for digital twinning of the atomic BEC.GAN consists of a generator G(•) that attempts to map a latent vector z to a realistic data of momentum distribution, G(•): z → ñ(k), and a discriminator D(•) that tries to differentiate the real data, n(k), from the fake data from the generator, ñ(k) = G(z).The two networks are trained simultaneously, with the generator attempting to produce data that can fool the discriminator, and the discriminator learning to correctly identify synthetic data (Methods).The generator and discriminator are realized by two parameterized deep neural networks, denoted as G(z; θ G ) and D(n(k); θ D ).We collect 3.6k independent measurements of momentum distributions for force-free experiments, and feed them to GAN (see Supplementary Note 3 [24]).This amount of data takes about forty hours to collect in experiments, which is reasonably affordable.In Fig. 2.a, we present fake data produced by the generator during training procedure, where the generated data is visually similar to real data, indicating that the model is capable of capturing the underlying data distribution without model collapsing.The trained generator produces a digital replica (Fig.  As in the experimental data that has typical and atypical configurations due to noises, the digital replica also generates typical and atypical configurations.Within the framework of GAN, the degree of atypicality is quantified by an anomaly score, ( The anomaly score combines both residual loss and discrimination loss, serving to quantify the atypicality of an input image n(k) in comparison to its corresponding digital replica ñ(k).Specifically, the residual loss (RL) A R = ∥n(k)− ñ(k))∥ 2 is produced by adding an encoder in front of the generator (Fig. 1), assessing the Euclidean distance between the real image and its corresponding digital replica.The discrimination loss (DL) directly given by the feature layer h(•) of the discriminator (see Supplementary Note 4 [24]).The encoder is trained by minimizing the residual loss.The weighting coefficient λ ∈ R is a hyper-parameter that balances RL and DL.These two components evaluate the discrepancy between fake and real data in terms of image distance and feature discrimination.We choose λ = −0.76 for an optimal sensitivity (see Supplementary Note 3 [24]).For a more in-depth understanding of Eq.( 2), additional detailed interpretations can be found in Method and Supplementary Materials [24].We find that the anomalous score has an approximate normal distribution (Fig. 3.b), which indeed reflects the typicality of momentum distribution data.
Sensing by anomaly detection.When an external force is applied, the physical BEC system then produces TOF data n(k) of different distributions.Conventional sensing schemes examine the response in the COM momentum (Eq.( 1)).The distributions of the COM momentum with and without an external force are different.Force sensing requires differentiating such distributions.When a weak force (F 0 = 7.81 × 10 −26 N in our experiment) is applied, the distribution of COM momentum is only very weakly affected, with a barely noticeable difference from force-free distribution.
With the digital replica, namely the generative machine learning model, we compute the anomaly score A(n(k)), a highly nonlinear function of n(k), that could incorporate higher order correlations of the data.This provides a systematic nonlinear data processing approach, much different from the linear data processing as in analyzing the simple COM momentum.As a result, the anomaly score is much sensitive to the force as it effectively reflects high-order information of the experimental data.The resultant distribution of the anomaly score caused by the weak external force is significantly different from the force-free distribution, in sharp contrast to the COM momentum (Fig. 3.a).Despite the nonlinearity in the data processing, the response of the anomaly score remains to be linear to the external force (Fig. 3.c).
By comparing the distributions of the COM momentum and the anomaly score, it is evident that analyzing the anomaly score, known as anomaly detection in the context of machine learning, is more efficient for detecting the external force applied to the BEC system.
We further investigate the primary characteristics that contribute to the anomaly score in presence of an external force.Specifically, we assess the momentum dependence of the residual loss with the generator G * (•) and the encoder E * (•) being fixed.In Fig. 3.d, we provide six representative atomic images from real experimental datasets labeled with anomaly scores.In Fig. 3.e, we observe bright speckles in n R (k)(commonly referred to as anomaly localization [28]), with these speckles becoming increasingly prominent as the applied force intensifies.This implies the signals contributing to the force sensing mainly come from the large momentum region in the second Brillouin zone.The anomaly localization is consistent with the common understanding in the BEC community that the momentum distribution at small momenta (near zero) is more affected by interaction effects and imaging saturation artifacts, indicating the machine learning model successfully captures the relevant features of the experimental data.Further discussion on model interpretability from the perspective of feature representation [28][29][30] is provided in Supplementary material [24].Our findings regarding anomaly localization, exemplified by the presence of a hexagonal peak structure in the rightmost portion of Figure 3.e, imply that the dominant signal for force sensing originates primarily from high-momentum peaks observed in time-of-flight (TOF) measurements.This could be attributed to the reduced impact of various sources of noise, such as atomic scattering, trapping potential, and thermal activation, on the high-momentum components of the Bose-Einstein condensate (BEC), owing to energy separation.Sensitivity and Stability.In order to quantitatively characterize the advantage of the anomaly detection over conventional approaches, we compute the corresponding sensitivity.A general force sensing process involves a force F to be detected, and a signal q that is directly or indirectly measured in the experiment.In the previous work [23], q corresponds to COM momentum k COM (Eq.( 1)).It corresponds to the anomaly score A (Eq. ( 2)) in the machine learning approach Fig. 4 Sensitivity and stability of anomaly detection.a.The sensitivity distribution of using the anomaly score (blue), center-of-mass (COM) momentum with raw data (green) and reduced datasets (yellow), respectively.In b, the Allan Deviations σ AD [δq/q 0 ] correspond to the anomaly score (AS) and the COM momentum.The momentum difference δq = qt −q 0 represents the signal response, q 0 is the force-free signal and qt is the signal corresponding to the momentum distribution produced by acting the force on Bose-Einstein condensate (BEC).
Both of them decay with the integration time τ , as 1/τ .In c, we compared related works in sensitivity with force F , including measurements based on nano-tube [31], nano-particles [32], trapped ions with phase-coherent velocimetry [33], a single trapped ion with optical clock Doppler velocimetry [34], a 3D-trapped single ion [18], and ultracold atoms in a cavity [2].Note that error bars indicate the one-sigma statistical uncertainty in panel (b) and (c).
reported here.The measured signals q would fluctuate in consecutive experimental measurements due to noises of various channels.We assume the fluctuations in different measurements are completely independent.The strength of the fluctuations is quantified by the standard deviation of q, to be referred to as σ 0 .A single measurement has a fixed time cost of T 0 .The minimum force we can resolve with one single-measurement is given by V min ∼ σ 0 /|∂ V q|.Performing N times of experimental measurements, the signal to noise ratio (SNR) is given by SNR = √ N × |∂ V qV |/σ 0 .The one-sigma sensitivity is defined as (see Supplementary Note 1 [24]) This definition applies to both conventional approaches and the anomaly detection.
Acting linear transformation on q, the sensitivity remains the same according to Eq. ( 4).However, different signals that are related by nonlinear transformations do not necessarily have the same sensitivity.We compare the sensitivities of the COM momentum and the anomaly detection approaches taking exactly the same set of experimental data.For the COM momentum approach, we obtain a sensitivity S COM = 6.8(9) × 10 −24 N/ √ Hz (Fig. 4.a).For the anomaly detection, we have S AS = 1.7(4) × 10 −25 N/ √ Hz.This means the anomaly detection is about 40 times more sensitive than the COM momentum approach.
We emphasize that in the above comparison we use the raw experimental data without invoking any prior knowledge of the physical process.The anomaly detection approach is thus entirely data-driven.We further examine how much the conventional COM momentum approach can be improved by machine learning based noise reduction.We perform Gaussian processing prior to extracting the COM momentum (see Supplementary Note 5 [24]).The resultant sensitivity can be improved to S COM r = 1.6(4) × 10 −24 N/ √ Hz (Fig. 4.a).But this is still one-order-of-magnitude worse than our anomaly detection.
In Figure 4.c, we show the comparison of the achieved sensitivity of digital twinning atomic BEC with previous experiments, including phase-coherent velocimetry [33], cold atoms in a cavity [2], and trapped ions [18].Our achieved force sensitivity shows orders-of-magnitude improvement over other experiments.It is worth to mention that the digital twinning and the anomaly detection techniques developed here are quite generic.These techniques are readily applicable to improve the sensitivity of other experimental setups as well.
For quantum force sensing, it is also important to have long-term stability besides the high sensitivity.This is captured by the Allan Deviation [35], which is widely used to examine long-term drifts.We confirm that the Allan Deviation of the anomaly detection falls off with the integration time (τ ) as 1/ √ τ , having the same scaling as the Allan Deviation of the COM momentum (Fig. 4.b).
It is thus evident that no long-term drifts are induced by the nonlinear data processing in anomaly detection.The 1/ √ τ decay also implies the fluctuations of the anomaly score are mainly white noise, which justifies the above definition of sensitivity.It is worth noting here that the sensitivity can also be enhanced by choosing the high dataquality region of the TOF measurements according to the impulse theorem, as used in a previous study [23].Such analysis requires certain prior information of the force, and gives a sensitivity comparable to the present anomaly detection approach.Nonetheless, we emphasize that the anomaly detection approach is purely data driven, and is consequently more robust against longterm drifts in experiments.The improvement in the long-term stability is evident by comparing the Allan Deviation of the anomaly detection to the pervious study [23].In the previous study, the Allan Deviation bends up at a time scale of τ = 10 4 s, whereas it keep decreasing following 1/ √ τ even at the time scale of 4 × 10 4 s.

Discussion
In this study, we present an unique method for quantum force sensing using digital twinning of atomic BEC and anomaly detection facilitated by a generative machine learning model.By incorporating complex correlation effects present in the experimental data through nonlinear processing, we achieve a significant enhancement in sensitivity while maintaining long-term stability.
Unlike conventional approaches that rely on extracting basic statistical moments from highdimensional data, such as time-of-flight (TOF) measurements in BEC, our anomaly detection approach employs a neural network-based nonlinear function, denoted as f NN (x), to fully exploit the information within the high-dimensional data.Through extensive training and iterative refinement, this methodology effectively amplifies the signal-to-noise ratio, as confirmed by convergence in sensitivity with increasing training data (see Supplementary Note 6 [24]).
Our findings reveal an intriguing aspect: the sensitivity of a physical sensor is intimately tied to the data processing strategy, denoted as S[f NN ].This implies the existence of an upper bound, which represents the maximum achievable sensitivity attainable by a given sensor configuration.
It is worth mentioning that the role of the digital twin in our framework mimics data behavior in sensing responses, which could be further advanced by a viable generative machine-learning model.The determination of this upper bound warrants further investigation in future research endeavors.
The other important direction is to investigate the fundamental quantum limits of the anomaly detection approach.How the optimal sensitivity S opt is fundamentally limited by the quantum shot-noise, and its scaling with the number of atoms in the BEC or the imaging resolution, are worth further theoretical studies.

Generative Adversarial Networks
Our primary objective is to leverage Generative Adversarial Networks (GANs) as generative models to construct digital replicas of our experimental data x ∼ P 0 (x).To begin, we collect a set of raw observables X = {x 1 , x 2 , x 3 , ..., x N } obtained from N independent experiments.In our force sensing setup, we have 3,600 two-dimensional time-of-flight (TOF) atomic images from independent experimental outcomes.90% of the signal-free images were utilized for training the generator through adversarial learning, while the remaining data was reserved for testing our model.Each pixel-wise image is converted to a resolution of 64×64 with pixel normalization within the range of [−1, 1].The discriminator D(θ D ) is constructed using six layers of fully-connected neural networks, with Leaky ReLU activation applied to each layer.The discriminator is trained to produce a one-dimensional scalar p ∈ [0, 1], which represents the probability that the input image x corresponds to real data.The generator G(θ G ) consists of five blocks of neural networks, with each block comprising a fully-connected layer, a batch normalization layer, and a ReLU unit.The input dimension of the generator is determined by the size of the latent vector z, which is set to one hundred in our setup.In an adversarial training strategy, the parameters θ D , θ G are simultaneously optimized using a standard min-max loss function, denoted as V (D, G) [36]: The convergence criterion is that the generator is able to successfully deceive the discriminator, leading to the generation of high-quality digital replicas of the training data.

Anomaly score
The anomaly score consists of two components.Firstly, we compute the residual loss (RL), denoted as A R (x) = ∥x − x∥ 2 , which represents the Euclidean distance between the real image and the fake image generated by the GAN.This loss directly captures the disparity between real and fake images.Secondly, we evaluate the discrimination loss (DL) of a feature layer, denoted as A D (x) = ∥h(x) − h(x)∥ 2 , where h(•) represents the feature layer of the discriminator.The discrimination loss quantifies the discrepancy between the features extracted from real and fake data [24].Specifically, we focus on the last fully-connected layer of the discriminator as the designated feature layer.
It is important to note that GANs learn a mapping from random noise z to an image drawn from a healthy distribution.However, due to the non-injectiveness of this mapping, multiple random inputs z can generate the same fake image.Statistically, this characteristic introduces uncertainty when scoring image anomalies, thus resulting in diminished sensitivity when employing the anomaly score as a signal in the sensing procedure.To address this issue and establish a more stable signal characterized by a bijective mapping, we introduce an additional neural network called encoder.This encoder, denoted as E(•), is trained to inversely generate the latent vector z given an input image x based on pre-trained GANs.The encoder architecture is designed to be the inverse of the generator.All three fixed networks, namely G * (•), D * (•), and E * (•), are solely trained using the signal-free dataset X.Consequently, the anomaly score can be evaluated by leveraging the three fixed deep networks in the following formulation: A(x) = ∥x − G * (E * (x))∥ 2 + λ∥h(x) − h(G * (E * (x)))∥ 2 , where λ denotes a weight coefficient.To determine the optimal weight coefficient that maximizes sensitivity S as defined in Eq.( 4), an extensive search for λ is performed within the range [−1, 1], aiming to identify the value that yields the highest sensitivity λ op = argmin λ∈[−1,1] S(λ).In our force sensing application, the optimal value was found to be λ op = −0.76(see Supplementary Note 3 [24]).For further details on model training and evaluation, we refer the reader to the supplementary materials [24].

Sensitivity of Anomaly Detection
Once the model of GAN is trained, it is used to produce an anomaly score A = f NN (x).The experimental measurement outcome x satisfies a certain probability distribution P F (x), depending on the external force F , i.e., the physical quantity V = F in Eq.( 4).Although the form of the distribution is unknown, we find the anomaly score calculated according to the experimental data obeys a Gaussian distribution (see Fig. 3.b) with a mean value A(F ), and a standard deviation σ 0 .We confirm that A is linear to the force strength.It is more convenient to adjust the impulse on the BEC by controlling the force acting time than controlling the force directly, so we adjust the force acting time to mimic a variable force according to the momentum-impulse theorem.In Fig. 3.c, we demonstrate the linear scaling of the anomaly score to the impulse.The SNR with one cycle of TOF measurement is SNR = A(F )/σ 0 .For the linearity of the response of the anomaly score to the force, the sensitivity of the anomaly detection is S = √ T 0 × σ0 ∂ F A(F ) F →0 . In terms of the probability distribution, the sensitivity is given by It is then apparent that the optimal choice of anomaly score to maximize sensitivity depends on the probability distribution.The digital twinning technique provides a purely data-driven approach to model the distribution, which permits the single-parameter (λ) optimization of the sensitivity.We remark here that there is still a large window for improving the sensitivity, because of the large degrees of freedom in constructing the anomaly score.
The computation code for producing the results in this work is available upon reasonable request.

Fig. 1
Fig. 1 The machine-learning assisted atomic force sensing.a.The schematic diagram of experiment setups for an atomic Bose-Einstein condensates (BEC) based force sensor.The atomic BEC is confined by a triangular optical lattice spread in the x-y plane.The time-of-flight image is probed by an imaging laser beam along the z direction, and showing on the CCD camera.With an external force applied on the BEC, the time-of-flight (TOF) image would develop systematic shifts.The signal can be automatically generated by inputting the TOF image into the well-trained machine-leaning model.b.The workflow of an anomaly detection method for force sensing.It involves the utilization of a generative machine learning model comprising a generator and a discriminator for digitally replicating the experimental time-of-flight images.The anomaly detection is assisted by introducing an additional encoder.All three components are deep artificial neural networks.The anomaly score (AS) is composed by residual loss (RL) between input data x and its digital replica x and discrimination loss (DL) generated by the discriminator.
2.b) of the experimental measurements (Fig. 2.c), which could generate fluctuating configurations involving all noise channels automatically.

Fig. 2
Fig. 2 The digital replica of time-of-flight measurements.a.The momentum distribution constructed by generative machine learning model at different training epoch.We present several images generated from a fixed generator, namely the digital replica in b. c shows eight representative real time-of-flight images with anomaly scores from 0.12 to 0.26.

Fig. 3
Fig. 3 Sensing with anomaly score.a-b.The probability distribution of averaged center-of-mass (COM) momentum k COM (in the unit of pixels) and anomaly score A in the absence of force (blue) and in the presence of force (red), respectively.Noting that the pixel displacement refers to the distance between COM and the y-axis center of pixel-wise images.c.The dimensionless anomaly score as a function of impulse I = F 0 • ∆T for an identical optical force F 0 .The normalization factor in c (A 0 ) is the averaged anomaly score in absence of the external force.The error bar in c represents one-sigma statistical uncertainty over six data points.The anomaly score At(∆T ) corresponds to signal-involved experiments with a force acting on the Bose-Einstein condensates for a time duration ∆T .d and e, show the real time-of-flight images and their corresponding anomaly localization (see the main text), respectively.Noting that the left (right) three instances in d are sampled from datasets with force-free (forceinvolved) environments.More technical details can be found in Method and Supplementary Note 2 and 3.