# Learning efficient erasure protocols for an underdamped memory

Nicolas Barros, Stephen Whitelam, Sergio Ciliberto, Ludovic Bellon

► To cite this version:

Nicolas Barros, Stephen Whitelam, Sergio Ciliberto, Ludovic Bellon. Learning efficient erasure protocols for an underdamped memory. Physical Review E, 2025, 111 (4), pp.044114. 10.1103/Phys-RevE.111.044114. hal-05064632

HAL Id: hal-05064632

https://hal.science/hal-05064632v1

Submitted on 12 May 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
Learning efficient erasure protocols for an underdamped memory

Nicolas Barros,¹ Stephen Whitelam,², * Sergio Ciliberto,¹ and Ludovic Bellon,¹, †

¹CNRS, ENS de Lyon, Laboratoire de Physique, F-69342 Lyon, France

²Molecular Foundry, Lawrence Berkeley National Laboratory, 1 Cyclotron Road, Berkeley, CA 94720, USA

We apply evolutionary reinforcement learning to a simulation model in order to identify efficient time-dependent erasure protocols for a physical realization of a one-bit memory by an underdamped mechanical cantilever. We show that these protocols, when applied to the cantilever in the laboratory, are considerably more efficient than our best hand-designed protocols. The learned protocols allow reliable high-speed erasure by minimizing the heating of the memory during the operation. More generally, the combination of methods used here opens the door to the rational design of efficient protocols for a variety of physics applications.

# I. INTRODUCTION

To erase one bit of information infinitely slowly requires the dissipation of $k_B T \ln 2$ of heat, where $k_B$ is Boltzmann's constant and $T$ the equilibrium temperature, a limit described by Landauer in 1961 [1, 2]. Performing erasure at finite rate incurs additional heat costs that depend on how the bit is realized and which time-dependent protocol is used [3–8]. Experiments on a mechanical cantilever and phenomenological modeling indicate that a one-bit memory realized by an underdamped oscillator can be used to perform erasure more reliably and at higher speeds than can overdamped systems. However, two phenomena negatively affect the operation of underdamped memories: 1) residual damping losses are proportional to the velocity, and 2) the system heats up at low dissipation when heat transfer to the thermostat cannot compensate for the work done on the system. The latter energy overhead is described by an extended Landauer bound, where the temperature to consider is a weighted average of $T$ during the transformation [9–11].

Harnessing the potential of underdamped systems for logic operations [12] requires finding optimal ways to perform erasure. Optimal protocols are not known because the problem is nonlinear [13, 14] – memories are bistable systems – and we want to work in the limit of fast processes, where long-time approximations [15–17] break down. In this article we show that evolutionary reinforcement learning [18–21], a form of machine learning, can be used to find protocols for memory erasure in underdamped systems that are considerably more efficient than our best hand-designed protocols. To do so we express a time-dependent erasure protocol in the form of a deep neural network. Such an ansatz does not presuppose a functional form for the protocol, and is flexible enough to represent many different forms, including jumps and high-frequency features that appear in optimal protocols in other underdamped systems [22]. Using a simulation model (or “digital twin”) of the experiment, we apply a genetic algorithm to train the neural network in order to

achieve a desired objective, which in this work is to render repeated erasures as reliable as possible, with a low energy of the memory after a single erasure as an intermediate objective. We then take the trained neural-network protocols and apply them to experiment, where we find that they behave as they do in simulation and represent a considerable improvement over our best hand-designed protocols, which were introduced in Refs. [6, 9, 10].

In what follows we introduce the experimental realization of a 1-bit memory with a cantilever and our simulation model of the experiment. We show that the model is an accurate representation of experiment. We then use evolutionary reinforcement learning within simulations in order to derive efficient erasure protocols, and we apply these protocols to experiment, where we observe results consistent with simulation. The trained neural-network protocols allow reliable high-speed erasures in a physical model of a one-bit memory, potentially important for next-generation computing applications. A striking benefit of those protocols is that they are also low-energy: they keep the memory cool, increasing its reliability. The combination of methods used here and the ability to deploy protocols in experiments opens the door to the rational design of hardware and software for deterministic $k_B T$-scale computing, and more generally to efficient protocols for a variety of physics applications.

# II. EXPERIMENTAL APPARATUS AND SIMULATION MODEL

Fig. 1(a) shows our experimental setup. This consists of a micromechanical cantilever that operates, in the absence of external forces, as an underdamped harmonic oscillator characterized by a stiffness $k$, a resonance angular frequency $\omega_0 = 2\pi f_0 = 2\pi \times (1090 \text{ Hz})$, and a quality factor $Q = 7$. The deflection $x$ of the resonator is measured using interferometry [27]. The oscillator is in thermal equilibrium with the surrounding air at room temperature $T$, and is subject to thermal fluctuations. The variance of $x$ at equilibrium is given by $\sigma^2 = k_B T/k \sim 1 \text{ nm}^2$. Subsequently, we express all lengths in units of $\sigma$, energies in units of $k_B T$, and time in units of $\omega_0^{-1}$. The fundamental oscillation period is thus $t_0 = 2\pi$.

<footnote>* swhitelam@lbl.gov</footnote>

<footnote>† ludovic.bellon@ens-lyon.fr</footnote>
<figure><img src="image_2.png" /><figcaption>FIG. 1. (a) Experimental setup: a conductive cantilever experiences an electrostatic force $F_{el}$ due to the voltage difference $V - V_0$ with a facing electrode. The deflection $x$ of the cantilever, measured by interferometry, is compared to a threshold $x_0$ by the feedback loop setting $V = \pm V_1$. (b) This results in a tunable double-well potential $U$ [23, 24], that can be measured via the Boltzmann distribution $\rho_0(x)$ of the cantilever deflection in equilibrium: $U(x) = -\ln \rho_0(x)$. We plot this measured potential as dots, with error bars of one standard deviation, on top of the line denoting Eq. (1). Logical states 0 and 1 are assigned to values $x < 0$ and $x > 0$, respectively. Our aim is to change the tunable parameters $x_0, x_1$ as a function of time in order to render multiple erasures (resets to 0 or 1) as reliable as possible. (c) Basic erasure protocol for a reset to state 0 (top). This protocol results in the distribution $\rho(x, t)$ in experiment (bottom). (d) Time-ordered snapshots with the potential $U(x, t)$, associated Boltzmann equilibrium distributions $\rho_0(x)$, and the distribution of cantilever positions $\rho(x, t)$ in experiment (green) and simulation (black dashed) [25]. The full movie of the time evolution of $U(x, t)$ and $\rho(x, t)$ corresponding to those snapshots is available as a supplementary file [26]. Experiment and simulation are consistent. This basic protocol is only partially reliable: about 7% of trajectories end in the wrong well. In what follows we apply machine learning to the simulation in order to learn more efficient erasure protocols $[x_0(t), x_1(t)]$, and we deploy these protocols in experiment.</figcaption></figure>

Using a fast feedback loop [23, 24] we can modulate the electrostatic force acting on the cantilever so that it experiences a virtual energy potential $U(x, t)$ that is parameterized by two scalars, $x_0(t)$ and $x_1(t)$:

$$U(x,t) = \frac{1}{2}(x - S[x - x_0(t)]x_1(t))^2 + x_0(t)x_1(t)[S(x - x_0(t)] + S[x_0(t)]). \quad (1)$$

Here $S$ is the sign function, where $S[x] = -1$ if $x < 0$, and $S[x] = 1$ otherwise. $U(x, t)$ has in general a double-well form, shown in Fig. 1(b), where $x_0$ tunes the asymmetry and $x_1$ the barrier height. We start and end with a symmetric double well, and associate cantilever positions $x < 0$ and $x > 0$ with logical states 0 and 1, respectively. Starting in thermal equilibrium, with the cantilever in either well, we can impose a time-dependent protocol $[x_0(t), x_1(t)]$ in order to perform erasure, i.e. to bring the cantilever tip from its starting well to a specified final well in time $t_f = 2t_0$. We allow the protocol to act over one fundamental oscillation period $t_0$, and then wait in the final double-well for an additional time $t_0$ in order to assess the stability of the system. The time $t_f$ is very short, smaller than the relaxation time of the system $Qt_0/\pi$, and optimized protocols are required in order to minimize the kinetic energy of the cantilever post-erasure

and so render erasure reliable. If the post-erasure kinetic energy is too large then the cantilever will escape from the intended well, rendering erasure unreliable [11]. In what follows our aim is to determine a protocol that makes multiple erasures, each of time $t_f$ and with no waiting time between them, as reliable as possible.

Our model of the underdamped oscillator consists of the dimensionless Langevin equation (see derivation in Appendix A)

$$\ddot{x} + Q^{-1}\dot{x} = -U'(x, t) + \sqrt{2Q^{-1}}\xi. \quad (2)$$

Here dots and primes denote differentiation with respect to time $t$ and position $x$, respectively, and $\xi$ is a Gaussian white noise satisfying $\langle \xi(t) \rangle = 0$ and $\langle \xi(t)\xi(t') \rangle = \delta(t-t')$.

Introducing the cantilever velocity $v = \dot{x}$ and integrating Eq. (2) over the short time interval $\Delta t$ yields the update equations (details in Appendix A)

$$\begin{aligned} x(t + \Delta t) &= x(t) + v(t)\Delta t, \\ v(t + \Delta t) &= \alpha v(t) - (1 - \alpha) Q U'[x(t)] + \sqrt{1 - \alpha^2} \tilde{\xi}(t), \end{aligned} \quad (3)$$

where $\alpha \equiv e^{-\Delta t/Q}$, and $\tilde{\xi}(t)$ is randomly drawn from a centered normal distribution of unit variance. We numerically integrate Eqs. (3) from time $t=0$ to $t=t_f$ using a timestep $\Delta t = 1.09 \times 10^{-4}t_0$, starting in equilibrium with the potential in its symmetric double-well form.
### III. HAND-DESIGNED ERASURE PROTOCOLS AND VALIDATION OF THE SIMULATION MODEL

In Fig. 1(c) we present our basic erasure protocol [6]. As shown in Fig. 1(c-d), this merges the two wells symmetrically, translates the resulting single well to the left or right (for erasure to state 0 or 1, respectively), and then reconstitutes the double-well potential. The time-ordered snapshots in panel (d) show the potential (black), the associated Boltzmann equilibrium distributions (grey dashed), and the instantaneous distribution of cantilever positions in experiment (green) and simulation (black dashed) [25]. Our simulation results are consistent with our experiments. The cantilever positions are in general far from thermal equilibrium. From inspection of the panels at times $t/t_f = 0.7$ and 1, and from panel (c), it is clear that in several trajectories the cantilever has so much kinetic energy that it escapes from the desired well prior to the end of the quiescent period. As a result, the basic protocol achieves erasure with only about 93% success rate (in both experiment and simulation).

In Fig. 2(a) we show that the basic protocol fails completely when applied to 100 consecutive erasures (with the target 0 or 1 chosen randomly with equal likelihood): the probability $P_s(100)$ of observing 100 consecutive successful erasures is zero, in both simulation and experiment [28]. The excess kinetic energy possessed by the cantilever following each erasure quickly builds and renders erasures completely unreliable. For all trajectories, we compute the work $W$ performed on the system during the erasure using the usual stochastic thermodynamics convention [29], $W = \int \partial_t U(x, t)dt$. In the experiment, the feedback loop has no energetic contribution, because its only role is to construct the virtual potential [23, 24]. In Fig. 2(b) we illustrate the work distribution associated with the basic erasure protocol in simulation and experiment, confirming again the accuracy of the simulation model, and underlining the fact that feedback used to create the virtual potential – which is not considered in the simulation model – has no energetic impact upon erasure. The work distribution is very broad, with a mean value $\langle W \rangle = 15.9$, far above the Landauer bound. With such a short $t_f$, the basic protocol is both unreliable and expensive.

In Fig. 3(a) we show our best hand-designed protocol, an enhanced version of the basic protocol with delta function-like kicks at four points along the trajectory [10]. These kicks are motivated by the finding that optimal translation of an underdamped particle in a harmonic potential requires delta function impulses that abruptly change the velocity of the particle [22]. In our case the enhanced protocol outperforms the basic protocol to a considerable degree, achieving a probability of success for one erasure of $P_s(1) = 99.2\%$. However, for 100 consecutive erasures the success rate drops sharply, to $P_s(100) = 13\%$ [Fig. 2(a)]. The work distribution is much narrower than that of the basic protocol, with the aver-

<figure><img src="image_3.png" /><figcaption>FIG. 2. (a) Success probability $P_s$ as a function of the number of consecutive erasures $n$ for the four different protocols, and (b) distributions of work done per erasure calculated using 100 consecutive erasures, for three different protocols. We see agreement between simulation and experiment [28]. The trained neural-network protocols are considerably more successful than our hand-designed protocols: $P_s(100) = 0$ for the basic protocol, 13% for the enhanced protocol, 82% for the protocol trained on a single erasure, and 92% for the protocol trained on multiple erasures. The learned protocols also require less work than the hand-designed protocols.</figcaption></figure>

age work decaying to $\langle W \rangle = 6.5$ [Fig. 2(b)]. Part of the overhead to Landauer’s bound originates from the kicks around $t/t_f = 0.25$. These are sometimes in the wrong direction, creating the side lobes around the ideal trajectory in Fig. 3(a). Some of these side-lobe trajectories eventually escape to the wrong well.

### IV. LEARNING OPTIMIZED PROTOCOLS

We can use the simulation model to produce an improved erasure protocol. Following Ref. 30, we encode the time-dependent protocol $[x_0(t), x_1(t)]$ in the form of a deep neural network, and train it using a genetic algorithm [18, 31] to achieve a desired goal (more details in Appendix C). This process is a form of evolutionary
<figure><img src="image_4.png" /><figcaption>FIG. 3. Erasure protocols for a single reset to state 0 (top panels), and the resulting distributions $\rho(x,t)$ of cantilever positions in experiment. The format is the same as Fig. 1(c). We show (a) the enhanced protocol, (b) the protocol trained to maximize the success rate and minimize the total energy upon performing a single erasure, and (c) the protocol trained to maximize the success rate of 100 consecutive erasures. In Fig. 7 in the appendix we show that distributions $\rho(x,t)$ from simulation and experiment are consistent. Movies of the time evolution of $U(x,t)$ and $\rho(x,t)$ for all protocols are available as supplementary files [26].</figcaption></figure>

reinforcement learning. We have carefully benchmarked this procedure using overdamped passive-matter [30, 32] and active-matter systems [33], and in Appendix B we show that it performs well in the case of an underdamped system whose optimal translation protocol is known exactly [22].

We instruct the learning algorithm to minimize the order parameter $\phi = 1 - P_s(1) + \langle E_{tot} \rangle/100$ for single erasures. Here $P_s(1)$ and $\langle E_{tot} \rangle$ are the mean success rate for a single erasure and the mean total energy $E_{tot} = \frac{1}{2}v(t_f)^2 + U(x(t_f))$ at the end of a single erasure (computed using $10^4$ independent trajectories).

The value 100 is introduced in order to make the terms $1 - P_s(1)$ and $\langle E_{tot} \rangle/100$ of similar order of magnitude (and therefore importance) for an erasure probability of about 99%. Minimizing $\phi$ results in a protocol that performs erasure with high probability, and that results in a cantilever with small values of kinetic and potential energy. In Fig. 3(b) we show the protocol produced by this procedure. It possesses jumps at the start and end, and rapid changes midway through. It performs well: its success rate for single simulated erasures is 99.9%. When applied to 100 consecutive erasures it produces a success rate of 85.6%. Significantly, the protocol performs essentially as well in experiment: we measure success rates of 99.7% for single erasures and 81.2% for 100 consecutive erasures using the learned protocol with our experimental apparatus.

In Fig. 3(c) we show the protocol produced by retraining the protocol of panel (b) to maximize the order parameter $\phi = P_s(100)$, the success rate for 100 consecutive erasures (averaged over $10^4$ independent realizations of the stochastic process to ensure low statistical uncertainty). It is subtly different from the previous protocol, but performs considerably better on consecutive erasures: we measure success rates for 100 consecutive erasures of 90.9% (simulation) and 92.1% (experiment). That is, the learned protocol is essentially as effective when applied to 100 consecutive erasures as the basic protocol is for a single erasure.

In Fig. 2(a) we show the success rates $P_s(n)$ for $n$ consecutive erasures for the two hand-designed protocols and the two learned protocols. We see agreement between simulation and experiment, with the two learned protocols outperforming the two hand-designed protocols. This is our central result: by applying machine learning to a simulation model of the experiment we have identified protocols that, when deployed in experiment, are considerably more reliable than our best hand-designed protocols. They are also cheaper: the average work during the 100 consecutive erasures is $\langle W \rangle = 4.2$ for the single trained protocol, and $\langle W \rangle = 4.1$ for the retrained one. The learned protocols are more narrowly distributed around their means than are the hand-designed protocols [Fig. 2(b)]. We note that the learning algorithm was instructed to maximize the reliability of repeated erasures, not minimize work, but achieving reliability leads to less work expenditure than with the hand-designed protocols.

The excellent agreement between the experiments and the numerical simulations on its digital twin show that the learned protocols are robust to non-idealities of the system, such as the description of the mechanical system and its frequency-dependent damping [34, 35] by a simple harmonic resonator. Using the dimensionless equations for the dynamics, we can in particular simply rescale the protocols for any variation of the resonant frequency $f_0$ or of the stiffness $k$. Small variations (of the order of 10%) of the quality factor $Q$ or final time $t_f$ have no noticeable effect on the learned protocols, but larger ones would require a retraining.
V. MECHANISM UNDERPINNING THE SUCCESS OF THE LEARNED PROTOCOLS

The enhanced and learned protocols achieve a single erasure with high probability, 99.2% and 99.9%, respectively, and the distribution of cantilever positions at time $t_f$ is similar for the two protocols (see Fig. 3 and Fig. 8 in Appendix D). The main difference between the two protocols is the kinetic energy of the cantilever after erasure. In Fig. 4(a) we show distributions of cantilever velocities after one erasure for the basic protocol, enhanced protocol, and learned protocol of Fig. 3(b), superposed with the equilibrium distribution at temperature $T$. The basic protocol has a long tail of high-energy values. The enhanced protocol is better, but the learned protocol is better still: the evolutionary optimization process was instructed to maximize erasure probability and minimize total energy (kinetic plus potential), and it has done this successfully.

This difference in kinetic energy is a major component of the difference in consecutive-erasure success between learned and hand-designed protocols, shown in Fig. 2(a). In Fig. 4(b) we show the effective temperature, relative to thermal equilibrium, after $n$ consecutive erasures, $T_{\text{eff}}/T = \langle v(nt_f)^2 \rangle / \langle v(0)^2 \rangle$. The basic, enhanced, and learned protocols achieve steady-state effective temperatures of about 5.8, 2.6, and 1.6, respectively. With the resting barrier height of $\Delta E = 12.5$, the likelihood of spontaneous escape from the desired potential well during each erasure is $p_{\text{escape}} \sim 2e^{-\Delta E/T_{\text{eff}}}$ (assuming that the basic attempt frequency is of order $f_0$, and so 2 attempts are made per erasure). The likelihood that no escape occurs in 100 erasures is then $P_s(100) \sim (1-p_{\text{escape}})^{100}$, which equates to 0, 0.19, and 0.92 if we use the values of $T_{\text{eff}}$ for the three protocols. These numbers are consistent with the measured values of 0, 0.13, and 0.92, and indicate that a major component of the success of the learned protocol lies in its ability to ensure a low kinetic energy or effective temperature during erasure.

The two learned protocols possess similar values of the effective temperature during repeated erasures, shown in Fig. 4(b), but the protocol optimized for repeated erasure success does better on that metric than does the protocol optimized for a single erasure [Fig. 2(a)]. This difference confirms that kinetic energy is not the only quantity that determines erasure success, and shows that the second learned protocol has adapted to ensure more reliable erasure in the face of this kinetic energy: the single-erasure protocol has evolved under exposure to initial conditions in equilibrium at temperature $T$, while the multiple-erasure training protocol has evolved under exposure to a steady-state initial temperature $T_{\text{eff}} > T$.

As illustrated in Fig. 4(b), the memory reaches a non-equilibrium steady state after only a few cycles. The choice of 100 consecutive erasures is thus more than sufficient to ensure that the resulting protocol can then be applied to a large number of consecutive erasures. The

<figure><img src="image_5.png" /><figcaption>FIG. 4. (a) Distribution of cantilever velocities in simulation (dashed lines) and experiment (plain lines) for the basic, enhanced, and learned protocols, together with the initial equilibrium distribution (black dashed). Data are for single erasures in which the target is of state 0 or 1 with equal likelihood [25]. The learned protocol produces the narrowest distribution of velocities. (b) Effective temperature during repeated erasures after erasure $n$ in simulation (dashed lines) and experiment (plain lines), for the four protocols considered in this work [28]. A major component of the success of the learned protocols lies in their ability to maintain a relatively low effective temperature.</figcaption></figure>

corresponding improvement in success rate over $N$ consecutive erasures done using the different protocols can be determined by extrapolating each line in Fig. 2(a), assuming an exponential decay of $P_s$ with $N$.

VI. CONCLUSIONS

We have used evolutionary reinforcement learning applied to a simulation model to identify efficient erasure protocols for an underdamped mechanical cantilever. We have shown that the same protocols when used in experiment are considerably more efficient than our best hand-designed protocols, essentially solving the heating problem that plagues repeated fast erasures. In this case the simulation model is an accurate representation of our experiment. If it were not, there exists the possibility of applying the learning algorithm directly to experiment,
because all the information needed to train the neural network is accessible in experiment. This combination of methods therefore opens the door to the rational design of k<sub>B</sub>T-scale hardware and their operating algorithms, and more generally to efficient protocols for applied physics.

The data supporting this study is available in Ref. 36. Code for doing evolutionary optimization of cantilever protocols can be found at Ref. 37.

ACKNOWLEDGMENTS

This work has been partially funded by project ANR-22-CE42-0022. SW performed work as part of a user project at the Molecular Foundry at Lawrence Berkeley National Laboratory, supported by the Office of Basic Energy Sciences of the U.S. Department of Energy under Contract No. DE-AC02-05CH11231. SW was partially supported by the US Department of Energy, Office of Science, Office of Basic Energy Sciences Data, Artificial Intelligence and Machine Learning at DOE Scientific User Facilities program under Award Number 34532 (a digital twin for in silico spatiotemporally-resolved experiments).

APPENDIX

Appendix A: Langevin equation
non-dimensionalization and numerical integration

The first oscillation mode of the cantilever is modeled by an harmonic oscillator of mass *m*, stiffness *k*, and damping coefficient *γ*. It is subject to a feedback electrostatic force *F*<sub>el</sub> and thermal noise due to the contact with the thermostat. The dimensionful position *x*̄ of the cantilever is described by the Langevin equation

$$
m \frac{d^2 \bar{x}}{dt^2} = -k \bar{x} - \gamma \frac{d \bar{x}}{dt} + F_{\text{el}} + \sqrt{2k_B T} \gamma \xi, \quad (\text{A1})
$$

with $\bar{t}$ the dimensionful time. The electrostatic force can take only two values in our feedback implementation, which we set as $\pm k\bar{x}_1$ with a proper definition of the origin of $\bar{x}$. The natural scales of this problem are $\sigma = \sqrt{k_B T/k}$ for length, $\omega_0^{-1} = \sqrt{m/k}$ for time, and $k_B T$ for energy. We therefore introduce $\bar{x} = \sigma x$ and $\bar{t} = \omega_0^{-1}t$ into Eq. A1 in order to derive the dimensionless Eq. (2), with the quality factor of the simple harmonic oscillator being $Q = m\omega_0/\gamma$.

To numerically integrate Eq. (2) we introduce the cantilever velocity $v = \dot{x}$, giving

$$
\dot{v} + Q^{-1}v = -U'(x,t) + \sqrt{2Q^{-1}}\xi. \quad (A2)
$$

Writing the left-hand side of (A2) as e<sup>-t/Q</sup>∂<sub>t</sub> (ve<sup>t/Q</sup>), and assuming that *x* is constant over the interval [*t*, *t* +

Δt], we multiply (A2) by e<sup>t/Q</sup>, integrate over the interval [*t*, *t* + Δt] and divide both sides by e<sup>(t+Δt)/Q</sup> to obtain

$$
v(t + \Delta t) - \alpha v(t) = -(1 - \alpha) Q U'(x, t) + \eta(t), \quad (A3)
$$

where $\alpha \equiv e^{-\Delta t/Q}$ and

$$
\eta(t) \equiv e^{-(t+\Delta t)/Q} \sqrt{2Q^{-1}} \int_{t}^{t+\Delta t} dt' \xi(t') e^{t'/Q}. \quad (A4)
$$

Since ξ(t) is normally distributed so is η(t), with cor-
relations 〈η(t)〉 = 0, 〈η(t)η(t')〉 = 0, and 〈η(t)²〉 =
1 − α². Eq. (A3) is the second line of Eq. (3), with
ξ̃(t) = η(t)/√(1 − α²) a random noise from a centered nor-
mal distribution of unit variance. The first line of Eq. (3)
follows from the integration of ẋ = x over [t, t + Δt].

**Appendix B: Benchmarking the learning algorithm**

In this section we demonstrate the ability of the evolu-
tionary learning procedure to identify efficient protocols
for underdamped systems (we have previously demon-
strated the same for overdamped passive- and active-
matter systems [30, 32, 33]).

We consider the trap-translation problem of Ref. 22,
whose optimal solution is known exactly. An under-
damped particle is subjected to an optical trap-like har-
monic potential

$$
U(x, t) = \frac{1}{2} (x - \lambda(t))^2, \quad (B1)
$$

where $\lambda(t)$ is the position of the trap center. The protocol
that moves the trap from position $\lambda_i = 0$ to position $\lambda_f$
in time $t_f$ with minimum work is given by

$$
\lambda^*(t) = \Lambda(t + Q^{-1}) + \Lambda[\delta(t) - \delta(t - t_f)], \quad (B2)
$$

where $\Lambda \equiv \lambda_f/(t_f + 2Q^{-1})$. The work expended under this protocol is

$$
W^* = \frac{\lambda_f^2}{2 + Q t_f}. \qquad (B3)
$$

We choose $\lambda_f = 5$, $t_f = 3.80$, and $Q = 10$, in which case we have $W^* \approx 0.63$.

To simulate the optimal protocol (B2) we must
modify Eq. (3): if we write $U'(x,t)$ as $U'_0(x,t) +
\Lambda[\delta(t) - \delta(t-t_f)]$, where $U'_0(x,t)$ is the force due to the
first term in Eq. (B2), then the second line of Eq. (3)
becomes

$$
v(t + \Delta t) = \text{r.h.s} + \Lambda (\delta_{t,0} - \delta_{t,tf}). \quad (B4)
$$

Here “r.h.s” denotes the right-hand side of Eq. (3) (with
$U'(x,t)$ replaced by $U'_0(x,t)$), and $\delta_{i,j}$ is the Kronecker
delta, equal to unity if $i = j$ and equal to zero otherwise.
The work associated with the delta kicks is $\Delta W = \Lambda(v_i -
v_f)$, where $v_i$ is the velocity immediately before the first
<figure><img src="image_6.png" /><figcaption>FIG. 5. Trap-translation problem of Ref. 22 for an underdamped particle. We show trap position as a function of time (top) and work distributions (bottom) resulting from three protocols: (a) linear; (b) linear with jumps; and (c) a protocol expressed by a neural network trained by genetic algorithm to minimize $\langle W \rangle$. The latter protocol is close to optimal. The black dashed line in the top panels is the optimal protocol (B2). The black dashed vertical line in the lower panels is the optimal mean work value $W^*$, Eq. (B3), and the dashed distribution is that resulting from the optimal protocol. Here averages and distributions are calculated from $5 \times 10^5$ independent trajectories. The initial velocity $v(0)$ and the initial position $x(0)$ are both chosen from a Gaussian distribution with zero mean and unit variance.</figcaption></figure>

kick and $v_f$ is the velocity immediately after the second kick.

This problem poses a difficult task for any learning algorithm, because the optimal protocol contains delta functions. Moreover, the delta functions are important: in Fig. 5(a) we show the results of a linear protocol $\lambda(t) = \lambda_f t/t_f$, which produces mean work $\langle W \rangle \approx 3.71$, and in Fig. 5(b) we show the result of a linear protocol with jumps, given by Eq. (B2) without the delta-function terms, which produces mean work $\langle W \rangle \approx 3.25$. Both values of work are considerably in excess of the optimal value.

In Fig. 5(c) we show the protocol expressed by a deep neural network trained by genetic algorithm to minimize $\langle W \rangle$, following the procedure described in Ref. 30. This protocol has jumps at the start and end, and rapidly-varying features near the start and end. It produces mean work $\langle W \rangle \approx 0.66$, only about 4% larger than the optimal value. The distribution of work produced by the neural-network protocol is similar to that of the optimal distribution.

The evolutionary learning algorithm has therefore identified a regularized version of the delta-function impulses seen in the optimal protocol, resulting in a protocol associated with a mean work only slightly larger

than optimal. This comparison establishes confidence in the ability of the learning algorithm to identify efficient protocols for underdamped systems. In the main text we show that it can identify protocols for underdamped systems that are considerably more efficient than those designed by hand. The results of this section suggest that the rapidly-varying features seen in Fig. 3(b-c) may become delta-function impulses in the true optimal limit, but also that the differences between the learned protocols and the hypothetical optimal ones are likely to be small.

## Appendix C: Training details

We train the neural-network protocols following the procedure used in Ref. 30, specified by the code deposited in Ref. 37. Briefly, we simulate $10^4$ independent trajectories of the simulation model using a protocol $[x_0(t), x_1(t)] = [0, 5] + g\theta(t/t_f)$, where $g$ is the two-dimensional output of a deep neural network whose input is $t/t_f$ and whose weights are $\theta$. From these $10^4$ trajectories we construct an order parameter $\phi$ (described below). We then adjust the weights $\theta$ using a genetic algorithm instructed to extremize $\phi$. To do so we run 50 lots of
<figure><img src="image_7.png" /><figcaption>FIG. 6. Evolution of the components of the order parameter in Eq. (C1) as a function of the number $n_{ev}$ of evolutionary steps, during the training of the neural-network protocol shown in Fig. 1(c).</figcaption></figure>

10⁴ independent trajectories, each controlled by a neural network with slightly different randomly-chosen values of $\theta$. We select the best 5 neural networks (the 5 associated with the best values of $\phi$), and clone and mutate these networks in order to produce a new set of 50 neural networks. Mutations consist of adding Gaussian random numbers $\epsilon \sim N(0, 10^{-4})$ to each weight of the neural network. We repeat this procedure until $\phi$ stops evolving, with $n_{ev}$ used to indicate the number evolutionary steps taken.

To produce the protocol of Fig. 3(b) we proceed as follows. We start from the null protocol, with $\theta = 0$ and $g_0 = 0$, and so $x_0$ and $x_1$ are fixed to their initial values. We instruct the genetic algorithm to minimize the order parameter

$$ \phi = \begin{cases} \langle (\Delta x)^2 \rangle + 50 & \text{if } P_s(1) < 0.9; \\ 1 - P_s(1) + \langle E_{\text{tot}} \rangle / 100 & \text{otherwise.} \end{cases} \quad (C1) $$

Here $\langle (\Delta x)^2 \rangle = \langle (x(t_f) + 5)^2 \rangle$ is the mean-squared distance between the final position of the cantilever and the final position ($-x_1(t_f) = -5$) of the center of the left-hand potential well, assuming erasure to state 0. For erasure to state 1, we use the same protocol with the sign of $x_0(t)$ reversed. $P_s(1)$ is the mean success rate for a single erasure (erasure to state 0 is deemed successful if $x(t_f) < 0$), and $\langle E_{\text{tot}} \rangle$ is the mean total energy $E_{\text{tot}} = \frac{1}{2}v(t_f)^2 + U(x(t_f), t_f)$ at the end of the protocol. The first clause of Eq. (C1) encourages the neural network to produce protocols in which the cantilever position ends close to the final position of the left-hand potential well. When the probability of erasure is greater than 90%, the second clause becomes active and encourages protocols that 1) perform erasure with high fidelity,

and 2) leave the cantilever with small values of total energy.

Fig. 6 shows the evolution of $\langle (\Delta x)^2 \rangle$ (top), $P_s(1)$ (middle), and $\langle E_{\text{tot}} \rangle$ (bottom) as a function of the number $n_{ev}$ of evolutionary steps. For each value of $n_{ev}$ we show the values of these order parameters associated with the neural network that gives rise to the smallest value of $\phi$. The number of trajectories required after $n_{ev}$ steps is $50 \times 10^4 \times n_{ev}$. The trained protocol is then used in experiment.

The protocol of Fig. 3(c) is obtained by taking the protocol of Fig. 3(b) and retraining it using $10^4$ independent simulations, each of 100 consecutive erasures. In this case we instructed the learning algorithm to maximize $\phi = P_s(100)$, the probability of obtaining 100 successful erasures. During the course of training we observed $\phi$ to increase from about 0.85 to about 0.9.

## Appendix D: Additional data

In Fig. 7 we show the probability distributions $\rho(x, t)$ in the format of Fig. 1(c) and Fig. 3 resulting from the four protocols. In Fig. 8 we show time-ordered snapshots in the format of Fig. 1(d) for three protocols. In all cases, simulation and experiment are consistent.

<figure><img src="image_8.png" /><figcaption>FIG. 7. Probability distributions $\rho(x, t)$ in the format of Fig. 1(c) resulting from the four protocols considered in this work, in simulation (left) and experiment (right). Panel (a) shows the basic protocol of Fig. 1(c). Panel (b) shows the enhanced protocol of Fig. 3(a). Panel (c) shows the learned protocol of Fig. 3(b), designed to maximize erasure fidelity and minimize total energy upon performing a single erasure. Panel (d) shows the learned protocol of Fig. 3(c), designed to maximize the reliability of multiple successive erasures. In all cases we show a single erasure to state 0, starting from equilibrium [25]. Movies of the time evolution $\rho(x, t)$ for all protocols are available as supplementary files [26].</figcaption></figure>
<figure><img src="image_9.png" /><figcaption>FIG. 8. Time-ordered snapshots for the basic and enhanced protocols, and for the learned protocol of Fig. 3(c). We show the potential $U(x, t)$, the associated Boltzmann distributions $\rho_0(x)$, and the distribution of cantilever tip positions $\rho(x, t)$ in experiment (green) and simulation (black dashed) for a single erasure to state 0 [25]. The enhanced and learned protocols achieve erasure with respective probabilities of 99.2% and 99.9%; the main difference between these protocols lies in the distribution of kinetic energies after erasure, as shown in Fig. 4. Movies of the time evolution of $U(x, t)$ and $\rho(x, t)$ for all protocols are available as supplementary files [26].</figcaption></figure>

[1] R. Landauer, Irreversibility and heat generation in the computing process, IBM J. Res. Dev. 5, 183 (1961).

[2] C. H. Bennett and R. Landauer, The fundamental physical limits of computation, Sci. Am. 253, 48 (1985).

[3] A. Bérut, A. Arakelyan, A. Petrosyan, S. Ciliberto, R. Dillenschneider, and E. Lutz, Experimental verification of landauer's principle linking information and thermodynamics, Nature 483, 187 (2012).

[4] Y. Jun, M. Gavrilov, and J. Bechhoefer, High-precision test of landauer's principle in a feedback trap, Phys. Rev. Lett. 113, 190601 (2014).

[5] K. Proesmans, J. Ehrich, and J. Bechhoefer, Finite-time landauer principle, Phys. Rev. Lett. 125, 100602 (2020).

[6] S. Dago, J. Pereda, N. Barros, S. Ciliberto, and L. Bellon, Information and thermodynamics: Fast and precise approach to landauer's bound in an underdamped micromechanical oscillator, Phys. Rev. Lett. 126, 170601 (2021).

[7] A. B. Boyd, A. Patra, C. Jarzynski, and J. P. Crutchfield, Shortcuts to thermodynamic computing: The cost of fast and faithful information processing, J. Stat. Phys. 187, 17 (2022).

[8] G. Li and H. Dong, Shortcut to finite-time memory erasure, Phys. Rev. E 110, 034115 (2024).

[9] S. Dago and L. Bellon, Dynamics of Information Erasure and Extension of Landauer's Bound to Fast Processes, Phys. Rev. Lett. 128, 070604 (2022).

[10] S. Dago, S. Ciliberto, and L. Bellon, Adiabatic computing for optimal thermodynamic efficiency of information processing, Proc. Nat. Acad. Sci. 120, e2301742120 (2023).

[11] S. Dago, S. Ciliberto, and L. Bellon, Reliability and operation cost of underdamped memories during cyclic erasures, Adv. Phys. Res. 3, 2300074 (2024).

[12] K. J. Ray, A. B. Boyd, G. W. Wimsatt, and J. P. Crutchfield, Non-markovian momentum computing: Thermodynamically efficient and computation universal, Phys. Rev. Res. 3, 023164 (2021).

[13] J. Sanders, M. Baldovin, and P. Muratore-Ginanneschi, Optimal control of underdamped systems: An analytic approach, J. Stat. Phys. 191, 117 (2024).

[14] J. Sanders, M. Baldovin, and P. Muratore-Ginanneschi, Minimal-work protocols for inertial particles in non-harmonic traps, preprint arXiv: 2407.15678 (2024).

[15] S. Blaber, M. D. Louwerse, and D. A. Sivak, Steps minimize dissipation in rapidly driven stochastic systems, Phys. Rev. E 104, L022101 (2021).

[16] J. Ehrich, S. Still, and D. A. Sivak, Energetic cost of feedback control, Phys. Rev. Res. 5, 023080 (2023).

[17] G. M. Rotskoff and G. E. Crooks, Optimal control in nonequilibrium systems: Dynamic riemannian geometry of the ising model, Phys. Rev. E 92, 060102 (2015).

[18] J. H. Holland, Genetic algorithms, Sci. Am. 267, 66 (1992).

[19] D. Floreano, P. Dürr, and C. Mattiussi, Neuroevolution: from architectures to learning, Evol. Intel. 1, 47 (2008).
[20] F. P. Such, V. Madhavan, E. Conti, J. Lehman, K. O. Stanley, and J. Clune, Deep neuroevolution: genetic algorithms are a competitive alternative for training deep neural networks for reinforcement learning, preprint arXiv: 1712.06567 (2018).

[21] S. Whitelam and I. Tamblyn, Learning to grow: Control of material self-assembly using evolutionary reinforcement learning, Phys. Rev. E 101, 052604 (2020).

[22] A. Gomez-Marin, T. Schmiedl, and U. Seifert, Optimal protocols for minimal work processes in underdamped stochastic thermodynamics, J. Chem. Phys. 129, 024114 (2008).

[23] S. Dago, J. Pereda, S. Ciliberto, and L. Bellon, Virtual double-well potential for an underdamped oscillator created by a feedback loop, J. Stat. Mech. 2022, 053209 (2022).

[24] S. Dago, N. Barros, J. Pereda, S. Ciliberto, and L. Bellon, Virtual potential created by a feedback loop: Taming the feedback demon to explore stochastic thermodynamics of underdamped systems, in *Crossroad of Maxwell Demon*, edited by X. Bouju and C. Joachim (Springer Nature Switzerland, Cham, 2024) pp. 115-135, also arXiv: 2311.12687 (2023).

[25] Results for single erasures are measured over $10^4$ independent trajectories in simulation, and $4 \times 10^3$ independent trajectories in experiment.

[26] See videos included in the supplementary files of this preprint for movies showing the full time evolution of the potential $U(x,t)$ with the superposed distribution of $\rho(x,t)$ for the four protocols of this work.

[27] P. Paolino, F. Aguilar Sandoval, and L. Bellon, Quadrature phase interferometer for high resolution force spectroscopy, Rev. Sci. Instrum. 84, 095001 (2013).

[28] Results for 100 consecutive erasures are measured over $10^4$ trajectories in simulation. In experiment, we use $10^3$ independent trajectories for the trained neural-network protocols, 665 independent trajectories for the enhanced protocol, and 174 independent trajectories for the basic protocol.

[29] K. Sekimoto, *Stochastic Energetics*, Lect. Notes Phys., Vol. 799 (Springer, Berlin Heidelberg, 2010).

[30] S. Whitelam, Demon in the machine: learning to extract work and absorb entropy from fluctuating nanosystems, Phys. Rev. X 13, 021005 (2023).

[31] M. Mitchell, *An introduction to genetic algorithms* (MIT press, 1998).

[32] S. Whitelam, How to train your demon to do fast information erasure without heat production, Phys. Rev. E 108, 044138 (2023).

[33] C. Casert and S. Whitelam, Learning protocols for the fast and efficient control of active matter, preprint arXiv: 2402.18823 (2024).

[34] J. E. Sader, Frequency response of cantilever beams immersed in viscous fluids with applications to the atomic force microscope, J. Appl. Phys. 84, 64 (1998).

[35] L. Bellon, Thermal noise of microcantilevers in viscous fluids, J. Appl. Phys. 104, 104906 (2008).

[36] N. Barros and L. Bellon, Dataset: Learning efficient erasure protocols for an underdamped memory, 10.5281/zenodo.13829200 (2024).

[37] https://github.com/swhitelam/cantilever.