WorksPhysics and Astronomy
Cyclic perturbations encode memories in trained neural networks without loss of performance
Abstract
Many disordered materials exhibit a remarkable form of memory: they retain information about the history of cyclic perturbations. Whether this phenomenon also occurs in artificial neural networks, whose mathematical structure and dynamics share many similarities with disordered physical systems, is unknown. Here we show that cyclically perturbing a trained, overparameterized deep neural network encodes information in the structure of the weights that can subsequently be retrieved, thus retaining memory of the perturbation history. During each write cycle, all weights are displaced, after which the network relaxes through gradient descent. Repeated cycles organise the neural network into a state that is reversible for perturbations up to the write amplitude, allowing the encoded value to be read from the onset of irreversible weight motion. Multiple memories can also be encoded, although under deterministic writing only the largest persists at long times. Inspired by cyclically sheared suspensions, we introduce a novel noisy-write protocol that preserves all encoded memories at long times. Remarkably, neither deterministic nor noisy memory writing measurably affects the network's performance on unseen data from its original learning task. Our results establish cyclic memory as a phenomenon shared by disordered physical systems and deep neural networks, and show that networks can exploit as yet unexplored memory capabilities without compromising their original function.
Significance Statement
Building on the immense success of machine learning in recent years, the field of physical learning has made great progress imbuing materials with information storage and processing properties. For example, repeated deformation of a disordered solid organizes its microscopic components so that a previous deformation amplitude can be recovered. We show the same form of memory in trained deep neural networks. Repeatedly perturbing and relaxing a network’s weights encodes one or more amplitudes in a readable configuration. As such, our work uncovers a novel capability of deep neural networks that does not sacrifice existing functionality. This is a rare example of computational phenomena in physical materials inspiring a discovery in artificial neural networks, as opposed to the other way around.
Introduction
Memory effects – where the state or dynamics of a system depends on its history – play a significant role in a vast number of systems across the natural sciences and engineering. In recent years, an intriguing set of phenomena have emerged whereby memories (i.e. sequences of values) can be written and read from systems of disordered particles, without imposing any obvious order on them [1, 2, 3, 4]. This result is particularly striking given that established methods for recording information, e.g. written text, or bits encoded on a hard drive, are very deliberately not disordered.
How does reading and writing memories in disordered systems work in practice? Seminal work by Keim and Nagel [1] demonstrated that a random suspension of particles can encode memory by subjecting it to repeated cyclic shear; the shear amplitude serves as the write amplitude, or memory. Initially, a shear cycle will result in many particle collisions, causing the particles to rearrange and hence fail to return to their original positions once the shear cycle is complete. However, after many shear cycles, the particles will be organised into positions where they no longer collide. Once all particles avoid collisions, the system exists in a steady state when viewed stroboscopically (i.e. once per cycle). This state encodes the write amplitude . The read protocol consists of single shear cycles at varying amplitudes , applied to copies of the system on which the memory has been written. When , all particles return to their original positions at the end of the shear cycle. When , collisions will start to occur hence some particles will be displaced. Consequently, can be deduced from the inflection point on a plot of the number of displaced particles against . Many variations on this basic set up have been studied, including reading/writing multiple transient memories [1, 2], memory formation in dense suspensions [5, 6], memory formation in adaptive networks [7], Hopfield-like associative memory [8], and the effect of random driving [9].
Deep neural networks (DNNs) appear far removed from particulate materials, yet the two systems share many common aspects in their mathematical structure. In DNNs, the loss function forms a high-dimensional landscape, with the network weights the degrees of freedom. Training corresponds to the network following a trajectory in weight space that minimises, typically stochastically, the value of the loss. In the network-particles analogy, weights play the role of particle coordinates and the loss function plays the role of the energy [10, 11, 12, 13, 14, 15]. The ratio of the number of training examples, , to network parameters, , has a role resembling particle density. At low , overparameterized networks can fit every training example and access extended regions of the loss landscape with training loss . This is much like the way in which a dilute gas with finite range interactions has an energy approximately equal to zero. Increasing produces an underparameterized regime with nonzero loss, analogous to the onset of interactions in a denser particle system [11].
However, the analogy between DNNs and disordered materials has important limits. Overparameterized networks have no established counterpart of particle caging, their zero-loss regions can extend over long distances, and stochastic gradient descent and its related training algorithms produce nonthermal noise that is anisotropic, has a non-flat power spectrum, and varies in intensity over time [15, 16, 17, 18, 19, 20, 21, 22, 23, 24]. Furthermore, trained networks can generalize to unseen data – a phenomenon with no obvious physical counterpart. These differences make it unclear whether memory formation in disordered materials can be translated to a neural network, or whether the motion within a low-loss region required by disordered memory read/write protocols would preserve the computation learned by the network.
Here we demonstrate that trained DNNs can acquire readable memories under cyclic weight perturbations. A deterministic protocol stores one long-lived amplitude and a second transient amplitude. A modified noisy protocol stabilizes both amplitudes over the observation time. Throughout, the networks retain their performance on unseen data. The memories therefore occupy degrees of freedom that are available within a low-loss region while leaving the network’s original predictive function intact. As such, this work constitutes an unforeseen generalisation of the disordered memory concept to a new class of systems, as well as identifying a novel and as yet unexploited capability of deep neural networks.
Results
Cyclic driving produces a readable memory
As a proof of principle, we use the benchmark test of digit recognition from the standard MNIST dataset [25], and ask whether a network trained on this task could exhibit memory effects analogous to those seen in particulate systems. For simplicity, we restrict ourselves to a binary supervised classification task where fully connected networks are trained to distinguish the MNIST digits 2 and 6. The images are reduced to 10 principal components, following the approach of [11] and [15], and networks with three hidden layers are trained using the quadratic hinge loss. Figure 1B shows that as hidden-layer width increases, the final training loss drops by several orders of magnitude, marking entry into the overparameterized regime. Reaching the overparameterised state is however dependent on a network’s initial conditions and stochastic training trajectory. Hence, out of 50 width-10 networks (410 parameters), 41 achieve the low loss values characteristic of overparameterisation, defined here as . In the remainder of this work, we exclusively use these 41 width-10 networks.
Our goal is to imprint a memory value, , onto neural networks that have already been trained on the above digit recognition task, in such a way that we can recover the memory later. To do so, we introduce a cyclic protocol for DNNs inspired by the cyclic shearing of particle suspensions. Briefly, we displace every network weight in equal increments along a fixed direction until the cumulative displacement reaches . Gradient descent relaxes the network after every increment. This is the upward sweep depicted in Figure 1C. We then reverse the displacement and increment the weights downwards, again interspersing the increments with periods of gradient descent, as depicted in the downward sweep of the same figure. The process of writing a memory consists of repeated applications of an upward sweep followed by a downward sweep. If the trajectory in weight space of an upward and downward sweep remains entirely on a flat region of the loss landscape, the network returns to its starting point. However, if the trajectory encounters a nonzero-loss region, gradient descent displaces it, and so the completed cycle no longer returns every weight to its initial value. Such an event is depicted schematically in Figure 1D, and is analogous to a collision between particles during a cycle of shear in the case of memory writing in physical systems. Repeated write cycles thus move the network around in the loss landscape until a state is reached that is fully reversible up to the memory value, .
Figure 1. (A) Networks classify MNIST digits 2 and 6, assign labels +1 and −1, respectively. (B) Final training loss as a function of hidden-layer width. Networks begin to reach near width 8, identifying the underparameterized-to-overparameterized transition. Some wider networks remain at high loss because of their initial conditions and stochastic training trajectories. (C) The write protocol consists of upward and downward weight sweeps, with gradient-descent relaxation after each step. (D) Schematic trajectory through the loss landscape. The initial and final states are indicated by white circles; upward and downward sweeps are depicted by red and green arrows, respectively. Relaxation on a non-flat region (dashed arrow) prevents return to the initial state.
Subsequently, we read the memory by applying one cycle of an upward and downward sweep to a copy of the written network at a probe amplitude , and then probing across many values of . The readout is the number of weights displaced by more than a sensitivity after the read cycle. What does this look like in practice? Figure 2A shows the number of displaced weights as a function of , averaged over 41 independently trained networks, each of which has been subjected to the write protocol with memory value . The individual curves correspond to applying the read protocol after increasing numbers of write cycles. As the number of write cycles increases, a sharp inflection point emerges at , demonstrating that the memory value has indeed been stored in the structure of the DNN, and can be successfully read by our protocol. The inflection point demarcates the boundary between reversible and irreversible weight trajectories under the read protocol.
The same read/write protocols can encode more than one value. To demonstrate this, we alternate a cycle at with six cycles at . Once again applying the read protocol and plotting the result in Figure 2B, both memory values appear as changes in the slope of the read curves. As expected, the smaller amplitude is transient, and disappears after approximately 140 write cycles. This hierarchy mirrors the behaviour of multiple transient memories in cyclically driven suspensions: repeated driving ultimately organizes the system around the largest amplitude, erasing signatures of smaller amplitudes [1, 2]. As such, the results in Figure 2 exactly reproduce the phenomenology of particulate systems, and constitute a clear demonstration of the existence of cyclic memory in DNNs.

Figure 2. Memories written by deterministic cyclic perturbations. (A) Number of weights displaced by more than after a read cycle of amplitude . A memory written at appears at the onset of eight motion. (B) Memories of and appear as changes in slope. The smaller memory is erased after approximately 140 write cycles. In both panels, color progresses from 0 write cycles (purple) to 200 cycles (yellow).
A novel noisy write protocol stabilizes multiple memories
Thus far, we have considered memory writing protocols in DNNs for the case of fully deterministic dynamics. How does the presence of noise change this picture? A striking aspect of cyclic memory in particulate systems is that noise can, counterintuitively, stabilise multiple memories, preventing smaller memories from being erased by the largest one. The reason for this is that the noise continually returns particles to regions of space from which they were previously swept out [1]. Collisions correspond to the system moving out of a zero energy state, hence in the energy landscape picture, noise repeatedly drives the system onto the hills surrounding zero energy basins.
It is not immediately obvious if noise will also preserve multiple memories in DNNs. Indeed, we find that the most literal translation of this mechanism to DNNs, i.e. directly adding Gaussian noise to the network weights, does not reproduce the stabilising effect seen in particulate systems. In fact, it produces the more naively intuitive result that memories are simply erased by the noise (Supporting Information). This suggests that noise does not generically promote memory retention in DNNs, but rather requires a specific mechanism through which it may help stabilise existing memories.
To establish how noise can enhance memory retention in DNNs, we modify the loss during the write cycles so that previously flat regions are assigned a weak, randomly varying gradient pushing the network toward the finite-loss boundaries (see Eq. (5) for the full definition). We call this modification “spring noise”, due to its qualitative similarity to placing springs between randomly selected pairs of particles. The read protocol remains unchanged and deterministic.
The effect of introducing spring noise during the write cycles of a memory written at is shown in Figure 3A. As with the deterministic case in Figure 2A, there is a large inflection at , demonstrating that the memory has been successfully written and read. In contrast to Figure 2A, some weights continued to move for after many write cycles, long past the point where the deterministic write protocol reaches a reversible state. This persistent subthreshold response is also seen in particles subjected to thermal noise, and is the network analog of continued particle collisions in previously swept out regions of space.
Figure 3. Memories written with spring noise. (A) A memory at remains visible, while weights continue to move for . Color progresses from 0 write cycles (purple) to 200 cycles (yellow). (B) Memories at and both remain visible after 360 cycles. Color progresses from 0 cycles (purple) to 360 cycles (yellow). Both panels use and . See Eq. (5) for the definition of .
We next apply the write protocol with spring noise to the case of multiple memories, with values and , again applied in the same sequence as in the deterministic experiment of Figure 2B. The spring noise result is shown in Figure 3B, where both memories remain visible as abrupt gradient changes in the readout curves after 360 write cycles. The smaller memory therefore persists for substantially longer than its deterministic counterpart, which is erased after approximately 140 cycles. Consequently, Figure 3B demonstrates the effectiveness of spring noise at recovering the phenomenology of noisy particle suspensions. The existence of a write/read protocol capable of storing multiple persistent memories in DNNs is crucial for any practical application of this phenomenon.
Memory writing preserves predictive performance on unseen data
A major distinction between a neural network and a disordered material is that the network can perform a learned computation. This raises the important question of what effect, if any, writing and reading memories by cyclic perturbation has on the DNNs’ performance on the task it was originally trained to perform. We therefore compare the networks’ loss values on unseen test data from the original digit classification task before and after writing a memory. As shown in Figure 4, neither the deterministic protocol nor the spring noise protocol produces a discernible change in the distribution of test losses. Thus, within the amplitudes and times studied, cyclic driving
Figure 4. Effect of memory writing on predictive performance. Test-loss distributions are shown before and after 200 cycles writing a memory at . (A) Deterministic write protocol. (B) Spring noise protocol with . Neither protocol produces a discernible change in test loss.
reorganized the network weights enough to encode additional information without measurably degrading generalization on the original classification task. In other words, the predictive performance on unseen data is not compromised at all, and yet the DNNs are enriched by additional memory capabilities.
Discussion
Our results establish a form of memory in trained DNNs that is distinct from the associative memories of Hopfield networks and the persistent dynamical states of recurrent networks. A Hopfield memory corresponds to an attractor, so storage capacity is related to the number of stable minima [26, 27]. Here an amplitude is represented instead by the distance from the network’s state to a finite-loss boundary along a prescribed perturbation path. Capacity is therefore controlled by the geometry of a low-loss region rather than by the number of minima.
This geometric distinction may help expose where the analogy between neural networks and disordered materials succeeds and where it fails. In particulate systems, zero-energy regions are constrained by nearby collisions and by boundary conditions. Such systems are typically isotropic, hence collisions occur when any particle moves in any direction by roughly one interparticle distance. By contrast, weights in an overparameterized network can diffuse for long times without encountering a barrier [15, 16]. Furthermore, the weights of our DNNs have free boundary conditions, hence Gaussian noise is likely to result in an effect similar to a gas expanding, with fewer and fewer interactions as the particles move apart.
These differences between DNNs and particles may explain why Gaussian weight noise does not stabilize multiple memories: unconstrained diffusion can carry the network away from finite-loss boundaries rather than repeatedly returning it to them. Spring noise is designed to restore that return and successfully recovered the phenomenology of thermally driven particle systems, despite being dissimilar to thermal fluctuations. The importance of basin shape does, however, suggest a potentially important difference between memory formation by cyclic perturbations in DNNs compared with physical systems. If DNNs do indeed have much larger basins, as suggested above, then it could be that they will have a much higher memory capacity than a comparable set of particles.
The preservation of test performance shows that movement within a low-loss region can alter a network’s response to parameter perturbations without changing its measured predictive function. This is an important condition for establishing cyclic memory as a useful addition to established DNN functionality. Furthermore, it moves DNNs a small step closer to the biological scenario of information storage and processing occurring in the same structures, as opposed to the standard computer architecture separating the two.
Determining how many independent amplitudes or perturbation directions can be stored, how capacity scales with network size, and whether analogous memory phenomena exist in the underparameterized regime are immediate open questions. More broadly, the results suggest that memory formation by cyclic perturbation could be a quite general phenomenon in disordered systems, not just restricted to particles, or the charge-density waves which the particle work was inspired by [28, 29]. Perhaps the analogy could be extended even further afield, to disordered ecosystems [30] and beyond.
Materials and Methods
Data and network preparation
We selected images of digits 2 and 6 from MNIST and assigned labels and , respectively [25]. Principal-component analysis reduced each image to 10 components. The training set contained 5,000 images and the test set contained 1,000 images, with equal numbers of each digit in both sets.
The models were fully connected, feed-forward networks without bias parameters. Each network had 10 input units, three hidden layers of equal width with ReLU activations, and one output unit. We varied hidden-layer width from 5 to 10 to locate the overparameterization transition. Networks were trained for 10,000 epochs by stochastic gradient descent with learning rate 0.01 and batch size 32. Memory experiments used all width-10 networks whose final training loss was below .
For training examples, the quadratic hinge loss, , was
where is the network output for example [31]. The flat zero of this loss provides extended regions in which perturbations can be reversible.
Deterministic write protocol
Starting from trained parameters , we added a scalar increment to every weight, then performed full-batch gradient-descent steps at learning rate . We repeated the displacement and relaxation times, then reversed the process by subtracting before each relaxation. The upward and downward sweeps formed one write cycle. Unless stated otherwise, . Manual checks on several networks confirmed convergence within 2,000 relaxation steps.
Single-memory experiments repeatedly used cycles with . For two-memory experiments, cycles were applied in the sequence
with and . Repeating the smaller amplitude was not required to create the memory but accelerated the evolution of the low-amplitude part of the read curve.
Read protocol
Each read amplitude was tested on a separate copy of the written network. We applied one upward and downward cycle using the same , relaxation time, and learning rate as in the write protocol. The memory readout was the number of weights whose final values differed from their values before the read cycle by more than . Changes in the slope of this count as a function of identified written amplitudes.
Spring-noise protocol
During noisy writing, we replaced the per-example loss by
where and the remaining definition of was unchanged. A new was sampled after each increment or decrement of . This replacement gives the nominally flat part of the loss a random gradient directed toward the quadratic region. We used for the results in Figure 3. All reads were performed without noise. The value of is somewhat arbitrary as there is no system defined energy scale. Instead, must be chosen manually so as to be strong enough to preserve small memories, but not so strong as to eradicate all memories. Such a balancing act is similar to the process of choosing the sensitivity without a physical length scale.
Gaussian weight-noise control
As a control, independent Gaussian random values were added directly to all weights after each increment or decrement during writing. At standard deviation , a memory written at retained a flat response below (Figure 5A). Smaller noise had no visible effect, whereas larger noise removed the sharp response at , as shown in Figure 5B, with .
Figure 5. Gaussian weight-noise control. (A) At low noise levels, the number of changed weights remains zero below the writing amplitude . Parameters are and noise standard deviation . (B) At high noise levels, the memory is simply erased. Parameters are and noise standard deviation .
Acknowledgments
M.K.W. gratefully acknowledges funding from Stichting Ammodo. This work used the Dutch national e-infrastructure with the support of the SURF Cooperative using grant no. EINF-19321.
Author Contributions
M.K.W. and L.M.C.J. designed the research; M.K.W. performed the research and analyzed the data; M.K.W. and L.M.C.J. wrote the paper.
Competing Interest Statement
The authors have no competing interests.
Data, Materials, and Software Availability
The code used to generate all of the data, results and plots in this paper is available at https://github.com/mkerrwinter/cyclicMemory.
References
- [1]N. C. Keim and S. R. Nagel, Physical Review Letters 107, 1 (2011), arXiv:1101.2931.DOI
- [2]N. C. Keim, J. D. Paulsen, and S. R. Nagel, Physical Review E - Statistical, Nonlinear, and Soft Matter Physics 88, 1 (2013), arXiv:1307.1184.DOI
- [3]N. C. Keim, J. D. Paulsen, Z. Zeravcic, S. Sastry, and S. R. Nagel, Reviews of Modern Physics 91, 35002 (2019).
- [4]J. D. Paulsen and N. C. Keim, Annual Review of Condensed Matter Physics 16, 61 (2025), arXiv:2405.08158.DOI
- [5]D. Fiocco, G. Foffi, and S. Sastry, Physical Review Letters 112, 1 (2014).
- [6]D. Fiocco, G. Foffi, and S. Sastry, Journal of Physics Condensed Matter 27 (2015), 10.1088/0953-8984/27/19/194130.
- [7]K. Bhattacharyya, D. Zwicker, and K. Alim, Physical Review Letters 129, 28101 (2022).
- [8]W. Guo, V. R. Anesetti, K. Zhang, S. Ameen, A. Kandala, M. Stern, N. Pashine, J. D. Paulsen, J. M. Schwarz, and T. Zhang, arXiv , 1 (2026), arXiv:2603.14534.arxiv.org/abs/2603.14534
- [9]M. Mungan, D. Kumar, K. Patinet, and D. Vandembroucq, Physical Review Letters 134, 178203 (2025).
- [10]S. Franz and G. Parisi, Journal of Physics A: Mathematical and Theoretical 49, 145001 (2016), arXiv:1501.03397.DOI
- [11]M. Geiger, S. Spigler, S. D’Ascoli, L. Sagun, M. Baity-Jesi, G. Biroli, and M. Wyart, Physical Review E 100, 012115 (2019), arXiv:1809.09349.DOI
- [12]M. Baity-Jesi, L. Sagun, M. Geiger, S. Spigler, G. Ben Arous, C. Cammarota, Y. LeCun, M. Wyart, and G. Biroli, Journal of Statistical Mechanics: Theory and Experiment 2019, 124013 (2019), arXiv:1803.06969.
- [13]Y. Bahri, J. Kadmon, J. Pennington, S. S. Schoenholz, J. Sohl-Dickstein, and S. Ganguli, Annual Review of Condensed Matter Physics 11, 501 (2020).
- [14]D. Ghio, Y. Dandi, F. Krzakala, and L. Zdeborová, Proceedings of the National Academy of Sciences of the United States of America 121, 1 (2024), arXiv:2308.14085.DOI
- [15]M. K. Winter and L. M. Janssen, Physical Review Research 7, 23010 (2025), arXiv:2405.13098.arxiv.org/abs/2405.13098
- [16]B. L. Annesi, C. Lauditi, C. Lucibello, E. M. Malatesta, G. Perugini, F. Pittorino, and L. Saglietti, Physical Review Letters 131, 227301 (2023), arXiv:2305.10623.arxiv.org/abs/2305.10623
- [17]N. Yang, C. Tang, and Y. Tu, Physical Review Letters 130, 237101 (2023), arXiv:2206.01246.DOI
- [18]M. Kühn and B. Rosenow, arXiv , 20 (2023), arXiv:2306.05300.DOI
- [19]S. L. Smith, E. Elsen, and S. De, Proceedings of the 37th International Conference on Machine Learning (2020), arXiv:2006.15081.
- [20]U. Şimşekli, L. Sagun, and M. Gurbuzbalaban, 36th International Conference on Machine Learning, 97, 5827 (2019), arXiv:1901.06053.
- [21]D. Soudry and Y. Carmon, arXiv (2016), arXiv:1605.08361.arxiv.org/abs/1605.08361
- [22]N. S. Keskar, J. Nocedal, P. T. P. Tang, D. Mudigere, and M. Smelyanskiy, 5th International Conference on Learning Representations, ICLR 2017 - Conference Track Proceedings , 1 (2017), arXiv:1609.04836.
- [23]L. Wu, M. Wang, and W. J. Su, Advances in Neural Information Processing Systems 35 (2022), arXiv:2207.02628.
- [24]L. Wu, C. Ma, and E. Weinan, Advances in Neural Information Processing Systems 2018-Decem, 8279 (2018).
- [25]“MNIST dataset, http://yann.lecun.com/exdb/mnist/,”.
- [26]J. J. Hopfield, Proceedings of the National Academy of Sciences of the United States of America 79, 2554 (1982).
- [27]D. J. Amit, H. Gutfreund, and H. Sompolinsky, Physical Review A 32, 1007 (1985).
- [28]S. N. Coppersmith, T. C. Jones, L. P. Kadanoff, A. Levine, J. P. McCarten, S. R. Nagel, S. C. Venkataramani, and X. Wu, Physical Review Letters 78, 3983 (1997).
- [29]M. L. Povinelli, S. N. Coppersmith, L. P. Kadanoff, S. R. Nagel, and S. C. Venkataramani, Physical Review E - Statistical Physics, Plasmas, Fluids, and Related Interdisciplinary Topics 59, 4970 (1999).
- [30]A. Altieri, F. Roy, C. Cammarota, and G. Biroli, Physical Review Letters 126, 258301 (2021), arXiv:2009.10565.DOI
- [31]C. P. Lee and C. J. Lin, Neural Computation 25, 1302 (2013).



