1 Introduction
Deep learning (DL) has been devoted to solving physical problems in recent years. With the help of its extraordinary abilities to make predictions about data and to extract meaningful features, exciting progresses have been made in the research fields of quantum dynamics [
1,
2], many-body physics [
3], precision measurement [
4], condensed-matter physics [
5-
9] and quantum machine learning [
10-
12]. When applying DL the primary problem faced by us is to establish a suitable network for the training data set. So far several neural networks (NNs) are utilized. For example, the earlier artificial neural network can approximate any distributions with only two neural layers [
13]; but it becomes inaccurate when the layer number increases [
14]. The restricted Boltzmann machine is an unsupervised method, which can uncover the information underlying the data by learning the joint distribution with Bayesian theory [
15]. It is difficult to train the system without a fine partition-function solution [
16]. Other NNs such as the convolutional NN [
17] and the recurrent NN [
18] are more universal in extracting local features of data and learning the relationships among elements with a high accuracy [
19,
20], despite that they may face the problem of gradient exploding or gradient vanishing due to the complexity of dynamics. Therefore a single type of NN becomes incapable of solving complex population dynamics.
The quality of simulating a fast-oscillating dynamics usually depends on the precision of sampling [
21]. When the number of sampling points is insufficient, exact numerical ways may arise poor outcomes that are largely deviated from its real values [
22]. However a high-precision sampling will add to the costs of experiments; at the same time it also leads to a long-time calculation limited by the capacity of computers. Therefore it is quite difficult to accurately obtain the data of fast-oscillating dynamics both in theory and in experiment. In the present work we propose a hybrid NN involving two different networks which are so-called Long short-term memory (LSTM) [
23] and Residual network (ResNet) [
24,
25], in order to study the fast-oscillating dynamical evolution of systems. Taking a generalized double-well dynamics of Bose–Einstein condensates (BECs) as an example, we show that our modified DL method can well solve the time evolution of population difference between two wells with high fidelity of the phase and the frequency of oscillations. This modified DL refers to one kind of series connection between LSTM and ResNet with its performance enhanced by a pre-learning of periodicity in dynamics. ResNet will use the learning outcomes from LSTM to work better. In addition, an improved integrated DL based on modified DL is also proposed to facilitate the training time, which is enabled by changing the loss function for feedback. With this feedback mechanism, LSTM can benefit from ResNet, resulting in the reduction of data amount needed for training.
For atomic Bose–Einstein condensates (BECs) trapped in a double-well potential, a large number of achievements were carried out arising a well-solved theoretical model [
26-
30]. This leads to an easier generation of enough training data via the Runge-Kutta method beforehand. Our hybrid network enables a highly-efficient learning of frequency based on the periodicity verification of strongly-oscillating population dynamics. Moreover, even if the original data is not enough the LSTM network can also perform a reliable prediction on the higher frequency values of the population oscillating in the macroscopic quantum self-trapping (MQST) regime, which are far beyond the trained parameters. However, the numerical method fails to work in this case because of the inadequate sampling. Compared to the direct DL that only contains single kind of ResNet, integrating LSTM and ResNet can deeply increase the learning efficiency despite expending a slightly longer training time, since more layers are required for constructing this integrated network. The final infidelity obtained by estimating the deviation of fractional population difference can be much lower than 0.01 with the help of a hybrid network learning.
2 Residual network
Structure of our residual network is shown by a series of blocks in Fig. 1. The filter kernel serving as a central element in the learning process, should be carefully chosen. We use filter kernels to scan matrice which enables the feature extraction from objects. By element-wisely multiplying matrice and filter kernels, machine can well learn the features of input data. However, with deeper networks, a traditional convolutional NN becomes more difficult to train, since we may face the problem of gradient vanishing or gradient exploding, which leads to a poor performance in DL. Hence, we choose a deep residual network (or so-called
ResNet) to solve this problem. An element-wise sum in the ResNet labeled by arrows in Fig. 1, will prevent the loss of information from passing through deep networks, and also avoid the vanishing of gradient by adding the former input with present hidden layer’s output. This simple process preserves the former information which means that it increases the volume of data handled by the next layer. The detail of this technology can be seen in Ref. [
24]. To be more specific, arrows linking the batch normalization layer and the element-wise sum layer in Fig. 1, point to the process of residual learning.
From physical review, we are more interested in training or generating useful information within a “black box” [the red frame in Fig. 5(b)] if the input is determined. Although training a high-performance network needs a lot of expense yet it may enable a robust prediction about the unknown results in a short-time period, especially while dealing with a complex system in the absence of analytical solutions. Our motivation is building an efficient learning protocol which can bridge the results from original numerical simulation and unknown prospective result based on the given input parameters. That may facilitate an easy and robust simulation for solving complex physical problems.
3 Double-well dynamics with two BECs
A double-well potential serving as a basic platform in the study of microscopic mediums, especially for atomic BECs [
31-
35], has been focused by researchers for decades. A typical double-well potential can be easily created by the combination of a periodic optical potential with strong harmonic confinement, played by a periodic one-dimensional light shift [
36]. If atomic BECs are confined in such a double-well optical trap, the effects of boson Josephson junction (BJJ) or MQST can be observed.
Our study starts from a brief introduction to the dynamical evolution of BECs in a double-well potential. The wave function for two weakly-coupled atomic condensates is expanded as
under the mean-field approximation. To be universal, two wells are asymmetric and has an energy difference γ between them. A standard treatment for solving the population dynamics between two wells, will adopt the nonlinear two-mode dynamical equations (here )
with the Hamiltonian given by
and the amplitudes
(
) with
Nj,
the number and the phase of particles in the
jth trap. Here
is a constant and
Uj is the trapped atomic interaction which is related to the atomic scattering length.
K is the inter-trap coupling coefficient [
26]. Upon defining the phase difference
and the fractional population difference
, Eq. (2) can be re-organized as
in which we rescale the time by ( is the frequency unit). Other dimensionless parameters are
accordingly, which indicate the imbalanced energy of two wells as well as the atomic tunneling rate respectively. Solving and essentially gives rise to the whole population dynamics of atomic BECs in a double-well system.
It is clearly shown that the pair of variables and are canonically conjugate satisfying =, =. Based on that, the Hamiltonian can be rewritten as
By simply assuming (symmetric) and ensuring , it leads to , . The initial energy starts from
which is conserved during the dynamical evolution. According to the initial phase difference or π we can obtain the zero-mode or π-phase mode individually. Here we focus on the former case. stands for the initial population imbalance and is tunable. In experiment via the adjustment of that characterizes the relative strength between interaction and tunneling rate, we can observe two different regimes: BJJ and MQST. The former meets and around when Λ is small. As increasing Λ that exceeds a critical value , the atomic population oscillation becomes self-trapped giving to on average. This behavior is also accompanied by an unbound and increasing phase that is winding with time.
The critical value between Josephson oscillation and self-trapping effects has been analytically solved at
, arising [
37]
which means if the initial energy increases exceeding the fractional population difference will reveal a significant change, corresponding to the critical point between the two regimes.
By using a standard fourth-order Runge–Kutta method, our numerical simulations for and are explicitly presented in Figs. 2(a) and (b). As expected, both the population dynamics and the phase variation manifest the existence of a significant transition across the critical value . If a BJJ appears between two wells accompanied by a small phase fluctuation in time, ensuring the average values . However when Λ becomes larger, atom tends to be self-trapped in single-well with a time-dependent and increasing phase. Figures 2(c) and (d) show a global representation of the phase diagram in the () space as well as the frequency f of population dynamics versus Λ. The critical transition at is clearly seen, agreeing with the discussions in (a, b). These numerical results allow us to establish a sufficient and accurate data set to train the neural network. In addition the DL method enables a robust prediction about unknown results which are far beyond the test parameters in data set.
4 Direct learning
To show the robustness of DL which can be applied for diverse physical problems, we first take this double-well model as an example, since both the fractional population difference and the phase dynamics of two BECs can be analytically solved here. Nowadays the DL method is regarded as a shortcut for this target. Because once a data set has been formed by using part of the original data obtained from numerical simulations, it reveals a strong ability of generating similar data and with the training network. Most interestingly, benefiting from the ability of strong prediction it can even give other unknown results which are beyond the original data set.
Our work starts from equation (4) by setting e.g. , , arising . The original parameter range is fixed to covering two regimes: MQST and BJJ. The data set is formed by uniformly separating 90001 Λ values within this range and solving and for each Λ via the method of fourth-order Runge-Kutta. The time interval is with a unit of . As a result, we can finally obtain two two-dimension data sets for z and φ in the space of . Each contains 90001×501 data. While training the network with data sets we randomly choose 9000 samples as a validation set, leaving the remaining 81001 samples for training. All computing results are based on Intel Core i7-7900X @3.30GHz and GeForce RTX 2060 with 1024 batch size and 32 filter size on Python 3.8.
An efficient learning depends on the design of network. To search for a suitable network, in Table 1 we select different hidden-layers and calculate the losses after 400 epochs by using different activation functions. Here the “layers” means the number of hidden convolutional layers. In general as the increase of layer numbers the Mean-squared-error (MSE) becomes lower, however at the expense of a longer training time. To propose a low-expense method with high precision, we use
efficiency (the last column in Table 1) as an indication for one network’s compromised performance, which is defined by the training speed divided by the Tanh-type loss. It is clearly shown that a seven-layer model is the best one because of the maximal efficiency value
(bold). Also, we compare the results based on two different activation functions: Tanh and Sine. The Tanh-type function can bring a lower learning loss than the Sine function, which will be considered in the calculation. In a practical training, we choose optimizer Adam for implementing the optimization [
38]. In order to prevent over-fitting, the decay factor is 0.8, the minimum learning rate is
and the patience is 2.0 in the stage of Early-stopping and adaptive learning. The MSE loss function
is defined by
where is the learning outcome, i.e., the fractional population imbalance, at () for each Λ. is the ground-truth from numerical solutions for each Λ. N is the length of arrays and is the number of Λ learned in ResNet. Here , , .
Figure 3 globally displays the population difference and the phase variation in two regimes, extracted from direct DL and numerical ways respectively. As for the learning of phase variation our results well fit with the numerical predictions see (c, d). Note that when plotting (d) we do not constrain the range of φ. So due to the linear increasing of φ accompanied by a slight oscillation in the long-time regime, the number of layers(here we choose seven hidden layers) becomes insufficient. As shown in the inset of (d), with the increase of layer numbers: e.g., seven layers (red-solid), nine layers (blue-solid), a nine-layer network in direct DL provides a better agreement with the numerical result (black-dashed). However, the direct DL with single kind of network fails to work well in the case of learning, especially in the MQST regime. Because in this regime two atomic BECs trapped in one well, will show a fast-oscillating behavior, leading to the breakdown of our thin single network (ResNet). We find the learning outcomes can not catch up with the change of , see (b). In the core of direct DL, such a rapid oscillation with small peak-peak amplitudes can not be easily trained by a limited database. Because the small loss in the whole process would cause gradient vanishing, making the whole learning process inefficient.
To improve the learning quality, especially in the case of MQST where the dynamics of behaves as rapid oscillations with , we have to search for a new learning method. Since the periodicity of population dynamics is apparently seen, it is easy to decompose the function into two components: frequency and amplitude within one period. So we can learn them separately based on the dynamical character in one period, instead of implementing a global optimization for all hyper-parameters. This new learning method will be beneficial owing to the use of a low-expense network with fewer number of hidden layers as compared to the direct DL, if same accuracy is attainable. The modified network only needs a small receptive field size which indeed reduces the number of kernel layers and its size. Before carrying out our new method we have to verify the periodic feature of .
5 Modified learning
5.1 Periodicity verification
Periodicity verification can facilitate the design of network in modified DL. Compared to the traditional ways for that purpose such as Fourier Transform (FT) [
39] and Auto-correlation Function (ACF) [
39], here we choose the method originating from the chaotic physics to determine
’s periodicity since it is more visible. This is called
Poincaré section [
40,
41]. For an orbit in a two-dimensional phase space, one could always select an appropriate hyperplane which should not contain or be tangent with this orbit. In general, if there exists a fixed-point or fixed number of discrete points, the orbit must have a determined period [
42]. Based on the nonlinearity of Eq. (4) we use this method to determine the periodicity of dynamics.
In this double-well system, we choose φ=0 as a hyperplane in the BJJ regime and φ=π in the MQST regime. We draw the points where the trajectory of () crosses this hyperplane. Specific examples are displayed in Fig. S1 of Appendix A, in which we compare the relations of , and the Poincaré maps under different Λ values. When plotting the Poincaré maps the periodic character of can be clearly confirmed by the presence of some discrete points.
5.2 Frequency learning
A direct simulation for the frequency
f as a function of
Λ has been solved by adopting numerical ways in Fig. 2(d), where the critical frequency at
is fixed to be 0.1. When turning to the problem of solving an one-dimensional array of data, e.g., learning frequency of fractional population difference
, ResNet is not the best choice since it typically suits for extracting features of a two-dimensional array [
43,
44], such as learning
and
in direct DL. Here we introduce a modified Recurrent Neural network which is so-called LSTM for that purpose [
23]. This method has been applied for studying knot types of polymer conformations [
45] and phase-modulation stabilization in quantum key distribution [
46]. LSTM is a model which could memorize the important part of the previous context in a data series and forget other irrelevant parts selectively. Therefore, it performs pretty well in time-series fitting and prediction due to the consideration of correlation in the context. Although its weakness also lies in the requirement for more time to train, in contrast to the case of using ResNet when same number of layers is required. Luckily it performs better in preventing from gradient vanishing and exploding in the long-range-series training.
The results of frequency learning are demonstrated in Table 2 and Fig. 4. Table 2 compares the MSE losses under different hidden layers by using various activation functions: Tanh, Sine and Mixture. For obtaining an optimal network we also consider the time expense, leading to the result of efficiency which can be used to quantitatively characterize the learning performance. We find only six hidden LSTM layers(bold) are sufficient for learning. Notice that here the definition of efficiency depends on the application of LSTM network which is different from that used in Table 1 for the case of direct DL. Besides we also use Early-stopping to avoid over-fitting. Root mean-square prop is chosen as a new optimizer in LSTM network. The original training area is the same as in direct DL i.e. and the results from an extensive range of are also given based on the prediction of LSTM. A good agreement between our learning outcomes and the numerical results is apparently observed in Fig. 4(a) except for the critical point since the network treats it as an outlier (singularity) due to the discontinuity. Inset plots the change of MSE loss with epochs which has been reduced to be much smaller than 0.001 when epoch is larger than 1200. Therefore the way of LSTM is suitable for an individual frequency learning in the training process.
Remarkably, with the increase of Λ the oscillation of dynamics becomes stronger. The traditional numerical method is unable to give accurate results due to the calculation precision limited by a sampling interval . Reducing could enhance the precision yet adding to the cost. So a bigger mismatch will appear between the numerically-estimated values and the real numbers when , see the red-solid curve in Fig. 4(b). This numerical curve is obtained by computing the time duration between two same waves for extracting the information of frequency. It is apparent that the oscillating frequency becomes much larger as Λ increases which makes the fixed sampling interval inadequate. However the LSTM network can preserve a robust prediction for higher frequency values (blue-dashed, ) under same initial preparation. Remember the initial data set based on and are unchanged in the learning. Therefore the LSTM network is expected to be more suitable for solving the fast-oscillating behavior even if the sampling points are inadequate or in low-frequency regime.
5.3 Modified network
A new modified network can be reconstructed by taking account into the role of LSTM in the learning frequency. Thinner networks can only capture limited local information with a small receptive field size [
47]. Therefore, our method makes it possible to produce a hybrid network by combining LSTM and ResNet which is able to generate the whole population dynamics within a small receptive field size. In this hybrid learning network as shown in Fig. 5(b), the former LSTM network is used for frequency learning by the way of Poincaré map at the first stage. Additionally, the ResNet is treated as a core network for generating the whole dynamics of the fractional population difference
. For the ResNet learning, we also use the MSE loss function
[Eq. (9)], in which the parameters
,
N,
are all obtained after implementing LSTM. In the core of our procedure [see red box in Fig. 5(b)], we use the Poincaré maps and LSTM network integrated to transmit extra information to ResNet. More importantly the way of Poincaré map can improve the learning fidelity via periodicity verification before learning.
Figures 5(a1)–(a3) globally present the results of under numerical simulation, direct DL as well as our modified network learning. A special case of is shown in the insets accordingly. Clearly the direct DL method gives rise to poor results in the MQST regime as compared to the numerical calculation because of the strong oscillation. The direct DL only contains single ResNet that is insufficient for grasping the fast-oscillating behavior. However a significant improvement can be attainable if two blocks of Poincaré map and LSTM network are added in the procedure. A quantitative comparison between direct and modified DL results uses the mean relative error
where and obtained from the network training and the numerical ground-truth, are also Λ-dependent. Here 0.1 serves as an arbitrary small quantity to overcome the divergency. The relative error is a metric of the final performance standing for the derivation between learning outcome and numerical ground-truth, i.e. the infidelity of learning. While the MSE loss is an indicator at the training stage. In the BJJ region two learning ways lead to comparable errors ( and ), confirming the efficiency of both learning methods. However as turning to the MQST region the modified DL apparently leads to the reduction of mean relative error from to , which extremely increases the capability of network in learning a fast-oscillating dynamics.
By now, the hybrid system that contains a sequential LSTM and ResNet networks can provide an improved learning for the population dynamics, especially in the MQST regime. While we also note that, two networks must be trained independently suffering from a long-time expense. A typical time expense is 34 seconds for one-epoch training. To overcome this weakness we propose an integrated network by combining LSTM and ResNet together with the help of feedback mechanism. This new learning method can further accelerate the training speed, saving the time by 15 or more in an one-epoch training.
6 Integrated learning
A universal study for the population dynamics in an asymmetric double-well is performed. Motivated by Ref. [
48] it is possible to utilize the feedback of loss from ResNet learning to train the former LSTM network, instead of a direct frequency learning by it, in order to accelerate the learning speed. The role of LSTM is providing the frequency information for the next ResNet learning due to the thin and small convolutional network of Resnet. Similarly, the periodicity verification is carried out by using
Poincaré section as shown in Fig. S2. The feedback mechanism in our integrated DL scheme means that the loss function of ResNet can be treated as an indicator for the LSTM network’s learning, and it would largely improve its learning efficiency. Because the MSE loss function defines the deviation between the final outcome and the ground-truth value.
In the practical training we follow the procedure diagram in Fig. 6(b). It differs from the modified DL mainly by using a new loss function , which can be expressed as
where k is a weight factor and denotes the partial data number to train LSTM. In an asymmetric well we use the initial population difference z0 as a tunable parameter, instead of Λ. The first term standing for the loss estimation in single ResNet, takes a similar form like Eq. (9). The second term serves as an auxiliary for showing the deviation of real frequency f from the ground-truth fg with respect to each z0. Therefore the ResNet learning can offer an efficient feedback for the frequency learning in the LSTM network. Our scheme follows the procedure in Fig. 6(b). In order to minimize as well as to speed up the convergence of this integrated network, we carry out an individual training for two networks at initial steps. After that we fix the ResNet and let the LSTM being trained for steps to minimize accompanied by generating an array of frequency for each z0. In addition we also simultaneously train ResNet to reduce the value of . Based on our practical training, we set four steps for LSTM’s training and five steps for ResNet in each iteration, the weight factor is .
The integrated DL bases on the fractional population difference in an asymmetric double well where is assumed. Here we set and treat as a variable. After implementing a periodic verification of z with the method of Poincaré maps (see Fig. S2 in Appendix A) we do the learning following the procedure of Fig. 6(b). Figures 6(a1)–(a3) plot similar results as Figs. 5(a1)–(a3) yet within the space. Clearly as compared to the direct DL, the results obtained from the integrated DL in (a3) have a better agreement with the numerical results shown in (a1). To make this discussion more quantitative, we also calculate the relative errors of two learning methods. From Fig. 6(c), it is clearly shown that the integrated DL method performs better than the direct DL for arbitrary z0 owing to its smaller relative errors. Besides we observe that will increase if is enhanced because of the increasing frequency. In the integrated DL we only have to compute partial data for estimating the frequency i.e. (the total number is ), benefiting from the feedback mechanism. While it can reduce the relative error i.e. the infidelity, from to on average by using an integrated neural network.
7 Conclusion and outlook
Before ending we compare the efficiencies of three DL methods. Note that here the efficiency is defined as the training speed divided by the relative error , not the loss function. Given the original data are obtained by solving Eq. (4) we display the learning results of various methods in Table 3. The original data set for is generated by setting . Although the training process costs much longer time than the generation it is possible to predict unknown results beyond the given parameter range. Note that here a direct DL with a total 13-layer ResNet fails to fit the real population dynamics on the MQST regime, leading to a poor efficiency (the infidelity attains 0.0209 when ). However, accompanied by an auxiliary LSTM network that provides a certification of the oscillating frequencies, the resulting hybrid network (modified DL or integrated DL) has shown a significant improvement for the learning efficiency. The efficiency reaches as high as (the final infidelity obtained for is far smaller than 0.01) for the integrated DL. Besides the hybrid network can also provide a precise learning in both BJJ and MQST regimes, and can even make convincing predictions about data with respect to the unknown parameters. When turning to the case of learning higher-frequency dynamics such as in the MQST regime, we find that the Runge–Kutta method becomes inaccessible due to the finite sampling interval. Instead, our LSTM network reveals an ability of making predictions about higher frequency values based on the same data set.
In conclusion we develop a hybrid “LSTM+ResNet” network to revisit the population and phase dynamics of two BECs in a double-well potential. Because the fast-oscillating behavior of population difference in the MQST regime makes the traditional direct DL inaccessible, we propose a novel learning method which integrates LSTM and ResNet networks and then brings about a strong promotion to the learning efficiency. The LSTM also represents a robust prediction for the characteristic periodicities of data sets. This hybrid network performs better with a high precision and a very low relative error (the final infidelity obtained for the fractional population difference) . Most importantly, it shows a strong ability of prediction for the data in the fast-oscillating regime which are far beyond the original data set given by the exact numerical calculations in the slow-oscillating regime. This prediction capability of method could find more applications in solving problems of physics and other sciences, which are lack of sufficient parameters restrained by the experimental conditions or costs.
As an outlook we discuss how our hybrid network could work for other systems possessing more complex population dynamics which cannot be analytically solved. For example, when the effective three-body interactions of BECs are not negligible there is no longer an analytical solution of the double-well dynamics and the evolution of population difference possesses complex multi-frequency oscillations [
49]. Then a Fourier frequency analysis combined with two algorithms,
Attention and
Sparsity can help us to realize efficient learning. If there exists several frequency components from the Fourier transformed data,
Attention, which is a method in computer science to assign weights for values, will learn the weight of each frequency in the multi-frequency oscillating dynamics. However, if the exact frequencies are unknown, we have to put a series of candidates into the set. Thus, the frequency set may have many irrelevant elements, making the learning outcome polluted. Serving as an enhancement trick for the Attention mechanism,
Sparsity ensures the sparsity of used frequencies, which can make the selected frequencies more effective and reduce the complexity and time expense for learning [
50]. In short, with the aid of
Attention, we can obtain the weight of each frequency component and reconstruct them into the final outcome where
Sparsity may help learning in a continuous parameter system. Finally, remember that our DL method depends on a data set to train. This data set can be generated by solving theoretical equations. Even if the problem is analytically unsolvable the sample data can still be collected from experimental measurements. So our method not only applies to theoretical simulations but also to experimental estimation. Moreover, our integrated DL method is not restricted to a sufficient sampling which means an extensive application in various systems is desirable in the future.