On the supra-linear storage in dense networks of grid and place cells Adriano Barra, Martino S. Centonze, Michela Marra Solazzo, Daniele Tantari Abstract Place-cell networks, typically forced to pairwise synaptic interactions, are widely studied as models of cognitive maps: such models, however, share a severely limited storage capacity, scaling linearly with network size and with a very small critical storage. This limitation is a challenge for navigation in three-dimensional space because, oversimplifying, if encoding motion along a one-dimensional trajectory embedded in two dimensions requires O ⁡ ( K ) O(K) patterns (interpreted as bins), extending this to a two-dimensional manifold embedded in a three dimensional space -yet preserving the same resolution- requires roughly O ⁡ ( K 2 ) O(K^{2}) patterns, namely a supra-linear amount of patterns. In these regards, dense Hebbian architectures, where higher-order neural assemblies mediate memory retrieval, display much larger capacities and are increasingly recognized as biologically plausible, but have never linked to place cells so far. Here we propose a minimal two-layer model, with place cells building a layer and leaving the other layer populated by neural units that account for the internal representations (so to qualitatively resemble grid cells in the medial enthorinal cortex of mammals): crucially, by assuming that each place cell interacts with pairs of grid cells (the minimal quest to capture information on position but also on direction, i.e. the one- and two-point correlation functions), we show how such a model is formally equivalent to a dense Battaglia-Treves-like Hebbian network of grid cells only endowed with four-body interactions. By studying its emergent computational properties by means of statistical mechanics of disordered systems, we prove -analytically- that such effective higher-order assemblies (constructed under the guise of biological plausibility) can support supra-linear storage of continuous attractors; furthermore, we prove -numerically- that the present neural network (namely the simplest dense generalization of the interplay between grid and cells) is, thus, already capable of recognition and navigation on general surfaces embedded in a three-dimensional space. 1 Introduction The hippocampus, particularly the CA1 region, hosts place cells that fire selectively when an animal occupies specific locations, thereby forming the building blocks of cognitive maps—internal representations of the external, physical, space [ 41 , 42 , 21 , 31 , 44 ] . These networks have been extensively modeled as continuous attractor neural networks (CANNs), which support localized bumps of activity that smoothly track stimuli along continuous manifolds (see e.g. [ 52 , 45 , 48 ] ). Among such models, the Battaglia–Treves formulation, with N McCulloch–Pitts neurons storing K spatial maps, has served as a canonical reference [ 14 , 15 ] . Its statistical-mechanical analysis has yielded exact phase diagrams and clarified the roles of noise and inhibition, yet revealed a severe limitation: storage scales only linearly with system size, i.e., K_{\max}=\alpha_{c}N , with \alpha_{c}\lesssim 10^{-2} , far below the Hopfield benchmark ( \alpha_{c}\sim 10^{-1} ). Even improved models deepened in more recent times, see e.g. [ 43 , 37 ] , still face roughly the same low capacity. This shortcoming is indeed not unique to the Battaglia–Treves model but, rather, stems from the common assumption of pairwise synaptic couplings ( p=2 ), inherited from classical Hebbian learning and shared by most attractor frameworks for spatial memory. In contrast, recent work on dense Hopfield models [ 30 ] has demonstrated that many-body generalizations retain biological plausibility while achieving supra-linear storage [ 1 , 6 , 10 , 49 , 28 , 29 , 50 ] . Extending this perspective to networks that try to capture spatial correlations can thus be relevant, especially if we think that whereas encoding locomotion along a one-dimensional manifold embedded in d=2 dimensions requires O(K) patterns, representing motion on a two-dimensional manifold embedded in d=3 dimensions demands roughly O(K^{2}) patterns (if we want to preserve spatial resolution), resulting in an unattainable scenario if tackled by neural networks supporting solely linear capacity storage. On top of that, the discovery of grid cells in the medial entohrinal cortex (MEC) of mammals [ 26 ] has led to the idea that the spatial selectively shown by place cells is not entirely encoded in the hippocampus (where the CA1 and CA3 regions populated by place cells lie), but it is rather a byproduct of internal activity in the MEC and its connection with the hippocampus [ 40 , 22 , 46 ] . In fact, as the animal crosses specific positions in space, grid cells activate coherently in periodic hexagonal-grid patterns (hence showing spatial selectivity) and their activity is fed to the hippocampus producing the aperiodic spatial selectivity shown by place cells [ 46 ] . Grid cells are known for maintaining their characteristics ( i.e. scale, phase and orientation) across different environments [ 23 ] , which suggests that grid cells work as universal maps, which is compatible with the idea that grid-cells offer a universal metric for space-representation and space-navigation. The latter constitutes a key difference with place cells, whose configurations change at different environments, a property that is called remapping [ 39 ] , which is essential for recalling past memories associated with different space environments, [ 38 ] . In order to investigate the interplay between place and grid cells in mammals’ navigation system, we propose here a suitably simplified associative memory model that tries to capture some of the main properties of the biological counterpart, while attaining the possibility of studying its computational properties with techniques inherited from statistical mechanics of spin glasses, namely interpolation technique and replica trick. Nevertheless, despite the drastic simplifications carried out in keeping its architecture minimal, which is needed to perform exact computations (at the replica symmetry level of description), the model is able to work as a navigation system on rather general manifolds, capturing spatial correlations within the environment and enjoying a supra-linear storage of patterns coding for its navigation. Building on analogies with p -spin models in spin-glass theory [ 25 , 24 , 9 , 4 ] and relying upon the duality between (higher-order) Boltzmann machines and (generalized) Hopfield neural networks [ 3 , 1 , 11 , 13 , 36 , 53 , 33 , 51 , 7 , 17 ] , we develop a minimal two-layer architecture as a core-model for spatial navigation in mammals: the hidden (or more internal ) layer is built off by neurons whose function is to represent the spatially coherent states that qualitatively resemble grid cells activity that, in turn, underlie the firing of place cells, the latter being all allocated in the visible (or more external ) layer. We stress the fact that, in our model, the purpose of the hidden layer of neurons is to produce internal representations that are localized in the space coded by a given manifold \mathcal{M}_{hidden} . The coherent activity produced in the hidden layer is responsible for the emergence of the activation of place cell neurons in the visible layer at specific locations in the visible space \mathcal{M}_{visible} . The latter is a binned representation of the environment, where each place cell is attached to a given anchor point (within its surrounding region, i.e. the place field ): this way, hidden neurons work qualitatively as grid cell units. Up to this point, the model is general as its actual representation depends on the particular choice of \mathcal{M}_{hidden} , which is not fixed: in our simulations and computations, however, we minimally diverge from biological plausibility by choosing \mathcal{M}_{hidden}=\mathcal{S}_{D} to be the D- dimensional (hyper-)sphere of the same dimension of \mathcal{M}_{visible} (while in biological circuits of grid cells \mathcal{M}_{hidden} is rather a torus [ 18 ] ) 1 1 1 To be sharp, in our simulations, coordination by place cells for toroidal navigation will be taken into account and solely grid cells will be a tessellation of a regular -Euclidean- space for the sake of simplicity. , and we focus on the study of aperiodic (rather than periodic) solutions of the MC dynamics, as this considerably simplifies the calculations and numerical subtleties, yet letting the model still able to capture key aspects of the general qualitative behavior of its biological counterpart. Crucially, if we force each place cell in the visible layer to interact with (at least) couples of grid cells -the minimal quest to capture both information on orientation but also for navigation (namely the one- and two-point correlation functions), once the visible layer is integrated out (thus, by relying on the above mentioned duality, we focus on the marginal distribution of solely the hidden neurons), this construction is then shown to be formally equivalent to a dense Battaglia–Treves network [ 14 ] with many-body (i.e. four) interactions that allow to code higher-order spatial correlations needed to bin a D\geq 3 \mathcal{M}_{visible} space. In this dense formulation, the maximal storage of K patterns naturally scales as K_{\max}=\alpha_{c}N^{p-1} , where the supra-linear factor N^{p-1} (rather than the small pre-factor \alpha_{c} ) drives the capacity enhancement: as a result, effective fully connected higher-order neural networks, involving quadruplets (or more) of neurons but actually representing lower-order biologically-driven layered networks, can thus constitute a natural route to overcome the storage bottleneck and, in a cascade fashion, easily allow for spatial navigation in dimensions higher than two. In practice, for a d=3 dimensional embedding space, it suffices to work with p=4 -order interactions: we study this case in detail. Analytically, by inspecting its supra-linear storage capacity and checking the stability of coherent attractor states, numerically, facing challenging navigation tasks, concretely showing how spatial navigation on a bi-dimensional manifold embedded in a three dimensional space becomes affordable by such a neural network. In doing so, we provide a theoretical framework that highlights the computational and dynamical advantages of many-body interactions in spatial memory, offering a step toward more biologically realistic models of information processing neural networks within mammals’ brain. 2 The model: from definitions to computational capabilities In this Section, trying to preserve the most biological plausibility, we introduce the core-mechanisms that we identifies as mandatory for a neural network in order to accomplish spatial orientation and navigation on manifolds embedded in generic dimensions (i.e. not confined to planar motion). In particular, in Sec. 2.1 we introduce the simplest bipartite structure where one layer -built off by place cells- interact in a mean field manner with another layer -built off by grid cells- such that, each place cell senses couples of grid cells (i.e. the interactions are ternary and not pairwise): this is the minimal quest to capture one- and two-point correlation functions among grid cells for a given chart to be recognized. This assumption has two fundamental -despite elementary- consequences: the former is that, the dual representation of this bipartite network (achievable by marginalizing over the place cells), is a generalized dense Battaglia-Treves model equipped with four-wise interactions among grid cells only and this network is able to accomplish supra-linear storage of patterns and thus can play as a working model for spatial orientation also in the challenging case of motion in a three-dimensional environment. The latter is that the field acting on each place cell contains Hebbian pairwise interactions among grid cells, hence -as grid cells correlate (due to their interactions) while they recognize the underlying chart- this forces a unique place cell to fire (or just a few of them), letting to this cell the freedom to operate in a quasi-grandmother way and this is pivotal to extend elementary the model from solely spatial recognition to account also for spatial navigation. Indeed, in Sec. 2.2 we extend this core-model by providing also information on consecutive maps in order to turn the network into a true behavioral model able to cope with spatial navigation too. Crucially, as place cells can play like grandmother cells (namely they activate in a rather specific way, that is when the animal crossed their related place field), this extension can be achieved trivially, simply by adding to the Cost function defining the core-model an extra navigation term where a coupling among two consecutive place cells suffices to drive the animal within the manifold under exploration as it gives rise to a stochastic process in space à la Markov: we stress that, without a quasi-grandmother cell-like behavior of the visible layer, modeling such a spatial drive would be rather cumbersome. The whole result in a minimal neural network’s architecture that preserves the Hebbian structure of the synaptic tensors and allows locomotion on manifolds embedded in \mathbb{R}^{3} , namely the challenging scenario (from a modeling perspective) of actual interest. Figure 1 : A sketch of the model. Left : the place cells \{\mathbf{z}\} are disposed on the vertices of the grid following the mapping that associates each index \mu to the coordinate (\mu_{x},\mu_{y})=(\mu\bmod L,\lfloor\mu/L\rfloor) . Right : as the animal crosses specific points in the environment, place cells activate accordingly, producing a coherent state in the space of grid cells \{\mathbf{s}\} and relative map \mu . 2.1 The simplest representation: one layer of grid cells and one layer of place cells Nowadays, the interplay of grid and place cells is understood to be essential for space orientation and navigation in mammals. However, grid and place cells are placed in two distinct areas of the brain, the hyppocampus and the MEC respectively, which causes some difficulties in a proper understanding of how these two neural circuits are wired together in order to produce the observed cognitive behavior related to space orientation. We propose a simplified model that combines place and grid cell-like neurons in a bipartite architecture, where a recurrent continuous attractor network of N hidden neurons \{s_{i}\}_{i=1,..,N} that play the role of grid cells, is (recurrently) connected to the visible layer built off by K neurons \{z_{\mu}\}_{\mu=1,..,K} , which play the role of place cells. The bipartite architecture allows to bridge the internal space \mathcal{M}_{hidden} to the visible space \mathcal{M}_{visible} , which represents the external environment navigated by the animal. Let us assume that \mathcal{M}_{hidden} and \mathcal{M}_{visible} have the same intrinsic dimension D , which is smaller than the dimension d of the embedding space where these manifolds live, i.e. D=d-1 . Concretely, we shall focus on the bi-dimensional navigation embedded in our three-dimensional Euclidean space, so that D=2 and d=3 , but our analytical results will be valid for any d\geq 1 in general 2 2 2 Note that \mathcal{M}_{visible} has periodic boundary conditions, namely a toroidal topology. . Let us assume that each hidden neuron s_{i} is mapped to the hidden space \mathcal{M}_{hidden} via a multi-chart \eta^{\mu}_{i}:\mathcal{M}_{hidden}\to\mathbb{R}^{D} , one chart per each representation \mu=1,..,K of the hidden space. The assumption of the existence of a multi-chart representation, rather than a single one, is essential as each such representation can be connected to a bijective map \phi_{\mu} that bridges \mathcal{M}_{hidden} to a point r^{\mu}\in\mathcal{M}_{visible} , i.e. \phi_{\mu}:\mathbb{\eta}^{\mu}\to r^{\mu}\in\mathcal{M}_{visible} . In other words, we assume that the visible space \mathcal{M}_{visible} is binned in K bins, and the center r^{\mu} of each bin is the anchor point of one visible neuron z_{\mu} , which in turn is connected to (couples of) hidden neurons \mathbf{s} in a given fixed chart \mathbf{\eta}^{\mu} . Notice that we need a binning procedure that allows to bin this space with a number of bins K of order K\sim L^{d-1} , where L is the typical linear size of the visible space. This means that, for a generic embedding dimension d , we need a dense model whose order of interactions p scales at least as p=d , hence allowing to extensively bin the external space with the size of the hidden layer: N\sim L . In our model, the quest that each place cells communicates with couples of grid cells automatically forces the lower (even) value of p such that p\geq d , which for d=3 is p=4 and this suffices to allow for three-dimensional orientation and navigation as we deepen in the rest of the manuscript. Let us now introduce the equations that govern the stochastic dynamics of our model: \displaystyle\tau_{h}\frac{du_{i}(t)}{dt}=-u_{i}(t)+\sum_{j=1}^{N}\sum_{\mu=1}^{K}J^{\mu}_{ij}\ z_{\mu}(t)s_{j}(t)+\epsilon_{s}(t) (1) \displaystyle\tau_{v}\frac{dz_{\mu}(t)}{dt}=-z_{\mu}(t)+\frac{1}{2}\sum_{j=1}^{N}\sum_{i=1}^{N}J^{\mu}_{ij}\ s_{i}(t)s_{j}(t)+\epsilon_{v}(t) (2) \displaystyle s_{i}=\sigma(\gamma u_{i}), (3) \displaystyle\langle\epsilon(t)\rangle=0,\>\>\langle\epsilon(t)\epsilon(t^{\prime})\rangle=2\tau\beta^{-1}\delta(t-t^{\prime}) (4) where \tau_{h},\tau_{v} are the timescales of the hidden and visible layer respectively, u_{i} is the pre-synaptic potential of the hidden neuron i , and it is related to the post-synaptic potential s_{i} with the relation provided in eq. 3 , where \sigma(\gamma x)=\frac{1}{1+e^{-\gamma x}} is the sigmoid function with gain \gamma>0 and \mathbf{J}^{\mu}=\{J^{\mu}_{ij}\}_{i,j=1,..,N} is the synaptic tensor that connects the hidden neurons in each chart \mu to the corresponding visible place cells. Finally, the synaptic noise in each layer \epsilon(t) (with the subscripts v and s ) follows the fairly standard one- and two-points correlation relations, as coded in eq. 4 with fast noise (or ’temperature’) T=\beta^{-1} ruled by its (fastest) timescale \tau . For simplicity we assume that the visible neurons \mathbf{z} activate via the identity input-output relation, but other choices (such as a ReLu activation) can be used. In our model, we do not study the problem of inferring the synaptic matrix \mathbf{J}^{\mu} from the data, but rather assume that the maps \bf{\eta}^{\mu} are known (namely their entries are independently sampled accordingly to a uniform distribution as explained in Appendix Appendix Zero: Definition of maps and their statistics ) and we write directly the synaptic tensor \mathbf{J}^{\mu} in the Hebbian form, which reads \displaystyle J^{\mu}_{ij}=\sqrt{\frac{8}{N^{3}}}\ \eta^{\mu}_{i}\cdot\eta^{\mu}_{j} (5) where \eta^{\mu}_{i}\cdot\eta^{\mu}_{j} is the usual dot product in R^{d} and the pre-factor ensures the linear extensivity with the hidden layer’s size N in the thermodynamic limit: we refer to the Appendix Appendix Zero: Definition of maps and their statistics to check the details that allow to write the standard Battaglia-Treves synaptic tensor in terms of this Hebb-like prescription. In the zero noise limit \beta\to\infty the dynamics becomes deterministic and admits the following Lyapunov function \mathcal{H}(\boldsymbol{s},\boldsymbol{z}|\boldsymbol{\eta}) (that will also play as the Hamiltonian in the analytical investigations and as the Cost Function in the numerical inspections that follow): \displaystyle\mathcal{H}(\boldsymbol{s},\boldsymbol{z}|\boldsymbol{\eta})=-\frac{1}{2}\sum_{\mu=1}^{K}\sum_{i,j=1}^{N}J^{\mu}_{ij}s_{i}s_{j}z_{\mu}+\frac{1}{2}\sum_{\mu=1}^{K}z^{2}_{\mu}+c(\boldsymbol{s}) (6) where c(s)=\sum_{i=1}^{N}\int^{s_{i}}ds_{i}^{\prime}\ \sigma^{-1}(s_{i}^{\prime}) is a term arising from the input-output relation provided in eq. ( 3 ). We note that this and the other term \propto z_{\mu}^{2} at the r.h.s. of eq. ( 6 ) play the role the (negative log) of the prior over the hidden and visible neurons once one introduces the likelihood distribution [ 16 ] , as it will become clear soon 3 3 3 Furthermore, in the statistical mechanical treatment that follows, these terms will be reabsorbed in the prior directly within the partition function ( vide infra ). . It is indeed a simple exercise to show that the Lyapunov function ( 6 ) decreases along any dynamical trajectory \{\boldsymbol{u}(t),\boldsymbol{z}(t)\} , that is: \displaystyle\frac{d\mathcal{H}}{dt}=-\tau_{v}\sum_{\mu}\left(\frac{dz_{\mu}(t)}{dt}\right)^{2}-\tau_{h}\sum_{i}\sigma^{\prime}(\gamma u_{i}(t))\left(\frac{du_{i}(t)}{dt}\right)^{2}\leq 0. (7) because \sigma is an increasing function of its argument (such that \sigma^{\prime}(\gamma u_{i})>0 ) and it eventually reaches equilibrium at long times t\to\infty . For a given finite value of the synaptic noise \beta<\infty , the dynamics of the network is no longer deterministic, rather it becomes intrinsically stochastic and it can be studied by introducing the likelihood at time t , p_{t}(\boldsymbol{s},\boldsymbol{z}|\boldsymbol{\eta}) , that -thanks to Detailed Balance granted by the symmetry of the Hebbian couplings in the Cost function- converges for t\to\infty to the following Boltzmann-Gibbs measure: \displaystyle\lim_{t\to\infty}p_{t}(\boldsymbol{s},\boldsymbol{z}|\boldsymbol{\eta})=p_{\infty}(\boldsymbol{s},\boldsymbol{z}|\boldsymbol{\eta})=Z^{-1}(\boldsymbol{\eta})\ e^{-\beta\mathcal{H}(\boldsymbol{s},\boldsymbol{z}|\boldsymbol{\eta})} (8) where Z_{N}(\beta,\boldsymbol{\xi}) , i.e., the normalization factor, is also referred to as the partition function . In the following, we take the infinite gain limit, i.e. \gamma\to\infty , which results in boolean variables for the hidden neurons, i.e. \boldsymbol{s}=\{0,1\}^{N} (namely, driven by simplicity, we keep the s variables to be N McCulloch \& Pitts neurons as in the original Battaglia-Treves model), as this allows us to further simplify the sampling procedure without loosing much information. The z variables are instead real-valued neurons, equipped -as stated- with a Gaussian prior (i.e. the term \propto z_{\mu}^{2} in the Cost function ( 6 ), whose -fairly standard- role is to prevent them to activate toward too high values). In general, sampling from the likelihood ( 8 ) is difficult, if not intractable, since computing the partition function Z is hard. In order to circumvent this difficulty, we use the pseudo-likelihood [ 19 , 54 ] in place of the likelihood, where we isolate the hidden neuron at site i , s_{i} , conditioned to all other neurons except it: \{\boldsymbol{s}_{\setminus i},\boldsymbol{z}\} , and similarly for the visible layer, i.e. we isolate z_{\mu} conditioned to all other neurons \{\boldsymbol{s},\boldsymbol{z}_{\setminus\mu}\} . Hence we define two pseudo-likelihoods, one per each layer, that read \displaystyle p(s_{i}|\boldsymbol{s}_{\setminus i},\boldsymbol{z},\boldsymbol{\eta})=Z(\boldsymbol{s}_{\setminus i},\boldsymbol{\eta})^{-1}e^{-\beta\mathcal{H}(s_{i}|\boldsymbol{s}_{\setminus i},\boldsymbol{z},\boldsymbol{\eta})}, (9) \displaystyle p(z_{\mu}|\boldsymbol{s},\boldsymbol{z}_{\setminus\mu},\boldsymbol{\eta})=Z(\boldsymbol{z}_{\setminus\mu},\boldsymbol{\eta})^{-1}e^{-\beta\mathcal{H}(z_{\mu}|\boldsymbol{s},\boldsymbol{z}_{\setminus\mu},\boldsymbol{\eta})}. (10) The two pseudo-likelihoods defined above allow us to perform alternate Gibbs sampling as an algorithm for Monte Carlo dynamics. The advantage of this procedure is that now we are able to easily sample from the partition functions Z(\boldsymbol{s}_{\setminus i},\boldsymbol{\eta}) and Z(\boldsymbol{z}_{\setminus\mu},\boldsymbol{\eta}) , allowing us to finally write the effective updating rules for the hidden and visible layers, which read \displaystyle P(s^{t+1}_{i}=1|\boldsymbol{s}^{t}_{\setminus i},\boldsymbol{z}^{t},\boldsymbol{\eta})=\sigma\left(\beta h_{i}(\boldsymbol{s}^{t}_{\setminus i},\boldsymbol{z}^{t},\boldsymbol{\eta})\right), (11) \displaystyle P(z^{t+1}_{\mu}|\boldsymbol{s}^{t},\boldsymbol{z}^{t}_{\setminus\mu},\boldsymbol{\eta})=\mathcal{N}\left(\zeta_{\mu}(\boldsymbol{s}^{t},\boldsymbol{z}^{t}_{\setminus\mu},\boldsymbol{\eta}),\beta^{-1}\right), (12) where we introduced the cavity fields h_{i} and \zeta_{\mu} as follows \displaystyle h_{i}(\boldsymbol{s}_{\setminus i},\boldsymbol{z},\boldsymbol{\eta})=\sqrt{\frac{8}{N^{3}}}\ \sum_{\mu}\sum_{j\neq i}\eta^{\mu}_{i}\cdot\eta^{\mu}_{j}\ s_{j}z_{\mu}, (13) \displaystyle\zeta_{\mu}(\boldsymbol{s},\boldsymbol{z}_{\setminus\mu},\boldsymbol{\eta})=\zeta_{\mu}(\boldsymbol{s},\boldsymbol{\eta})=\sqrt{\frac{2}{N^{3}}}\ \sum_{i,j}\eta^{\mu}_{i}\cdot\eta^{\mu}_{j}\ s_{i}s_{j}. (14) Notice that the cavity field \zeta_{\mu}(\boldsymbol{s},\boldsymbol{\eta}) does not depend on \boldsymbol{z} anymore, hence it plays the role of a magnetic field in the visible layer. This reveals the simplicity but also effectiveness of the present model: as a magnetic field is polarized in a given direction \mu by virtue of its pairwise internal correlations among the grid neurons \boldsymbol{s} , the related place cell z_{\mu} activates accordingly, producing a spike that is localized at position r^{\mu} in the visible space \mathcal{M}_{visible} . Furthermore, as maps are uncorrelated, in the large N limit, once a place cell is firing (highlighting that the animal entered its place field), all the others stay silent (much as in the Hopfield benchmark, where once a Mattis magnetization has raised because its related pattern has been retrieved, all the other remain quiescent), thus -in the present model- place cells spontaneously behaves as grandmother cells, acquiring the required selectivity that, empirically, typically these cells enjoy 4 4 4 For the sake of clearness, still bridging with the Hopfield reference, the possible presence of spurious attractor states implies that, still confined within the retrieval region whose existence we still must prove, not just a unique magnetization may rise from zero but, at worst, a few of them: this does not alter however the high specificity these cells acquire by working in the present architecture. : we will prove, in the second part of the paper, that this grandmother-like behavior results to be pivotal in order to turn such a recognition model into a navigation model. In the thermodynamic limit (and confined to the low noise and an affordable storage of charts), we expect the sampling procedure outlined above to converge towards global minima of the cost function ( 6 ) that are continuously connected to form continuous attractors for the neural dynamics, which -in the present setting- carries the spatial information about the location of the animal in the external space. To inspect and quantify such a phenomenon, namely the ability of the network to orientate itself in the external environment and, consequently, navigate within it, we must at first derive its phase diagram and then prove the existence of a not-empty retrieval region within it, i.e. a phase where the model is able to produce spatially coherent states in the hidden manifold that are directly connected to localized activity in the visible space (the latter, in turn, are correlated to the animal’s position in the physical space). To reach this goal, we need to introduce a set of control parameters (that, in turn, play as the axes of the phase diagram) and a set of order parameters (that are simple observables able to capture the macroscopic behavior of the network). We introduce three control parameters: \lambda,\qquad\beta=\frac{1}{T},\qquad\alpha=\frac{p!}{2d^{p/2}}\lim_{N\to\infty}\frac{K}{N^{p-1}}, where \lambda\in\mathbb{R}^{+} tunes the global inhibition strength in the network 5 5 5 Note that, in general, inhibition is mandatory to prevent the network from globally activating as, once we integrate out the place cells, we are left with a dense network built off solely by Boolean variables [0,+1] rather than Ising spins [-1,+1] . , \beta\in\mathbb{R}^{+} is the so-called inverse temperature , ruling the level of fast noise in the dynamics 6 6 6 Note that, for \beta\to 0 , network dynamics is dominated by noise and resemble an unstructured random walk in configuration space. Conversely, in the zero-temperature limit \beta\to\infty , the dynamics steepest descends accordingly to a deterministic energy minimization, leading the system toward stable attractors that correspond to stored spatial maps. and \alpha accounts for the load of patterns in the network within the high-storage prescription, namely working at the maximal storage before blackout catastrophes may emerge. From now on, for the sake of simplicity, we fix one value of the control parameters, namely we work at \lambda=1 : this simplifies considerably the calculations and, as we prove along the paper ( vide infra , in particular Figure 4 and its caption), if the network is able to work for unitary values of the inhibition strength, it can certainly work (even better) for other (close by) values 7 7 7 Indeed in the insets of Figure 4 we show \alpha_{c} vs \lambda where it shines that the case \lambda=1 plays as an effective lower bound for the critical storage (namely, slightly higher values of \lambda improve the network performances). . Once the control parameters have been introduced, the macroscopic behavior of the system is naturally described by the following order parameters \displaystyle\boldsymbol{x}_{\mu} \displaystyle=\frac{1}{N}\sum_{i=1}^{N}\boldsymbol{\eta}^{\mu}_{i}s_{i}\quad\text{(population vector)} (15) \displaystyle q_{ab} \displaystyle=\frac{1}{N}\sum_{i=1}^{N}s_{i}^{a}s_{i}^{b}\quad\text{(grid cell's replica overlap)} (16) \displaystyle p_{ab} \displaystyle=\frac{1}{K}\sum_{\mu=1}^{K}z_{\mu}^{a}z_{\mu}^{b}\quad\text{(place cell's replica overlap)} (17) \displaystyle m \displaystyle=\frac{1}{N}\sum_{i=1}^{N}s_{i}\quad\text{(mean firing activity)} (18) where a,b=1,\ldots,n denote replica indices. Next, as standard in the statistical mechanics of disordered systems, we introduce and study the (quenched) free energy of the model \mathcal{A}(\alpha,\beta,\lambda) , namely \mathcal{A}(\alpha,\beta,\lambda):=\lim_{N\to\infty}\frac{1}{N}\mathbb{E}\ln Z_{N,K}(\beta,\lambda,\boldsymbol{\eta}), (19) where the expectation \mathbb{E} averages over the randomness in the quenched charts: as standard in the theoretical investigations, these are entirely random objects, namely their entries are Rademacher variables. Once reached an expression for the quenched free energy in terms of the control and order parameters of the theory, its extremization w.r.t. the order parameters returns to a set of self-consistency equations that trace their evolution in the space of the control parameters, whose inspection allows to paint the phase diagram of the model, namely to obtain the explicit evolution of the order parameters in the space of the control parameters 8 8 8 For the sake of clearness, to be sharp, due to historical reasons we are using the statistical pressure \mathcal{A} and not the free energy F with no loss of generality as \mathcal{A}=-\beta F . . Given that the dynamics of the visible neurons is driven by the internal correlations among the hidden neurons \boldsymbol{s} , we can safely integrate out the formers over the factorized Gaussian measure D\boldsymbol{z}=\prod_{\mu}\frac{dz_{\mu}}{\sqrt{2\pi\beta^{-1}}}\ \exp\left(-\frac{\beta}{2}z_{\mu}^{2}\right) , and write the partition function as follows \displaystyle Z_{N,K}(\beta,\lambda=1,\boldsymbol{\eta}) \displaystyle=\sum_{\boldsymbol{s}=\{0,1\}^{N}}\int D\boldsymbol{z}\>\exp\left(\beta\sqrt{\frac{2}{N^{3}}}\sum_{\mu=1}^{K}\sum_{i,j=1}^{N}\ \eta^{\mu}_{i}\cdot\eta^{\mu}_{j}s_{i}s_{j}z_{\mu}\right) (20) \displaystyle=\sum_{\boldsymbol{s}=\{0,1\}^{N}}\exp\left(\frac{\beta}{N^{3}}\sum_{i_{1},i_{2},i_{3},i_{4}=1}^{N}\sum_{\mu=1}^{K}\eta^{\mu}_{i_{1}}\cdot\eta^{\mu}_{i_{2}}\ \eta^{\mu}_{i_{3}}\cdot\eta^{\mu}_{i_{4}}\ s_{i_{1}}s_{i_{2}}s_{i_{3}}s_{i_{4}}\right) (21) Figure 2 : Duality of representation. Left : the two-layer neural network where couples of grid cells (green circles in the left layer) are coupled to a place cell (blue circle in the right layer). For the sake of simplicity only one triplet - i.e. one coupling- is shown. Right : the equivalent representation (obtained by marginalizing out the place cells, see eq. ( 20 )) in terms of a dense Battaglia-Treves-like neural network of grid cells only. Namely we reached the equivalent dual representation of this model naturally in terms of a dense Hebbian network built off by solely grid cells: see Figure 2 . While we refer to the supplementary material for the mathematical details that allow to express the free energy of this class of models in terms of control and order parameters (achieved by two independent approaches, namely interpolation technique -see Appendix Appendix One: Interpolation Technique for dense networks of place cells - and replica trick -see Appendix Appendix Two: Replica trick for dense networks of place cells ), hereafter we report directly the results that stem from this investigation and its extremization, namely the explicit expression of the free energy as well as the self-consistent equations for its order parameters. Under the replica symmetry ansatz (namely assuming that these stochastic variables do not fluctuate in the thermodynamic limit, rather they concentrate around their unique averages \overline{m} , \overline{x} , \overline{q} ), the free energy of the dense Battaglia-Treves model reads as \displaystyle\mathcal{A}\left(\alpha,\beta,\lambda\right)=\left(1-p\right)\beta\|\boldsymbol{\overline{x}}\|^{p}-\beta\left(\lambda-1\right)\left(1-p\right)\overline{m}^{p}+\left(1-p\right)\alpha\beta^{2}\left(\overline{q}_{1}^{p}-\overline{q}_{2}^{p}\right)+ \displaystyle\quad+\mathbb{E}_{\boldsymbol{\eta}}\int Dz\ln\bigg[1+\exp\bigg(\beta p\|\boldsymbol{\overline{x}}\|^{p-2}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)-\beta p\left(\lambda-1\right)\overline{m}^{p-1}+\alpha\beta^{2}p\left(\overline{q}_{1}^{p-1}-\overline{q}_{2}^{p-1}\right)+\beta\sqrt{2\alpha p\overline{q}_{2}^{p-1}}z\bigg)\bigg]. (22) Figure 3 : Phase diagram of the dense Battaglia-Treves model for p=4 . Notice that the free energy eq. 2.1 is formally invariant under d (since d always only appears inside the definition of \alpha ), hence the phase diagram is the same for every value of d . As expected, we note the presence of three regions, namely the high noise limit captured by the paramagnetic phase (PM) -where nor computational capabilities neither spin glass features appear- the low noise but too much load regime captured by the spin glass region (SG) (where glassy features are shown but the model is handling too much information and it fails in performing chart recognition) and the ferromagnetic phase (FM) -where retrieval of maps is effectively achieved by the network in this challenging high storage regime where K\propto N^{3} . Remarkably, as deepened in the Appendix, in reaching this expression we ensured the maximal scaling K=\frac{2\alpha d^{p/2}}{p!}N^{p-1} , namely the expected supra-linear scaling K\propto N^{p-1} that, in this particular setting with p=4 , reads as K=\alpha N^{3} : if we now prove the existence of a not-empty retrieval region in the phase diagrams of this network (as it is indeed shown by the plots provided in Figure 3 for both two and three dimensions) we reached the first part of our thesis: once the analytical inspections grant the existence of such a retrieval region, we then must computationally verify that, actually, confining the network to that region, it is indeed able to reconstruct the spatial charts and, eventually, use them for navigation. The set of self-consistent equations that trace the evolution of the order parameters in the space of the control parameters - stemmed by the quest \nabla_{\boldsymbol{\overline{x}},\overline{q_{1}},\overline{q_{2}}}\mathcal{A}\left(\alpha,\beta,\lambda\right)=0 - is reported hereafter and allows us to draw the phase diagrams reported in Figure 3 . \displaystyle\|\boldsymbol{\overline{x}}\|^{2}=\int D\boldsymbol{z}\ \langle\ \left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)\sigma\left(\beta h(\boldsymbol{\overline{x}},\overline{q}_{1},\overline{q}_{2};z)\right)\ \rangle_{\boldsymbol{\eta}}, (23) \displaystyle\overline{q}_{1}=\int D\boldsymbol{z}\ \langle\ \sigma(\beta h(\boldsymbol{\overline{x}},\overline{q}_{1},\overline{q}_{2};z)\ \rangle_{\boldsymbol{\eta}}, (24) \displaystyle\overline{q}_{2}=\int D\boldsymbol{z}\ \langle\ \sigma^{2}(\beta h(\boldsymbol{\overline{x}},\overline{q}_{1},\overline{q}_{2};z)\ \rangle_{\boldsymbol{\eta}}, (25) \displaystyle h(\boldsymbol{\overline{x}},\overline{q}_{1},\overline{q}_{2};z)=p\|\boldsymbol{\overline{x}}\|^{p-2}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)-p\left(\lambda-1\right)\overline{m}^{p-1}+\alpha\beta p\left(\overline{q}_{1}^{p-1}-\overline{q}_{2}^{p-1}\right)+\sqrt{2\alpha p\overline{q}_{2}^{p-1}}z. (26) where (\boldsymbol{\overline{x}},\overline{q}_{1},\overline{q}_{2}) are the expected values of the population vector and the diagonal and off-diagonal part of the overlap respectively and h(\boldsymbol{\overline{x}},\overline{q}_{1},\overline{q}_{2};z) is the internal effective field. Figure 4 : Phase diagrams of dense Battaglia-Treves like neural networks of grid cells with (left) d=2,p=4 , (center) d=2,p=6 and (right) d=2,p=8 at different values of the inhibition strength \lambda confined to planar motion. We remark two points: The former is that, qualitatively, the existence of a retrieval region is robust with respect to the density of the network. The latter is that, while \lambda actually does not appear in the main text (due to our choice of using \lambda=1 in order to simplify the mathematical treatment, as explained in Appendix Appendix Zero: Definition of maps and their statistics ), such working assumption (i.e. \lambda=1 ) is roughly a worse case scenario as proved by the insets of these diagrams, where the maximal storage \alpha_{c} is shown versus \lambda . Furthermore, in Figure 4 we also provide and compare the phase diagrams that networks equipped with, respectively, p=4 , p=6 and p=8 couplings, would give rise to: the ultimate purpose of these plots is to prove robustness of the theory also w.r.t. the network’s density because, while we analyzed the case p=4 as a special test case, the theory is completely general. We stress that we have conducted MC simulations in order to test numerically our theoretical results of the p=4 model and confirmed that the scaling K\propto N^{3} is indeed correct, with a critical load \alpha_{c} at zero temperature that is compatible with the theoretical value of \alpha_{c}=10^{-3} within the numerical errors, for either d=2,3 dimensions. 2.2 Extending the model from spatial recognition to spatial navigation The model described so far is a reconstruction model, not yet a behavioral model, namely it is able to store and recall several attractor states corresponding to discretized positions in the visible space but there is no dynamics underlying (i.e. it accounts for chart reconstruction by a static animal). At contrary, biological neural circuits that perform spatial navigation are typically able to reconstruct the animal’s position dynamically, that is, while the animal is moving within its environment. In other words, the animal’s position changes according to the animal’s motion, with mechanisms that can vary in accordance with biological complexity but that typically share the main functioning: external stimuli representing angular or linear velocity are reconstructed according to visual clues about the external environment, and are used to modulate the synaptic interactions in the neural layers where the bump of activity is correlated with the position 9 9 9 Note that this modulation drives the system out of equilibrium -as Detailed Balance is no longer granted- and typically breaks the symmetry of interactions, leading to the emergence of new dynamical effects that can, in some cases, break the stability of the attractors of the dynamics leading to chaotic regimes [ 47 ] : we will not deepen these chaotic aspects in the present paper. . In our model, we assume that the external velocity of the animal in the visible space \mathcal{M}_{visible} is well reconstructed (due to the fact that place cells interact with couples of grid cells in the core-model defined in eq. ( 6 )) and available to the layer of place cells, where it is used to modulate new interactions in the \mathbf{z} layer 10 10 10 Note that, tacitely, we assume that these interactions take place on a lower timescale compared to \tau_{z} , allowing the core-network presented so far (namely the cost function ( 6 )) to work effectively in a quasi-equilibrium regime. . The role of these new interactions is to drive the network -and thus the moving animal- towards the next basin of attraction, which represents a new position in the visible space that is correlated with the animal’s true position as the latter explores the environment 11 11 11 The strength of the new interaction is represented by the firing rate of a new layer of neurons, in analogy to conjunctive neurons that receive information about linear velocity and current position from the cells immediately above them in the visible layer [ 44 , 35 ] , however –for the sake of simplicity– we omit this third layer and directly simulate the activity of such conjunctive neurons via effective fields to be added core Cost function provided by ( 6 ). : see the introductory Figure 6 . Operatively, thanks to the grandmother like behavior of the place cells in this model, adding a new effective term to generalize \mathcal{H}(\boldsymbol{\sigma},\boldsymbol{z}|\boldsymbol{\eta})\to\mathcal{H}(\boldsymbol{\sigma},\boldsymbol{z}|\boldsymbol{\eta})+\mathcal{H}_{nav} in order to turn the model into a navigation model is a trivial task: indeed, again by a glance at Figure 6 , it is immediate to realize that the new navigation term must read as \displaystyle\mathcal{H}_{nav}=\ \displaystyle J^{+}_{x}\sum_{{\mu_{x},\mu_{y}}=1}^{L}z_{(\mu_{x},\mu_{y})}z_{(\mu_{x}+1,\mu_{y})}+J^{-}_{x}\sum_{{\mu_{x},\mu_{y}}=1}^{L}z_{(\mu_{x},\mu_{y})}z_{(\mu_{x}-1,\mu_{y})}+ \displaystyle+J^{+}_{y}\sum_{{\mu_{x},\mu_{y}}=1}^{L}z_{(\mu_{x},\mu_{y})}z_{(\mu_{x},\mu_{y}+1)}+J^{-}_{y}\sum_{{\mu_{x},\mu_{y}}=1}^{L}z_{(\mu_{x},\mu_{y})}z_{(\mu_{x},\mu_{y}-1)}. (27) Notice that the indices (\mu_{x},\mu_{y}) represent the coordinate of each neuron z_{\mu} in the visible D=2 -dimensional space via the following transformation: \displaystyle\mu_{x}=\mu\text{ mod }L,\ \ \mu_{y}=\lfloor\mu/L\rfloor. (28) In this way we are able to cover the space \mathcal{M}_{visible}=L^{2} by placing the place cell z_{\mu} in the position given by the coordinates (\mu_{x},\mu_{y})\in M_{visible} . Notice also that the covering is periodic along both directions, hence realizing a toroidal topology, as observed experimentally in biological place cells [ 26 ] 12 12 12 We stress once more that modeling such an extension from spatial recognition to spatial navigation would be, in principle, rather complicated, while here -ultimately due to the highly selective firing of place cells that allows them to behave in a quasi-grandmother manner- it can be taken into account by simply coupling in a pairwise manner two consecutive place cells. Furthermore, we also stress that -despite the high selectivity of the place cells is empirical well established (and related to the amplitude of their place fields), here we did not assume their behavior, rather we obtained it as an emergent property of the collective action of all the cells. . The quantities (J^{\pm}_{x},J^{\pm}_{y}) are functions of time accounting for the firing activity of the conjunctive neurons [ 35 ] , which are modulated by the external velocity v_{ext} of the animal. In particular, suppose that a conjunctive neuron responsible for a shift in the x direction, fires f_{x}\tau times (where \tau is the conjunctive neurons timescale): each time it fires, it drives the activity of z_{\mu} towards the right (or left) direction by one unit of distance. Hence, if the x component of the velocity of the animal is v_{x} , we assume the simplest proportionality rule: f_{x}\tau\sim|v_{x}| , where the sign of v_{x} selects which conjunctive neuron has to operate (there are left- and right- neurons responsible for the motion along +x and -x ), and similarly for the y direction. The ratio f_{x}\tau/|v_{x}| gives the relative strength of the new interaction with respect to the intensity of the cavity fields defined in ( 14 ). Concretely, the simplest modeling assumption is to chose (J^{\pm}_{x},J^{\pm}_{y}) to be proportionally representing the firing activity of the conjunctive neurons, such that along the \pm x directions we have \displaystyle\frac{1}{T}\int_{0}^{T}J^{\pm}_{\mu_{x}}(t)dt\sim f^{\pm}_{x}\sim|v_{x}| where f^{\pm}_{x} is the firing rate of the \pm x conjunctive neurons, and similarly along y . Figure 5 : Simplest tests of the dynamical reconstruction of two trajectories, the first one in the shape of a pentagon (left) and the second one a circular trajectory (right) of the ’animal’ by the dense network. Black: true velocity of the animal, represented by arrows starting at the prescribed anchor points, for all the involved tiles within the plane where the motion happens. Overall, all these arrows roughly form a circle in the visible space \mathcal{M}_{visible} . Red: reconstructed trajectory in the \mathbf{z} layer of place cells: just by visual inspection, we can appreciate how the reconstructed trajectory resembles the real motion, nevertheless, it also shines that there are errors in the reconstruction (i.e. the two circles do not perfectly overlap as the red arrows sometimes lie inside the black circle some other times outside, preserving zero mean, but not-zero standard deviations). Such a dynamical model is able to reconstruct the trajectory of the animal rather well, despite not perfectly, as shown -as a test case- at first in a particularly simple circular motion presented in Fig. 5 : a crucial point is that, unavoidably, the reconstruction error is inversely related to the resolution by which the visible space is tessellated (hence the reason for a sufficiently fine-grained grid and, thus, a dense network) and it is accumulated during the integration of the velocity along the trajectory as we now deepen focusing on more classical experiments. Now we try and reproduce computationally, by our navigation model, the celebrated firing fields presented by the Moser’s and their collaborators in their famous work [ 31 ] : we confine the numerical animal in a squared box of side L=100 and we force it to perform a standard random walk. In Fig. 6 (left panel), the activity of place cells neurons z is shown for a random trajectory of the animal. Notice that, even if each place cell has a fixed place field of area 1 around it by construction (see Appendix Appendix Zero: Definition of maps and their statistics ), it can actually fire even outside this region: this is due to the error in reconstruction that gets accumulated by integrating the external velocity v of the animal as times goes by, as reported in Fig. 7 . Figure 6 : In this picture we reproduce theoretically, by relying upon our model with p=4 , the same kind of plots produced empirically in the celebrated experiments reported in [ 31 ] . (Left) Simulation of a single random walk by the numerical animal is shown on a L\times L=30\times 30 grid: while motion takes place, a subset of place cells (i.e. those indicated in the legend) activate (and are visually represented by circle points) as the animal passes closely enough to their anchor point (that are instead indicated as a triangle). (Center) After simulating several random trajectories on a larger (i.e. L\times L=100\times 100 ) grid, we have enough statistics to show the place fields of four selected place cells, which are defined as the effective area where a given cell fires. (Right) Resulting distribution of the amplitudes of the place fields: we highlight that such a histogram is fairly well compatible with the hypothesis that it follows the Gamma distribution (i.e. the \rho(r) reported in eq. ( 29 ), shown as a dashed orange curve in the lin-log plot). Note that these plots show planar navigation embedded in a three-dimensional space as, due to the periodic boundary conditions ( x+L\to x and y+L\to y ), these plane by a glance are actually tori in three dimensions. For each place cell, the one-dimensional errors \delta\vec{r}=(\delta x,\delta y) are defined as the displacement between the place field centers and their firing locations: crucially, if we do a histogram of their Euclidean distances –defined as r=\left\lVert\delta\vec{r}\right\rVert_{2} , as shown in Fig. 6 (top right panel)– these distribute according to a Gamma distribution \displaystyle\rho(r)=\frac{r}{\sigma^{2}}e^{-\frac{r^{2}}{2\sigma^{2}}} (29) Figure 7 : Errors in trajectory reconstruction by the present network as the random walk of the animal takes place. (Left) Errors accumulate as time elapses, giving rise to a diffusion-like process. (Middle) As a result, while the mean is kept zero (errors \delta x,\ \delta y are symmetrically distributed), the distance \sqrt{(\delta x)^{2}+(\delta y)^{2}} between the anchor point and the real position of the animal (when the corresponding place cell fires) gets biased (i.e., it is no longer unitary, as assumed a priori) giving rise to the Gamma distribution shown in the (Right) panel on a lin-lin scale (relative to a snapshot of the error taken at the final time of the simulated dynamics T=1000 ). where \sigma is the standard deviation of r that –given the diffusive nature of the process– scales as \sigma\sim\sqrt{t} (where t is the time of the random walk): we speculate that this intrinsic error in reconstruction is the origin of the Gamma distribution (shown on a lin-log scale in Fig. 6 but also on a lin-lin scale in the third panel of Fig. 7 , dedicated to deepening the accumulation of noise during motion) that is empirically observed both in mice performing random walks in small cages [ 27 ] as well as in bats performing Levy flights in long tunnels [ 20 ] (see also [ 32 ] for a quantitative statistical analysis). We remark that this feature is not intrinsic to the present model, rather it happens regardless the selected tradeoff between density of the network and resolution of the tessellation as we now explain: indeed, even if we would work out a better model (eventually departing from biological evidence) and we assume that each place cells z_{\mu} interact with three grid cells per time (so to eventually capture information also on the acceleration, namely collecting one- two- and three-point correlation functions), then the dual dense network would be a generalized dense Battaglia-Treves model with couplings involving six-neurons: this would simply result in a slower time for accumulating noise during integration of the trajectory that, ultimately, still gives rise to the Gamma distribution: the impasse is intrinsic to the balance between resolution of tesselation and effective density of the network. As a result, we speculate that such an intrinsic tradeoff between resolution in tessellation and density of the effective dense network that must handle such a grid could be the underlying reason of the (almost universal) Gamma distribution of place fields typically observed in the experiments 13 13 13 The main source of errors lies in the integration of the velocity itself given the resolution of the visible space: this gives rise to a tradeoff between storage capacity and resolution that dense network can cope with, as explained in [ 2 ] , see also [ 5 , 34 ] . . We also point out that navigation flows easily if handled by the present network and this is also due the fact that dense networks have better shaped minima (if compared to shallow counterparts) that allows easily the place cells to drive the motion. At contrary, with the same resolution, a standard pairwise Battaglia-Treves model would face a storage by far above the critical value making the network stuck in spin glass minima, hence resulting in several place cells active at once but all poorly firing. 3 Conclusions Driven by the observation that, keeping the resolution fixed, the larger the dimension of the environment explored by the animal, the larger the number of patterns required to tessellate it with anchor points for spatial orientation, in this work we have extended the classical Battaglia–Treves neural network model beyond the conventional pairwise ( p=2 ) interaction scheme, demonstrating that a dense formulation (already with the minimal choice of p=4 couplings) can sustain the required supra-linear storage of spatial maps and thus allow the animal to easily explore surfaces embedded in a three-dimensional Euclidean space. However, rather than assuming this dense model as the starting point, we investigated a biologically-driven network with a two-layer architecture in which grid cells form the visible layer and place cells the hidden layer: crucially, in order to let the place cells detect (at least) pairwise correlations among grid-cell activities (that is, in order to capture one-point and two-point correlation functions, mandatory to extract information on both position as well as direction of the numerical animal exploring its surrounding), the interactions in this bipartite network are between a place cell and couples of grid cells, as coded by the cost function ( 6 ). By marginalizing out the place cells within a statistical mechanical treatment of this network, such a minimal network is shown to be equivalent to an effective dense Battaglia-Treves model in the grid cells only (as shown by the equivalence ( 20 )): this duality of representation highlights how effective higher-order Hebbian assemblies can emerge from biologically plausible network structures, thus bridging the gap between theoretical dense models and hippocampal circuitry. Our analysis, grounded in statistical mechanics of disordered systems, reveals that the inclusion of quadruplet interactions in the Battaglia-Treves model fundamentally reshapes the storage properties of the network: unlike classical pairwise models, where the number of storable maps scales linearly with system size and it is further severely constrained by a small critical pre-factor \alpha_{c} , the dense Battaglia–Treves model achieves supra-linear scaling, K_{\max}=\alpha_{c}N^{p-1} . Even if retaining a small \alpha_{c} , the N^{p-1} factor ensures a dramatic increase in its storage capacity and this property is particularly relevant for representing navigation in higher-dimensional spaces, where -in order to preserve resolution- the number of required patterns must grow with the manifold dimensionality. Interestingly, a not trivial result stemming from the analytical inspection of this model at work with orientation within a given environment is that the high-selectivity of place cells (that allows them to fire solely when the animal enters their place fields) is not assumed here, rather it emerges as a consequence of the place-grid cell’s interactions: as the animal crosses various place fields one after another, grid cells orchestrate time to time so to trigger the specific response of one place cell per time allowing these place cells to behave in a quasi grandmother way, in accordance with empirical findings. Crucially, due to this highly specialized behavior, it is thus trivial to correlate place cells together so to turn recognition into navigation. Interestingly, a not trivial result stemming from the numerical inspection of this model at work with navigation within a given environment is that, while we assumed each place field to have the same unitary amplitude, as the motion takes place (e.g. the animal is forced to random walk in a squared cage), the place field distribution gets deformed, collapsing on a Gamma distribution that is extensively experimentally revealed in the pertinent literature (see e.g. [ 32 , 27 , 20 ] ): this is because, despite the network is fairly able to reproduce the trajectory of the animal, yet small errors (e.g. given by the finite resolution) in its detection sum up as the motion keeps going and -while preserving zero mean (allowing for bonafide reconstruction)- they drift away the anchor point and the real position crossed by the animal when the corresponding place cell spikes. Remarkably, this feature is robust against model’s improvements: even assuming that place cells interact with e.g. triples of grid cells (so to collect higher order information on the correlation functions), nevertheless, this would result in a more dense Battaglia-Treves network (with six interacting neurons per time), that would however preserve the same pathology, the solely difference being the slower accumulation timescale for the errors related to reconstruction. A comment on the underlying techniques (beyond the above results of potential interest for the Neuroscience Community) that can be of interest for the Statistical Mechanical Community is that we enriched the present study with two appendices (see Appendix Appendix One: Interpolation Technique for dense networks of place cells and Appendix Appendix Two: Replica trick for dense networks of place cells ) entirely dedicated to explain how to adapt two celebrated mathematical methods in order to cope with information processing capabilities of these networks: the former is Guerra interpolation, a rigorous approach eventually more diffused within the Mathematical Physics division of our Community, the latter is the Replica Trick, that is a powerful tool largely diffused within the Theoretical Physics division of our Community. In both these approaches we assumed that, in the large network size limit, the order parameters capturing the network’s property self-average around their means and that these are unique, namely we assumed replica symmetry , the fairly standard level of description in the bulk of neural network’s Literature. Yet, some characteristics of the phase diagrams that we obtained (as e.g. the re-entrance of the retrieval region in the \beta\to\infty limit at the critical storage values), suggests that replica symmetry could be broken by the true representation of the stored continuous attractors in the cost function landscape thus, in a near future, efforts will be spent to inspect the role of replica symmetry breaking in layered networks of grid and place cells. Beyond these mathematical challenges to overcome, future inspections should also include quantitative comparisons with experimental data on hippocampal–entorhinal circuits in a systematic and exhaustive way. Appendix Zero: Definition of maps and their statistics Let us describe more explicitly our framework, particularly the definition of the multi-charts \{\boldsymbol{\eta}^{\mu}_{i}\}^{\mu=1,..,K}_{i=1,..,N} and the relation between the original bipartite network and its integral representation in terms of a dense model, starting from the basic Battaglia-Treves reference and then generalizing to the present case. Let us start by the charts: for every neuron s_{i} , these are defined as the mappings between the hidden manifold \mathcal{M}_{hidden} and the coordinate space \mathbb{R}^{d} . Since we have K different copies of the same hidden space \mathcal{M}_{hidden} , this mapping is responsible of the localization of the hidden neurons \mathbf{s} in the whole space \mathcal{M}_{hidden}^{\bigotimes K} . In the following we fix \mathcal{M}_{hidden}=S_{D} , the hyper-sphere which we assume of unitary radius for the sake of simplicity. Hence, we can define Definition 1 (Multi charts) . The multi-charts \boldsymbol{\eta}^{\mu}_{i} are d- dimensional functions such that \displaystyle\boldsymbol{\eta}^{\mu}_{i}:S_{D}\to\mathbb{R}^{d} (30) Recall that d=D+1 is the dimension of the embedding space while D is the manifold where the real motion takes place. Given the manifest spherical symmetry of the system (see Fig. 8 for d=2 and 10 for d=3 ), in parameterizing the multi-charts we use spherical coordinates, such that each point on the hyper-sphere is determined by the angles \omega=(\phi_{1},\phi_{2},..,\phi_{D}) , with \displaystyle(\phi_{1},..,\phi_{D-1})\in[0,\pi]^{D-1},\quad\phi_{D}\in[0,2\pi] (31) and consequently, the multi-charts are functions of these angles \boldsymbol{\eta}_{i}^{\mu}=\boldsymbol{\eta}(\omega_{i}^{\mu}) , with the condition \eta_{i}^{\mu}\cdot\eta^{\mu}_{i}=1,\forall\mu,i . Notice that each index \mu=1,..,K can be viewed as denoting a copy of the same space S_{D} , such that each hidden neuron s_{i} has a different position on each hyper-sphere at the same time. Remark 1 . Once the coordinates \{\omega_{i}^{\mu}\}^{\mu=1,..,K}_{i=1,..,N} for each neuron s_{i} and map \mu are assigned, the multi-charts \boldsymbol{\eta}^{\mu}_{i}=\boldsymbol{\eta}(\omega_{i}^{\mu}) can be interpreted as (unit) vectors in \mathbb{R}^{d} , where the scalar product can be defined. The scalar product of two distinct multi-charts in the same map \mu , \eta^{\mu}_{i}\cdot\eta^{\mu}_{j} only depends on the relative angle \phi_{ij} by virtue of the spherical law of cosines, namely: \displaystyle\eta^{\mu}_{i}\cdot\eta^{\mu}_{j}=\cos\phi_{ij} (32) Figure 8 : Two examples of maps \eta^{1} and \eta^{2} shown for the case d=2 , where the topology of the maps \boldsymbol{\eta}^{\mu}_{i} is the circle S_{1} , characterized by the set of angles \theta^{\mu}_{i}\in[0,2\pi] . A retrieval state is shown in \boldsymbol{\eta}^{1} as all neurons that lie within the \overline{\psi}\in[\overline{\theta}-\delta/2,\overline{\theta}+\delta/2] interval are activated (here displayed as black dots), while the others stays quiescent (in white dots). The same firing pattern of neurons, that looks coherent in the first map \boldsymbol{\eta}^{1} , looks disordered in the other map \boldsymbol{\eta}^{2} . Note that the centers of the place fields are scattered roughly uniformly along the unitary circle S_{1} and that the width of all the place fields is roughly the same (and equal to one). The process by which the coordinates are assigned is very important for our goals, since it defines how the hidden neurons s_{i} tessellate the global hidden space (S_{D})^{\bigotimes K} . We assume that the assignment process is random, such that, independently for each map \mu , the coordinates of each hidden neuron s_{i} are (also independently) extracted at random with a uniform prior over the space of angles \{\omega_{i}^{\mu}\}^{\mu=1,..,K}_{i=1,..,N} . Figure 9 : The norm of the population vector is shown as a function of \delta in the case of d=2 ( left ) and d=3 ( right ), and confronted with numerical simulations at finite size N=10,100,1000 . Definition 2 (Coherent States) . For any given i.i.d. assignment of the angles \{\omega^{\mu}_{i}\} , a perfect coherent state in any fixed map \nu=1,..,K , is a neuron state \mathbf{s} such that the module of the order parameter ||\mathbf{\overline{x}}^{\nu}||\equiv\overline{x}^{\nu}=\pi^{-1} in the thermodynamic limit N\to\infty . The result holds in particular in dimension d=2 and d=3 . Consider first d=2 . The population vector is \mathbf{x}^{\nu}=\frac{1}{N}\sum_{i|s_{i}=1}(\cos\theta_{i}^{\nu},\sin\theta_{i}^{\nu}) . In the thermodynamic limit we can approximate the sum with the following integral: x^{\nu}=\frac{1}{2\pi}\int_{-\delta/2}^{\delta/2}d\theta^{\nu}(\cos\theta^{\nu},\sin\theta^{\nu})=\left(0,\frac{1}{\pi}\sin\frac{\delta}{2}\right) where we have introduced the parameter \delta which defines the width of the coherent region, i.e. the angle window upon which the neurons are simultaneously active (while the others are quiescent), see Fig. 8 . Hence, the norm of the population vector is x^{\nu}=\frac{1}{\pi}\sin\frac{\delta}{2} , which is equal to \pi^{-1} for \delta=\pi . For d=3 , a similar reasoning applies, leading to x^{\nu}=\int_{0}^{2\pi}\frac{d\phi^{\nu}}{2\pi}\int_{0}^{\delta}\frac{d\theta^{\nu}}{\pi}(\sin\theta^{\nu}\cos\phi^{\nu},\sin\theta^{\nu}\sin\phi^{\nu},\cos\theta^{\nu})=\left(0,0,\frac{1}{\pi}\sin\delta\right) which has norm x^{\nu}=\frac{1}{\pi}\sin\delta . The results are confirmed numerically in Fig. 9 . Now we are able to define the Definition 3 (Quenched Average) . For any given function g(\boldsymbol{\eta}) that depends on the realization of the K maps \{\boldsymbol{\eta}^{\mu}_{i}\}^{\mu=1,..,K}_{i=1,..,N} , the quenched average is denoted as \mathbb{E}_{\eta}[g(\boldsymbol{\eta})] or \langle g(\boldsymbol{\eta})\rangle_{\boldsymbol{\eta}} depending on the context, and is defined as: \langle g\left(\boldsymbol{\eta}\right)\rangle_{\boldsymbol{\eta}}=\int\prod_{i,\mu=1}^{N,K}d^{D}\omega_{i}^{\mu}\ g(\boldsymbol{\eta}(\boldsymbol{\omega}))=\int\prod_{i,\mu=1}^{N,K}\prod_{q=1}^{D}d(\phi_{q})_{i}^{\mu}\ g(\boldsymbol{\eta}(\phi_{1},..,\phi_{D})), (33) where \boldsymbol{\omega} collectively denotes the set of angles \{\omega^{\mu}_{i}\}^{\mu=1,..,K}_{i=1,..,N} and the integral is supposed to be performed over the domain given by eq. 31 . This assumes that the maps are statistically independent, which allows the expectation over the place fields to factorize over the sites i=1,...,N and the maps \mu=1,...,K . In practice, for our purposes, in the mean field approximation we need to compute the quenched average over functions that depend only on the scalar product of \boldsymbol{\eta} and some vector \boldsymbol{a} , i.e. g(\boldsymbol{\eta}\cdot\boldsymbol{a}) and \boldsymbol{\eta}\cdot\boldsymbol{a}\>g(\boldsymbol{\eta}\cdot\boldsymbol{a}) , which is the case for our self-consistency eqs. 23 - 25 . The quenched averages read \displaystyle\langle g(\boldsymbol{\eta}\cdot\boldsymbol{a})\rangle_{\boldsymbol{\eta}}=\int_{0}^{\pi}\frac{d\theta}{\pi}\ g(|\boldsymbol{a}|\cos\theta), (34) \displaystyle\langle\boldsymbol{\eta}\cdot\boldsymbol{a}\>g(\boldsymbol{\eta}\cdot\boldsymbol{a})\rangle_{\boldsymbol{\eta}}=|\boldsymbol{a}|\int_{0}^{\pi}\frac{d\theta}{\pi}\ \cos\theta\ g(|\boldsymbol{a}|\cos\theta) (35) where we used |\boldsymbol{\eta}|=1 . Notice that the important orthogonality condition holds \displaystyle\langle\boldsymbol{\eta}^{\mu}_{i}\cdot\boldsymbol{\eta}^{\nu}_{j}\rangle_{\boldsymbol{\eta}}=\delta_{ij}\delta^{\mu\nu}. (36) In order to derive the statistical properties of the model of grid cells, we introduce the dense generalization of the Battaglia-Treves Cost Function involving the neurons \{s_{i}\}_{i=1,..,N} in d- dimensions and with general interaction order K by analogy with the pairwise case: following [ 14 ] , keeping in mind that the kernel has to be a function of a distance among place field cores on the manifold and that the latter is the unitary circle in two dimensions, to take advantage from the Hebbian experience [ 8 ] , the interacting strength between neurons will be written as \displaystyle J_{ij}=\frac{1}{N}\sum_{\mu=1}^{K}\eta^{\mu}_{i}\cdot\eta^{\mu}_{j}\ . (37) Figure 10 : Neuronal activity in the first two maps \mu=1,2 at \lambda=1 . The dense Hamiltonian -see e.g. its sharp definition ( 39 ) from the next Appendix- allows to define a MCMC neural update procedure that, in the retrieval regime, produces stable coherent states where half of the neurons are active and the other half quiescent. ( left panels ): the neural activity is spatially coherent in one of the maps ( \mu=1 , first panel on the left), while it looks random in the other maps ( \mu=2 , second panel from the left). ( right panels ) The same neural activity in the \mu=1 and \mu=2 maps is shown in the third and fourth panels from the left in the spherical and angular coordinates (\theta,\phi) respectively. Notice that the Hebbian kernel ( 37 ) is a function of the relative Euclidean distance of the i,j neuron’s coordinates \theta_{i},\theta_{j} in each map \mu : to show this, one can simply compute the dot product as \eta^{\mu}_{i}\cdot\eta^{\mu}_{j}=\cos(\theta_{i}^{\mu})\cos(\theta_{j}^{\mu})+\sin(\theta_{i}^{\mu})\sin(\theta_{j}^{\mu})=\cos(\theta_{i}^{\mu}-\theta_{j}^{\mu}). We can now define the Cost function of the original Battaglia-Treves model as given by the next Definition 4 (pairwise Battaglia-Treves Hamiltonian) . Given N McCulloch \& Pitts neurons \boldsymbol{s}=(s_{1},...,s_{N})\in\{0,1\}^{N} , K charts \boldsymbol{\eta}=(\eta^{1},...,\eta^{K}) with \eta^{\mu}\in S_{D} for \mu\in(1,...,K) encoded with the specific kernel ( 37 ), and a free parameter \lambda\in\mathbb{R}^{+} to tune the global inhibition within the network, the Battaglia-Treves Hamiltonian for chart reconstruction reads as 14 14 14 The symbol ‘ \approx ’ in eq. ( 38 ) becomes an exact equality in the thermodynamic limit, N\to\infty , where, splitting the summation as \sum_{i1 ) in eq. ( 39 ), and using the definition ( 15 ), we write: \displaystyle H_{N}^{\left(p\right)}\left(\boldsymbol{s}|\boldsymbol{\eta}\right)= \displaystyle-N\|\boldsymbol{x}_{1}\|^{p}+\frac{\lambda-1}{N^{p-1}}\sum_{i_{1},\ldots,i_{p}=1}^{N}s_{i_{1}}\cdots s_{i_{p}}+ (41) \displaystyle-\frac{1}{N^{p-1}}\sum_{\mu=2}^{K}\sum_{i_{1},\ldots,i_{p}}\left(\boldsymbol{\eta}_{i_{1}}^{\mu}\cdot\boldsymbol{\eta}_{i_{2}}^{\mu}\right)\cdots\left(\boldsymbol{\eta}_{i_{p-1}}^{\mu}\cdot\boldsymbol{\eta}_{i_{p}}^{\mu}\right)s_{i_{1}}\cdots s_{i_{p}}, Each scalar product in the noise term is given by \boldsymbol{\eta}^{\mu}_{i}\cdot\boldsymbol{\eta}^{\mu}_{j}=\sum_{t=1}^{d}\eta^{\mu,t}_{i}\eta^{\mu,t}_{j}, where the components \eta^{\mu,t}_{i} are i.i.d. with zero mean and variance 1/d . Following the reasoning of previous investigations on dense neural networks with interpolating tools (see e.g. [ 6 , 1 , 3 ] ), to simplify the treatment of the noise term – in particular, to allow for a Hubbard-Stratonovich (HS) transformation (that, in turn, is in order to lower the effective degree of interaction) – we approximate the product of p/2 scalar products as the product of two independent Gaussian variables, each corresponding to a multilinear combination of p/2 vectors: \left(\boldsymbol{\eta}_{i_{1}}^{\mu}\cdot\boldsymbol{\eta}_{i_{2}}^{\mu}\right)\cdots\left(\boldsymbol{\eta}_{i_{p/2-1}}^{\mu}\cdot\boldsymbol{\eta}_{i_{p/2}}^{\mu}\right)\approx\eta^{\mu}_{i_{1},\ldots,i_{p/2}}\eta^{\mu}_{i_{p/2+1},\ldots,i_{p}}, where \eta^{\mu}_{i_{1},\ldots,i_{p/2}} and \eta^{\mu}_{i_{p/2+1},\ldots,i_{p}} are standard Gaussian variables with mean zero and variance 1/d^{p/4} . We can now rewrite the noise term approximately as \displaystyle-\frac{1}{N^{p-1}}\sum_{\mu=2}^{K}\sum_{i_{1},\ldots,i_{p}}\left(\boldsymbol{\eta}_{i_{1}}^{\mu}\cdot\boldsymbol{\eta}_{i_{2}}^{\mu}\right)\cdots\left(\boldsymbol{\eta}_{i_{p-1}}^{\mu}\cdot\boldsymbol{\eta}_{i_{p}}^{\mu}\right)s_{i_{1}}\cdots s_{i_{p}}\approx \displaystyle\approx-\frac{A}{N^{p-1}}\sum_{\mu=2}^{K}\left(\sum_{i_{1},\ldots,i_{p/2}}\eta^{\mu}_{i_{1},...,i_{p/2}}s_{i_{1}}\cdots s_{i_{p/2}}\right)^{2}, where A is a pre-factor to be determined. The transition from a full p -wise summation to a squared form involves a change in combinatorics. Specifically, the original sum includes all p! permutations of p indices, while the squared form symmetrically counts each unordered pair of p/2 -tuples twice. Therefore, to match the scale of the two expressions, we must correct for this over-counting by introducing a suitable normalization factor, namely A=\sqrt{\frac{p!}{2}} . The factor p! accounts for all permutations of the p indices in the original term, while the factor \frac{1}{2} arises from the symmetric square, which double-counts each pair of index groups. Note that expressing the term as a perfect square also introduces diagonal terms – i.e., those with repeated index tuples: \left(\sum_{i_{1},...,i_{p/2}}\,\eta^{\mu}_{i_{1},...,i_{p/2}}\,s_{i_{1}}\cdots s_{i_{p/2}}\right)^{2}=\sum_{\begin{subarray}{c}i_{1},\dots,i_{p/2}\\ j_{1},\dots,j_{p/2}\end{subarray}}\eta^{\mu}_{i_{1},\dots,i_{p/2}}\eta^{\mu}_{j_{1},\dots,j_{p/2}}s_{i_{1}}\cdots s_{i_{p/2}}s_{j_{1}}\cdots s_{j_{p/2}}. (42) Diagonal contributions \left(i_{1},\dots,i_{p/2}\right)=\left(j_{1},\dots,j_{p/2}\right) are counted twice, whereas the original Hamiltonian counts them at most once. This overcounting introduces a systematic bias that must be corrected. To address this, we subtract the expected value of the spurious diagonal contributions. Since each \eta^{\mu}_{i_{1},\dots,i_{p/2}} is a zero-mean Gaussian variable with variance \mathbb{E}[(\eta^{\mu}_{i_{1},\ldots,i_{p/2}})^{2}]=1/d^{p/4} , the correction term becomes: \sqrt{\frac{p!}{2}}\sum_{i_{1},...,i_{p/2}}\mathbb{E}\left[(\eta^{\mu}_{i_{1},...,i_{p/2}})^{2}\right]s_{i_{1}}^{2}\cdots s_{i_{p/2}}^{2}=\sqrt{\frac{p!}{2}}\frac{1}{d^{p/4}}\sum_{i_{1},...,i_{p/2}}s_{i_{1}}^{2}\cdots s_{i_{p/2}}^{2}. (43) Therefore, incorporating the diagonal terms and employing the definition of the order parameter ( 18 ), the Hamiltonian is expressed as \displaystyle H_{N}^{\left(p\right)}\left(\boldsymbol{s}|\boldsymbol{\eta}\right)= \displaystyle-N\|\boldsymbol{x}_{1}\|^{p}+N\left(\lambda-1\right)m^{p}-\frac{\lambda-1}{N^{p-1}}\sum_{i_{1},\ldots,i_{p/2}=1}^{N}s_{i_{1}}^{2}\cdots s_{i_{p/2}}^{2}+ (44) \displaystyle-\frac{1}{N^{p-1}}\sqrt{\frac{p!}{2}}\sum_{\mu=2}^{K}\left(\sum_{i_{1},\dots,i_{p/2}}\eta^{\mu}_{i_{1},\dots,i_{p/2}}s_{i_{1}}\cdots s_{i_{p/2}}\right)^{2}+\frac{1}{N^{p-1}d^{p/4}}\sqrt{\frac{p!}{2}}\sum_{\mu=2}^{K}\sum_{i_{1},\dots,i_{p/2}}s_{i_{1}}^{2}\cdots s_{i_{p/2}}^{2}. We now introduce the partition function Z_{N}\left(\beta\right)=\sum_{\boldsymbol{s}}\exp\left(-\beta H_{N}\right) . By substituting H_{N}^{\left(p\right)}\left(\boldsymbol{s}|\boldsymbol{\boldsymbol{\eta}}\right) into the definition of the partition function Z_{N}\left(\beta\right) , we obtain: \displaystyle Z_{N}\left(\beta,\boldsymbol{\eta}\right)= \displaystyle\sum_{\boldsymbol{s}}\exp\bigg[\beta N\|\boldsymbol{x}_{1}\|^{p}-\beta N\left(\lambda-1\right)m^{p}+\beta\frac{\lambda-1}{N^{p-1}}\sum_{i_{1},\ldots,i_{p/2}=1}^{N}s_{i_{1}}^{2}\cdots s_{i_{p/2}}^{2}+ (45) \displaystyle+\frac{\beta}{N^{p-1}}\sqrt{\frac{p!}{2}}\sum_{\mu=2}^{K}\left(\sum_{i_{1},\dots,i_{p/2}}\eta^{\mu}_{i_{1},\dots,i_{p/2}}s_{i_{1}}\cdots s_{i_{p/2}}\right)^{2}-\frac{\beta}{N^{p-1}d^{p/4}}\sqrt{\frac{p!}{2}}\sum_{\mu=2}^{K}\sum_{i_{1},\dots,i_{p/2}}s_{i_{1}}^{2}\cdots s_{i_{p/2}}^{2}\bigg]. Applying the HS transformation 16 16 16 \exp\left[\beta Q^{2}\right]=\int\frac{dz}{\sqrt{2\pi}}\exp\left[-\frac{1}{2}z^{2}+\sqrt{2\beta}Qz\right] to the quadratic term tacitly introduces the place cells as hidden variables and gives: \displaystyle Z_{N}\left(\beta,\boldsymbol{\eta}\right)= \displaystyle\sum_{\boldsymbol{s}}\int D\boldsymbol{z}\>\exp\Bigg[\beta N\|\boldsymbol{x}_{1}\|^{p}-\beta N\left(\lambda-1\right)m^{p}+\beta\frac{\lambda-1}{N^{p-1}}\sum_{i_{1},\ldots,i_{p/2}=1}^{N}s_{i_{1}}^{2}\cdots s_{i_{p/2}}^{2}+ (46) \displaystyle+\sqrt{\frac{2\beta}{N^{p-1}}\sqrt{\frac{p!}{2}}}\sum_{\mu=2}^{K}\sum_{i_{1},\dots,i_{p/2}}\eta^{\mu}_{i_{1},\dots,i_{p/2}}s_{i_{1}}\cdots s_{i_{p/2}}z_{\mu}-\frac{\beta}{N^{p-1}d^{p/4}}\sqrt{\frac{p!}{2}}\sum_{\mu=2}^{K}\sum_{i_{1},\dots,i_{p/2}}s_{i_{1}}^{2}\cdots s_{i_{p/2}}^{2}\Bigg], where z_{\mu}\sim\mathcal{N}(0,1) and the Gaussian measure is defined as D\boldsymbol{z}=\prod_{\mu=2}^{K}\frac{dz_{\mu}}{\sqrt{2\pi}}\exp\left(-\frac{z_{\mu}^{2}}{2}\right) . Definition 7 . Given the auxiliary Gaussian neurons z_{\mu}\sim\mathcal{N}(0,1) introduced via the HS transformation, we define the place-cell overlap between replicas a and b as p_{ab}=\frac{1}{K}\sum_{\mu=1}^{K}z_{\mu}^{a}z_{\mu}^{b}. (47) This order parameter measures the similarity between the hidden representations in two replicas. The form of the partition function in eq. ( 46 ) enables us to define a suitable interpolating Hamiltonian \mathcal{H}\left(t\right) , depending on a interpolation parameter t\in[0,1] , which continuously connects the original model at t=1 with a simplified one-body system at t=0 , where neurons interact only with independent Gaussian fields. The free energy of the original model is then obtained via the fundamental theorem of calculus: A(\alpha,\beta)=\mathcal{A}(1)=\mathcal{A}(0)+\int_{0}^{1}ds\,\left[\frac{d}{dt}\mathcal{A}(t)\right]_{t=s}. (48) where the interpolating free energy \mathcal{A}(t) is defined as: \mathcal{A}(t)=\lim_{N\to\infty}\frac{1}{N}\mathbb{E}_{\eta}\ln\mathcal{Z}(t), (49) and \mathcal{Z}(t) is the interpolating partition function, defined as follows: Definition 8 (Interpolating partition function) . Let t\in[0,1] be the interpolating parameter, and let A , B , C , D , \psi_{1} , \psi_{2} in \mathbb{R} . Assume that J_{i}\sim\mathcal{N}(0,1) for i=1,\ldots,N and J_{\mu}\sim\mathcal{N}(0,1) for \mu=1,\ldots,K , are independent and identically distributed standard Gaussian variables. The interpolating partition function \mathcal{Z}(t) is given by: \displaystyle\mathcal{Z}\left(t\right)= \displaystyle\sum_{\boldsymbol{s}}\int D\boldsymbol{z}\>\exp\Bigg[t\beta N\|\boldsymbol{x}_{1}\|^{p}+\left(1-t\right)N\sum_{a=1}^{d}\psi_{1}^{\left(a\right)}x_{1}^{\left(a\right)}-t\beta N\left(\lambda-1\right)m^{p}-\left(1-t\right)N\psi_{2}\left(\lambda-1\right)m+ (50) \displaystyle-t\beta\frac{\lambda-1}{N^{p-1}}\sum_{i_{1},\ldots,i_{p/2}=1}^{N}s_{i_{1}}^{2}\cdots s_{i_{p/2}}^{2}+\sqrt{t}\sqrt{\frac{2\beta}{N^{p-1}}\sqrt{\frac{p!}{2}}}\sum_{\mu=2}^{K}\sum_{i_{1},\dots,i_{p/2}}\eta^{\mu}_{i_{1},\dots,i_{p/2}}s_{i_{1}}\cdots s_{i_{p/2}}z_{\mu}+ \displaystyle-t\frac{\beta}{N^{p-1}d^{p/4}}\sqrt{\frac{p!}{2}}\sum_{\mu=2}^{K}\sum_{i_{1},\dots,i_{p/2}}s_{i_{1}}^{2}\cdots s_{i_{p/2}}^{2}+ \displaystyle+\sqrt{1-t}\left(A\sum_{i=1}^{N}J_{i}s_{i}+B\sum_{\mu=2}^{K}J_{\mu}z_{\mu}\right)+\frac{1-t}{2}\left(C\sum_{\mu=2}^{K}z_{\mu}^{2}+D\sum_{i=1}^{N}s_{i}^{2}\right)\Bigg]. From now on, for the sake of clearness, we write explicitly the replica symmetric assumption at work on the order parameters. Definition 9 (Replica symmetry) . Under the replica-symmetry assumption, in the thermodynamic limit the order parameters self-average around their mean values (denoted with a bar), i.e., their distributions get delta-peaked, independently of the replica considered, namely \displaystyle\lim_{N\to\infty}\left\langle\left(\|\boldsymbol{x}_{1}\|-\|\boldsymbol{\overline{x}}\|\right)^{2}\right\rangle=0 \displaystyle\quad\Rightarrow\quad\lim_{N\to\infty}\left\langle\|\boldsymbol{x}_{1}\|\right\rangle=\|\boldsymbol{\overline{x}}\| (51) \displaystyle\lim_{N\to\infty}\left\langle\left(q_{11}-\overline{q}_{1}\right)^{2}\right\rangle=0 \displaystyle\quad\Rightarrow\quad\lim_{N\to\infty}\left\langle q_{11}\right\rangle=\overline{q}_{1} (52) \displaystyle\lim_{N\to\infty}\left\langle\left(m-\overline{m}\right)^{2}\right\rangle=0 \displaystyle\quad\Rightarrow\quad\lim_{N\to\infty}\left\langle m\right\rangle=\overline{m} (53) \displaystyle\lim_{N\to\infty}\left\langle\left(q_{12}-\overline{q}_{2}\right)^{2}\right\rangle=0 \displaystyle\quad\Rightarrow\quad\lim_{N\to\infty}\left\langle q_{12}\right\rangle=\overline{q}_{2} (54) \displaystyle\lim_{N\to\infty}\left\langle\left(p_{11}-\overline{p}_{1}\right)^{2}\right\rangle=0 \displaystyle\quad\Rightarrow\quad\lim_{N\to\infty}\left\langle p_{11}\right\rangle=\overline{p}_{1} (55) \displaystyle\lim_{N\to\infty}\left\langle\left(p_{12}-\overline{p}_{2}\right)^{2}\right\rangle=0 \displaystyle\quad\Rightarrow\quad\lim_{N\to\infty}\left\langle p_{12}\right\rangle=\overline{p}_{2} (56) Note that, for the generic order parameter X , the above concentration can be rewritten as \left\langle\left(\Delta X\right)^{2}\right\rangle\xrightarrow[N\to\infty]{}0,\quad\text{where}\quad\Delta X:=X-\overline{X}, and, clearly, the RS approximation also implies that, in the thermodynamic limit, \left\langle\Delta X\Delta Y\right\rangle=0\quad\text{for any generic pair of order parameters }X,Y,\quad\text{as well as}\quad\left\langle\left(\Delta X\right)^{k}\right\rangle\to 0\quad\text{for }k\geq 2. Lemma 1 . The t derivative of interpolating free energy is given by \displaystyle\frac{d}{dt}\mathcal{A}(t)= \displaystyle\beta\langle\|\boldsymbol{x}_{1}\|^{p}\rangle-\sum_{a=1}^{d}\psi_{1}^{(a)}\langle x_{1}^{(a)}\rangle-\beta\left(\lambda-1\right)\langle m^{p}\rangle+\psi_{2}\left(\lambda-1\right)\langle m\rangle+ (57) \displaystyle+\frac{\beta K}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\langle p_{11}q_{11}^{p/2}\rangle-\left(\frac{A^{2}}{2}+\frac{D}{2}\right)\langle q_{11}\rangle-\left(\frac{B^{2}K}{2N}+\frac{CK}{2N}\right)\langle p_{11}\rangle+ \displaystyle-\frac{\beta K}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\langle p_{12}q_{12}^{p/2}\rangle+\frac{A^{2}}{2}\langle q_{12}\rangle+\frac{B^{2}K}{2N}\langle p_{12}\rangle+ \displaystyle-\frac{\beta K}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\langle q_{11}^{p/2}\rangle-\beta\frac{\lambda-1}{N^{p-1}}\langle q_{11}^{p/2}\rangle. Proof. We differentiate \mathcal{A}(t) with respect to t : \displaystyle\frac{d}{dt}\mathcal{A}\left(t\right)= \displaystyle\frac{1}{N}\mathbb{E}\frac{1}{\mathcal{Z}(t)}\sum_{\boldsymbol{s}}\int D\boldsymbol{z}\>\mathcal{B}(\boldsymbol{s},\boldsymbol{z};t)\Bigg[\beta N\|\boldsymbol{x}_{1}\|^{p}-N\sum_{a=1}^{d}\psi_{1}^{\left(a\right)}x_{1}^{\left(a\right)}+ (58) \displaystyle-\beta N\left(\lambda-1\right)m^{p}+N\psi_{2}\left(\lambda-1\right)m-\beta\frac{\lambda-1}{N^{p-1}}\sum_{i_{1},\ldots,i_{p/2}=1}^{N}s_{i_{1}}^{2}\cdots s_{i_{p/2}}^{2}+ \displaystyle+\frac{1}{2\sqrt{t}}\sqrt{\frac{2\beta}{N^{p-1}}\sqrt{\frac{p!}{2}}}\sum_{\mu=2}^{K}\sum_{i_{1},\dots,i_{p/2}}\eta^{\mu}_{i_{1},\dots,i_{p/2}}s_{i_{1}}\cdots s_{i_{p/2}}z_{\mu}+ \displaystyle-\frac{\beta}{N^{p-1}d^{p/4}}\sqrt{\frac{p!}{2}}\sum_{\mu=2}^{K}\sum_{i_{1},\dots,i_{p/2}}s_{i_{1}}^{2}\cdots s_{i_{p/2}}^{2}+ \displaystyle-\frac{1}{2\sqrt{1-t}}\left(A\sum_{i=1}^{N}J_{i}s_{i}+B\sum_{\mu=2}^{K}J_{\mu}z_{\mu}\right)-\frac{1}{2}\left(C\sum_{\mu=2}^{K}z_{\mu}^{2}+D\sum_{i=1}^{N}s_{i}^{2}\right)\Bigg], where \mathcal{B}(\boldsymbol{s},\boldsymbol{z};t)=\exp\left(-\beta\mathcal{H}(t)\right) is the Boltzmann weight associated with the interpolating Hamiltonian \mathcal{H}(t) . We now evaluate each term separately. (i)=\frac{1}{N}\mathbb{E}\left[\omega\left(\beta N\|\boldsymbol{x}_{1}\|^{p}\right)\right]+\frac{1}{N}\mathbb{E}\left[\omega\left(-N\sum_{a=1}^{d}\psi_{1}^{\left(a\right)}x_{1}^{\left(a\right)}\right)\right]=\beta\langle\|\boldsymbol{x}_{1}\|^{p}\rangle-\sum_{a=1}^{d}\psi_{1}^{\left(a\right)}\langle x_{1}^{\left(a\right)}\rangle. (59) (ii)=\frac{1}{N}\mathbb{E}\left[\omega\left(-\beta N\left(\lambda-1\right)m^{p}\right)\right]+\frac{1}{N}\mathbb{E}\left[\omega\left(N\psi_{2}\left(\lambda-1\right)m\right)\right]=-\beta\left(\lambda-1\right)\langle m^{p}\rangle+\psi_{2}\left(\lambda-1\right)\langle m\rangle. (60) (iii)=\frac{1}{N}\mathbb{E}\left[-\beta\frac{\lambda-1}{N^{p}}\sum_{i_{1},\dots,i_{p/2}}\omega\left(s_{i_{1}}^{2}\cdots s_{i_{p/2}}^{2}\right)\right]=-\beta\frac{\lambda-1}{N^{p/2}}\langle q_{11}^{p/2}\rangle. (61) We aim to compute the contribution \displaystyle(iv) \displaystyle=\frac{1}{N}\mathbb{E}\left[\frac{1}{2\sqrt{t}}\sqrt{\frac{2\beta}{N^{p-1}}\sqrt{\frac{p!}{2}}}\sum_{\mu=2}^{K}\sum_{i_{1},\dots,i_{p/2}}\eta^{\mu}_{i_{1},\dots,i_{p/2}}\omega\left(s_{i_{1}}\cdots s_{i_{p/2}}z_{\mu}\right)\right] \displaystyle=\frac{1}{2N\sqrt{t}}\sqrt{\frac{2\beta}{N^{p-1}}\sqrt{\frac{p!}{2}}}\sum_{\mu=2}^{K}\sum_{i_{1},\dots,i_{p/2}}\mathbb{E}\left[\eta^{\mu}_{i_{1},\dots,i_{p/2}}\omega\left(s_{i_{1}}\cdots s_{i_{p/2}}z_{\mu}\right)\right]. We apply Stein’s lemma 17 17 17 Stein’s lemma . Let X\sim\mathcal{N}(0,\sigma^{2}) and let f\colon\mathbb{R}\to\mathbb{R} be a differentiable function such that \mathbb{E}[|f^{\prime}(X)|]<\infty . Then, the following identity holds: \mathbb{E}[Xf(X)]=\sigma^{2}\mathbb{E}[f^{\prime}(X)]. to obtain: \displaystyle\mathbb{E}\left[\eta^{\mu}_{i_{1},\dots,i_{p/2}}\omega\left(s_{i_{1}}\cdots s_{i_{p/2}}z_{\mu}\right)\right] \displaystyle=\mathbb{E}\left[\left(\eta^{\mu}_{i_{1},\dots,i_{p/2}}\right)^{2}\right]\mathbb{E}\left[\frac{\partial}{\partial\eta^{\mu}_{i_{1},\dots,i_{p/2}}}\omega\left(s_{i_{1}}\cdots s_{i_{p/2}}z_{\mu}\right)\right] \displaystyle=\frac{1}{d^{p/4}}\sqrt{t}\sqrt{\frac{2\beta}{N^{p-1}}\sqrt{\frac{p!}{2}}}\left[\omega\left(\left(s_{i_{1}}\cdots s_{i_{p/2}}z_{\mu}\right)^{2}\right)-\omega^{2}\left(s_{i_{1}}\cdots s_{i_{p/2}}z_{\mu}\right)\right]. The expression above corresponds to a difference of overlaps under the interpolating measure. Recognizing the definitions of the replica overlaps ( 16 ), ( 17 ) we conclude: (iii)=\frac{\beta K}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\left(\langle q_{11}^{p/2}p_{11}\rangle-\langle q_{12}^{p/2}p_{12}\rangle\right). (62) We now evaluate the contribution of the diagonal correction term: \displaystyle(v) \displaystyle=\frac{1}{N}\mathbb{E}\left[-\frac{\beta}{N^{p-1}d^{p/4}}\sqrt{\frac{p!}{2}}\sum_{\mu=2}^{K}\sum_{i_{1},\dots,i_{p/2}}\omega\left(s_{i_{1}}^{2}\cdots s_{i_{p/2}}^{2}\right)\right] (63) \displaystyle=-\frac{\beta K}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\langle q_{11}^{p/2}\rangle. We continue with the remaining terms: \displaystyle(vi) \displaystyle=\frac{1}{N}\mathbb{E}\left[-\frac{A}{2\sqrt{1-t}}\sum_{i=1}^{N}J_{i}\omega\left(s_{i}\right)-\frac{B}{2\sqrt{1-t}}\sum_{\mu=2}^{K}J_{\mu}\omega\left(z_{\mu}\right)\right] \displaystyle=-\frac{A}{2N\sqrt{1-t}}\sum_{i=1}^{N}\mathbb{E}\left[J_{i}\omega\left(s_{i}\right)\right]-\frac{B}{2N\sqrt{1-t}}\sum_{\mu=2}^{K}\mathbb{E}\left[J_{\mu}\omega\left(z_{\mu}\right)\right]. We apply Stein’s lemma to obtain: \displaystyle\mathbb{E}\left[J_{i}\omega\left(s_{i}\right)\right]=\mathbb{E}\left[J_{i}^{2}\right]\mathbb{E}\left[\frac{\partial}{\partial J_{i}}\omega\left(s_{i}\right)\right]=A\sqrt{1-t}\left[\omega\left(s_{i}^{2}\right)-\omega^{2}\left(s_{i}\right)\right], \displaystyle\mathbb{E}\left[J_{\mu}\omega\left(z_{\mu}\right)\right]=\mathbb{E}\left[J_{\mu}^{2}\right]\mathbb{E}\left[\frac{\partial}{\partial J_{\mu}}\omega\left(z_{\mu}\right)\right]=A\sqrt{1-t}\left[\omega\left(z_{\mu}^{2}\right)-\omega^{2}\left(z_{\mu}\right)\right], noting that \mathbb{E}\left[J_{i}^{2}\right]=1 , \mathbb{E}\left[J_{\mu}^{2}\right]=1 . Again, this corresponds to a difference of overlaps under the interpolating measure. Recognizing the definitions of the replica overlaps, ( 16 ) and ( 17 ) we conclude: (vi)=-\frac{A^{2}}{2}\left(\langle q_{11}\rangle-\langle q_{12}\rangle\right)-\frac{B^{2}K}{2N}\left(\langle p_{11}\rangle-\langle p_{12}\rangle\right). (64) Finally, \displaystyle(vii) \displaystyle=\frac{1}{N}\mathbb{E}\left[-\frac{C}{2}\sum_{\mu=2}^{K}\omega\left(z_{\mu}^{2}\right)-\frac{D}{2}\sum_{i=1}^{N}\omega\left(s_{i}^{2}\right)\right] (65) \displaystyle=-\frac{CK}{2N}\langle p_{11}\rangle-\frac{D}{2}\langle q_{11}\rangle. Collecting all the contributions (i),...,(vii) , we recover the expression for the derivative of the interpolating free energy as stated in the lemma, thus completing the proof. ∎ Proposition 1 . Assuming replica symmetry, we define the following constants: \displaystyle\psi_{1}^{(a)}=\beta p\|\boldsymbol{\overline{x}}\|^{p-2}\overline{x}^{a}, (66) \displaystyle\psi_{2}=\beta p\overline{m}^{p-1}, (67) \displaystyle A^{2}=\frac{\beta Kp}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{p}_{2}\overline{q}_{2}^{p/2-1}, (68) \displaystyle B^{2}=\frac{2\beta}{N^{p/2-1}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{q}_{2}^{p/2}, (69) \displaystyle C=\frac{2\beta}{N^{p/2-1}d^{p/4}}\sqrt{\frac{p!}{2}}\left(\overline{q}_{1}^{p/2}-\overline{q}_{2}^{p/2}\right), (70) \displaystyle D=\frac{\beta Kp}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\left(\overline{p}_{1}\overline{q}_{1}^{p/2-1}-\overline{p}_{2}\overline{q}_{2}^{p/2-1}\right). (71) Then, the derivative of the interpolating free energy simplifies to: \displaystyle\frac{d}{dt}\mathcal{A}(t)= \displaystyle\left(1-p\right)\beta\|\boldsymbol{\overline{x}}\|^{p}-\beta\left(\lambda-1\right)\left(1-p\right)\overline{m}^{p}+ (72) \displaystyle-\frac{\beta Kp}{2N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\left(\overline{p}_{1}\overline{q}_{1}^{p/2}-\overline{p}_{2}\overline{q}_{2}^{p/2}\right)+ \displaystyle-\frac{\beta K}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{q}_{1}^{p/2}-\beta\frac{\lambda-1}{N^{p/2}}\overline{q}_{1}^{p/2}. Proof. We apply the replica-symmetry (RS) assumption ( 9 ) to each term in the derivative of the interpolating free energy ( 57 ). Let \|\boldsymbol{\overline{x}}\| denote the mean of \|\boldsymbol{x}_{1}\| under RS. Applying a binomial expansion 18 18 18 Newton’s formula: \left(a+b\right)^{n}=\sum_{k=0}^{n}\binom{n}{k}a^{k}b^{n-k} around the mean, we obtain: \displaystyle\langle\|\boldsymbol{x_{1}}\|^{p}\rangle=\langle\left(\boldsymbol{x_{1}}\cdot\boldsymbol{x_{1}}\right)\rangle^{p/2} \displaystyle=\sum_{k=0}^{p/2}\binom{p/2}{k}\langle\left(\boldsymbol{x_{1}}\cdot\boldsymbol{x_{1}}-\boldsymbol{\overline{x}}\cdot\boldsymbol{\overline{x}}\right)^{k}\rangle\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\overline{x}}\right)^{p/2-k} \displaystyle=\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\overline{x}}\right)^{p/2}+\frac{p}{2}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\overline{x}}\right)^{p/2-1}\langle\boldsymbol{x_{1}}\cdot\boldsymbol{x_{1}}\rangle-\frac{p}{2}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\overline{x}}\right)^{p/2}+V_{N}\left(\boldsymbol{\overline{x}}\right) \displaystyle=\left(1-\frac{p}{2}\right)\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\overline{x}}\right)^{p/2}+\frac{p}{2}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\overline{x}}\right)^{p/2-1}\langle\sum_{a=1}^{d}\left(x_{1}^{\left(a\right)}\right)^{2}\rangle+V_{N}\left(\boldsymbol{\overline{x}}\right). Observe that, as N\to\infty , that is, in the thermodynamic limit, the term V_{N}\left(\boldsymbol{\overline{x}}\right)=\sum_{k=2}^{p/2}\binom{p/2}{k}\langle\left(\boldsymbol{x_{1}}\cdot\boldsymbol{x_{1}}-\boldsymbol{\overline{x}}\cdot\boldsymbol{\overline{x}}\right)^{k}\rangle\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\overline{x}}\right)^{p/2-k}\to 0 . Moreover, since \boldsymbol{\overline{x}}=\left(\overline{x}^{\left(a\right)}\right)_{a=1}^{d} , each \overline{x}^{\left(a\right)} represents the mean of x_{1}^{\left(a\right)} aunder the RS assumption; thus, in the thermodynamic limit, we have \langle\left(x_{1}^{\left(a\right)}-\overline{x}^{\left(a\right)}\right)^{2}\rangle\to 0 . It follows that \langle\sum_{a=1}^{d}\left(x_{1}^{\left(a\right)}\right)^{2}\rangle\to\sum_{a=1}^{d}\left[-\left(\overline{x}^{\left(a\right)}\right)^{2}+2\boldsymbol{\overline{x}}^{a}\langle x_{1}^{\left(a\right)}\rangle\right] . Hence, \displaystyle\langle\|\boldsymbol{x_{1}}\|^{p}\rangle=\langle\left(\boldsymbol{x_{1}}\cdot\boldsymbol{x_{1}}\right)\rangle^{p/2} \displaystyle=\left(1-\frac{p}{2}\right)\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\overline{x}}\right)^{p/2}+\frac{p}{2}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\overline{x}}\right)^{p/2-1}\sum_{a=1}^{d}\left[-\left(\overline{x}^{\left(a\right)}\right)^{2}+2\boldsymbol{\overline{x}}^{a}\langle x_{1}^{\left(a\right)}\rangle\right] \displaystyle=\left(1-\frac{p}{2}\right)\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\overline{x}}\right)^{p/2}-\frac{p}{2}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\overline{x}}\right)^{p/2}+p\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\overline{x}}\right)^{p/2-1}\sum_{a=1}^{d}\overline{x}^{a}\langle x_{1}^{a}\rangle \displaystyle=\left(1-p\right)\|\boldsymbol{\overline{x}}\|^{p}+p\|\boldsymbol{\overline{x}}\|^{p-2}\sum_{a=1}^{d}\overline{x}^{a}\langle x_{1}^{a}\rangle. Therefore, \beta\langle\|\boldsymbol{x_{1}}\|^{p}\rangle-\beta p\|\boldsymbol{\overline{x}}\|^{p-2}\sum_{a=1}^{d}\overline{x}^{a}\langle x_{1}^{a}\rangle=\beta\left(1-p\right)\|\boldsymbol{\overline{x}}\|^{p}. We thus define: \psi_{1}^{(a)}=\beta p\|\boldsymbol{\overline{x}}\|^{p-2}\overline{x}^{a}. Let \overline{m} denote the RS mean of m . Applying a binomial expansion, we get: \displaystyle\langle m^{p}\rangle \displaystyle=\sum_{k=0}^{p}\binom{p}{k}\langle\left(m-\overline{m}\right)^{k}\rangle\overline{m}^{p-k} \displaystyle=\left(1-p\right)\overline{m}^{p}+p\overline{m}^{p-1}\langle m\rangle+V_{N}\left(\overline{m}\right). Observe that, as N\to\infty , the term V_{N}\left(\overline{m}\right)=\sum_{k=1}^{p}\binom{p}{k}\langle\left(m-\overline{m}\right)^{k}\rangle\overline{m}^{p-k}\to 0 . Therefore, -\beta\left(\lambda-1\right)\langle m^{p}\rangle+\psi_{2}\left(\lambda-1\right)\langle m\rangle=-\beta\left(\lambda-1\right)\left(1-p\right)\overline{m}^{p}. We define: \psi_{2}=\beta p\overline{m}^{p-1}. Let \overline{q}_{2} and \overline{p}_{2} denote the RS mean of q_{12} and p_{12} , respectively. Applying a binomial expansion yields: \displaystyle\langle p_{12}q_{12}^{p/2}\rangle \displaystyle=\langle\left(p_{12}-\overline{p}_{2}+\overline{p}_{2}\right)\left(q_{12}-\overline{q}_{2}+\overline{q}_{2}\right)^{p/2}\rangle \displaystyle=\langle\left(p_{12}-\overline{p}_{2}\right)\left(q_{12}-\overline{q}_{2}+\overline{q}_{2}\right)^{p/2}\rangle+\overline{p}_{2}\langle\left(q_{12}-\overline{q}_{2}+\overline{q}_{2}\right)^{p/2}\rangle \displaystyle=\sum_{k=0}^{p/2}\binom{p/2}{k}\langle\left(p_{12}-\overline{p}_{2}\right)\left(q_{12}-\overline{q}_{2}\right)^{2}\rangle\overline{q}_{2}^{p/2-k}+\overline{p}_{2}\sum_{k=0}^{p/2}\binom{p/2}{k}\langle\left(q_{12}-\overline{q}_{2}\right)^{k}\rangle\overline{q}_{2}^{p/2-k} \displaystyle=\overline{q}_{2}^{p/2}\langle p_{12}\rangle+\frac{p}{2}\overline{p}_{2}\overline{q}_{2}^{p/2-1}\langle q_{12}\rangle-\frac{p}{2}\overline{p}_{2}\overline{q}_{2}^{p/2}+V_{N}^{\left(1\right)}\left(\overline{p}_{2},\overline{q}_{2}\right)+V_{N}^{\left(2\right)}\left(\overline{p}_{2},\overline{q}_{2}\right). In the thermodynamic limit, the term V_{N}^{(1)}(\overline{p}_{2},\overline{q}_{2})+V_{N}^{(2)}(\overline{p}_{2},\overline{q}_{2})\to 0 . Therefore, \displaystyle-\frac{\beta K}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\langle p_{12}q_{12}^{p/2}\rangle+\frac{\beta K}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{q}_{2}^{p/2}\langle p_{11}\rangle+\frac{\beta Kp}{2N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{p}_{2}\overline{q}_{2}^{p/2-1}\langle q_{12}\rangle=\frac{\beta Kp}{2N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{p}_{2}\overline{q}_{2}^{p/2}, Thus, we define: \displaystyle A^{2}=\frac{\beta Kp}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{p}_{2}\overline{q}_{2}^{p/2-1}, \displaystyle B^{2}=\frac{2\beta}{N^{p/2-1}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{q}_{2}^{p/2}. Similarly, let \overline{q}_{1} and \overline{p}_{1} denote the RS mean of q_{11} and p_{11} , respectively. Expanding via the binomial formula gives: \displaystyle\langle p_{11}q_{11}^{p/2}\rangle \displaystyle=\langle\left(p_{11}-\overline{p}_{1}+\overline{p}_{1}\right)\left(q_{11}-\overline{q}_{1}+\overline{q}_{1}\right)^{p/2}\rangle \displaystyle=\langle\left(p_{11}-\overline{p}_{1}\right)\left(q_{11}-\overline{q}_{1}+\overline{q}_{1}\right)^{p/2}\rangle+\overline{p}_{1}\langle\left(q_{11}-\overline{q}_{1}+\overline{q}_{1}\right)^{p/2}\rangle \displaystyle=\sum_{k=0}^{p/2}\binom{p/2}{k}\langle\left(p_{11}-\overline{p}_{1}\right)\left(q_{11}-\overline{q}_{1}\right)^{2}\rangle\overline{q}_{1}^{p/2-k}+\overline{p}_{1}\sum_{k=0}^{p/2}\binom{p/2}{k}\langle\left(q_{11}-\overline{q}_{1}\right)^{k}\rangle\overline{q}_{1}^{p/2-k} \displaystyle=\overline{q}_{1}^{p/2}\langle p_{11}\rangle+\frac{p}{2}\overline{p}_{1}\overline{q}_{1}^{p/2-1}\langle q_{11}\rangle-\frac{p}{2}\overline{p}_{1}\overline{q}_{1}^{p/2}+V_{N}^{\left(1\right)}\left(\overline{p}_{1},\overline{q}_{1}\right)+V_{N}^{\left(2\right)}\left(\overline{p}_{1},\overline{q}_{1}\right). Again, in the thermodynamic limit, V_{N}^{(1)}(\overline{p}_{1},\overline{q}_{1})+V_{N}^{(2)}(\overline{p}_{1},\overline{q}_{1})\to 0 . Therefore, \displaystyle\frac{\beta K}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\langle p_{11}q_{11}^{p/2}\rangle-\frac{\beta K}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{q}_{1}^{p/2}\langle p_{11}\rangle-\frac{\beta Kp}{2N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{p}_{1}\overline{q}_{1}^{p/2-1}\langle q_{11}\rangle=-\frac{\beta Kp}{2N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{p}_{1}\overline{q}_{1}^{p/2}, We define: \displaystyle\frac{A^{2}}{2}+\frac{D}{2}=\frac{\beta Kp}{2N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{p}_{1}\overline{q}_{1}^{p/2-1}, \displaystyle\frac{B^{2}K}{2N}+\frac{CK}{2N}=\frac{\beta K}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{q}_{1}^{p/2}. Recalling the definitions of A^{2} ( 68 ) and B^{2} ( 69 ), we obtain: \displaystyle C=\frac{2\beta}{N^{p/2-1}d^{p/4}}\sqrt{\frac{p!}{2}}\left(\overline{q}_{1}^{p/2}-\overline{q}_{2}^{p/2}\right), \displaystyle D=\frac{\beta Kp}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\left(\overline{p}_{1}\overline{q}_{1}^{p/2-1}-\overline{p}_{2}\overline{q}_{2}^{p/2-1}\right). Finally, the term -\frac{\beta K}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{q}_{1}^{p/2}-\beta\frac{\lambda-1}{N^{p/2}}\overline{q}_{1}^{p/2} arises directly from the RS identity ( 54 ). ∎ We must now evaluate the one-body contribution \mathcal{A}(t=0) . Proposition 2 . The Cauchy condition \mathcal{A}(t=0) in the thermodynamic limit reads as: \displaystyle\mathcal{A}\left(t=0\right) \displaystyle=\mathbb{E}_{\boldsymbol{\eta}}\int Dz\ln\bigg[1+\exp\bigg(\beta p\|\boldsymbol{\overline{x}}\|^{p-2}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)-\beta p\left(\lambda-1\right)\overline{m}^{p-1}+ (73) \displaystyle+\sqrt{p\overline{p}_{2}\overline{q}_{2}^{p/2-1}}z+\frac{p}{2}\left(\overline{p}_{1}\overline{q}_{1}^{p/2-1}-\overline{p}_{2}\overline{q}_{2}^{p/2-1}\right)\bigg)\bigg]+ \displaystyle+\frac{\beta K}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{q}_{1}^{p/2}+\frac{\beta^{2}Kp!}{2N^{p-1}d^{p/2}}\left(\overline{q}_{1}^{p}-\overline{q}_{2}^{p}\right). Proof. This follows from directly setting t=0 in equation ( 50 ). We obtain: \displaystyle\mathcal{A}\left(t=0\right)= \displaystyle\frac{1}{N}\mathbb{E}\ln\sum_{\boldsymbol{s}}\int D\boldsymbol{z}\>\exp\bigg(N\sum_{a=1}^{d}\psi_{1}^{\left(a\right)}x_{1}^{\left(a\right)}-N\psi_{2}\left(\lambda-1\right)m+ \displaystyle+A\sum_{i=1}^{N}J_{i}s_{i}+B\sum_{\mu=2}^{K}J_{\mu}z_{\mu}+\frac{C}{2}\sum_{\mu=2}^{K}z_{\mu}^{2}+\frac{D}{2}\sum_{i=1}^{N}s_{i}^{2}\bigg). We separate the terms that depend on z_{\mu} from those that do not, leading to: \displaystyle\mathcal{A}_{1}=\frac{1}{N}\mathbb{E}\ln\sum_{\boldsymbol{s}}\exp\left(N\sum_{a=1}^{d}\psi_{1}^{\left(a\right)}x_{1}^{\left(a\right)}-N\psi_{2}\left(\lambda-1\right)m+A\sum_{i=1}^{N}J_{i}s_{i}+\frac{D}{2}\sum_{i=1}^{N}s_{i}^{2}\right), \displaystyle\mathcal{A}_{2}=\frac{1}{N}\mathbb{E}\ln\int D\boldsymbol{z}\>\exp\left(+B\sum_{\mu=2}^{K}J_{\mu}z_{\mu}+\frac{C}{2}\sum_{\mu=2}^{K}z_{\mu}^{2}\right). Let us first analyze \mathcal{A}_{1} . Using the definitions x_{1}^{(a)}=\frac{1}{N}\sum_{i=1}^{N}\eta_{i}^{1,(a)}s_{i} and m=\frac{1}{N}\sum_{i=1}^{N}s_{i} , we get: \displaystyle\mathcal{A}_{1} \displaystyle=\frac{1}{N}\mathbb{E}_{\boldsymbol{\eta}}\ln\sum_{\boldsymbol{s}}\exp\left(\sum_{a=1}^{d}\psi_{1}^{\left(a\right)}\sum_{i=1}^{N}\eta_{i}^{1,\left(a\right)}s_{i}-\psi_{2}\left(\lambda-1\right)\sum_{i=1}^{N}s_{i}+A\sum_{i=1}^{N}J_{i}s_{i}+\frac{D}{2}\sum_{i=1}^{N}s_{i}^{2}\right) \displaystyle=\mathbb{E}_{\boldsymbol{\eta}}\int Dz\ln\left[1+\exp\left(\sum_{a=1}^{d}\psi_{1}^{\left(a\right)}\eta^{1,\left(a\right)}-\psi_{2}\left(\lambda-1\right)+Az+\frac{D}{2}\right)\right], with z\sim\mathcal{N}(0,1) . Substituting the definitions of \psi_{1}^{(a)} , \psi_{2} , A , and D , we obtain: \displaystyle\mathcal{A}_{1}= \displaystyle\mathbb{E}_{\boldsymbol{\eta}}\int Dz\ln\Bigg[1+\exp\bigg(\beta p\|\boldsymbol{\overline{x}}\|^{p-2}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)-\beta p\left(\lambda-1\right)\overline{m}^{p-1}+ \displaystyle+\sqrt{\frac{\beta Kp}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{p}_{2}\overline{q}_{2}^{p/2-1}}z+\frac{\beta Kp}{2N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\left(\overline{p}_{1}\overline{q}_{1}^{p/2-1}-\overline{p}_{2}\overline{q}_{2}^{p/2-1}\right)\bigg)\Bigg]. Now rescaling: \frac{\beta K}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{p}_{1}\to\overline{p}_{1}\qquad\text{and}\qquad\frac{\beta K}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{p}_{2}\to\overline{p}_{2}, (74) we obtain: \mathcal{A}_{1}=\mathbb{E}_{\boldsymbol{\eta}}\int Dz\ln\left[1+\exp\left(\beta p\|\boldsymbol{\overline{x}}\|^{p-2}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)-\beta p\left(\lambda-1\right)\overline{m}^{p-1}+\sqrt{p\overline{p}_{2}\overline{q}_{2}^{p/2-1}}z+\frac{p}{2}\left(\overline{p}_{1}\overline{q}_{1}^{p/2-1}-\overline{p}_{2}\overline{q}_{2}^{p/2-1}\right)\right)\right]. We now consider \mathcal{A}_{2} . Using the Gaussian integral and recalling that J_{\mu}\sim\mathcal{N}(0,1) , we find: \displaystyle\mathcal{A}_{2} \displaystyle=\frac{1}{N}\mathbb{E}\left[\ln\prod_{\mu>1}\int\exp\left(-\frac{1-C}{2}z_{\mu}^{2}+BJ_{\mu}z_{\mu}\right)\right] \displaystyle=-\frac{K}{2N}\ln\left(1-C\right)+\frac{B^{2}K}{2N\left(1-C\right)}\mathbb{E}_{J}\left[J_{\mu}^{2}\right] \displaystyle=-\frac{K}{2N}\left[\ln\left(1-C\right)+\frac{B^{2}}{\left(1-C\right)}\right]. Expanding \ln(1-C) and \frac{1}{1-C} in Taylor series 19 19 19 Taylor expansions: \ln(1-C)=-C-\frac{C^{2}}{2}+\mathcal{O}(C^{3}),\quad\frac{1}{1-C}=1+C+C^{2}+\mathcal{O}(C^{3}) . , and inserting the definitions of C and B^{2} , we obtain: \displaystyle\mathcal{A}_{2} \displaystyle=\frac{K}{2N}\Bigg[\frac{2\beta}{N^{p/2-1}d^{p/4}}\sqrt{\frac{p!}{2}}\left(\overline{q}_{1}^{p/2}-\overline{q}_{2}^{p/2}\right)+\frac{2\beta^{2}}{N^{p-2}d^{p/2}}\frac{p!}{2}\left(\overline{q}_{1}^{p}+\overline{q}_{2}^{p}-2\overline{q}_{1}^{p/2}\overline{q}_{2}^{p/2}\right)+ \displaystyle+\frac{2\beta}{N^{p/2-1}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{q}_{2}^{p/2}+\frac{2\beta}{N^{p/2-1}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{q}_{2}^{p/2}\left(\frac{2\beta}{N^{p/2-1}d^{p/4}}\sqrt{\frac{p!}{2}}\left(\overline{q}_{1}^{p/2}-\overline{q}_{2}^{p/2}\right)\right)\Bigg] \displaystyle=\frac{K}{2N}\Bigg[\frac{2\beta}{N^{p/2-1}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{q}_{1}^{p/2}+\frac{2\beta^{2}}{N^{p-2}d^{p/2}}\frac{p!}{2}\overline{q}_{1}^{p}+\frac{2\beta^{2}}{N^{p-2}d^{p/2}}\frac{p!}{2}\overline{q}_{2}^{p}+ \displaystyle-\frac{4\beta^{2}}{N^{p-2}d^{p/2}}\frac{p!}{2}\overline{q}_{1}^{p/2}\overline{q}_{2}^{p/2}+\frac{4\beta^{2}}{N^{p-2}d^{p/2}}\frac{p!}{2}\overline{q}_{1}^{p/2}\overline{q}_{2}^{p/2}-\frac{4\beta^{2}}{N^{p-2}d^{p/2}}\frac{p!}{2}\overline{q}_{2}^{p}\Bigg] \displaystyle=\frac{\beta K}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{q}_{1}^{p/2}+\frac{\beta^{2}K}{N^{p-1}d^{p/2}}\frac{p!}{2}\left(\overline{q}_{1}^{p}-\overline{q}_{2}^{p}\right). Therefore, we obtain Eq. ( 73 ). ∎ Applying eq. ( 48 ), we obtain the following result. Theorem 1 . In the thermodynamic limit, the replica-symmetric quenched free energy of the dense Battaglia-Treves model, which includes McCulloch-Pitts neurons as described in eq. ( 39 ), for the S^{d-1} embedding space, can be expressed in terms of the (mean values of the) order parameters \|\boldsymbol{\overline{x}}\|,\overline{q}_{1},\overline{q}_{2},\overline{p}_{1},\overline{p}_{2} , and the control parameters \alpha,\beta , as follows: \displaystyle A\left(\alpha,\beta\right) \displaystyle=\left(1-p\right)\beta\|\boldsymbol{\overline{x}}\|^{p}-\beta\left(\lambda-1\right)\left(1-p\right)\overline{m}^{p}+\alpha\beta^{2}\left(\overline{q}_{1}^{p}-\overline{q}_{2}^{p}\right)-\frac{p}{2}\left(\overline{p}_{1}\overline{q}_{1}^{p/2}-\overline{p}_{2}\overline{q}_{2}^{p/2}\right)+ (75) \displaystyle+\mathbb{E}_{\boldsymbol{\eta}}\int Dz\ln\bigg[1+\exp\bigg(\beta p\|\boldsymbol{\overline{x}}\|^{p-2}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)-\beta p\left(\lambda-1\right)\overline{m}^{p-1}+ \displaystyle+\sqrt{p\overline{p}_{2}\overline{q}_{2}^{p/2-1}}z+\frac{p}{2}\left(\overline{p}_{1}\overline{q}_{1}^{p/2-1}-\overline{p}_{2}\overline{q}_{2}^{p/2-1}\right)\bigg)\bigg]. Proof. The result follows directly by substituting eq. ( 72 ) and eq. ( 73 ) into eq. ( 48 ), namely: \displaystyle A\left(\alpha,\beta\right) \displaystyle=\beta\left(1-p\right)\|\boldsymbol{\overline{x}}\|^{p}-\beta\left(\lambda-1\right)\left(1-p\right)\overline{m}^{p}-\beta\frac{\lambda-1}{N^{p/2}}\overline{q}_{1}^{p/2}+ \displaystyle-\frac{\beta K}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{q}_{1}^{p/2}-\frac{\beta Kp}{2N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\left(\overline{p}_{1}\overline{q}_{1}^{p/2}-\overline{p}_{2}\overline{q}_{2}^{p/2}\right)+ \displaystyle+\mathbb{E}_{\boldsymbol{\eta}}\int Dz\ln\bigg[1+\exp\bigg(\beta p\|\boldsymbol{\overline{x}}\|^{p-2}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)-\beta p\left(\lambda-1\right)\overline{m^{p-1}}+ \displaystyle+\sqrt{p\overline{p}_{2}\overline{q}_{2}^{p/2-1}}z+\frac{p}{2}\left(\overline{p}_{1}\overline{q}_{1}^{p/2-1}-\overline{p}_{2}\overline{q}_{2}^{p/2-1}\right)\bigg)\bigg]+ \displaystyle+\frac{\beta K}{N^{p/2}d^{p/4}}\sqrt{\frac{p!}{2}}\overline{q}_{1}^{p/2}+\frac{\beta^{2}Kp!}{2N^{p-1}d^{p/2}}\left(\overline{q}_{1}^{p}-\overline{q}_{2}^{p}\right). Observe that, as N\to\infty , the term -\beta\frac{\lambda-1}{N^{p/2}}\overline{q}_{1}^{p/2} vanishes. Moreover, applying the rescaling defined in eq. ( 74 ), and substituting K=\frac{2\alpha N^{a}d^{p/2}}{p!} , we obtain: \displaystyle A\left(\alpha,\beta\right) \displaystyle=\beta\left(1-p\right)\|\boldsymbol{\overline{x}}\|^{p}-\beta\left(\lambda-1\right)\left(1-p\right)\overline{m}^{p}-\frac{p}{2}\left(\overline{p}_{1}\overline{q}_{1}^{p/2}-\overline{p}_{2}\overline{q}_{2}^{p/2}\right)+\alpha N^{a-p+1}\beta^{2}\left(\overline{q}_{1}^{p}-\overline{q}_{2}^{p}\right)+ \displaystyle+\mathbb{E}_{\boldsymbol{\eta}}\int Dz\ln\bigg[1+\exp\bigg(\beta p\|\boldsymbol{\overline{x}}\|^{p-2}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)-\beta p\left(\lambda-1\right)\overline{m}^{p-1}+ \displaystyle+\sqrt{p\overline{p}_{2}\overline{q}_{2}^{p/2-1}}z+\frac{p}{2}\left(\overline{p}_{1}\overline{q}_{1}^{p/2-1}-\overline{p}_{2}\overline{q}_{2}^{p/2-1}\right)\bigg)\bigg]. To ensure that the free energy remains finite and well-defined in the limit N\to\infty , it is necessary that a\leq p-1 . Therefore, in the thermodynamic limit, by setting a=p-1 with even p\geq 4 , we recover the desired expression. ∎ We now derive the self-consistency equations for all the order parameters involved in the replica-symmetric solution of the dense Battaglia-Treves model, including both the primary ones \|\boldsymbol{\overline{x}}\| , \overline{m} , \overline{q}_{1} , \overline{q}_{2} , and the auxiliary parameters \overline{p}_{1} , \overline{p}_{2} . Notably, the equations for \overline{p}_{1} and \overline{p}_{2} depend explicitly on \overline{q}_{1} and \overline{q}_{2} . This allows us to eliminate the auxiliary variables by substituting their expressions back into the replica-symmetric free energy A(\alpha,\beta) , given in eq. ( 75 ), so that the free energy depends solely on the primary order parameters \|\boldsymbol{\overline{x}}\| , \overline{m} , \overline{q}_{1} , and \overline{q}_{2} . This reformulation simplifies the theoretical framework and allows us to construct the phase diagram in the space of control parameters (\alpha,\beta) . The diagram reveals the regions corresponding to different dynamical phases and identifies the critical thresholds for memory retrieval and storage. In this way, the phase diagram offers a clear understanding of how the interplay between \alpha and \beta governs the collective dynamics and memory performance of the network in the high-storage regime. Theorem 2 . In the thermodynamic limit, the replica-symmetric quenched free energy of the dense Battaglia-Treves model, equipped with McCulloch-Pitts neurons as described in eq. ( 39 ), for the S^{d-1} embedding space, can be expressed in terms of the (mean values of the) order parameters \|\boldsymbol{\overline{x}}\|,\overline{m},\overline{q}_{1},\overline{q}_{2} , and the control parameters \alpha,\beta , as follows: \displaystyle A\left(\alpha,\beta\right) \displaystyle=\left(1-p\right)\beta\|\boldsymbol{\overline{x}}\|^{p}-\beta\left(\lambda-1\right)\left(1-p\right)\overline{m}^{p}+\left(1-p\right)\alpha\beta^{2}\left(\overline{q}_{1}^{p}-\overline{q}_{2}^{p}\right)+ (76) \displaystyle+\mathbb{E}_{\boldsymbol{\eta}}\int Dz\ln\bigg[1+\exp\bigg(\beta p\|\boldsymbol{\overline{x}}\|^{p-2}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)-\beta p\left(\lambda-1\right)\overline{m}^{p-1}+ \displaystyle+\alpha\beta^{2}p\left(\overline{q}_{1}^{p-1}-\overline{q}_{2}^{p-1}\right)+\beta\sqrt{2\alpha p\overline{q}_{2}^{p-1}}z\bigg)\bigg]. By extremizing the replica-symmetric free energy A(\alpha,\beta) with respect to the order parameters, we obtain the following self-consistency equations: \displaystyle\|\boldsymbol{\overline{x}}\|^{2}=\int D\boldsymbol{z}\>\langle\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)\sigma\left(\beta h\left(z\right)\right)\rangle_{\boldsymbol{\eta}}, (77) \displaystyle\overline{m}=\overline{q}_{1}=\int D\boldsymbol{z}\>\langle\sigma\left(\beta h\left(z\right)\right)\rangle_{\boldsymbol{\eta}}, (78) \displaystyle\overline{q}_{2}=\int D\boldsymbol{z}\>\langle\sigma^{2}\left(\beta h\left(z\right)\right)\rangle_{\boldsymbol{\eta}}, (79) where \sigma(t)=\frac{1}{1+e^{-t}} is the sigmoid activation function, D\boldsymbol{z}\> represents the Gaussian measure for z\sim\mathcal{N}(0,1) , and h(z) is the internal field acting on the neurons and reads as h\left(z\right)=p\|\boldsymbol{\overline{x}}\|^{p-2}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)-p\left(\lambda-1\right)\overline{m}^{p-1}+\alpha\beta p\left(\overline{q}_{1}^{p-1}-\overline{q}_{2}^{p-1}\right)+\sqrt{2\alpha p\overline{q}_{2}^{p-1}}z. (80) These equations describe the self-consistent relationships between the order parameters and the control parameters of the system ( \alpha,\beta ). Proof. Let f(z) denote the argument of the exponential in Eq. ( 75 ), namely: f(z)=\beta p\|\boldsymbol{\overline{x}}\|^{p-2}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)-\beta p\left(\lambda-1\right)\overline{m}^{p-1}+\frac{p}{2}\left(\overline{p}_{1}\overline{q}_{1}^{p/2-1}-\overline{p}_{2}\overline{q}_{2}^{p/2-1}\right)+\sqrt{p\overline{p}_{2}\overline{q}_{2}^{p/2-1}}z. (81) We begin by extremizing Eq. ( 75 ) with respect to \boldsymbol{\overline{x}} : \nabla_{\boldsymbol{\overline{x}}}A\left(\alpha,\beta\right)=0\Leftrightarrow\beta\left(p-1\right)\nabla_{\boldsymbol{\overline{x}}}\|\boldsymbol{\overline{x}}\|^{p}=\mathbb{E}_{\boldsymbol{\eta}}\int Dz\frac{\nabla_{\boldsymbol{\overline{x}}}\exp\left[f\left(z\right)\right]}{1+\exp\left[f\left(z\right)\right]} (82) For the left-hand side we have: \beta\left(p-1\right)\nabla_{\boldsymbol{\overline{x}}}\|\boldsymbol{\overline{x}}\|^{p}=\beta p\left(p-1\right)\|\boldsymbol{\overline{x}}\|^{p-2}\boldsymbol{\overline{x}}. (83) On the right-hand side: \nabla_{\boldsymbol{\overline{x}}}\exp\left[f\left(z\right)\right]=\nabla_{\boldsymbol{\overline{x}}}f\left(z\right)\cdot\exp\left[f\left(z\right)\right]=\beta p\nabla_{\boldsymbol{\overline{x}}}\left[\|\boldsymbol{\overline{x}}\|^{p-2}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)\right]\cdot\exp\left[f\left(z\right)\right], (84) with \displaystyle\nabla_{\boldsymbol{\overline{x}}}\left[\|\boldsymbol{\overline{x}}\|^{p-2}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)\right] \displaystyle=\nabla_{\boldsymbol{\overline{x}}}\left[\|\boldsymbol{\overline{x}}\|^{p-2}\right]\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)+\|\boldsymbol{\overline{x}}\|^{p-2}\nabla_{\boldsymbol{\overline{x}}}\left[\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)\right] \displaystyle=\left(p-2\right)\|\boldsymbol{\overline{x}}\|^{p-4}\boldsymbol{\overline{x}}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)+\|\boldsymbol{\overline{x}}\|^{p-2}\boldsymbol{\eta}. Substituting into Eq. ( 84 ), we obtain: \displaystyle\nabla_{\boldsymbol{\overline{x}}}\exp\left[f\left(z\right)\right]=\beta p\left[\left(p-2\right)\|\boldsymbol{\overline{x}}\|^{p-4}\boldsymbol{\overline{x}}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)+\|\boldsymbol{\overline{x}}\|^{p-2}\boldsymbol{\eta}\right]\exp\left[f\left(z\right)\right]. It follows that: \frac{\nabla_{\boldsymbol{\overline{x}}}\exp\left[f\left(z\right)\right]}{1+\exp\left[f\left(z\right)\right]}=\beta p\left[\left(p-2\right)\|\boldsymbol{\overline{x}}\|^{p-4}\boldsymbol{\overline{x}}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)+\|\boldsymbol{\overline{x}}\|^{p-2}\boldsymbol{\eta}\right]\sigma\left[f\left(z\right)\right]. (85) Substituting Eqs. ( 83 ) and ( 85 ) into Eq. ( 82 ), we get: \displaystyle\nabla_{\boldsymbol{\overline{x}}}A\left(\alpha,\beta\right)=0 \displaystyle\Leftrightarrow\beta p\left(p-1\right)\|\boldsymbol{\overline{x}}\|^{p-2}\boldsymbol{\overline{x}}=\mathbb{E}_{\boldsymbol{\eta}}\int Dz\beta p\left[\left(p-2\right)\|\boldsymbol{\overline{x}}\|^{p-4}\boldsymbol{\overline{x}}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)+\|\boldsymbol{\overline{x}}\|^{p-2}\boldsymbol{\eta}\right]\sigma\left[f\left(z\right)\right] \displaystyle\Leftrightarrow\boldsymbol{\overline{x}}=\frac{1}{p-1}\mathbb{E}_{\boldsymbol{\eta}}\int Dz\left[\left(p-2\right)\frac{\boldsymbol{\overline{x}}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)}{\|\boldsymbol{\overline{x}}\|^{2}}+\boldsymbol{\eta}\right]\sigma\left[f\left(z\right)\right]. Multiplying both sides by \boldsymbol{\overline{x}} , we find: \|\boldsymbol{\overline{x}}\|^{2}=\frac{1}{p-1}\mathbb{E}_{\boldsymbol{\eta}}\int Dz\left[\left(p-2\right)\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)+\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right]\sigma\left[f\left(z\right)\right]. Therefore: \|\boldsymbol{\overline{x}}\|^{2}=\mathbb{E}_{\boldsymbol{\eta}}\int Dz\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)\sigma\left[f\left(z\right)\right]. (86) Next, we extremize Eq. ( 75 ) with respect to \overline{m} : \displaystyle\frac{\partial}{\partial\overline{m}}A\left(\alpha,\beta\right)=0 \displaystyle\Leftrightarrow\beta\left(\lambda-1\right)\left(1-p\right)p\,\overline{m}^{p-1}=\mathbb{E}_{\boldsymbol{\eta}}\int Dz\frac{\frac{\partial}{\partial\overline{m}}\exp\left[f\left(z\right)\right]}{1+\exp\left[f\left(z\right)\right]} (87) \displaystyle\Leftrightarrow\beta\left(\lambda-1\right)\left(1-p\right)p\,\overline{m}^{p-1}=\mathbb{E}_{\boldsymbol{\eta}}\int Dz\,\beta\left(\lambda-1\right)\left(1-p\right)p\,\overline{m}^{p-2}\sigma\left[f\left(z\right)\right] \displaystyle\Leftrightarrow\overline{m}=\mathbb{E}_{\boldsymbol{\eta}}\int Dz\,\sigma\left[f\left(z\right)\right]. Now, we extremize Eq. ( 75 ) with respect to \overline{p}_{1} : \displaystyle\frac{\partial}{\partial\overline{p}_{1}}A\left(\alpha,\beta\right)=0 \displaystyle\Leftrightarrow\frac{p}{2}\overline{q}_{1}^{p/2}\frac{\partial}{\partial\overline{p}_{1}}\overline{p}_{1}=\mathbb{E}_{\boldsymbol{\eta}}\int Dz\frac{\frac{\partial}{\partial\overline{p}_{1}}\exp\left[f\left(z\right)\right]}{1+\exp\left[f\left(z\right)\right]} (88) \displaystyle\Leftrightarrow\frac{p}{2}\overline{q}_{1}^{p/2}=\mathbb{E}_{\boldsymbol{\eta}}\int Dz\,\frac{p}{2}\overline{q}_{1}^{p/2-1}\sigma\left[f\left(z\right)\right] \displaystyle\Leftrightarrow\overline{q}_{1}=\mathbb{E}_{\boldsymbol{\eta}}\int Dz\,\sigma\left[f\left(z\right)\right]. Similarly, extremizing with respect to \overline{p}_{2} , we obtain: \displaystyle\frac{\partial}{\partial\overline{p}_{2}}A\left(\alpha,\beta\right)=0 \displaystyle\Leftrightarrow\frac{p}{2}\overline{q}_{2}^{p/2}\frac{\partial}{\partial\overline{p}_{2}}\overline{p}_{2}=-\mathbb{E}_{\boldsymbol{\eta}}\int Dz\frac{\frac{\partial}{\partial\overline{p}_{2}}\exp\left[f\left(z\right)\right]}{1+\exp\left[f\left(z\right)\right]} (89) \displaystyle\Leftrightarrow\frac{p}{2}\overline{q}_{2}^{p/2}=\mathbb{E}_{\boldsymbol{\eta}}\int Dz\,\left[\frac{p}{2}\overline{q}_{2}^{p/2-1}-\frac{p\overline{q}_{2}^{p/2-1}z}{2\sqrt{p\overline{p}_{2}\overline{q}_{2}^{p/2-1}}}\right]\sigma\left[f\left(z\right)\right] \displaystyle\Leftrightarrow\overline{q}_{2}=\mathbb{E}_{\boldsymbol{\eta}}\int Dz\,\sigma\left[f\left(z\right)\right]-\frac{1}{\sqrt{p\overline{p}_{2}\overline{q}_{2}^{p/2-1}}}\,\mathbb{E}_{\boldsymbol{\eta}}\int Dz\,z\sigma\left[f\left(z\right)\right]. Using Wick’s theorem and the identity \mathbb{E}[z^{2}]=1 , we have 20 20 20 \frac{d}{dx}\sigma\left(f\left(x\right)\right)=f^{\prime}\left(x\right)\left[1-\sigma\left(f\left(x\right)\right)\right]\sigma\left(f\left(x\right)\right) : \displaystyle\mathbb{E}_{\boldsymbol{\eta}}\int Dz\,z\sigma\left[f\left(z\right)\right] \displaystyle=\mathbb{E}_{\boldsymbol{\eta},z}\left[z^{2}\right]\mathbb{E}_{\boldsymbol{\eta},z}\left[\frac{\partial}{\partial z}\sigma\left[f\left(z\right)\right]\right] (90) \displaystyle=\mathbb{E}_{\boldsymbol{\eta},z}\sqrt{p\overline{p}_{2}\overline{q}_{2}^{p/2-1}}\left[1-\sigma\left[f\left(z\right)\right]\right]\sigma\left[f\left(z\right)\right]. Substituting into Eq. ( 89 ), we get: \overline{q}_{2}=\mathbb{E}_{\boldsymbol{\eta}}\int Dz\,\sigma^{2}\left[h\left(z\right)\right]. (91) Extremizing A(\alpha,\beta) with respect to \overline{q}_{1} , we obtain: \displaystyle\frac{\partial}{\partial\overline{q}_{1}}A\left(\alpha,\beta\right)=0 \displaystyle\Leftrightarrow\alpha\beta^{2}\frac{\partial}{\partial\overline{q}_{1}}\left(\overline{q}_{1}^{p}-\overline{q}_{2}^{p}\right)-\frac{p}{2}\frac{\partial}{\partial\overline{q}_{1}}\left(\overline{p}_{1}\overline{q}_{1}^{p/2}-\overline{p}_{2}\overline{q}_{2}^{p/2}\right)+\mathbb{E}_{\boldsymbol{\eta}}\int Dz\,\frac{\frac{\partial}{\partial\overline{q}_{1}}\exp\left[f\left(z\right)\right]}{1+\exp\left[f\left(z\right)\right]}=0 (92) \displaystyle\Leftrightarrow\alpha\beta^{2}p\overline{q}_{1}^{p-1}-\frac{p^{2}}{4}\overline{q}_{1}^{p/2-1}+\mathbb{E}_{\boldsymbol{\eta}}\int Dz\,\left[\frac{p}{2}\overline{p}_{1}\left(\frac{p}{2}-1\right)\overline{q}_{1}^{p/2-2}\right]\sigma\left[f\left(z\right)\right]=0 \displaystyle\Leftrightarrow 2\alpha\beta^{2}\overline{q}_{1}^{p-1}-\frac{p}{2}\overline{q}_{1}^{p/2-1}+\left[\overline{p}_{1}\left(\frac{p}{2}-1\right)\overline{q}_{1}^{p/2-2}\right]\mathbb{E}_{\boldsymbol{\eta}}\int Dz\,\sigma\left[f\left(z\right)\right]=0 \displaystyle\Leftrightarrow 2\alpha\beta^{2}\overline{q}_{1}^{p-1}-\frac{p}{2}\overline{q}_{1}^{p/2-1}+\overline{p}_{1}\left(\frac{p}{2}-1\right)\overline{q}_{1}^{p/2-1}=0 \displaystyle\Leftrightarrow\overline{p}_{1}=2\alpha\beta^{2}\overline{q}_{1}^{p/2}. Extremizing with respect to \overline{q}_{2} , similarly: \displaystyle\frac{\partial}{\partial\overline{q}_{2}}A\left(\alpha,\beta\right)=0 \displaystyle\Leftrightarrow\alpha\beta^{2}\frac{\partial}{\partial\overline{q}_{2}}\left(\overline{q}_{1}^{p}-\overline{q}_{2}^{p}\right)-\frac{p}{2}\frac{\partial}{\partial\overline{q}_{2}}\left(\overline{p}_{1}\overline{q}_{1}^{p/2}-\overline{p}_{2}\overline{q}_{2}^{p/2}\right)+\mathbb{E}_{\boldsymbol{\eta}}\int Dz\,\frac{\frac{\partial}{\partial\overline{q}_{2}}\exp\left[f\left(z\right)\right]}{1+\exp\left[f\left(z\right)\right]}=0 (93) \displaystyle\Leftrightarrow-\alpha\beta^{2}p\overline{q}_{2}^{p-1}+\frac{p^{2}}{4}\overline{q}_{2}^{p/2-1}+ \displaystyle+\mathbb{E}_{\boldsymbol{\eta}}\int Dz\,\left[\frac{p}{2}\frac{\overline{p}_{2}\left(\frac{p}{2}-1\right)\overline{q}_{2}^{p/2-2}}{\sqrt{p\overline{p}_{2}\overline{q}_{2}^{p/2-1}}}z-\frac{p}{2}\overline{p}_{2}\left(\frac{p}{2}-1\right)\overline{q}_{2}^{p/2-2}\right]\sigma\left[f\left(z\right)\right]=0 \displaystyle\Leftrightarrow-2\alpha\beta^{2}\overline{q}_{2}^{p-1}+\frac{p}{2}\overline{q}_{2}^{p/2-1}+\frac{\overline{p}_{2}\left(\frac{p}{2}-1\right)\overline{q}_{2}^{p/2-2}}{\sqrt{p\overline{p}_{2}\overline{q}_{2}^{p/2-1}}}\mathbb{E}_{\boldsymbol{\eta}}\int Dz\,z\sigma\left[f\left(z\right)\right]+ \displaystyle-\overline{p}_{2}\left(\frac{p}{2}-1\right)\overline{q}_{2}^{p/2-2}\,\mathbb{E}_{\boldsymbol{\eta}}\int Dz\,\sigma\left[f\left(z\right)\right]=0 Using Stein lemma (i.e. Wick’s theorem), the identity \mathbb{E}[z^{2}]=1 and substituting ( 90 ) into Eq. ( 93 ), we get: \displaystyle\frac{\partial}{\partial\overline{q}_{2}}A\left(\alpha,\beta\right)=0 \displaystyle\Leftrightarrow-2\alpha\beta^{2}\overline{q}_{2}^{p-1}+\frac{p}{2}\overline{q}_{2}^{p/2-1}+\overline{p}_{2}\left(\frac{p}{2}-1\right)\overline{q}_{2}^{p/2-2}\mathbb{E}_{\boldsymbol{\eta}}\int Dz\,\left[1-\sigma\left[f\left(z\right)\right]\right]\sigma\left[f\left(z\right)\right]+ (94) \displaystyle-\overline{p}_{2}\left(\frac{p}{2}-1\right)\overline{q}_{2}^{p/2-2}\,\mathbb{E}_{\boldsymbol{\eta}}\int Dz\,\sigma\left[f\left(z\right)\right]=0 \displaystyle\Leftrightarrow-2\alpha\beta^{2}\overline{q}_{2}^{p-1}+\frac{p}{2}\overline{q}_{2}^{p/2-1}-\overline{p}_{2}\left(\frac{p}{2}-1\right)\overline{q}_{2}^{p/2-2}\,\mathbb{E}_{\boldsymbol{\eta}}\int Dz\,\sigma^{2}\left[f\left(z\right)\right]=0 \displaystyle\Leftrightarrow-2\alpha\beta^{2}\overline{q}_{2}^{p-1}+\frac{p}{2}\overline{q}_{2}^{p/2-1}-\overline{p}_{2}\left(\frac{p}{2}-1\right)\overline{q}_{2}^{p/2-1}=0 \displaystyle\Leftrightarrow\overline{p}_{2}=2\alpha\beta^{2}\overline{q}_{2}^{p/2}. Substituting \overline{p}_{1}=2\alpha\beta^{2}\overline{q}_{1}^{p/2},\qquad\overline{p}_{2}=2\alpha\beta^{2}\overline{q}_{2}^{p/2}, into the expression ( 75 ) of the free energy , we recover Eq. ( 76 ). Substituting \overline{p}_{1} and \overline{p}_{2} into Eq. ( 81 ), we get: f(z)=\beta\left[p\|\boldsymbol{\overline{x}}\|^{p-2}\left(\boldsymbol{\overline{x}}\cdot\boldsymbol{\eta}\right)-p\left(\lambda-1\right)\overline{m}^{p-1}+\alpha\beta p\left(\overline{q}_{1}^{p-1}-\overline{q}_{2}^{p-1}\right)+\sqrt{2\alpha p\overline{q}_{2}^{p-1}}z\right], (95) from which the internal field h(z) is identified. Finally, inserting Eq. ( 95 ) into the previously derived self-consistency conditions yields the Eqs. ( 77 ), ( 78 ) and ( 79 ). ∎ Corollary 1 . To facilitate the numerical solution of the self-consistent equations ( 77 )–( 79 ), it is helpful to perform a change of variables. The equations can then be rewritten as: \displaystyle\overline{x}=\frac{1}{\pi}\int Dz\int_{0}^{\pi}d\theta\,\cos(\theta)\ \sigma(\beta h(z,\theta)), (96) \displaystyle\overline{m}=\overline{q}_{1}=\frac{1}{\pi}\int Dz\int_{0}^{\pi}d\theta\ \sigma(\beta h(z,\theta)), (97) \displaystyle\overline{q}_{2}=\frac{1}{\pi}\int Dz\int_{0}^{\pi}d\theta\ \sigma^{2}(\beta h(z,\theta)), (98) where the function h(z,t) is defined as: h(z,\theta)=p\overline{x}^{p-1}\cos\theta-p\left(\lambda-1\right)\overline{m}^{p-1}+\alpha\beta p\left(\overline{q}_{1}^{p-1}-\overline{q}_{2}^{p-1}\right)+\sqrt{2\alpha p\overline{q}_{2}^{p-1}}z. (99) Proof. The equations ( 96 )-( 98 ) can be explicitly formulated by applying the relations ( 34 )-( 35 ) to evaluate the expectations over the map realizations. Let us focus on equation ( 96 ). Starting from equation ( 77 ) and applying the identity ( 35 ), we obtain: \|\boldsymbol{\overline{x}}\|^{2}=\frac{1}{\pi}\int Dz\int_{0}^{\pi}d\theta\ \|\boldsymbol{\overline{x}}\|\cos\theta\ \sigma\left(\beta h\left(z,\theta\right)\right). (100) Dividing both sides by \|\boldsymbol{\overline{x}}\| and setting \|\boldsymbol{\overline{x}}\|=\overline{x} , we recover equation ( 96 ). ∎ After proving the corollary, we proceed with the numerical resolution of equations ( 96 )–( 98 ), using the internal field defined in ( 99 ), in order to construct the phase diagram(s) of the model reported in the main text. Appendix Two: Replica trick for dense networks of place cells In a nutshell, the replica trick allows to compute the free energy by the formula \mathcal{A}(\alpha,\beta)=\lim_{N\to\infty}N^{-1}\mathbb{E}\ln Z=\lim_{N\to\infty}\lim_{n\to 0}\frac{\mathbb{E}Z^{n}-1}{nN}, (101) that is, it allows to avoid the computation of the logarithm of the partition function by dealing with the quantity \mathbb{E}Z^{n} , that reads accordingly to the next Proposition 3 . As different replicas are coupled together trough the product space of their relative Boltzmann measures, the quenched expectation of the n moments of the partition function \mathbb{E}Z^{n} can be written as \displaystyle\mathbb{E}Z^{n}=\mathbb{E}\left(\prod_{a=1}^{n}\sum_{\boldsymbol{s}_{a}}\right)\exp{\left[\frac{\beta p!}{N^{p-1}}\sum_{\mu=1}^{K}\sum_{a=1}^{n}\sum_{i_{1}<..1 maps as stated by the next Proposition 4 . The signal-to-noise distinction among the various contribution to the Cost function of the dense network results in a signal that reads as \displaystyle\mathcal{S}:\>\>\sum_{i_{1}<..s_{i}^{a}+\beta N\sum_{a}\left(\boldsymbol{x}^{1}_{a}\right)^{p}\right), (104) where \left(\boldsymbol{x}^{1}_{a}\right)^{p}=\boldsymbol{x}^{1}_{a}\cdot\boldsymbol{x}^{1}_{a}\dots\boldsymbol{x}^{1}_{a}\cdot\boldsymbol{x}^{1}_{a} is the dot product of p terms (we remind that p is even). The signal-to-noise distinction among the various contribution to the Cost function of the dense network gives rise to a slow-noise contribution \mathcal{N} to \mathbb{E}Z^{n} that reads as \displaystyle\mathbb{E} \displaystyle\exp\left(\frac{\beta p!}{N^{p-1}}\sum_{a,\mu>1}\sum_{i_{1}<..\>s^{a}_{i_{1}}\dots s^{a}_{i_{p}}\right)\sim \displaystyle\sim 1+\frac{\beta p!}{N^{p-1}}\sum_{a,\mu>1}\sum_{i_{1}<..\>s^{a}_{i_{1}}\dots s^{a}_{i_{p}}+ \displaystyle+\frac{1}{2}\left(\frac{\beta p!}{N^{p-1}}\right)^{2}\mathbb{E}\left[\left(\sum_{a,\mu>1}\sum_{i_{1}<..\>s^{a}_{i_{1}}\dots s^{a}_{i_{p}}\right)^{2}\right]. (105) The linear term in the expansion vanishes since the maps have different indices (given the condition on the sum i_{1}<..1}\sum_{i_{1}<..\boldsymbol{\eta}^{\nu}_{j_{1}}\dots\boldsymbol{\eta}^{\nu}_{j_{p}}\right]\>\>s^{a}_{i_{1}}\dots s^{a}_{i_{p}}\>\>s^{b}_{j_{1}}\dots s^{b}_{j_{p}}\sim \displaystyle\sim\frac{1}{(p!)^{2}}\sum_{a,b}\sum_{\mu,\nu>1}\sum_{i_{1},..,i_{p}}\sum_{j_{1},..,j_{p}}\mathbb{E}\left[\boldsymbol{\eta}^{\mu}_{i_{1}}\dots\boldsymbol{\eta}^{\mu}_{i_{p}}\>\boldsymbol{\eta}^{\nu}_{j_{1}}\dots\boldsymbol{\eta}^{\nu}_{j_{p}}\right]\>\>s^{a}_{i_{1}}\dots s^{a}_{i_{p}}\>\>s^{b}_{j_{1}}\dots s^{b}_{j_{p}}. Now, let us compute the expectation \mathbb{E}\left[\boldsymbol{\eta}^{\mu}_{i_{1}}\dots\boldsymbol{\eta}^{\mu}_{i_{p}}\>\boldsymbol{\eta}^{\nu}_{j_{1}}\dots\boldsymbol{\eta}^{\nu}_{j_{p}}\right] . We consider the case p=4 specifically now: we write \displaystyle\mathbb{E}\left[\boldsymbol{\eta}^{\mu}_{i_{1}}\cdot\boldsymbol{\eta}^{\mu}_{i_{2}}\>\boldsymbol{\eta}^{\mu}_{i_{3}}\cdot\boldsymbol{\eta}^{\mu}_{i_{4}}\boldsymbol{\eta}^{\mu}_{j_{1}}\cdot\boldsymbol{\eta}^{\mu}_{j_{2}}\>\boldsymbol{\eta}^{\mu}_{j_{3}}\cdot\boldsymbol{\eta}^{\mu}_{j_{4}}\right]=\sum_{t_{1},t_{2},t_{3},t_{4}=1}^{d}\mathbb{E}\left[\eta^{\mu,t_{1}}_{i_{1}}\eta^{\mu,t_{1}}_{i_{2}}\eta^{\mu,t_{2}}_{i_{3}}\eta^{\mu,t_{2}}_{i_{4}}\eta^{\nu,t_{3}}_{j_{1}}\eta^{\nu,t_{3}}_{j_{2}}\eta^{\nu,t_{4}}_{j_{3}}\eta^{\nu,t_{4}}_{j_{4}}\right], (106) where we have expanded the dot products by writing them explicitly by means of the indices t_{1},t_{2},t_{3},t_{4}=1,..,d that run over the components of the vectors. The leading terms in N are those for i_{1}\neq i_{2}\neq i_{3}\neq i_{4} and j_{1}\neq j_{2}\neq j_{3}\neq j_{4} . Focusing on these terms, we can rewrite eq. ( 106 ) as \displaystyle 4!\sum_{t_{1},t_{2},t_{3},t_{4}=1}^{d}\mathbb{E}\left[\eta^{\mu,t_{1}}_{i_{1}}\eta^{\nu,t_{3}}_{j_{1}}\right]\mathbb{E}\left[\eta^{\mu,t_{1}}_{i_{2}}\eta^{\nu,t_{3}}_{j_{2}}\right]\mathbb{E}\left[\eta^{\mu,t_{2}}_{i_{3}}\eta^{\nu,t_{4}}_{j_{3}}\right]\mathbb{E}\left[\eta^{\mu,t_{2}}_{i_{4}}\eta^{\nu,t_{4}}_{j_{4}}\right], (107) where the 4! term accounts for the number of possible pairings among the two set of indices \{i_{1},..i_{4}\} and \{j_{1},..,j_{4}\} . Each expectation appearing in the latter expression is non-zero only when \mu=\nu and the site-indices i_{1},..,i_{4},j_{1},..,j_{4} are equal in pairs: i_{1}=j_{1},i_{2}=j_{2},i_{3}=j_{3},i_{4}=j_{4} . We can write (neglecting the irrelevant index \mu for clarity): \displaystyle 4!\delta_{\mu,\nu}\delta_{i_{1},j_{1}}\delta_{i_{2},j_{2}}\delta_{i_{3},j_{3}}\delta_{i_{4},j_{4}}\sum_{t_{1},t_{2},t_{3},t_{4}=1}^{d}\mathbb{E}\left[\eta^{t_{1}}_{i_{1}}\eta^{t_{3}}_{i_{1}}\right]\mathbb{E}\left[\eta^{t_{1}}_{i_{2}}\eta^{t_{3}}_{i_{2}}\right]\mathbb{E}\left[\eta^{t_{2}}_{i_{3}}\eta^{t_{4}}_{i_{3}}\right]\mathbb{E}\left[\eta^{t_{2}}_{i_{4}}\eta^{t_{4}}_{i_{4}}\right]. (108) Now each expectation appearing in the latter expression is just the covariance of the vectors \boldsymbol{\eta}_{i} over the space of their components t=1,..,d . In the thermodynamic limit we can approximate such covariance with the d- identity matrix \frac{1}{d}\boldsymbol{1}_{d} , or in other words we can assume that, at leading order in N we have \mathbb{E}\left[\eta^{t_{1}}_{i}\eta^{t_{2}}_{i}\right]=\frac{1}{d}\delta_{t_{1},t_{2}} , where the factor d^{-1} in front is there to account for the normalization of the maps \boldsymbol{\eta} , i.e. \boldsymbol{\eta}_{i}\cdot\boldsymbol{\eta}_{i}=1 . The only non-zero contributions (in the thermodynamic limit) in eq. 108 are those for which t_{1}=t_{2}=t_{3}=t_{4} and t_{1}=t_{3},t_{2}=t_{4} , hence the latter equation has two distinct terms that read (apart from the delta’s in front which we omit for clarity): \displaystyle 4!\sum_{t=1}^{d}\mathbb{E}\left[\eta^{t}_{i_{1}}\eta^{t}_{i_{1}}\right]\mathbb{E}\left[\eta^{t}_{i_{2}}\eta^{t}_{i_{2}}\right]\mathbb{E}\left[\eta^{t}_{i_{3}}\eta^{t}_{i_{3}}\right]\mathbb{E}\left[\eta^{t}_{i_{4}}\eta^{t}_{i_{4}}\right]+ \displaystyle 4!\sum_{t_{1}\neq t_{2}}\mathbb{E}\left[\eta^{t_{1}}_{i_{1}}\eta^{t_{1}}_{i_{1}}\right]\mathbb{E}\left[\eta^{t_{1}}_{i_{2}}\eta^{t_{1}}_{i_{2}}\right]\mathbb{E}\left[\eta^{t_{2}}_{i_{3}}\eta^{t_{2}}_{i_{3}}\right]\mathbb{E}\left[\eta^{t_{2}}_{i_{4}}\eta^{t_{2}}_{i_{4}}\right]= \displaystyle=4!\left(\frac{d}{d^{4}}+\frac{d(d-1)}{d^{4}}\right)=\frac{4!}{d^{2}} (109) It can be shown that, for a generic even p , the magnitude of the expectation in eq. 106 generalizes to \frac{p!}{d^{p/2}} . Hence, we have that the noise contribution (eq. 105 ) can be rewritten as \displaystyle\mathcal{N}:\>\>1+\frac{p!K}{2d^{p/2}}\left(\frac{\beta}{N^{p-1}}\right)^{2}\sum_{a,b}\left(\sum_{i}s^{a}_{i}s^{b}_{i}\right)^{p}+\mathcal{O}\left(N^{(3-p)/2}\right)\sim\exp\left[\frac{p!K}{2d^{p/2}}\left(\frac{\beta}{N^{p-1}}\right)^{2}\sum_{a,b}\left(\sum_{i}s^{a}_{i}s^{b}_{i}\right)^{p}\right]. (110) The overall contribution of the noise to \mathbb{E}Z^{n} is then \displaystyle\int\left[\prod_{a,b=1}^{n,n}\frac{dq_{ab}d\hat{q}_{ab}}{2\pi/N}\right]\exp\left[iN\sum_{ab}q_{ab}\hat{q}_{ab}-i\sum_{ab}\hat{q}_{ab}\sum_{i}s^{a}_{i}s^{b}_{i}+N\beta^{2}\alpha\sum_{ab}\left(q_{ab}\right)^{p}\right], (111) where \alpha=\frac{p!}{2d^{p/2}}\frac{K}{N^{p-1}} (112) is the load of the model. Figure 11 : The variance of the product \sigma^{2}=\text{V}ar\left(\boldsymbol{\eta}_{i_{1}}\dots\boldsymbol{\eta}_{i_{p}}\right) for i_{1}<..s^{a}-i\sum_{ab}\hat{q}_{ab}s^{a}s^{b}\right)\Bigg]\equiv\int\left\{d\boldsymbol{x}^{1}d\boldsymbol{\hat{x}^{1}}d\boldsymbol{q}d\boldsymbol{\hat{q}}\right\}e^{N\phi(\boldsymbol{x}^{1},\boldsymbol{\hat{x}^{1}},\boldsymbol{q},\boldsymbol{\hat{q}})} (113) where \left\{d\boldsymbol{x}^{1}d\boldsymbol{\hat{x}^{1}}d\boldsymbol{q}d\boldsymbol{\hat{q}}\right\}\equiv\left[\prod_{a=1}^{n}\frac{d^{d}x^{1}_{a}d^{d}\hat{x}^{1}_{a}}{2\pi/N}\right]\left[\prod_{a,b=1}^{n,n}\frac{dq_{ab}d\hat{q}_{ab}}{2\pi/N}\right] is the integral measure in short form and \sum_{\{\boldsymbol{s}_{a}\}}\equiv\prod_{a=1}^{n}\sum_{s_{a}=\{0,1\}} is the partition sum over the replicated neurons s_{a} . As standard in replica calculations, we exchange the two limits appearing in eq. 101 and perform the thermodynamic limit first. The saddle point conditions \frac{\partial\phi}{\partial x^{1}_{a}}=0 and \frac{\partial\phi}{\partial q_{ab}}=0 give: \displaystyle\hat{x}^{1}_{a}=i\beta\>p\>(x^{1}_{a})^{p-1} (114) \displaystyle\hat{q}_{ab}=i\alpha\beta^{2}\>p\>(q_{ab})^{p-1} (115) which allow us to write \displaystyle\phi(\boldsymbol{x}^{1},\boldsymbol{q})=(1-p)\beta\sum_{a}(\boldsymbol{x}^{1}_{a})^{p}+ \displaystyle(1-p)\alpha\beta^{2}\sum_{ab}(q_{ab})^{p}+ \displaystyle+\ln\mathbb{E}_{\boldsymbol{\eta}}\sum_{\{\boldsymbol{s}_{a}\}}\exp\left(\beta p\sum_{a}\boldsymbol{\eta}\cdot(\boldsymbol{x}^{1}_{a})^{p-1}\>s_{a}+\alpha\beta^{2}p\sum_{ab}(q_{ab})^{p-1}s_{a}s_{b}\right). (116) Under RS assumption we have \displaystyle\boldsymbol{x}^{1}_{a}=\overline{\boldsymbol{x}},\qquad q_{ab}=\overline{q}_{1}\delta_{ab}+\overline{q}_{2}(1-\delta_{ab}), (117) thus we are now ready to state the main proposition of this Appendix, namely Proposition 5 . In the thermodynamic limit, the replica-symmetric quenched free energy of the dense Battaglia-Treves model, equipped with McCulloch \& Pitts neurons as described by eq. ( 39 ), for the S^{d-1} embedding space, can be expressed in terms of the (mean values of the) order parameters \overline{\boldsymbol{x}} , \overline{q}_{1} , \overline{q}_{2} and the control parameters \alpha , \beta (keeping \lambda=1 ), as follows: \displaystyle\mathcal{A}(\alpha,\beta,\lambda=1)= \displaystyle(1-p)\beta\overline{\boldsymbol{x}}^{p}+(1-p)\alpha\beta^{2}(\overline{q}_{1}^{p}-\overline{q}_{2}^{p})+ \displaystyle+\mathbb{E}_{\boldsymbol{\eta}}\int Dz\ln\left(1+\exp\left(\beta p\>\boldsymbol{\eta}\cdot\overline{\boldsymbol{x}}^{p-1}+\alpha\beta^{2}p\>(\overline{q}_{1}^{p-1}-\overline{q}_{2}^{p-1})+\beta\sqrt{2\alpha p\>\overline{q}_{2}^{p-1}}\>z\right)\right), (118) where the order parameters must assume values that extremize the above expression to ensure Thermodynamics prescriptions to hold. Remark 3 . In the replica derivation we adopt a slight abuse of notation; accordingly, powers such as \overline{\boldsymbol{x}}^{\,p-1} are understood as \|\overline{\boldsymbol{x}}\|^{\,p-2}\overline{\boldsymbol{x}} , so that \boldsymbol{\eta}\!\cdot\!\overline{\boldsymbol{x}}^{\,p-1}=\|\overline{\boldsymbol{x}}\|^{\,p-2}(\overline{\boldsymbol{x}}\!\cdot\!\boldsymbol{\eta}) and \overline{\boldsymbol{x}}^{\,p}=\|\overline{\boldsymbol{x}}\|^{\,p} . Under this convention, the replica-symmetric free energy reported above exactly coincides with the one previously obtained via the interpolation method (Eq. ( 75 ) for \lambda=1 ). Therefore, it is not necessary to re-derive the self-consistency equations, as they have already been obtained within the interpolation framework and hold unchanged here. Appendix 3