# Machine learning optimal control pulses in an optical quantum memory
experiment

Elizabeth Robertson<EMAIL_ADDRESS>Luisa Esguerra  Deutsches
Zentrum für Luft- und Raumfahrt e.V. (DLR), Rutherfordstr. 2, 12489 Berlin,
Germany  Technische Universität Berlin, Institute for Optics and Atomic
Physics, Hardenbergstr. 36, 10623 Berlin, Germany  Leon Messner  Deutsches
Zentrum für Luft- und Raumfahrt e.V. (DLR), Rutherfordstr. 2, 12489 Berlin,
Germany  Guillermo Gallego  Einstein Center Digital Future and Science of
Intelligence Excellence Cluster 10117 Berlin, Germany  Janik Wolters
Deutsches Zentrum für Luft- und Raumfahrt e.V. (DLR), Rutherfordstr. 2, 12489
Berlin, Germany  Technische Universität Berlin, Institute for Optics and
Atomic Physics, Hardenbergstr. 36, 10623 Berlin, Germany

###### Abstract

Efficient optical quantum memories are a milestone required for several
quantum technologies including repeater-based quantum key distribution and on-
demand multi-photon generation. We present an efficiency optimization of an
optical electromagnetically induced transparency (EIT) memory experiment in a
warm cesium vapor using a genetic algorithm and analyze the resulting
waveforms. The control pulse is represented either as a Gaussian or free-form
pulse, and the results from the optimization are compared. We see an
improvement factor of 3(7)% when using optimized free-form pulses. By limiting
the allowed pulse energy in a solution, we show an energy-based optimization
giving a 30% reduction in energy, with minimal efficiency loss.

††preprint: APS/123-QED

##  I  Introduction

Optical memories have been long recognized as a required technology in the
implementation of different quantum protocols, notably on-demand multi-photon
generation [1], repeater-based quantum key distribution (QKD) [2, 3, 4, 5],
and the translation of flying to stationary qubits, among others [6, 7].
Indeed, the aforementioned protocols have highly efficient operation as a
requirement, and often the memory efficiency bounds the attainable end-to-end
efficiency of the system. In QKD implementations, for example, this leads to a
logarithmic scaling in the time required for entanglement distribution [3].
Moreover, optical memories find applications in classical analog computing, in
systems such as reservoir computing, where the efficiency of the optical
memory provides a bound on the memory capacity of the reservoir [8].

Similarly to the variety one sees in the “qubits zoo”, quantum memories are
equally diverse in their form [9]. Spanning from single atoms [10], to solid-
state devices [11, 12], a range of optical quantum memories [13] have been
investigated providing a wide range of efficiencies. The most efficient
demonstrated memory systems are those operating at the ultra-cold regimes. By
removing several sources of decoherence, efficiencies of 75% - 85% [14, 15]
have been achieved. However, solid state devices also boast high-efficiency
operation, shown between 56% and 69% [16, 17].

Figure 1:  Experimental schematics. a) An overview of online genetic algorithm
optimization setup. Possible solutions (control pulses) are generated by the
genetic algorithm and are evaluated by carrying out a memory experiment. EOM:
electro-optic modulator; AOM: accousto-optic Modulator; AFG: arbitrary
function generator; CP1, CP2: calcite prisms; PD: photodiode; Cs: cesium vapor
cell. b) The three-level $\Lambda$ system used in the memory protocol. The
signal (control) lasers are red-detuned by 1GHz from their resonant hyper-fine
transitions. A resonant pump laser populates the ground state $|g\rangle$. c)
A typical memory experiment sequence. We denote $t_{\rm{0}}$ = 0 as the center
of the signal pulse to be stored, and we read out such that the time between
the signal in and the control read pulse is $\Delta t=200\mathrm{ns}$.

Warm vapor atomic memories based on electromagnetically induced transparency
(EIT) have been highlighted as one of the most promising of these systems, as
they are technologically simple, can be multiplexed [18], and have been
modeled to have high operating efficiency [19]. Using strong magnetic control
of atomic ensembles an 82% internal efficiency at room temperature was
demonstrated [20]. Moreover, warm vapor memories have been shown to have an
acceptance bandwidth of 0.66 GHz, making them suitable for interfacing with
semiconductor quantum dots and other single photon sources [21].

A theoretical formulation and optimization of the three-level $\Lambda$ EIT
scheme in free space was presented in Refs. [22, 19]. There, they use a
gradient ascent approach to optimize the control field, using an analytically
calculable gradient derived from the atomic spin wave, to learn the temporal
shape of the optimal optical pulse. These simulation-optimized pulses were
then transferred to the experiment, where they were shown to perform well [23,
24]. However, the model presented in these works is limited in the physics it
accounts for; indeed the presence of a fourth level changes the shape of the
optimal control pulses, as shown in Ref. [25]. Moreover, there are further
experimental effects such as four-wave mixing (FWM) and the inhomogeneous
broadening of the excited state that are not accounted for in the four-level
system models, and the optimal operating conditions of a memory experiment.
Using the genetic algorithm, we learn optimal control pulses of a warm cesium
vapor quantum memory, where the temporal shape is encoded either as a Gaussian
with the amplitude, pulse width, and delay as free parameters, or a
16-parameter free-form pulse. In this contribution, we apply an optimization
process to the experiment as a whole. In-experiment optimizations boast the
benefit of accounting for a variety of experimental effects; device-specific
transfer functions of optical modulators, inter-system delays between signal
and control, and physical effects not captured in model systems. However, as
the spin-wave gradients are not accessible in an experimental setting, we must
consider an alternative, gradient-free learning approach. Genetic algorithms
are widely acknowledged as noise-robust gradient-free optimization algorithms,
making them attractive for use in a wide range of atomic (optics) experiments
[26, 27, 28, 29].

We find that the efficiency of memory experiments carried out with Gaussian
pulses is similar to those of free-form pules, in the device-resolvable range
of the experiment. This is confirmed in theory, albeit for the storage of
shorter signals [30]. We show experimentally that this trend holds for larger
pulse widths; that is, we find that the use of free-from pulses provides an
average improvement of 3(7)% for signals ranging between
$\tau_{\rm{FWHM}}\gamma=\\{1.9,21.5\\}$. Here, $\tau_{\rm{FWHM}}$ is the full-
width-half-maximum (FWHM) of the signal pulse, given in units of $\tau$, where
$\tau$ is $1/\gamma$ and $\gamma$ is the excited state decay rate. Moreover,
we demonstrate that temporal regions of particular importance to the
efficiency when using free-form pulses are similar to those temporally
overlapping with the signal pulse [31]. We also illustrate the possibility of
learning optimal pulses under further objective constraints, such as total
pulse energy minimization. Here we show that we can reduce the energy of the
learned signal and control pulses by 30% with a minimal trade-off of 4(6)% in
efficiency. This finding might have important implications for reducing the
readout noise - which is a well-known issue in warm vapor memories.

This work is structured as follows: In section II, we first present the
optical memory (Section II.1) and then the genetic algorithm (Section II.2).
The analysis of the results is divided into two sections, first we consider
the optimization of different-width signals stored (Section III). In Section
III.2, we discuss the results of the energy optimization. A brief discussion
of improvements to the method and an outlook for further research are given in
the final section.

##  II  Optical quantum memory optimization

###  II.1  Warm vapor memory

The experimental setup we optimize has been described extensively in Ref.
[32]; Figure 1a) depicts a compressed setup and below we emphasize the
differences in the setup used in this work.

We use two lasers with linear, orthogonal polarization as the signal (S) and
control (C) lasers, which are offset-locked to a frequency difference of 9.2
GHz. The signal and control pulses are generated with an electro-optic
modulator and an accousto-optic modulator, respectively. This enables us to
reach peak pulse powers of $P_{\mathrm{C,cw}}=12.9\ \mathrm{mW}$, without the
semiconductor optical amplifier and spontaneous emission filtering system used
in Ref. [32]. A pump laser with power $P_{\mathrm{P,cw}}=15.1\ \mathrm{mW}$ is
locked on the $F=4\rightarrow F^{\prime}=4$ transition, and counter propagates
to the signal and control lasers. We red-detune both lasers to be $1\
\mathrm{GHz}$ off the atomic transition; a level scheme indicating the laser
frequencies is shown in Fig.1 b). The wavelength of the control laser is
monitored using a wavemeter and is locked to it using a simple feedback loop,
to prevent frequency drifts during the algorithm evolution. For each memory
experiment carried out during the genetic algorithm evolution, we pump for
$400\ \mathrm{ns}$, and when evaluating the final efficiency we pump for $10\
\mathrm{\mu s}$. Differing to Ref. [32], we operate the coherent signal pulses
well above single photon level, at a continuous wave power of $126\
\mathrm{\mu W}$. Moreover, we detect the output of the memory directly on an
amplified photodiode, that is, without further filtering.
A single memory experiment is illustrated in Fig.1 c). The write pulse
(purple) mediates the storage of the input signal pulse (blue) in a collective
spin state of cesium atoms. After a time $\Delta t=200\rm{ns}$, the read pulse
(red) retrieves the stored optical field from the collective spin state; this
output signal is referred to as the retrieved pulse. Any component of the
optical field that is not stored in this process is referred to as the
leakage. In this work we focus on learning the shape of the write pulse, the
read pulse is fixed as a Gaussian with FWHM of $40\ \rm{ns}$. To quantify the
performance of the memory, we define an internal memory efficiency
$\eta_{\mathrm{int}}$:

$\eta_{\rm{int}}=\frac{\int^{\Delta t+\Delta t/2}_{\Delta t-\Delta
t/2}|E_{\textrm{out}}|^{2}dt}{\int^{\Delta t/2}_{-\Delta
t/2}|E_{\textrm{in}}|^{2}dt}.$ (1)

$E_{\textrm{out}}$ is the retrieved signal pulse, $E_{\textrm{in}}$ is the
initial signal and $\Delta t$ is the time between the initial signal and the
retrieval control pulse. This input pulse, $|E_{\rm{in}}^{2}|$, is measured
using the same detector, PD1 (Thorlabs APD0815), in the far-detuned regime,
such that the optical losses in the system remain the same for both
measurements, but the atoms do not absorb the signal. We red-detune the lasers
by $\Delta=2\ \mathrm{GHz}$ for this measurement. All the efficiencies of the
final learned pulse are evaluated in this way. The efficiencies in this work
are reported for a storage time of $\Delta t=200\ \rm{ns}$ and are not
extrapolated back to $\Delta t=0$ as would be standard in memory systems
comparison. Consequently, we expect that we are under-representing the
efficiencies by a factor of about 1.3.

To ensure consistency over multiple runs, before each evaluation of the
internal efficiency, we turn off the heating of the atomic cell to further
reduce stray magnetic fields and set the bias voltage of the EOM to its
minimum.

###  II.2 Genetic Algorithm

The genetic algorithm [33] was developed in the 1960s and 1970s, inspired by
considering how adaptation can be imported to computer systems, and thus to
objective optimization [34]. The goal of a genetic algorithm is to iteratively
find solutions which well fulfill the objective of a function.

Figure 2 shows a flow chart of a genetic algorithm. Briefly, solutions
(individuals) are encoded using parameters (genes). Each solution is evaluated
using an objective (fitness) function, which gives the optimization goal.
Solutions that have a high fitness, i.e. are appropriate solutions to the
objective, are selected to form the next generation. The selected solution’s
genes are crossed over and mutated, generating the next generation’s
population. The genetic algorithm was implemented using the Python package
PyGAD [35].

Here we wish to find the optimal control pulse shape, which maximizes the
internal memory efficiency. Previously, Gaussians have been demonstrated as
good approximations of an ideal control pulse, and provide a good benchmark
for performance analysis against a more general, free-form pulse [32][31]. To
be able to distinguish the improvement in efficiency due to the genetic
algorithm from the improvement in efficiency due to the pulse encoding, we run
the genetic algorithm for both Gaussian, and free-form solution
representations, and compare the results. This corresponds to performing a
constraint optimization like following:

$\hat{\theta}=\operatorname*{arg\,max}_{\theta}\left(\eta_{\rm{int}}(\theta)\right)$
(2)

where

$\theta=\begin{cases}[a,f,d]&\text{if encoding a Gaussian pulse}\\\
[x_{1},...,x_{16}]&\text{if encoding a free-form pulse}\\\ \end{cases}$

and $\eta_{\rm{int}}$ is the efficiency of the memory experiment performed
with a write pulse generated from $\theta$ (see Eq. 1).

Figure 2:  a) Different gene representations for different solutions. Only 3
genes are used to encode the Gaussian; the amplitude, $a$, FWHM, $f$, and the
delay with respect to the signal pulse, $d$. 16 evenly distributed points,
$x_{\textrm{1}},...,x_{\textrm{16}}$ encode the free-form pulse. The signal
pulse is shown in the dashed blue line. b) Overview of a genetic algorithm.

In the Gaussian encoding, each solution is represented by three parameters:
the amplitude of the Gaussian, $a$, the full-width-at-half-maximum of the
Gaussian, $f$, and the delay of the pulse, $d$, with respect to the incoming
signal pulse (see Fig. 2a). The $a$ was allowed to take 50 discrete values
normalized to between 0 and 1, to reduce the dimension of the feature space
searched. Similarly, $d$ and $f$ were limited in their possible range of
values to between $-60$ and $0\ \rm{ns}$ and $(0$ and $80\ \rm{ns})$
respectively, both increasing $1\ \rm{ns}$ intervals.

To implement a free-form pulse optimization, we represent a solution by 16
evenly distributed points, which are interpolated using a smoothing cubic
spline method, to form a continuous waveform. Each point is limited to a range
of values between -0.2 and 1, and when interpolated, any negative values in
the waveform are clipped to 0. This is to ensure that steep gradients can be
learned, whilst not generating nonphysical negative pulse intensities.

For each of the two encodings, an initial population of 60 individuals is
randomly generated. For each individual, we generate the electrical waveform
encoded by the genes and modulate the waveform into the laser beam by altering
the RF power driving the AOM. Then we perform a memory experiment, as detailed
in Section II.1, using this waveform. The memory experiments for all
individuals in a generation are recorded by an oscilloscope in a single shot
and the trace is divided into individual memory experiments for evaluation.

As mentioned in Section II.1, the internal efficiency is typically measured by
detuning the laser, to ensure the signal pulse has the same losses as the
retrieval pulse. However, to measure the signal far-detuned for each solution
requires significant time overhead, which was deemed unfeasible for this
experiment. Consequently, we evaluate the solutions on a fitness function
which is faster to evaluate, and is linearly proportional to the internal
efficiency. Specifically, to measure the fitness of each individual, we
integrate the retrieved signal and normalize by a part of the input signal
measured on a photodiode (PD2), before the cesium cell. The part of the input
signal that is measured before the memory is integrated and is taken as a
normalizing factor.

Figure 3: The convergence of the free-form pulse, learned for a 18 ns width
signal. The fitness (light blue) and the related internal efficiency (dark
blue) show the saturation of the learning process at generation 30. The pulse
shapes for the best-performing pulse at each iteration are shown in purple,
the final pulse is thus the end result. Green shows the number of new
solutions tried per generation.

We select the solutions with the highest fitness to form the parents of next
generation of solutions. This is done by tournament selection with a
tournament size of ten, until ten parents are chosen. Once selected, the
parents are crossed over uniformly, and each of the genes of the resulting
children is randomly mutated with probability $p=0.3$. 55 new children are
generated in this manner and form the next generation, five of the best-
performing solutions survive unchanged. This process is repeated for 50 (25)
epochs for the free-form (Gaussian) pulses. As a single evaluation of a
generation takes $\sim 1.5$ minutes, the time taken to run the whole
experiment is $1.5\ \rm{minutes}\times\rm{\\#\ generations}$. To ensure the
timely termination of the algorithm, without cutting off the evolution too
early, we fix the number of generations executed. Given the comparatively
small feature space to be searched in the Gaussian case, we find the algorithm
to converge before 25 generations. Figure 3 shows a typical convergence plot
for a single run of the genetic algorithm with free-form gene encoding, which
illustrates the convergence of the algorithm well before 50 generations.
Solutions that have been already evaluated are saved in a dictionary, and
their value re-called if they are to be re-evaluated, resulting in strictly
monotonous convergence.

##  III  Results and discussion

###  III.1 Efficiency optimization

Figure 4: a) The efficiencies of the learned pulses, for varying signal FWHM.
The free-from pulses (purple) look to perform on average, slightly better than
the Gaussian pulse (green), but this improvement is not statistically
significant. The fits are modelled as
$\eta_{\rm{int}}=\eta_{0,\rm{t_{S}}}/\sqrt{1+(\frac{4\ln(2)}{\Delta
t_{S}\Delta\gamma})^{2}}$, where $\eta_{0,\rm{t_{S}}}$ is the maximal
achievable efficiency and the bandwidth of the memory, $\gamma$. See Ref. [32]
for the derivation.

We first run the genetic algorithm optimizing storage efficiency for
different-width Gaussian input pulses. Here we scan the FWHM of the signal
pulse from $3.8\ \rm{ns}-43\ \rm{ns}$
($\tau_{\rm{FWHM}}\gamma=\\{1.9,21.5\\}$, $\gamma\approx 500\ \mathrm{MHz}$),
and for each signal, learn first the optimized Gaussian pulse, then the
optimized free-form pulse. The results can be seen in Fig. 4. On average, the
free-from yields an improvement 3(7)% over the learned Gaussian pulses. This
extends the trend shown in Ref. [30], which shows that in a simulated three-
level system, there is almost no difference in attainable efficiency between
the free-form and Gaussian control pulses, for signal widths in the range
$\tau_{\rm{FWHM}}\gamma=\\{0.001,1.5\\}$. The agreement between simulation and
experiment is particularly surprising, given the presence of known physical
effects, which are not accounted for in three-level systems. Effects such as
the inhomogeneous broadening of the excited state, differences in the Rabi
frequency and the strength of coupling to different Zeeman levels are
correlated to the pulse energy, and thus the temporal shape of the pulses used
in the memory.

(a) $8.9\ \rm{ns}$ signal FWHM

(b) $18\ \rm{ns}$ signal FWHM

(c) $31\ \rm{ns}$ signal FWHM

(d) $41\ \rm{ns}$ signal FWHM

Figure 5: Free-form pulse optimization. We show the best-learned pulses for a
signal pulse with a) 8.9 ns b) 18 ns c) 31 ns and d) 41 ns full-width-at-half-
maximum. The distribution of values explored for each gene throughout the
whole optimization process is shown in a violin plot, with the final chosen
gene values indicated as purple dots. The corresponding electrical waveform
generated from the final gene values is shown in purple, and its corresponding
optical signal in green. The variance of solutions that have a fitness within
10% of the best-learned solution is plotted in blue. The lines joining the
points have no physical significance and are intended as a guide to the eye.
The temporal overlap of the signal and control pulses shows a consistent trend
in the closing of the coherence window (inset).

It seems as though the free-form pulses may yield only minimal improvements on
the total storage efficiency, yet before accepting this conclusion one must
also consider nuances of the pulse generation, particularly for smaller signal
widths. Due to the $15\ \rm{ns}$ rise time of the AOM, for shorter signal
pulses, it is not possible to modulate the optical field within the signal
field for small signals. We are only able to modulate the field in the form of
the falling flank of the AOM as it is switched off. Hence, it is not possible
to definitively dismiss non-Gaussian pulses as non-optimal for signal pulses
smaller than $\tau_{\rm{FWHM}}\gamma=1.9$.

Figure 5 shows the final learned pulses for a subset of the signal widths. A
general feature of all learned free-form pulses is a Gaussian-like falling
edge temporal overlap with the signal pulse. For signal widths above 18ns, we
observe a positively increasing trend between the distance of the peaks of the
signal and control fields (see Fig. 5 insets). Qualitatively, we see the
downward slope of the control pulse crosses first with the rising edge of the
signal pulse, i.e., the optimal control pulse arrives before the signal. This
behavior is also consistent for the Gaussian pulses and is consistent with the
optimal pulse learned in Ref. [31].

Figure 6: The efficiencies of energy restricted pulses, for a) 31 ns and c) 18
ns FWHM signal pulses. The corresponding learned pulses are plotted for the
free-form pulses (plotted in the upper panel of b) and d)) and Gaussian pulses
(plotted in the lower panel of b) and d)), with a color gradient from blue to
red (energy: low - high).

To determine how important specific genes are to the efficiency we use two
indicators, the distribution of the state space explored during the learning
process, and how much the genes of well-performing solutions vary. First, we
consider the state-space search by plotting the value distribution of all the
solutions (purple violin plot in Fig.5). Genes where the importance of the
value has little effect on the overall internal efficiency will have a wide
value distribution, as seen in genes 2 and 7 of Figure 5(a)) and genes 2 and 4
of Figure 5(b)). Similarly, genes whose value is important to the efficiency
of the experiment will have a compact value distribution, such as most of the
genes in the $11-16$ range of genes. This is not a surprise, as high gene
values would trigger early read-out of the pulse, reducing the residual signal
stored in the atoms, and thus reducing the retrieval. Secondly, we calculate
the variance for solutions that are at least 90% of the maximum fitness. These
can be seen in blue in Figure 5. We see a consistent trend across all learned
pulses that the variance fluctuates in genes 1-9 and beyond genes 10 the
fluctuations reduce, or are not present. This is an effect of preventing the
aforementioned read-out of the pulse. We see the variance mirrors the
distributions over the whole searched space, that is, genes that vary over the
whole state space, also have a high variance in the top 10% of solutions.
Thus, one can conclude that solutions that have a low variance are important
to the efficiency, and thus should be the focus of further optimization
efforts. We find the concentration of high varying genes before the arrival of
the signal pulse unsurprising, as these genes encode for time before the
arrival of the signal pulse.

###  III.2  Energy optimization

One application we demonstrate in this report is to learn solutions limited in
the total pulse energy.

Ref. [32] shows the effect of pulse energy on the signal-to-noise ratio of the
retrieved pulses from the optical memory. By setting genes of the pulse that
have no effect on the efficiency to high values, one increases the total pulse
energy. This, in turn, inadvertently decreases the signal-to-noise ratio of
the memory, with no efficiency payoff. To mitigate this effect in solutions
learned by the genetic algorithm, one can reduce the allowed energy through an
energy optimization. Indeed, a benefit to using a genetic algorithm is that we
can set secondary optimization objectives, to learn optimal pulses given
particularly restrained conditions.

To optimize the energy, we set the maximally learned pulse energy to be the
area under the curve of the electrical pulses learned in the experiments
described in Sec.III. Then, we generate new solutions as described in
Sec.II.2, but re-normalize any pulses whose electrical pulse area is larger
than a specified limit, hereby setting a hard constraint on the allowed pulse
energy of all the generated solutions. This leads to a modified constraint
optimization function:

$\tilde{\theta}=\operatorname*{arg\,max}_{\theta}\bigl{(}\eta_{\rm{int}}^{\prime}(\theta)\bigr{)},$
(3)

where

$\eta_{\rm{int}}^{\prime}=\begin{cases}\eta_{\rm{int}}(\theta)&\text{if}\
I(\theta)\leq I(\hat{\theta})\alpha\\\
\eta_{\rm{int}}(\theta/\beta)&\text{otherwise.}\\\ \end{cases}$

Here $I(\theta)$ is the integrated area under the curve of the pulse encoded
by $\theta$, $\hat{\theta}$ are the learned parameters from the efficiency
optimization, $\alpha$ is a percentage factor of the max energy,
$I(\hat{\theta})$ and the normalizing factor, $\beta$ is given by
$\beta=I(\theta)/I(\hat{\theta})\alpha$. We choose the energy limit to be a
progressively decreasing percentage of the learned pulse
($\alpha=\\{0.3,0.9\\}$), as shown in Figures 5(b)) and 5(c)). We carry out
the energy optimization in the medium ($18\ \rm{ns}$) and long ($31\ \rm{ns}$)
regimes and the results can be seen in Figure 6. The upper pulse energy limit
corresponds to an optical pulse energy of $E_{\rm{G},18\rm{ns}}=30.9\ \rm{nJ}$
and $E_{\rm{G},31\rm{ns}}=33.0\ \rm{nJ}$ for the Gaussian pulses, and
$E_{\rm{F},18\rm{ns}}=27.0\ \rm{nJ}$, $E_{\rm{F},31\rm{ns}}=52.2\ \rm{nJ}$ and
for the free-form pulses.

We show that for a 31 ns signal pulse, we see a consistent trade-off in
allowed pulse energy and attainable internal efficiency. This suggests that
without the need for an extra optimization objective, the algorithm already
goes part of the way to learning the most efficient pulse. Moreover, when we
consider the absolute energy of the learned pulses, we note that the maximum
allowed energy for the free-form pulses is about 1.6 times larger than the
corresponding maximum Gaussian energy. This means, that in absolute terms, the
60% energy free-form pulse, and 90% Gaussian pulse have been limited to about
the same energy, and yield similar efficiencies, correspondingly. This
supports the conclusion that for large signal sizes, Gaussians are good
approximations of the most energetically efficient pulse. Furthermore, we see
in Fig. 6b) that the falling flank of both the learned free-from and Gaussian
pulses remains consistent as the energy is reduced, supporting the conclusions
drawn from the previous section.

However, for a $18\ \rm{ns}$ signal pulse (see Fig. 6c), we are able to reduce
the pulse energy of both the free-form and Gaussian pulses by 30% with a
reduction of only 4(6) % from the efficiency at 100% pulse energy. For the
free-from pulses, this reduction in energy corresponds to the reduction in the
first part of the pulse (from 0- 75 ns), whilst the falling flank remains
largely constant. This supports our conclusions from the gene analysis, that
the first genes are not important factors in the efficiency. Indeed, we see
that in the very low energy regime, we tend to a pulse shape that looks
similar to the Gaussian. It is important to note, that only Figure 6a) shows a
signal pulse wide enough, such that one would be able to modulate the control
pulse within the signal pulse, due to limitations in the AOM rise time.

While this method is not able to reduce the pulse energy whilst maintaining
efficiency for all signal widths, it does give us a methodology that allows us
to specify a pulse energy, decided by the desired signal-to-noise ratio, and
learn optimal pulses for that energy level. This can be key in further pushing
the efficiency of warm quantum memories.

##  IV Conclusion

In summary, we have shown that a genetic algorithm can be used to optimize the
write pulses of an optical quantum memory. The choice of a free-form pulse
encoding gives an overall average improvement factor of 3(7)%, suggesting that
Gaussian pulses are an acceptable approximation to optimal pulses. This agrees
with the findings of Ref. [31]. Nonetheless, we have demonstrated the merit of
genetic algorithms in optimization with additional constraints, such as a
total pulse energy limit. Here we demonstrated that it is possible to reduce
the pulse energy by 30% in some cases, without a large compromise in
efficiency. This work focused on the measurement of the write control pulse
optimization for Gaussian-shaped signal pulse, however, other works
investigating signal shapes closer to the emission of single photon sources (
See Ref. [25]), indicate the value in extending this approach to different
signal shapes. Moreover, future work considering the learning and analysis of
an optimal read pulse may be interesting to determine the validity of the time
reversal assumption, often used in theoretical modeling [22]. Finally, this is
a platform-agnostic approach that can be applied to a wide range of atomic and
molecular physics experiments, supporting the further development of a range
of high-efficiency optical quantum memories.

##  V Acknowledgments

This work was funded by the German Ministry of Education and Research (BMBF)
project Q-ToRX and Deutsche Forschungsgemeinschaft 448532670. E.R.
acknowledges funding through the Helmholtz Einstein International Berlin
Research School in Data Science (HEIBRiDS).

##  VI Appendix 1 - Genetic Algorithm details

Hyper-parameter | Free-form (Gauss)
---|---
# Genes | 16 (3)
# Generations | 50 (25)
# Solutions per population | 60
# Parents mating | 10
Selection type | Tournament
Tournament size | 10
Elitism size | 5
Crossover type | Uniform
Mutation type | Random
Mutation probability | 0.3
Table 1: The hyper-parameters used to run the genetic algorithm [35]. Values
quoted in parenthesis are the parameters used for the Gaussian optimization.

In this appendix we elaborate on the processes used to select the parents and
generate the children of the next generation. Once the fitness’s of each
solution have been evaluated, one must consider a method of choosing which
solutions will be selected as parents. There are many different selection
methods available; in this work, we chose tournament selection as it is easy
to conceptualize and select the selection pressure (the likelihood that sub-
optimal solutions are selected). In tournament selection, a subsection of the
solutions are drawn at random. The highest-performing solution from the subset
is selected as a parent for the next generation. This process is repeated
until one has generated a number of parents, specified by the # parents mating
hyper-parameter. The list of parents is traversed sequentially and each pair
of parents is used to generate a solution of the next generation by crossover,
i.e. first parents 1 and 2 are selected, then parents 2, 3 etc. Once two
parents have been selected and their genes are crossed over, there are several
methods for performing crossover, which can be selected depending on the
physical meaning of the genes. We select a uniform crossover, such that for
each gene, one of the genes of the two parents is chosen with equal
probability, and that gene is copied across to the other. Once crossed over,
each gene of the child is mutated with a probability $p$, and the resulting
solution is taken as one element of the population in the next generation.
Table 1 lists the hyper-parameters that were used in the experiment.

## References

  * Nunn  _et al._ [2008] J. Nunn, K. Reim, K. C. Lee, V. O. Lorenz, B. J. Sussman, I. A. Walmsley, and D. Jaksch, Multimode memories in atomic ensembles, Physical Review Letters 101, 260502 (2008).
  * Sangouard  _et al._ [2011] N. Sangouard, C. Simon, H. de Riedmatten, and N. Gisin, Quantum repeaters based on atomic ensembles and linear optics, Reviews of Modern Physics 83, 33 (2011).
  * Gündoğan  _et al._ [2021a] M. Gündoğan, J. S. Sidhu, V. Henderson, L. Mazzarella, J. Wolters, D. K. L. Oi, and M. Krutzik, Proposal for space-borne quantum memories for global quantum networking, npj Quantum Information 7, 128 (2021a).
  * Wallnöfer  _et al._ [2023] J. Wallnöfer, F. Hahn, F. Wiesner, N. Walk, and J. Eisert, Requsim: Faithfully simulating near-term quantum repeaters (2023), arXiv:2212.03896 [quant-ph] .
  * Mol  _et al._ [2023] J.-M. Mol, L. Esguerra, M. Meister, D. E. Bruschi, A. W. Schell, J. Wolters, and L. Wörner, Quantum memories for fundamental science in space, Quantum Science and Technology 8, 024006 (2023).
  * Manukhova  _et al._ [2017] A. D. Manukhova, K. S. Tikhonov, T. Y. Golubeva, and Y. M. Golubev, Noiseless signal shaping and cluster-state generation with a quantum memory cell, Physical Review A 96, 023851 (2017).
  * Gündoğan  _et al._ [2021b] M. Gündoğan, T. Jennewein, F. K. Asadi, E. Da Ros, E. Sağlamyürek, D. Oblak, T. Vogl, D. Rieländer, J. Sidhu, S. Grandi, L. Mazzarella, J. Wallnöfer, P. Ledingham, L. LeBlanc, M. Mazzera, M. Mohageg, J. Wolters, A. Ling, M. Atatüre, H. de Riedmatten, D. Oi, C. Simon, and M. Krutzik, Topical white paper: A case for quantum memories in space (2021b), arXiv:2111.09595 [quant-ph] .
  * Jaurigue  _et al._ [2021] L. Jaurigue, E. Robertson, J. Wolters, and K. Lüdge, Reservoir computing with delayed input for fast and easy optimisation, Entropy 23, 1560 (2021).
  * Lei  _et al._ [2023] Y. Lei, F. K. Asadi, T. Zhong, A. Kuzmich, C. Simon, and M. Hosseini, Quantum optical memory for entanglement distribution (2023), arXiv:2304.09397 [quant-ph] .
  * Specht  _et al._ [2011] H. P. Specht, C. Nölleke, A. Reiserer, M. Uphoff, E. Figueroa, S. Ritter, and G. Rempe, A single-atom quantum memory, Nature 473, 190 (2011).
  * Gündoğan  _et al._ [2015] M. Gündoğan, P. M. Ledingham, K. Kutluer, M. Mazzera, and H. de Riedmatten, Solid state spin-wave quantum memory for time-bin qubits, Physical Review Letters 114, 230501 (2015).
  * Yang  _et al._ [2018] T.-S. Yang, Z.-Q. Zhou, Y.-L. Hua, X. Liu, Z.-F. Li, P.-Y. Li, Y. Ma, C. Liu, P.-J. Liang, X. Li, Y.-X. Xiao, J. Hu, C.-F. Li, and G.-C. Guo, Multiplexed storage and real-time manipulation based on a multiple degree-of-freedom quantum memory, Nature Communications 9, 3407 (2018).
  * Pu  _et al._ [2017] Y.-F. Pu, N. Jiang, W. Chang, H.-X. Yang, C. Li, and L.-M. Duan, Experimental realization of a multiplexed quantum memory with 225 individually accessible memory cells, Nature Communications 8, 15359 (2017).
  * Yang  _et al._ [2016] S.-J. Yang, X.-J. Wang, X.-H. Bao, and J.-W. Pan, An efficient quantum light–matter interface with sub-second lifetime, Nature Photonics 10, 381 (2016).
  * Bao  _et al._ [2012] X.-H. Bao, A. Reingruber, P. Dietrich, J. Rui, A. Dück, T. Strassel, L. Li, N.-L. Liu, B. Zhao, and J.-W. Pan, Efficient and long-lived quantum memory with cold atoms inside a ring cavity, Nature Physics 8, 517 (2012).
  * Sabooni  _et al._ [2013] M. Sabooni, Q. Li, S. Kröll, and L. Rippe, Efficient quantum memory using a weakly absorbing sample, Physical Review Letters 110, 133604 (2013).
  * Hedges  _et al._ [2010] M. P. Hedges, J. J. Longdell, Y. Li, and M. J. Sellars, Efficient quantum memory for light, Nature 465, 1052 (2010).
  * Meßner  _et al._ [2023] L. Meßner, E. Robertson, L. Esguerra, K. Lüdge, and J. Wolters, Multiplexed random-access optical memory in warm cesium vapor, Optics Express 31, 10150 (2023).
  * Gorshkov  _et al._ [2008] A. V. Gorshkov, T. Calarco, M. D. Lukin, and A. S. Sørensen, Photon storage in $\Lambda$ -type optically dense atomic media. IV. optimal control using gradient ascent, Physical Review A 77, 043806 (2008).
  * Guo  _et al._ [2019] J. Guo, X. Feng, P. Yang, Z. Yu, L. Q. Chen, C.-H. Yuan, and W. Zhang, High-performance raman quantum memory with optimal control in room temperature atoms, Nature Communications 10, 148 (2019).
  * Wolters  _et al._ [2017] J. Wolters, G. Buser, A. Horsley, L. Béguin, A. Jöckel, J.-P. Jahn, R. J. Warburton, and P. Treutlein, Simple atomic quantum memory suitable for semiconductor quantum dot single photons, Physical Review Letters 119, 060502 (2017).
  * Gorshkov  _et al._ [2007] A. V. Gorshkov, A. André, M. D. Lukin, and A. S. Sørensen, Photon storage in $\Lambda$ -type optically dense atomic media. II. free-space model, Physical Review A 76, 033805 (2007).
  * Novikova  _et al._ [2008] I. Novikova, N. B. Phillips, and A. V. Gorshkov, Optimal light storage with full pulse-shape control, Physical Review A 78, 021802 (2008).
  * Phillips  _et al._ [2008] N. B. Phillips, A. V. Gorshkov, and I. Novikova, Optimal light storage in atomic vapor, Physical Review A 78, 023801 (2008).
  * Rakher  _et al._ [2013] M. T. Rakher, R. J. Warburton, and P. Treutlein, Prospects for storage and retrieval of a quantum-dot single photon in an ultracold 87 Rb ensemble, Physical Review A 88, 053834 (2013).
  * Hornung  _et al._ [2000] T. Hornung, R. Meier, D. Zeidler, K.-L. Kompa, D. Proch, and M. Motzkus, Optimal control of one- and two-photon transitions with shaped femtosecond pulses and feedback, Applied Physics B: Lasers and Optics 71, 277 (2000).
  * Zeidler  _et al._ [2001] D. Zeidler, S. Frey, K.-L. Kompa, and M. Motzkus, Evolutionary algorithms and their application to optimal control studies, Physical Review A 64, 023420 (2001).
  * Judson and Rabitz [1992] R. S. Judson and H. Rabitz, Teaching lasers to control molecules, Physical Review Letters 68, 1500 (1992).
  * Gregoric  _et al._ [2017] V. C. Gregoric, X. Kang, Z. C. Liu, Z. A. Rowley, T. J. Carroll, and M. W. Noel, Quantum control via a genetic algorithm of the field ionization pathway of a rydberg electron, Physical Review A 96, 023403 (2017).
  * Shinbrough  _et al._ [2021] K. Shinbrough, B. D. Hunt, and V. O. Lorenz, Optimization of broadband $\Lambda$ -type quantum memory using gaussian pulses, Physical Review A 103, 062418 (2021).
  * Shinbrough and Lorenz [2023] K. Shinbrough and V. O. Lorenz, Variance-based sensitivity analysis of $\Lambda$ -type quantum memory, Physical Review A 107, 033703 (2023).
  * Esguerra  _et al._ [2023] L. Esguerra, L. Meßner, E. Robertson, N. V. Ewald, M. Gündoğan, and J. Wolters, Optimization and readout-noise analysis of a warm-vapor electromagnetically-induced-transparency memory on the Cs D1 line, Physical Review A 107, 042607 (2023).
  * Holland [1975] J. H. Holland,  _Adaptation in Natural and Artificial Systems - An Introductory Analysis with Applications to Biology, Control, and Artificial I_ (The MIT Press, Cambridge, 1975).
  * Mitchell [1998] M. Mitchell,  _An introduction to genetic algorithms_ , 1st ed., A Bradford book (MIT, Cambridge, Mass. and London, 1998).
  * Gad [2021] A. F. Gad, Pygad: An intuitive genetic algorithm python library (2021), arXiv:2106.06158 [cs.NE] .