WorksPhysics and Astronomy
Deep neural networks for high harmonic spectroscopy in solids
Abstract
Neural networks are a prominent tool for identifying and modeling complex patterns, which are otherwise hard to detect and analyze. While machine learning and neural networks have been finding applications across many areas of science and technology, their use in decoding ultrafast dynamics of quantum systems driven by strong laser fields has been limited so far. Here we use deep neural networks to analyze simulated noisy spectra of highly nonlinear optical response of a 2-dimensional gapped graphene crystal to intense few-cycle laser pulses. We show that a computationally simple 1-dimensional system provides a useful "nursery school" for our neural network, allowing it to be easily retrained to treat more complex systems, recovering the band structure and spectral phases of the incident few-cycle pulse with high accuracy, in spite of significant amplitude noise and phase jitter. Our results both offer a new tool for attosecond spectroscopy of quantum dynamics in solids and also open a route to developing all-solid-state devices for complete characterization of few-cycle pulses, including their nonlinear chirp and the carrier envelope phase.
Electrons provide the fundamental first step in response of matter to light. The feasibility of shaping light pulses at the scale of individual oscillations, from mid-IR to UV [1, 2], offers rich opportunities for controlling electronic response to light on sub-cycle timescale (e.g. [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]), leading to a variety of fascinating phenomena such as optically induced anomalous Hall effect [14] [15, 16], topological phase transitions with polarization-tailored light [13], or the topological resonance [7]. Over multiple laser cycles, control of electron dynamics with light also enables the so-called Floquet engineering – the tailored modification of the cycle-average properties of a light-dressed system, see e.g. [17] for a recent review.
In this context, starting with the pioneering work [18], high harmonic spectroscopy has developed into a powerful tool for exploring laser-driven electron dynamics in solids, see e.g. recent reviews [19–21]. Examples include identification of the common physical mechanisms underlying high harmonic generation in atoms, molecules and solids (e.g. [10] [22]), observation of Bloch oscillations [23], resolving interfering pathways of electrons in crystals with about 1-fsec precision [24], inducing [13] and monitoring topological [25–27] and Mott insulator-to-metal [28] phase transitions, resolving coherent oscillation of electronic charge density order [29], identifying the van Hove singularities in the conduction bands [30], and reconstructing effective potentials seen by the light-driven electrons with picometer accuracy [9].
Here we apply machine learning to the analysis of high harmonic generation from a crystal, which allows us to ’kill two birds with one stone’: reconstruct the band structure of the crystal and fully characterize incident few-cycle laser pulses, including both their nonlinear chirp and the phase of the carrier oscillations under the envelope (CEP).
The fundamental role of the CEP in nonlinear light-matter interaction has been understood theoretically in [31–34], stimulating first experiments in the gas phase [35]. Powerful gas-phase methods for characterizing few-cycle pulses have been developed, including stereo-above-threshold ionization (stereo-ATI) [36–38], attosecond streak camera and its modifications [39–43], and half-cycle high harmonic cutoffs [44]. Using nonlinear response of solids for characterizing the CEP has also been pursued [45–47]. Yet, all-optical, all-solid-state characterization of few-cycle pulses, including their CEP, remains a challenge. We hope to change this situation. Particularly relevant to our work are the earlier proposal on using interference patterns in spectrally overlapping regions of even- and odd-order harmonics in solids [48] and the use of two-color high harmonic spectroscopy for all-optical reconstruction of the band structure [49] from the two-dimensional high harmonic spectra, recorded as a function of the harmonic frequency and the two-color delay.
Two-dimensional spectra of the nonlinear-optical response may provide sufficient information to recover the pulse. One prominent example is frequency-resolved optical gating, which uses the second-order optical response recorded as a function of the time-delay between the two incident pulses, the target pulses and the auxiliary gate pulse (e.g. [41, 50, 51].)
Extending this analysis to highly nonlinear optical response remains an open problem. The crucial importance of addressing this problem stems from the fact that such analysis would allow one to characterize the laser pulse directly in the interaction region.
In special cases, such as the case of the two-color high harmonic spectroscopy of attosecond pulses using fundamental and the second harmonic (e.g. [52]), the 2D harmonic spectra recorded as a function of the two-color phase and the harmonic frequency may carry sufficient information for reconstructing attosecond pulses as they are produced, directly in the interaction region. Such reconstruction does, however, require detailed understanding of the physics of the microscopic quantum response. The possibility of solving a full reconstruction problem in a general case, recovering both the pulse and the quantum system, remains completely unexplored.
When there is no simple and/or well known functional dependence between the response data and the parameters one wishes to reconstruct, the problem is well suited for neural networks. Such networks aim to find a smooth analytical function which connects the input and the desired output . If it is successful, one can conclude that the data indeed does contain the information . Pertinent examples include applications to solving the Schrödinger equation, where neural networks can output highly accurate results [53, 54].
Our results show that, given sufficient training set, the 2D spectra of the high harmonic response as a function of the nonlinear response frequency and the CEP of an unknown driving pulse allow for simultaneous reconstruction of both the pulse and the unknown crystal band structure, even in the presence of substantial noise including CEP jitter.
To demonstrate the method, we assume no apriori knowledge about the incident pulse and use rather limited knowledge about the nonlinear medium. For the quantum system, we begin with a modified Rice-Mele model [55] with nearest neighbor, next nearest neighbor, etc. hoppings, see Figure 1(a) (and Supplementary information for further details.) Both the on-site energies and the couplings are assumed to be unknown. The reconstruction procedure is expected to output both the parameters of the pulse and of the lattice. We are thus faced with a nonlinear optimization problem with a very large input dimension, which requires finding optimal interpolation between the existing trial samples.
Such a regression tool is provided by deep neural networks (DNNs) [56], already used for such diverse applications as boosting the signal-to-noise ratio in LHC collision data [57], establishing a fast mapping between galaxy and dark matter distribution [58], and constructing efficient representations of many-body quantum states [59]. The inherent resilience of neural networks to noise is an important asset for pulse shape characterization. The emergence of photonic implementations of feed-forward neural networks [60] outlines a perspective of implementing this regression scheme in an all-optical way.
The vector potential of the incident laser field, , is generated in the frequency domain with the unknown to the neural network quadratic and the cubic phases:
The complex parameter is defined in such a way that, in the absence of the cubic chirp, the pulse has a temporal width : , where is the chirp parameter. The chirp parameters and are expressed via dimensionless quantities and , , . The dimensionless parameters vary in the ranges , . Finally, sets the CEP of the pulse, also unknown to the neural network and chosen randomly. The system evolution is simulated for 40 laser cycles; an additional Gaussian cutoff is introduced at the leading and trailing edges of the pulse for numerical stability (see Supplementary information.)
The typical pulses we have used for reconstruction are shown in Fig. 2, both in time and frequency domain. The latter shows the spectral phases (red curves) alongside the spectral amplitudes (blue curves), as a function of , where is the carrier. Our typical simulated ”measurement” assumes that one can systematically vary the (unknown) CEP. Thus, we perform calculations by varying , with spanning the full range . For each , we measure the absolute value of the spectral amplitude of the laser-induced current , which is given by the Fourier transform of the calculated current .
The input data is composed of the absolute values of the integer harmonic amplitudes . The resulting 2D map as a function of and is used as the input

Figure 1. Model system used for pulse reconstruction and band structure spectroscopy via nonlinear-optical response. (a) The two types of sites present, A and B, are connected by hopping constants between similar sites and between the next-neighbor sites of the different type. (b-d) Examples of band structures that can be generated with this model system.

Figure 2. Sample pulse shapes used in the problem. (a-c) show the time-domain. (d-f) are the frequency-domain representations of their respective pulses, where the spectral phase (red line) and spectral amplitude normalized to the central frequency amplitude (blue area), are plotted with respect to frequency. The pulse parameters are , left to right: , , .
into the neural network. The network must then infer the (randomly chosen in each trial) intraband hoppings , the unknown initial CEP , and the pulse parameters and . The values of , frequency , and are kept constant throughout. For more information about the inputs used, see Supplementary information.
In the reconstruction procedure, we have used two separate neural networks, one for recovering the band parameters, and another for recovering the CEP and pulse parameters. Both are constructed using the same architecture, consisting of 4 convolutional layers and two fully-connected ones, see Figure 3. Constructing them as a single neural network with split fully connected layer impedes the overall performance of the scheme. For either problem, this network is trained for 200 epochs with the AdaBelief [61] optimizer with batch size 256; the learning rate is initially set to and discounted at the 150th epoch by a factor of 10.

Figure 3. Network architecture used in the paper. Yellow denotes a convolution layer with the number of filters below, orange a batch normalization with subsequent Swish activation, red a maximum pooling layer, blue a fully connected layer, dark blue a Swish activation with no preceding batch normalization. The output of the last FC layer is linear.
To speed up training, we train networks to work on more complex datasets (e.g. with chirped pulses) by using a network pre-trained on a simpler dataset (e.g. with no chirp). The rest of the training procedure remains the same, but the overall number of epochs is reduced to 50.
The recovery results are demonstrated in Figure 4. The number of unknown band parameters is set to 4. The agreement between the actual and the reconstructed data, both for the system and for the pulse, is excellent. Tables with detailed analysis of the average performance are given in the supplementary material.

Figure 4. Band parameters (a-d) and CEP (e, f) recovered by the neural network for the source problem (Rice-Mele model, no chirp or cubic phase). The solid orange line serves as a reference. All points used belong to the test set.
We now also demonstrate that our neural network recovers the system parameters with comparable precision when the input-data contains experiment-like noise. We use a network pretrained on the initial noiseless dataset with no chirp or cubic phase. To simulate experimental noise, we have introduced a random CEP shift to each of the pulses in each sample, sampled from a uniform distribution within mrad. The output amplitudes were also affected by a uniformly-distributed multiplicative noise with an amplitude of 0.1. The
exact performance figures with and without added noise can be found in the supplementary information.
After demonstrating that our neural network recovers the band structure and pulse parameters of the simple source (Rice-Mele) model with high accuracy, we apply our approach to more complex systems. As an example of such more complex system, we used the 2-dimensional gapped graphene system. Its parameters (on-site energy and first-neighbor hopping) were generated in the vicinity of experimental values for hBN, within 4.0÷7.27 eV and 0.08÷0.16 a.u., respectively. We simulated its responses by integrating the semiconductor Bloch equations. To simulate experimental conditions, we applied noise using the same procedure as described above.
Due to the greater computational cost, we could only use 1280 samples as opposed to 65536 for the source problem. Such a dataset is too small to train an entire new network. Instead, we applied the transfer learning approach by using the networks pre-trained on datasets with no quadratic or cubic phase, varying the CEP, and 4 unknown band parameters, and partially retraining them (see Supplementary). We discovered that, in spite of the greater complexity of the underlying physical system, such a setup recovers the CEP with a precision comparable to the original problem (see Figure 5), and achieves good relative accuracy on the band parameters.

Figure 5. Band structure (a), pulse waveform (b), and CEP (c, d) recovered by the neural network for the target problem (2-dimensional gapped graphene with phase and multiplicative noise).
This adds new significance to the achieved results. Indeed, we have now demonstrated that the spectra from the initial model, while only resembling a real-world setup in a qualitative sense, provide a useful training ground for the neural network, allowing it to acquire useful abstract concepts (parameterized by the deeper layers) which it can later apply to more practical problems, for which it was also harder to generate as many training samples.
Our results demonstrate that solid-state HHG spectra contain more information than one extracts with conventional methods: not only the pulse parameters, but also the parameters of the quantum system are robustly reconstructed. Our approach replicates the advantages of gas-phase HHG spectroscopy, namely, the ability to resolve the CEP of laser pulses and the complex pulse shapes with polynomial spectral phase nonlinearities. At the same time, it requires neither the XUV pulses nor the photoelectron spectroscopy, such as the stereo-ATI. Moreover, it allows for all-optical solid-state implementation. In terms of required observables, it is closest to the method based on measuring the half-cycle cutoffs in gas-phase high harmonic generation [44]. However, it also allows one to deal with very strong chirps.
Applying neural networks to the analysis of half-cycle cutoffs and high harmonic generation spectra in the gas phase could be very interesting, especially in molecules, where multiple coupled harmonic generation channels present challenges for unravelling the underlying laser-driven multi-electron dynamics [62].
One could apply the developed neural network design to standard gas-phase experiments, to analyse the possibility of resolving the spectral phase and the CEP for short pulses by processing HHG spectra generated by known inert gases (Ar, Ne, etc.). In this case the neural network can be trained using TDSE simulations of the necessary responses before being applied to real experimental data.
The key difficulty of using high harmonic spectroscopy in solids is that, without a priori knowledge of the band structure, one lacks closed-form solutions for electron dynamics, similar to those available in the gas-phase. Our method circumvents this difficulty. Pulse characterization device implementing our principles could be tabletop, all solid-state, and capable of operating at ambient conditions.
Another interesting direction to pursue would be to apply novel physics-informed neural network architectures[63, 64] to resolve Hamiltonians of systems with many degrees of freedom (such as molecules) using time-resolved HHG spectra, such as those obtained from solids driven by mid-IR fields [24]. Neural networks can also be used for processing the sets of harmonic spectra connected by other relations, such as being measured for different angles between the crystal axes and the driving field, to uncover effective laser-modified potentials for the charge motion, extending the pioneering work in Ref. [9] to recover effective potentials of active band electrons. Here, once again, one can take advantage of our idea of using neural networks to extend a method of processing analytically-tractable systems to intractable ones, recovering effective structures.
FUNDING
M.I. and N.K. acknowledge funding of the DFG QUTIF grant IV152/6-2. N.K. acknowledges funding by the Foundation for Assistance to Small Innovative Enterprises (agreement No 196GUTsES8-D3/56338) and Foundation for the Advancement of Theoretical Physics and Mathematics (agreement No 20-2-2-39-1). This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 899794.
ACKNOWLEDGEMENTS
We thank Vera V. Tiunova for her useful feedback. N.K. and M.I. developed the idea behind the paper and wrote the manuscript. N.K., Á. J.-G. and R.E.F.S. performed the calculations. N.K. designed the neural network architecture.
DISCLOSURES
The authors declare no competing interests.
Data Availability
The generated datasets, trained neural network weights, and reconstructed values are available in Dataset 1 (Ref. [65]). The codes running the TDSE simulation and neural network reconstruction of parameters were written in the Julia language [66] and are available publicly on GitHub [67].
Modified Rice-Mele Model
The system is described by the Hamiltonian
Here for and for , is the maximum hopping order, which was varied from 2 to 6. The onsite energies are thus for site A and for site B, while the hopping terms connect the sites of the same kind. In the simulations, vary randomly between training samples and are unknown to the neural network. These hopping terms are selected in such a way that the band gap always lies between 8.0 and 16.0 eV. The higher hoppings are randomly generated within the ranges: , , , respectively. In all our computations, we assume , where is the lattice constant.
The Hamiltonian also includes a term proportional to , which describes hopping between sites and . This term explicitly breaks the inversion symmetry of the model, so that its nonlinear-optical response allows us to distinguish between pulses with CEPs differing by . We set to be much smaller than the typical values of ; we used eV and eV. This simplifies modelling relaxation. This system allows one to generate a rich variety of band structures and band-gaps , see Fig. 1 (b-d) for some examples.
When we set the lattice constant , , in the space, the field-free Hamiltonian transforms to:
The field is introduced via the Peierls substitution, which transforms the laser-driven Hamiltonian in the momentum space as:
The system is thus decomposed into an ensemble of non-interacting two-level systems, characterized by the canonical momentum . We evolve each TLS using the master equation with a decoherence term:
Here denotes the off-diagonal part of the density matrix in the Hamiltonian eigenstate basis, is the dephasing time, set to , where is a single fundamental laser period.
Driving Pulses in Time Domain
In time domain, the pulse shape corresponding to the frequency-domain representation in the main text can be written in closed analytical form:
The envelope function in the above equation is:
The normalizing factor is introduced to keep the peak absolute value of the envelope function at 1 when there’s no cubic phase, and conserve the total pulse power at all parameter values. For numerical stability, we introduce a cutoff function that ensures that at the beginning and end of the pulse:
with the numerical vector potential taking the form
Evaluation of the Airy Function
We have approximated the Airy function required for computing the pulse shape in (8) with Maclaurin series [1 Eq. 9.4.1] and asymptotic series [1 Eq. 9.7.5, 9.7.9] for small and large arguments, respectively. For we used the Maclaurin series up to ; for , the asymptotic expansion for was used. This approximation allows for a maximum relative error below .
Solution of the time dependent Schrödinger equation
We discretize the 1D Brillouin zone of the crystal into 32 points (finer discretization does not worsen the NN’s performance). For each point, we initialize the system in the pure ground state of the Hamiltonian (2) for , then evolve this state according to (5). The dephasing time is selected phenomenologically. For all computations, the field , and the central frequency are kept constant.
80 times per cycle, we record the current, computed as:
In the above equation, we neglect the () factor. Each ”recording“ interval is separated into 2 integration steps. Each integration step consists of iterations of the following procedure:
Within each integration step, the field is kept constant. The matrix exponent is computed numerically exactly in the assumption that is traceless.
Neural networks
Here we first give a very brief general introduction into neural networks, and then discuss applications to our particular problem.
Suppose we search for a model that best describes a known experimental data set with total samples. Generally, the workflow is:
Define the model as a trial function that depends on a vector of parameters .
Define a measure of divergence between the results predicted by the model and experimental results , expressed as . The most common measure for is the mean squared error (MSE), obtained for .
Optimize the parameters to minimize the divergence .
The most basic example of such an approach is the linear regression: we define the model as with , and use the MSE divergence. Minimizing the divergence with respect to and , we obtain what’s known as the linear least squares method. For this case, we have two options available. First, we could find the optimal analytically by and solving the overdefined system of linear equations.However, this may not be optimal for high-dimensional data, and so we can choose an alternative way where we optimize the same parameters with gradient descent, updating against the gradient of the divergence function: . Obviously, the result must be the same, which can be verified analytically.
Evidently, linear regression cannot model most data sets. The simple nonlinear regression methods generally rely on fitting the experimental data to an ansatz selected by hand. Such methods include logistical regression, polynomial regression, and the more exotic expansions over various bases such as the Legendre polynomials and harmonic functions. However, selecting the correct nonlinear regression requires extensive trial-and-error testing of various ansätze, which is generally not possible except for simple cases with known symmetries and properties of the experimental data set. A convenient solution to this complication is using neural networks, which serves as a universal ansatz by being capable of approximating any continuous finite function to an arbitrary precision [2]. This property is the key advantage of neural networks, which allows them to be successfully applied even to data sets where the very existence of a connection between the input and the output is not evident.
We will now discuss the core principles of a neural network. A neural network is constructed of building blocks called neurons. The neuron, demonstrated schematically on Fig. 1(a) is defined as follows.

Figure 1 (PDF p. 21). (a) The vector is the -dimensional input vector, is the -dimensional weight vector, is the bias. The output is computed as , commonly rewritten as with , . The gray circles represent elements of the input data, light blue stands for the weighted summation (linear transform), and dark blue for the nonlinear activation function. (b) The layout of a perceptron with a single hidden layer.
The neuron is a function with -dimensional input and one-dimensional output . Here is the weight vector of the neuron, is the bias, and is the activation function. The typically chosen activation functions include the logistical function, ReLU, Softplus, Swish, etc. A neuron encodes a single nonlinearity, such as a smooth step for the logistical ( sigmoid) activation function. Neural networks use compositions of these nonlinearities to approximate arbitrary smooth functions.
In a neural network, the neurons are arranged in layers where each neuron has the same input vector and the same activation function . For this layer, the bias is expressed by a vector, the weights by a matrix, and the output is given by , where is applied individually to each argument. The simplest neural network, called the single-layer perceptron, consists of only two such layers, and is schematically demonstrated on Fig. 1(b). The first (hidden) layer contains all the nonlinearities, and gets the raw data as the input. The second (output) layer may or may not be linear, i.e. have an identity activation function, and in the linear case simply applies a learnable linear transform to the outputs of the hidden layer.
The universal approximation theorem [2] states that any continuous finite function can be approximated by a perceptron with a sufficiently large hidden layer with a non-polynomial activation function. However, for many cases this turns out to be computationally non-optimal. A more efficient representation that requires less parameters can be achieved by using stacked layers, with the output of -th layer being the input for -th. A network constructed in such a way is commonly named ”fully connected”. For N-layer deep fully connected networks, the equation is commonly rewritten as , where is the layer number, , . The output function is therefore given by: .
The general heuristic states that the higher layers process higher-level features, and thus can learn highly nonlinear and nonlocal patterns. A ’dual’ version of the universal approximation theorem [3, 4] demonstrates that an arbitrary continuous function can also be approximated by a neural network with a fixed (but not arbitrarily small) number of neurons per layer and sufficiently large number of layers. Shown on figure 2 is the general scheme of a deep fully connected neural network.

Figure 2 (PDF p. 23). In a deep feed-forward neural network, the output of each layer is used as the input of the next one, with the network output being evaluated at the last layer.
Deep neural networks can be trained in an optimal way thanks to a procedure called ’backpropagation’ [5] that allows to efficiently differentiate the loss function with respect to each of its parameters . This enables optimizing them with the gradient descent procedure, which consists of updating against the gradient of the divergence function, called ’loss’ for neural networks: , ideally yielding a function that minimizes the error for each sample simultaneously. However, the ’naive’ gradient descent is vulnerable to noise and local minima, and in practice, more sophisticated methods are employed, such as ADAM [6]. ADAM is based on correcting the gradient descent update by using an adapted momentum of the parameters which prevents them from getting stuck in a local minimum. For the same goal, the input data is separated into ’batches’ that consist of a defined number of samples. The parameters are updated after processing each batch. The process of optimizing the FFNN parameters, or ’training’ the FFNN, therefore consists of the following steps.
Select a batch of data as input.
(forward pass) Evaluate the output of each consecutive layer to obtain the NN output.
Compute the loss function between the produced output and the desired output.
(backward pass) Calculate the gradient of the loss function with respect to each parameter by reverse propagating the loss gradient from the last to the first layer.
Compute the update to the parameters using a parameter update procedure (gradient descent, ADAM, ADAGrad, ADAMax, etc) and apply it.
The above steps are repeated for the entire data set. Processing the entire data set according to the training procedure is called a ’training epoch’. A neural network can be trained for any number of epochs, ranging from tens to thousands.
Therefore, deep neural networks can be used to model complex dependencies in a computationally optimal way, often requiring several orders of magnitude less computational time than exact methods. However, their application is not limited to regression problems.
The neural networks have been implemented using the Flux.jl [7, 8] library.
Convolutional Neural Networks
In practice, pure fully connected networks are rarely used on datasets where the existence of local features in the input data can be assumed (e.g. real-life photographs.) When dealing with a dataset where spatial coordinates can be assigned to each element of the input data, a fully connected layer cannot take advantage of the information about the relative position of pixels. Hence, such a layer assigns as much meaning to nonlocal features as to local ones – but nonlocal features are more likely to be spurious, making the network prone to overfitting. The networks designed to remedy this problem are called convolutional neural networks (CNNs for short). The basic unit of a CNN is a convolutional layer constructed as described below.
Suppose the input image is a 3-dimensional tensor, where is the image width, is the height, and is the number of channels (which can be, for example, the red, green, and blue channels of a photograph). A convolutional layer is defined by its convolutional filter, bias, and activation function. A convolutional filter is then a 4-dimensional tensor, where are the spatial dimensions of the receptive field of the filter (usually ), and is the number of channels in the output feature map, which can be arbitrarily high. This convolutional filter is applied in the following way:
After this, a -dimensional bias is added, and a nonlinear activation function is applied like it’s done for fully connected neural networks. The output of a convolutional layer is then:
Just like fully connected layers, the convolutional layers can be nested upon each other to extract increasingly complex and nonlocal features with each subsequent layer.
In practice, convolutional layers are almost universally alternated with pooling layers which reduce the amount of computations required. A pooling layer with a receptive field shrinks a -sized image to a -sized one by mapping each region of size of the input image to a single pixel of the output image for each channel. Usually, the number of channels in convolutional filters is doubled after each maximum pooling operation to make the nonlocal features more expressive than local ones.
CNN’s are also commonly regularized with batch normalization layers. For each channel of the input data, a batch normalization layer first normalizes the channel data to mean 0 and variance 1 across the entire data batch, then shifts it to have a new mean and variance , where and are trainable parameters. Although the usefulness of batch normalization in stabilizing and accelerating deep neural network training is demonstrably significant [9], the reason for it is currently a disputed matter [10].
An architecture demonstrating the described principles can be seen in Figure 3; see [11] for detailed review.
In our work, we aimed to first train our neural network on a source problem (the Rice-Mele model dataset), and then retrain it for a target problem (the gapped graphene dataset). We found that a fully connected neural network was able to attain performance comparable to a CNN on the source problem. To do so, it required the input of the 2D frequency-phase spectra concatenated with their Fourier transforms along the phase axis. However, as FCNNs are prone to overfitting, they turned out to be ill-suited for retraining and performed poorly on the target problem. CNNs, on the other hand, can be retrained by only retraining the fully connected layers, without affecting the convolutions. Following this procedure, we attained good performance on both the source and the target problems (see Figure 4, Figure 5).
Input Data
The phase was discretized into 32 steps. Per each laser cycle, 80 time points were recorded, allowing us to recover integer harmonics up to , thus a single 2D plot has points of the form . These were normalized to the mean value of 0 and standard deviation of 1. The normalized images were then presented as tensors, i.e. 2D images with a single channel.
We have generated data sets that consist of 65536 samples for pulses with no cubic phase, and 262144 samples for pulses with cubic phase. Next, 1% of samples from each dataset have been set apart to form the test set. The required output were the band parameters, the CEP in the form of , and the dimensionless chirp and cubic phase.
During the training process, the data have undergone random circular shifts: before a training step, all 2D plots in each batch were transformed by a circular shift along the axis. This has allowed us to train with smaller datasets and helped to combat overfitting.
Source Problem Performance
The average performance of the selected neural network on the test set of the Rice-Mele model dataset for different unknown parameters is given below. For parameters that do not change sign, the average relative error is also indicated.
| , eV | , eV | , eV | , eV | , rad | |
| abs | 0.024 | 0.030 | 0.037 | 0.025 | 0.018 |
| rel | 0.004 | 0.012 |
| , eV | , eV | , eV | , eV | , rad | |
| abs | 0.026 | 0.032 | 0.040 | 0.027 | 0.018 |
| rel | 0.005 | 0.013 |
| , eV | , eV | , eV | , eV | , rad | |
| abs | 0.033 | 0.073 | 0.065 | 0.035 | 0.022 |
| rel | 0.006 | 0.021 |
| , eV | , eV | , eV | , eV | , rad | |
| abs | 0.046 | 0.074 | 0.089 | 0.058 | 0.047 |
| rel | 0.008 | 0.025 |
Table 3. Average recovery performance for the CEP + 4 parameters Rice-Mele model dataset.
| , eV | , eV | , eV | , eV | , rad | ||
| abs | 0.043 | 0.056 | 0.062 | 0.064 | 0.064 | 0.070 |
| rel | 0.007 | 0.026 |
Table 4. Recovery performance for the CEP + chirp + 4 parameters Rice-Mele model dataset.
| , eV | , eV | , eV | , eV | , rad | |||
| abs | 0.052 | 0.069 | 0.099 | 0.066 | 0.228 | 0.098 | 0.037 |
| rel | 0.010 | 0.026 |
Table 1. Figure 5. Recovery performance for the CEP + chirp + cubic phase + 4 parameters Rice-Mele model dataset.
Modeling high-harmonic response of gapped graphene
To demonstrate that the concepts learned by the neural network on the original task can be applied to more difficult problems, we consider the case of hexagonal boron nitride (hBN), a two-dimensional material described by a Hamiltonian equivalent to gapped graphene:
The parameters of this material are taken within the following ranges: eV, a.u. (atomic units; 1 a.u. = 27.2 eV). The incident laser field is a single-cycle pulse with wavelength , peak power . The pulse width, carrier frequency, and peak power are kept constant for all samples. The decoherence time set to 2 fs.
We model the high-harmonic response by solving the density matrix master equation (atomic units are used),
using the code introduced in [12, 13]. The initial state is a mixed state with no coherence between the eigenstates, and given by the fully-filled valence band. The time-dependent interaction is performed in the length gauge and in the dipole approximation,
where is the field-free Hamiltonian in Eq. (18) and is the time-dependent electric field. The position operator is given by , where is the Berry connection [14]. The current is then obtained as
where are the number of -points, and is the velocity operator.
We checked the high harmonic spectrum was converged for a -grid of points and a time step of a.u. Same as before, for each crystal sample, consisting of a mass, first neighbor hopping, and initial CEP, we measure the current between and .
Transfer Learning
The method of transfer learning is applied to problems for which there isn’t enough data to train a neural network (commonly named ”target” problems), but which have a similar problem (”source” problem) with sufficient training data available. The first stage consists of training the model (in our case, a neural network) to solve the source problem. The deeper layers of our network learn more abstract representations of the input data. However, as the information flow approaches the output, the concepts learned by the layers become less abstract and more specialized on the exact problem. Thus, in the second stage, the neural network is partially retrained for the target problem, with only the last layers being retrained. The retrained network may or may not be used as part of a larger neural network which modifies its inputs or uses the outputs of its hidden layers.
Alternatively, transfer learning may be used for two similar problems even when there is sufficient data for the target probkem. A network pre-trained on a source problem may be retrained completely for the target, but its pre-trained parameters still prove to be a better initial guess than random initialization.
We thus use the idea of transfer learning in two senses. First, for the source (TDSE) problem, networks trained on datasets with less unknown nonlinear phase parameters are used as initial guesses to train networks to recover more complex spectral phases – i.e., the networks designed to recover the CEP and band parameters for unchirped pulses are retrained to process chirped pulses, after which they are retrained on the dataset with a cubic phase.
We also use transfer learning to train our neural network to recover pulses and band parameters from gapped graphene spectra. After pretraining it on the source dataset we use 1280 gapped graphene responses as target dataset. Due to its small size, we use 20% of the dataset for validation. We augment the target data in the same way as we do with the source data.
For both networks (band parameter and CEP), we retrain the entire network.
Retrained Network Performance
The average performance of our neural networks on the noisy gapped graphene dataset after retraining is given below.

| , eV | , a.u. | , rad | |
| abs | 0.021 | 0.0184 | |
| rel |
Figure 6. Average error of the neural network recovery for the gapped graphene dataset. a.u. designates 1 atomic unit.
References
- [1]DLMF, NIST Digital Library of Mathematical Functions, http://dlmf.nist.gov/, Release 1.0.27 of 2020-06-15, f. W. J. Olver, A. B. Olde Daalhuis, D. W. Lozier, B. I. Schneider, R. F. Boisvert, C. W. Clark, B. R. Miller, B. V. Saunders, H. S. Cohl, and M. A. McClain, eds.
- [2]A. Pinkus, Approximation theory of the mlp model in neural networks, Acta numerica 8, 143 (1999).DOI
- [3]Z. Lu, H. Pu, F. Wang, Z. Hu, and L. Wang, The expressive power of neural networks: A view from the width, in Advances in neural information processing systems (2017) pp. 6231–6239.arxiv.org/abs/1709.02540
- [4]P. Kidger and T. Lyons, Universal approximation with deep narrow networks, in Conference on Learning Theory (2020) pp. 2306–2327.
- [5]D. E. Rumelhart, G. E. Hinton, and R. J. Williams, Learning representations by back-propagating errors, nature 323, 533 (1986).
- [6]D. P. Kingma and J. Ba, Adam: A method for stochastic optimization, arXiv preprint arXiv:1412.6980 (2014).arxiv.org/abs/1412.6980
- [7]M. Innes, E. Saba, K. Fischer, D. Gandhi, M. C. Rudilosso, N. M. Joy, T. Karmali, A. Pal, and V. Shah, Fashionable modelling with flux, CoRR abs/1811.01457 (2018), arXiv:1811.01457.arxiv.org/abs/1811.01457
- [8]M. Innes, Flux: Elegant machine learning with julia, Journal of Open Source Software 10.21105/joss.00602 (2018).DOI
- [9]S. Ioffe and C. Szegedy, Batch normalization: Accelerating deep network training by reducing internal covariate shift, in International conference on machine learning (PMLR, 2015) pp. 448–456.
- [10]S. Santurkar, D. Tsipras, A. Ilyas, and A. Madry, How does batch normalization help optimization? (2019), arXiv:1805.11604 [stat.ML].arxiv.org/abs/1805.11604
- [11]P. Mehta, M. Bukov, C.-H. Wang, A. G. Day, C. Richardson, C. K. Fisher, and D. J. Schwab, A high-bias, low-variance introduction to machine learning for physicists, Physics reports 810, 1 (2019).DOI
- [12]R. Silva, F. Martín, and M. Ivanov, High harmonic generation in crystals using maximally localized wannier functions, Physical Review B 100, 195201 (2019).DOI
- [13]R. Silva, Á. Jiménez-Galán, B. Amorim, O. Smirnova, and M. Ivanov, Topological strong-field physics on sub-laser-cycle timescale, Nature Photonics 13, 849 (2019).
- [14]E. Blount, Formalisms of band theory, in Solid state physics, Vol. 13 (Elsevier, 1962) pp. 305–373.DOI