Typeset with jpsj3.cls Full Paper Construction of a Neural Network with Temperature-Dependent Recall Patterns Munetaka Sasaki ∗ Faculty of Engineering, Kanagawa University, Yokohama 221-8686, Japan arXiv:2602.20620v1 [cond-mat.dis-nn] 24 Feb 2026 (Received February 25, 2026) We present a simple model that recalls two different patterns depending on the temperature. To realize a change in recall pattern due to temperature change, we embed two patterns to different graphs: the first pattern into a fully connected graph and the second pattern into a sparse graph. Because a fully connected graph is more resistant to thermal fluctuations than a sparse graph, we can realize a change in recall pattern by tuning relative weights of the two patterns properly. We demonstrate by equilibrium Monte-Carlo simulations that such a temperature-dependent change in recall patterns does occur in our model. Simulation results strongly indicate that the system undergoes a first-order phase transition when the change in recall patterns occurs. It is also demonstrated by annealing simulations that the system fails to recall the pattern embedded in the sparse graph at low temperatures if the free-energy barrier is too high to overcome within the given simulation timescale. sults strongly indicate that the system undergoes a firstorder phase transition when the change in recall patterns occurs. We also performed an annealing simulation in which the temperature was gradually decreased from high to low. Consequently, we found that the system fails to recall the pattern embedded in the sparse graph at low temperatures if the free-energy barrier is too high to overcome within the given simulation timescale. The outline of the paper is as follows: In Sect. 2, we define our model. In Sect. 3, we describe our simulation method. In Sect. 4, we show our simulation results. Section 5 is devoted to summary and discussion. 1. Introduction 1) The Hopfield model has served as a paradigmatic model of associative memory in neural systems. The Hamiltonian of the Hopfield model is defined by X Jij Si Sj , (1) H=− i 0) is an exchange constant and {ξiS } denotes a pattern embedded in the sparse graph. The possible value for ξiS is either −1 or +1. It is worth pointing out that HS is a Hamiltonian of the Mattis model3) defined on the sparse graph. Therefore, the system with the Hamiltonian HS is equivalent to the ferromagnetic Ising model on the sparse graph. The ground state of HS is ±{ξiS }. ∗ E-mail : msasaki@kanagawa-u.ac.jp 1 2 J. Phys. Soc. Jpn. The second term HF in Eq. (3) is given as HF {Si } = − 2 kN C F J m̄F {Si } , 2 3. Method (6) where N is the number of sites, C F (> 0) is a parameter that adjusts a balance between HS and HF , and k is the degree of the sparse graph. We assume that all the vertices have the same degree k in the sparse graph. m̄F is a ”magnetization” of the fully connected graph defined by m̄F {Si } ≡ 1 X N ξiF Si , TcF = kC F J, (9) where we set the Boltzmann constant kB to unity. Now the point is that we can adjust the the transition temperature TcS of HF by changing the sparse graph. For example, if we choose the two dimensional square lattice as a sparse graph, the transition temperature TcS √ becomes 2/ log(1 + 2)J ≈ 2.27J. The degree k of the two dimensional square lattice is four. Therefore, if C F > TcS /(4J) ≈ 0.567, TcF becomes larger than TcS . On the other hand, the ground state energy of HS and that of S F HF , which are denoted as EGS and EGS respectively, are given as F EGS =− kN C F J . 2 (10) S F Therefore, if C F < 1, EGS is smaller than EGS . Now let us consider what happens when 0.567 < C F < 1. As the temperature is decreased from a high temperature, the system with the Hamiltonian H of Eq. (3) is expected to undergo a phase transition at TcF because TcF > TcS . When TcS < T < TcF , the order parameter m̄F defined by Eq. (7) grows with decreasing the temperature. However, we can expect that a second transition occurs at T S and the order parameter m̄S defined by m̄S {Si } ≡ exp[−βF (β; mS , mF )] (7) F where Jij ≡ JξiF ξjF . The transition temperature TcF of F H , which is equal to that in the infinite-range ferromagnetic Ising model, is given as kN J , 2 In this study, we use a variant of the Wang-Landau method regarding the order parameter.4) In this method, the Wang-Landau method5, 6) is modified to measure free energy as a function of order parameters. A similar method has been proposed in Ref. 7 to calculate free energy by the multicanonical ensemble method.8, 9) In the present study, we measure free energy as a function of order parameters mS and mF defined by ≡ CTr{Si } exp[−βH{Si }]δ(mS − m̄S {Si }) i where {ξiF } denotes a pattern embedded in the fully connected graph. Again, the possible value for ξiF is either −1 or +1. For simplicity, we assume that ξiS and ξiF are randomly and independently determined either +1 or −1 with probability 1/2 for all i. The Hamiltonian HF is equivalent to that of the Mattis model defined on the fully connected graph because we can rewrite HF as kC F X F kC F J HF {Si } = − Jij Si Sj − , (8) N i mS as Fmin . Similarly, a local minimum with mS > mF is denoted as Smin . In Fig. 5, Fmin and Smin are denoted by triangles and inverted triangles, respectively. The single local minimum at T = 2.5 J is Fmin . When T is 2.0 J, there are two local minima Fmin and Smin (Fig. 5 (b)). As schematically shown in Fig. 6, we hereafter denote a barrier that separates the two local minima as B. In Fig. 5, the barrier B is denoted by squares. At this temperature, Fmin is the global minimum. However, the free energy of Smin becomes almost equal to that of Fmin at T = 1.7 J (Fig. 5 (c)), and Smin becomes the global minimum at lower temperatures (Fig. 5 (d)). It should be noted that the temperature in Fig. 5 (c), i.e., 1.7 J, is close to the crossing temperature Tcross of ”Sample 1” in Fig. 2. The location of the global minimum shifts discontinuously as the temperature is changed across Tcross . This behavior explains the reason why two magnetizations in Fig. 2 changes abruptly around Tcross . These observations strongly support that, as mentioned above, the transition at Tcross is a firstorder transition. Fig. 5. βFdiff of a sample is plotted as a function of two magnetizations for four different temperatures. Fdiff is defined by Eq. (15). The sample is the same as ”Sample 1” in Fig. 2. The size L is 30 and the coefficient C F is 0.90. The locations of Fmin , Smin , and B are denoted by triangles, inverted triangles, and squares, respectively. See text for the definitions of Fmin , Smin , and B. We next explain how we analyze these data of free energy. As mentioned before, we first define Tcross as a temperature at which the magnitude relationship between mF and mS changes. We estimate Tcross by interpolation. We next define the free-energy differences ∆FS and ∆BF as  ∆FS ≡ β F (Fmin ) − F (Smin ) , (17)  ∆BF ≡ β F (B) − F (Fmin ) , (18) where F (Fmin ), F (Smin ), and F (B) are the free energies at Fmin , Smin , and B, respectively (see Fig. 6). We measure ∆FS and ∆BF at temperatures below Tcross and observe how they changes as the temperature decreases from Tcross . In concrete, ∆FS and ∆BF are evaluated for each sample at temperatures T = Tcross − 0.1nJ (n = 0, 1, 2, · · · ), (19) by interpolation. This measurement is done above the minimum temperature Tmin = 1.0 J. Fig. 6. The definitions of the free-energy differences ∆FS and ∆BF . In Fig. 7, ∆FS averaged over samples is plotted as a function of ∆T , where ∆T = 0.1nJ is the difference between the measurement temperatures given by Eq. (19) and Tcross . Because Tcross and the maximum value of ∆T that satisfies the inequality Tcross −∆T ≥ Tmin are different from sample to sample, the number of samples used for the average depends on ∆T . When ∆T is 0, F (Fmin ) is almost the same as F (Smin ) because the temperature is just Tcross . Therefore, ∆FS at ∆T = 0 is almost zero for all L. We see that ∆FS increases with increasing ∆T , and its speed increases with increasing L. This means that Smin is stabilized with decreasing temperature, and the stabilization becomes faster with increasing L. We next show the ∆T dependence of ∆BF in Fig. 8. Interestingly, ∆T dependence of ∆BF is rather weak. We also notice that ∆BF increases with increasing L. When L = 30 and ∆T = 0, ∆BF is about 26.9. This means that it is quite difficult for the system to escape from the local minimum Fmin because the probability that the system overcomes the barrier B is given by exp(−∆BF ). In Fig. 9, ∆BF ’s for four samples are plotted as a function of ∆T . The size L is 30 and the samples are the same as those in Fig. 2. We see that the behavior of ∆BF J. Phys. Soc. Jpn. Full Paper Fig. 7. The free-energy difference ∆FS averaged over samples is plotted as a function of ∆T , where ∆T is the difference between the measurement temperatures given by Eq. (19) and Tcross . The coefficient C F is 0.90. varies considerably depending on the sample. Fig. 8. The free-energy difference ∆BF averaged over samples is plotted as a function of ∆T , where ∆T is the difference between the measurement temperatures given by Eq. (19) and Tcross . The coefficient C F is 0.90. 4.3 Annealing simulation The result shown in Fig. 8 indicates that, if the size L is large and the free-energy barrier ∆BF is high, the system cannot escape from Fmin even when the temperature becomes lower than Tcross and Fmin becomes globally unstable. To verify the validity of this conjecture, we performed an annealing simulation. The result is shown in Fig. 10. In this simulation, the system was gradually cooled from an initial temperature 6.0 J to 1.0 J in steps of ∆T = 0.1 J. At each temperature, a usual MC simulation with the Metropolis method10) was performed. The initial temperature was set to be well above the critical temperature TcF . The system was kept at each temperature for 2 × 107 MCS. The first 107 MCS are for equilibration and the following 107 MCS are for measurement. In Fig. 10, hmF iT is plotted as a function of temperature. The result of the annealing simulation is denoted by full circles. The full squares denotes equilibrium data obtained by the variant of the Wang-Landau method. The Online-Journal Subcommittee 5 Fig. 9. The temperature dependence of ∆BF for four samples. The size L is 30 and the coefficient C F is 0.90. The samples are the same as those in Fig. 2. size L is 30 and the coefficient C F is 0.90. The sample is the same as ”Sample 1” in Figs. 2 and 9. Therefore, the data shown in Fig. 2 and the equilibrium data shown in Fig. 10 are the same. Although the annealing and equilibrium data coincide with each other at high temperatures, they do not at low temperatures. This means that the system was not equilibrated in the annealing simulation at low temperatures. We performed annealing simulation 10 times with different random number sequences, but the results were almost the same. These results indicate that, as conjectured, the system continues to remain at Fmin at low temperatures despite that Fmin becomes globally unstable. It is worth pointing out that these results are consistent with the data of ∆BF shown in Fig. 9 (full circles), which shows that ∆BF is about 27.3 at ∆T = 0 and it increases with increasing ∆T . Because the probability that the system overcomes the barrier is given by exp(−∆BF ), the probability is about 1.4 × 10−12 at Tcross (∆T = 0) and it decreases with decreasing temperature. Therefore, it is quite difficult for the system to overcome the barrier within 2×107 MCS, i.e., the period at each temperature in this annealing simulation. Fig. 10. The temperature dependences of hmF iT obtained by annealing simulation (full circles) and equilibrium simulation (full squares). The size L is 30 and the coefficient C F is 0.90. The sample is the same as ”Sample 1” in Figs. 2 and 9. 6 J. Phys. Soc. Jpn. Online-Journal Subcommittee Full Paper 5. Summary and Discussion In this paper, we presented a simple model that recalls two different patterns depending on the temperature. To realize a change in recall pattern due to temperature change, we embed two patterns to different graphs: the first pattern into a fully connected graph and the second pattern into a sparse graph. Because a fully connected graph is more resistant to thermal fluctuations than a sparse graph, we can realize a change in recall pattern by tuning relative weights of the two patterns properly. In this study, we chose the two dimensional square lattice as a sparse graph. We demonstrated by equilibrium Monte-Carlo simulations that such a temperaturedependent change in recall patterns does occur in our model. Simulation results strongly indicate that the system undergoes a first-order phase transition when the change in recall patterns occurs. We also found that the free-energy barrier ∆BF increases with the system size. Therefore, as the size increases, the system has difficulty recalling patterns embedded in the sparse graphs at low temperatures because it becomes difficult for the system to overcome the the free-energy barrier within the given simulation timescale (see Fig. 10). It is a future challenge to modify the model so as to suppress the free-energy barrier for a smooth switching of recall patterns. In this study, only two patterns were embedded in the model. Therefore, the recall pattern was switched only once due to the temperature change. However, by preparing many graphs with different resistance to thermal fluctuations and embedding different patterns in each graph, it is possible to modify the model so that the recall pattern is switched multiple times. To prepare graphs with different resistance to thermal fluctuations, one may use the geometric graph11) in which vertices located on a ddimensional hypercubic lattice are connected by an edge with a probability proportional to d−α ij , where dij is the distance between the two vertices and α is a positive exponent. By changing the exponent α, we can continuously change the effective dimension of the graph, and therefore its resistance to thermal fluctuations. On the other hand, an increase in the number of embedded patterns is expected to obscure the switching of recall pat- terns with the temperature change. This is the reason why we restrict ourselves to the case that the number of embedded patterns is two. Appendix: Proof for the existence of sequential transitions Sequential transitions mentioned in Sect. 2 occur if we choose C F so as to satisfy the following two conditions: • TcS < TcF . S F • EGS < EGS . From Eqs. (9) and (10), we find that there exists C F that satisfies both the two conditions if the inequality TcS < kJ, (A·1) holds. The transition temperature TcS is maximized when the graph is a random one because the effective spatial dimension of the random graph is infinity. The transition temperature Tc∗ (k) for random graphs with a fixed degree k is analytically calculated12) as Tc∗ (k) = J  −1 tanh 1 k−1 . (A·2) Because Tc∗ (k) < kJ for k ≥ 3 and TcS ≤ Tc∗ (k), the inequality (A·1) is always satisfied. Therefore, it is proven that we can always choose C F for any sparse graphs so that sequential transitions occur. 1) J. J. Hopfield, Proc. NatL Acad. Sci. USA 79, 2554 (1982). 2) D. O. Hebb, A Wiley Book in Clinical Psychology (Wiley, New York, 1949) p. 62. 3) D. C. Mattis, Phys. Lett. A 56, 421 (1976). 4) K. Watanabe and M. Sasaki, J. Phys. Soc. Jpn. 80, 093001 (2011). 5) F. Wang and D. P. Landau, Phys. Rev. Lett. 86, 2050 (2001). 6) F. Wang and D. P. Landau, Phys. Rev. E 64, 056101 (2001). 7) B. A. Berg, U. Hansmann, and T. Neuhaus, Phys. Rev. B 47, 497 (1993). 8) B. Berg and T. Neuhaus, Phys. Lett. B 267, 249 (1991). 9) B. Berg and T. Neuhaus, Phys. Rev. Lett. 68, 9 (1992). 10) N. Metropolis, A. W. Rosenbluth, M. N. Rosenbluth, A. H. Teller, and E. Teller, J. Chem. Phys. 21, 1087 (1953). 11) M. Sasaki, J. Phys. Soc. Jpn. 89, 104006 (2020). 12) M. Mézard and A. Montanari, Information, Physics, and Computation (Oxford, New York, 2009) p. 386.