$$L_{1\text{RSB}}(u) = \begin{cases} \frac{(\rho_{\text{typ}} - 1)^2}{4\rho_{\text{typ}}g'(1)(\rho_{\text{typ}}g'(1) - 2g_2)} - \frac{1}{\sqrt{g'(1)}}\left(\frac{1}{\sqrt{\rho_{\text{typ}}}} - \sqrt{\rho_{\text{typ}}}\right)u, & u \le u_t < 0, \\ (\rho_{\text{typ}}g'(1) - 2g_2)u^2, & u > u_t. \end{cases} \quad (\text{C123})$$

The first line in this expression is obtained from the RS solution and corresponds to energy $e \le e_t$ while the second line is obtained from $\mathcal{L}_{1\text{RSB}}(e)$ and describes energies $e \ge e_t$. This scaling function displays a second order transition for $u = K_t - K_{\text{typ}}$ in the sense that it is continuous and its first derivative as well at this point. Its asymptotic behaviours as $u \to -\infty$ and $u \to 0$ allow to respectively match the linear behaviour of the LDF $\mathcal{L}(e) \approx -s_t(e - e_{\text{typ}}(\Gamma = 0))$ for $\Gamma = 0$ and the quadratic behaviour $\mathcal{L}(e) \approx (e - e_{\text{typ}}(\Gamma))^2/(2V_{\min}(\Gamma))$ for finite but small $\Gamma$.

Close to the wall, i.e. for $e \to e_c$, the LDF takes instead a different scaling form

$$\mathcal{L}(e) \approx G_{1\text{RSB}} \left( \frac{\sqrt{\rho_{\text{typ}}g'(1)(e - e_c)}}{\Gamma}; \frac{g_2}{\rho_{\text{typ}}g'(1)} \right), \quad (\text{C124})$$

$$G_{1\text{RSB}}(z; w) = -\frac{1}{2}((1+2z)(1+w(1+2z)) + \ln(-2z)), \quad z \in [z_{\text{typ}}, 0], \quad (\text{C125})$$

with $z_{\text{typ}} = z_t = -1/2$. For $z < -1/2$ one has $G_{1\text{RSB}}(z; w) = 0$. Note that in the special case $w = 1/2$, this scaling function is the same as for the FRSB case. This scaling function behaves asymptotically as

$$G_{1\text{RSB}}(z; w) = \begin{cases} -\frac{1}{2}(\ln(-2z) + 1 + w) + O(z) & , \quad z \to 0, \\ (1 - 2w)(z - z_{\text{typ}})^2 + \frac{4}{3}(z - z_{\text{typ}})^3 + O(z - z_{\text{typ}})^4 & , \quad z \to z_{\text{typ}}. \end{cases} \quad (\text{C126})$$

In particular, the first line matches the logarithmic divergence of the LDF in Eq. (C93) as $e \to e_c$ for $\Gamma > 0$. The second line instead, matches the behaviour of the scaling function $L_{1\text{RSB}}(u)$ for $u \to +\infty$.

**Remark on stability of the 1RSB solution:** To ensure the stability of the 1RSB phase, an analysis of the quadratic form (see Appendix D for details) reveals that both the following eigenvalues must be negative

$$\Lambda_0^{1\text{RSB}} = f''(q_0^*) - \frac{1}{(v_* + m_0^*(1 - q_0^*))^2}, \quad (\text{C127})$$

$$\Lambda_1^{1\text{RSB}} = f''(1) - \frac{1}{v_*^2}. \quad (\text{C128})$$

In the limit $q_0^* \to 1$, both these eigenvalues coincide and match the expression of $\Lambda^{\text{RS}}$ in Eq. (C5). Ensuring negativity of the above eigenvalues yields the conditions

$$\frac{g'(1) - g'(q_0^*)}{(1 - q_0^*)g''(1)} \ge \frac{\rho(q_0^*)}{\alpha(q_0^*)} \ge \frac{(1 - q_0^*)g''(q_0^*)}{g'(1) - g'(q_0^*)}, \quad (\text{C129})$$

which can be shown to hold numerically on several important examples (e.g. the p-spin model).
## Appendix D: Stability of the RS and 1RSB Phases

To determine the stability of the different phases, one needs to consider the eigenvalues of the quadratic variation A around the saddle-point solution Q

$$A_{(ab)(cd)} = \frac{\delta \Phi_n(q_0^*)}{\delta Q_{ab} \delta Q_{cd}} = \beta^2 f''(Q_{ab}) \delta_{(ab)(cd)} - (Q^{-1})_{ad} (Q^{-1})_{bc} - (Q^{-1})_{ac} (Q^{-1})_{bd}. \qquad (D1)$$

To ensure stability, this quadratic form must have negative eigenvalues.

### D.1 RS Phase

In the RS phase,

$$(Q^{-1})_{ab} = \delta_{ab}(p_d - p_0) + p_0 = \frac{1}{1-q} \left( \delta_{ab} - \frac{q}{1+(n-1)q} \right). \qquad (D2)$$

The equations for the eigenvalues of the quadratic form read

$$\Lambda_{*}q_{ab} = \beta^2 f''(q)q_{ab} - p_0^2 \sum_{c \neq d} q_{cd} - p_0(p_d - p_0) \sum_{c} (q_{ac}(1 - \delta_{ac}) + q_{bc}(1 - \delta_{bc})) \\ -(p_d - p_0)^2 q_{ab}, \quad a \neq b. \qquad (D3)$$

Let us first sum this equation over a and b $\neq a$ to obtain the first eigenvalue, denoted $\Lambda_1^{RS}$,

$$\Lambda_1^{RS} \sum_{a \neq b} q_{ab} = [\beta^2 f''(q) - n(n-1)p_0^2 - 2p_0(p_d - p_0)(n-1) - (p_d - p_0)^2] \sum_{a \neq b} q_{ab}. \qquad (D4)$$

The degeneracy for the eigenvalue is given by the dimension of space for the corresponding eigenvector and here $d_1^{RS} = 1$. Let us now suppose that $\sum_{a \neq b} q_{ab} = 0$ and sum Eq. (D3) over a, thus obtaining the second eigenvalue $\Lambda_2^{RS}$

$$\Lambda_2^{RS} \sum_b q_{ab}(1 - \delta_{ab}) = [\beta^2 f''(q) - (n-2)p_0(p_d - p_0) - (p_d - p_0)^2] \sum_b q_{ab}(1 - \delta_{ab}). \qquad (D5)$$

The degeneracy for this eigenvalue is $d_2^{RS} = n-1$ as there are n parameters $\sum_b q_{ab}(1 - \delta_{ab})$ for $a = 1, \dots, n$ and one constraint $\sum_{a \neq b} q_{ab} = 0$. Finally, supposing that $\sum_b q_{ab}(1 - \delta_{ab}) = 0$ for $a = 1, \dots, n$, we obtain from Eq. (D3) the third and last eigenvalue $\Lambda_3^{RS}$

$$\Lambda_3^{RS} q_{ab} = [\beta^2 f''(q) - (p_d - p_0)^2] q_{ab}. \qquad (D6)$$

For this eigenvalue, there are $n(n-1)/2$ independent parameters $q_{ab} = q_{ba}$ for $a, b = 1, \dots, n$ with $q_{aa} = 1$ and n constraints $\sum_b q_{ab}(1 - \delta_{ab}) = 0$ for $a = 1, \dots, n$, the degeneracy is thus $d_3^{RS} = n(n-3)/2$. In the regime $n \to 0$ and $\beta \to \infty$ with $s = n\beta = O(1)$ and $v = \beta(1-q)$, the eigenvalues for the RS solution read

$$\frac{\Lambda_1^{RS}}{\beta^3} \to \lambda_1^{RS} = - \frac{2v + s}{v^2(v + s)^2} < 0, \qquad (D7)$$

$$\frac{\Lambda_2^{RS}}{\beta^3} \to \lambda_2^{RS} = - \frac{2}{v^2(v + s)} < 0, \qquad (D8)$$
$$ \frac{\Lambda_3^{RS}}{\beta^2} \rightarrow \lambda_3^{RS} = f''(1) - \frac{1}{v^2}. \qquad (D9) $$

Note the different scaling for the last eigenvalue. In particular, the last eigenvalue $\lambda_3^{RS}$ becomes positive for

$$ v = \frac{1}{2} \left( -s + \sqrt{\frac{4}{f'(1)} + s^2} \right) > \frac{1}{\sqrt{f''(1)}}. \qquad (D10) $$

This criterion can be rewritten in terms of s as

$$ s < s_{RSB} = \frac{1}{\sqrt{f''(1)}} \left( \frac{f''(1)}{f'(1)} - 1 \right). \qquad (D11) $$

## D.2 1RSB Phase

In the 1RSB phase,

$$ (Q^{-1})_{ab} = (r_d - r_1)\delta_{ab} + (r_1 - r_0)P_{ab} + r_0, \qquad (D12) $$

$$ r_d = \frac{n-m}{mn(1-q_1+m(q_1-q_0))} + \frac{1}{n(1-q_1+m(q_1-q_0)+nq_0)} - \frac{1-m}{m(1-q_1)}, \qquad (D13) $$

$$ r_1 = \frac{n-m}{mn(1-q_1+m(q_1-q_0))} + \frac{1}{n(1-q_1+m(q_1-q_0)+nq_0)} - \frac{1}{m(1-q_1)}, \qquad (D14) $$

$$ r_0 = - \frac{q_0}{(m(q_1-q_0)+1-q_1)(1-q_1+m(q_1-q_0)+nq_0)}, \qquad (D15) $$

where the matrix $P_{ab}$ is 1 if a, b belong to the same block and zero otherwise. Using a similar approach as in [65], the equation determining the eigenvalues of the quadratic form reads

$$ \Lambda_* q_{ab} = \beta^2 f''(Q_{ab}) q_{ab} - r_0^2 \sum_{c \neq d} q_{cd} - (r_1 - r_0)^2 m^2 q_{\bar{a}\bar{b}} - (r_d - r_1)^2 q_{ab} \\ - m(r_d - r_1)(r_1 - r_0)(q_{\bar{a}b} + q_{a\bar{b}}) \qquad (D16) $$

$$ -mr_0(r_1 - r_0) \sum_c (q_{\bar{a}c} + q_{c\bar{b}}) - r_0(r_d - r_1) \sum_c (q_{ac}(1 - \delta_{ac}) + q_{cb}(1 - \delta_{bc})), \quad a \neq b, \qquad (D17) $$

$$ q_{\bar{a}\bar{b}} = \frac{1}{m}(qP)_{ab}, \quad q_{\bar{a}\bar{b}} = \frac{1}{m^2}(PqP)_{ab}, \quad q_{\bar{a}\bar{a}} = \frac{1}{m}(PqP)_{aa}. \qquad (D18) $$

Using the identities

$$ \sum_b q_{\bar{a}\bar{b}}(1 - \delta_{ab}) = \frac{1}{m} \sum_c q_{ac}(1 - \delta_{ac}) \sum_b P_{bc}(1 - \delta_{ab}) = \sum_c q_{ac}(1 - \delta_{ac}) - q_{\bar{a}a}, \qquad (D19) $$

$$ \sum_b q_{\bar{a}b}(1 - \delta_{ab}) = \sum_b q_{\bar{a}b} - q_{\bar{a}a}, \qquad (D20) $$

$$ \sum_b q_{\bar{a}\bar{b}}(1 - \delta_{ab}) = \frac{1}{m^2} \sum_{c \neq d} q_{cd} P_{ad} \sum_b P_{bc}(1 - \delta_{ab}) $$
$$= \frac{1}{m} \sum_{c \neq d} q_{cd} P_{ad} - \frac{1}{m^2} \sum_{c \neq d} q_{cd} P_{ad} P_{ac} = \sum_{b} q_{\bar{a}\bar{b}} - \frac{q_{\bar{a}\bar{a}}}{m}, \qquad (D21)$$

$$\sum_{b} f''(Q_{ab})q_{ab}(1 - \delta_{ab}) = f''(q_0) \sum_{b} q_{ab}(1 - \delta_{ab}) + (f''(q_0) - f''(q_1))q_{\bar{a}\bar{a}}, \quad (D22)$$

let us compute

$$\begin{aligned} \Lambda_* \sum_b q_{ab} (1 - \delta_{ab}) ={}& \beta^2 f''(q_0) \sum_b q_{ab} (1 - \delta_{ab}) + \beta^2 [f''(q_1) - f''(q_0)] q_{\bar{a}\bar{a}} - r_0^2 (n-1) \sum_{c \neq d} q_{cd} \\ & - (r_1 - r_0)^2 m^2 \left[ \sum_b q_{\bar{a}\bar{b}} - \frac{q_{\bar{a}\bar{a}}}{m} \right] - (r_d - r_1)^2 \sum_b q_{ab} (1 - \delta_{ab}) \\ & - m(r_d - r_1)(r_1 - r_0) \left[ \sum_b q_{\bar{a}\bar{b}} + \sum_b q_{ab} (1 - \delta_{ab}) - 2q_{\bar{a}\bar{a}} \right] \\ & - m r_0 (r_1 - r_0) \left[ (n-2) \sum_b q_{\bar{a}\bar{b}} + \sum_{b \neq c} q_{bc} \right] \\ & - r_0 (r_d - r_1) \left[ (n-2) \sum_b q_{ab} (1 - \delta_{ab}) + \sum_{b \neq c} q_{bc} \right], \end{aligned} \qquad (D23)$$

$$\begin{aligned} \Lambda_* q_{\bar{a}\bar{a}} ={}& \beta^2 f''(q_1) q_{\bar{a}\bar{a}} - \frac{m-1}{m} r_0^2 \sum_{c \neq d} q_{cd} - (r_1 - r_0)^2 (m-1) q_{\bar{a}\bar{a}} \\ & - (r_d - r_1)(r_1 - r_0) ((m-2)q_{\bar{a}\bar{a}} + q_{\bar{a}\bar{a}}) - (r_d - r_1)^2 q_{\bar{a}\bar{a}} \\ & - 2(m-1)r_0(r_1 - r_0) \sum_c q_{\bar{a}c} - r_0(r_d - r_1) \sum_c \left( q_{\bar{a}c} + \frac{m-2}{m} q_{ac} (1 - \delta_{ac}) \right). \end{aligned} \qquad (D24)$$

Next, using the identity

$$\sum_a \sum_b q_{\bar{a}\bar{b}} = \frac{1}{m} \sum_{b \neq c} q_{bc} \sum_a P_{ac} = \sum_{a \neq b} q_{ac}, \qquad (D25)$$

$$\sum_a q_{\bar{a}\bar{a}} = \frac{1}{m} \sum_a \sum_{b \neq c} q_{bc} P_{ab} P_{ac} = \frac{1}{m} \sum_{b \neq c} q_{bc} P_{bc} \sum_a P_{ab} = \sum_{b \neq c} q_{bc} P_{bc} = m \sum_a q_{\bar{a}\bar{a}}, \qquad (D26)$$

we can obtain the first two eigenvalues $\Lambda_1^{\text{1RSB}}$, $\Lambda_2^{\text{1RSB}}$, satisfying the system of equations

$$\begin{aligned} \Lambda_* \sum_{a \neq b} q_{ab} ={}& [\beta^2 f''(q_0) - (m(r_1 - r_0) + r_d - r_1)^2 - 2(n-1)r_0(m(r_1 - r_0) + r_d - r_1)] \sum_{a \neq b} q_{ab} \\ & + [\beta^2 (f''(q_1) - f''(q_0)) + m(r_1 - r_0)^2 + 2(r_1 - r_0)(r_d - r_1)] \sum_a q_{\bar{a}\bar{a}}, \end{aligned} \qquad (D27)$$

$$\begin{aligned} \Lambda_* \sum_a q_{\bar{a}\bar{a}} ={}& [\beta^2 f''(q_1) - (m-1)(m(r_1-r_0)^2 + 2(r_d-r_1)(r_1-r_0)) - (r_d-r_1)^2] \sum_a q_{\bar{a}\bar{a}} \\ & - (m-1) [nr_0^2 + 2r_0(m(r_1-r_0) + r_d - r_1)] \sum_{a \neq b} q_{ab}. \end{aligned} \qquad (D28)$$

The eigenvalues are obtained by ensuring a determinant equal to zero. Next, we suppose that $\sum_{a \neq b} q_{ab} = 0$ and $\sum_a q_{\bar{a}\bar{a}} = 0$ and compute a new pair of eigenvalues $\Lambda_2^{\text{1RSB}}$, $\Lambda_3^{\text{1RSB}}$

$$\Lambda_* \sum_b q_{\bar{a}\bar{b}} = [\beta^2 f''(q_0) - (m(r_1 - r_0) + r_d - r_1)^2 - (n-2)r_0(m(r_1 - r_0) + r_d - r_1)] \sum_b q_{\bar{a}\bar{b}}$$
$$ + [\beta^2(f''(q_1) - f''(q_0)) + m(r_1 - r_0)^2 + 2(r_1 - r_0)(r_d - r_1)] q_{\bar{a}\bar{a}}, \quad (D29) $$

$$ \Lambda_* q_{\bar{a}\bar{a}} = [\beta^2 f''(q_1) - (m-1)(m(r_1-r_0)^2 + 2(r_d-r_1)(r_1-r_0)) - (r_d-r_1)^2] q_{\bar{a}\bar{a}} \\ - (m-1)[2r_0(m(r_1-r_0) + r_d - r_1)] \sum_b q_{\bar{a}b}. \quad (D30) $$

Supposing then that $\sum_b q_{\bar{a}b} = 0$ and $q_{\bar{a}\bar{a}} = 0$, one can obtain a simple equation for yet another eigenvalue

$$ \Lambda_5^{1\text{RSB}} q_{\bar{a}\bar{b}} = [\beta^2 f''(q_0) - (m(r_1 - r_0) + r_d - r_1)^2] q_{\bar{a}\bar{b}}, \quad P_{ab} = 0. \quad (D31) $$

Supposing next that $q_{\bar{a}\bar{b}} = 0$ for $a, b = 1, \dots, n$ (ensuring thus that $\sum_b q_{\bar{a}b} = 0$), one obtains a system for the eigenvalues $\Lambda_6^{1\text{RSB}}$, $\Lambda_7^{1\text{RSB}}$

$$ \Lambda_* \sum_b q_{ab} (1 - \delta_{ab}) = [\beta^2 f''(q_0) - (r_d - r_1)^2 - m(r_d - r_1)(r_1 - r_0) \\ - r_0(n-2)(r_d - r_1)] \sum_b q_{ab} (1 - \delta_{ab}) \\ + m [\beta^2(f''(q_1) - f''(q_0)) + 2(r_d - r_1)(r_1 - r_0)] q_{\bar{a}a}, \quad (D32) $$

$$ \Lambda_* q_{\bar{a}a} = [\beta^2 f''(q_1) - (m-2)(r_d - r_1)(r_1 - r_0) - (r_d - r_1)^2] q_{\bar{a}a} \\ - \frac{m-2}{m} r_0 (r_d - r_1) \sum_b q_{ab} (1 - \delta_{ab}). \quad (D33) $$

To obtain the next eigenvalue, we suppose that $q_{\bar{a}a} = 0$ for $a = 1, \dots, n$, $q_{\bar{a}\bar{b}} = 0$ for $a, b = 1, \dots, n$ and $\sum_b q_{ab} = 0$ for $a = 1, \dots, n$, which yields

$$ \Lambda_8^{1\text{RSB}} q_{\bar{a}\bar{b}} = [\beta^2 f''(q_0) - (r_d - r_1)(m(r_1 - r_0) + r_d - r_1)] q_{\bar{a}\bar{b}}, \quad P_{ab} = 0. \quad (D34) $$

Finally supposing that $q_{\bar{a}b} = 0$ for $a, b = 1, \dots, n$ (ensuring thus $\sum_a q_{ab} = 0$) one obtains the two final eigenvalues $\Lambda_9^{1\text{RSB}}$, $\Lambda_{10}^{1\text{RSB}}$ that correspond respectively to $P_{ab} = 1$ and $P_{ab} = 0$

$$ \Lambda_9^{1\text{RSB}} q_{ab} = [\beta^2 f''(q_1) - (r_d - r_1)^2] q_{ab}, \quad P_{ab} = 1, \quad (D35) $$

$$ \Lambda_{10}^{1\text{RSB}} q_{ab} = [\beta^2 f''(q_0) - (r_d - r_1)^2] q_{ab}, \quad P_{ab} = 0. \quad (D36) $$

## Appendix E: Annealed Complexity of Minima at Fixed Energy

As shown in the main text, the opposite of the annealed complexity of minima at fixed energy $e$ provides a lower bound for the large-deviation function $\mathcal{L}_{\text{RS}}(e)$. Let us compute this quantity explicitly, by first computing the average density of minima at energy $e$, given by

$$ \overline{n_{\min}(e)} = \int_{\sqrt{N}\mathcal{S}_{N-1}} d\mathbf{x} \frac{\overline{\delta(\nabla H(\mathbf{x}))}}{\det \nabla^2 H(\mathbf{x}) |\Theta[\nabla^2 H(\mathbf{x})] \delta(e - H(\mathbf{x})/N)|}, \quad (E1) $$

where $\Theta[A] = 1$ if all the eigenvalues of $A$ are positive and zero otherwise. The Hamiltonian, its gradient and the Hessian have Gaussian zero average statistics which satisfy

$$ \overline{H(\mathbf{x})^2} = Nf(1), \quad (E2) $$

$$ \overline{(\nabla H)_i(\mathbf{x}) H(\mathbf{x})} = 0, \quad (E3) $$

$$ \overline{(\nabla H)_i(\mathbf{x})(\nabla H)_j(\mathbf{x})} = -\overline{(\nabla^2 H)_{ij}(\mathbf{x}) H(\mathbf{x})} = f'(1)\delta_{ij}, \quad (E4) $$
$$ \overline{(\nabla^2 H)_{ij}(\mathbf{x})(\nabla H)_k(\mathbf{x})} = 0, \qquad (E5) $$

$$ \overline{(\nabla^2 H)_{ij}(\mathbf{x})(\nabla^2 H)_{kl}(\mathbf{x})} = \frac{1}{N} \left[ (\delta_{ik}\delta_{jl} + \delta_{il}\delta_{jk})f''(1) + \delta_{ij}\delta_{kl}(f''(1) + f'(1)) \right]. \qquad (E6) $$

The Hessian matrix conditioned on zero gradient and a fixed value of the energy has a non-zero average given by

$$ \mathbb{E}[(\nabla^2 H)_{ij}(\mathbf{x})|\nabla H(\mathbf{x}) = \mathbf{0}, H(\mathbf{x}) = Ne] = \frac{\overline{(\nabla^2 H)_{ij}(\mathbf{x})H(\mathbf{x})}}{H(\mathbf{x})^2} Ne = -\frac{f'(1)}{f(1)}e, \quad (E7) $$

and a modified covariance

$$ \begin{aligned} & \mathrm{Cov}[(\nabla^2 H)_{ij}(\mathbf{x}), (\nabla^2 H)_{kl}(\mathbf{x})|\nabla H(\mathbf{x}) = \mathbf{0}, H(\mathbf{x}) = Ne] \\ &= \overline{(\nabla^2 H)_{ij}(\mathbf{x})(\nabla^2 H)_{kl}(\mathbf{x})} - \frac{\overline{(\nabla^2 H)_{ij}(\mathbf{x})H(\mathbf{x})} \times \overline{(\nabla^2 H)_{kl}(\mathbf{x})H(\mathbf{x})}}{H(\mathbf{x})^2} \\ &= \frac{1}{N} \left[ (\delta_{ik}\delta_{jl} + \delta_{il}\delta_{jk})f''(1) + \delta_{ij}\delta_{kl} \left( f''(1) + f'(1) - \frac{f'(1)^2}{f(1)} \right) \right]. \end{aligned} \qquad (E8) $$

Using these expressions, one can express

$$ \overline{n_{\min}(e)} = \frac{N^{(N-1)/2} S_{N-1}}{(2\pi f'(1))^{(N-1)/2}} \int_{-\infty}^{\infty} \frac{dx}{\sqrt{2\pi}} e^{-\frac{N}{2}\left(x^2 + \frac{e^2}{f(1)}\right)} \mathbb{E}[|\det \mathcal{H}|\Theta[\mathcal{H}]|_{X \in \text{GOE}}], \quad (E9) $$

$$ \mathcal{H} = \sqrt{f''(1)} X + \left( \sqrt{f''(1) + f'(1) - \frac{f'(1)^2}{f(1)}} x - \frac{f'(1)}{f(1)} e \right) \mathbb{I}. \qquad (E10) $$

At this stage, it is important to notice that

$$ f(1)(f''(1) + f'(1)) - f'(1)^2 = \frac{1}{2} \sum_{r,p=2}^{\infty} g_r g_p (r-p)^2 + \Gamma \sum_{r=2}^{\infty} (r-1)^2, \quad (E11) $$

is strictly positive apart in the case of the pure p-spin where this quantity is zero.

Let us first discuss the pure p-spin model. Using that $f'(1)/f(1) = p$, the annealed complexity at fixed energy is readily obtained as

$$ \begin{aligned} \Sigma_{p,\min}(e) &= \lim_{N \to \infty} \frac{1}{N} \ln \overline{n_{p,\min}(e)} \\ &= -\frac{pe^2}{2} + \frac{1}{2} + \frac{1}{2} \ln(p-1) + \int_{-2}^{2} \frac{d\lambda}{2\pi} \sqrt{4-\lambda^2} \ln \left| \lambda - \frac{p}{\sqrt{p-1}}e \right| . \end{aligned} \qquad (E12) $$

Using the identity

$$ \begin{aligned} \int_{-2}^{2} \frac{d\lambda}{2\pi} \sqrt{4-\lambda^2} \ln |\lambda+u| &= -\frac{1}{2} + \frac{u^2}{4} \\ -\Theta(u-2) \left( \frac{u}{4}\sqrt{u^2-4} - \ln \left( \frac{u+\sqrt{u^2-4}}{2} \right) \right), \end{aligned} \qquad (E13) $$

it yields [31, 34]

$$ \Sigma_{p,\min}(e) = \lim_{N \to \infty} \frac{1}{N} \ln \overline{n_{p,\min}(e)} \qquad (E14) $$
$$ = \frac{1}{2} \ln(p-1) - \frac{p-2}{p} \frac{e^2}{e_{c,RS}^2} + \Theta(e_{c,RS} - e) \left[ \frac{e\sqrt{e^2 - e_{c,RS}^2}}{e_{c,RS}^2} + \ln\left(\frac{e - \sqrt{e^2 - e_{c,RS}^2}}{e_{c,RS}}\right) \right], \quad (E15) $$

$$ e_{c,RS} = e_{RSB} = -\frac{2}{p}\sqrt{p-1}. \quad (E16) $$

The annealed complexity is negative for any energy $e \le e_{typ}$, and positive in the complementary range $e > e_{typ}$. For this model we find that the annealed complexity satisfies

$$ \Sigma_{p,\min}(e) = -\mathcal{L}_{p,RS}(e), \quad e \le e_{typ}. \quad (E17) $$

Let us now consider more general spherical models for which Eq. (E11) is positive. The associated annealed complexity is obtained as

$$ \begin{aligned} \Sigma_{\min}(e) &= \lim_{N \to \infty} \frac{1}{N} \ln \overline{n_{\min}(e)} \\ &= \max_{u \ge 2} \left[ -\frac{(ef'(1) + uf(1)\sqrt{f''(1)})^2}{2f(1)^2(f''(1) + f'(1) - \frac{f'(1)^2}{f(1)})} - \frac{e^2}{2f(1)} + \frac{1}{2} \right. \\ & \qquad \left. - \frac{1}{2} \ln \frac{f'(1)}{f''(1)} + \int_{-2}^{2} \frac{d\lambda}{2\pi} \sqrt{4 - \lambda^2} \ln|\lambda + u| \right]. \end{aligned} \quad (E18) $$

One can then use the identity (E13) in order to express explicitly the last term of this equation. Recasting the optimisation problem in terms of a new variable $v \in [0, 1/\sqrt{f''(1)}]$ such that

$$ u = \frac{1}{v\sqrt{f''(1)}} + v\sqrt{f''(1)}, \quad (E19) $$

one obtains

$$ \begin{aligned} \Sigma_{\min}(e) &= \lim_{N \to \infty} \frac{1}{N} \ln \overline{n_{\min}(e)} \\ &= \max_{v \in [0, 1/\sqrt{f''(1)})} \left[ -\frac{(evf'(1) + f(1)v^2f''(1) + f(1))^2}{2v^2f(1)(f(1)(f''(1) + f'(1)) - f'(1)^2)} \right. \\ & \qquad \left. - \frac{e^2}{2f(1)} + \frac{1}{2}(1 + v^2f''(1)) - \ln(v\sqrt{f'(1)}) \right]. \end{aligned} \quad (E20) $$

The saddle-point equation yields

$$ v_* = -\frac{e + \sqrt{e^2 - e_{c,RS}^2}}{2(f'(1) - f(1))}, \quad e_{c,RS} = -2\sqrt{f(1)\left(1 - \frac{f(1)}{f'(1)}\right)}, \quad (E21) $$

which lies within the interval $[0, 1/\sqrt{f''(1)}]$ for

$$ e \le e_{RSB} = -\frac{1}{\sqrt{f''(1)}} \left[ f'(1) + f(1) \left( \frac{f''(1)}{f'(1)} - 1 \right) \right]. \quad (E22) $$
At the saddle-point, the second derivative of the expression to maximise reads

$$ -\frac{(1 - v_*^2 f''(1))}{v_*^2} \left( 1 + \frac{f(1)(1 - v_*^2 f''(1))}{v_*^2(f(1)(f'(1) + f''(1)) - f'(1)^2)} \right) \le 0, \quad (E23) $$

thus showing that $v_*$ is indeed the maximum over the interval $[0, 1/\sqrt{f''(1)}]$.

Inserting this value in Eq. (E20), one can check that for any energy $e \le e_t$, corresponding to the RS regime,

$$ \Sigma_{\min}(e) = -\mathcal{L}(e) \quad (E24) $$

$$ \begin{aligned} = & \frac{2f(1)}{f'(1)} \frac{e^2}{e_{c,RS}^2} - \frac{e}{e_{c,RS}^2} \left( e - \sqrt{e^2 - e_{c,RS}^2} \right) \\ & + \ln \left( \frac{e - \sqrt{e^2 - e_{c,RS}^2}}{e_{c,RS}} \right) - \frac{1}{2} \ln \frac{f(1)}{f'(1) - f(1)}. \end{aligned} \quad (E25) $$

While the identification with $\mathcal{L}(e)$ is not exact for $e \ge e_t$, the expression of $\Sigma_{\min}(e)$ remains the same for any $e \le e_{RSB}$. This identity is not expected to hold within the replica-symmetry broken phase as one naturally expects that $\Sigma_{\min}(e) > 0$ in this regime.

For energies $e > e_{RSB}$, the parameter $v$ is pinned at the value $1/\sqrt{f''(1)}$ and the annealed complexity reads

$$ \begin{aligned} \Sigma_{\min}(e) = & -\frac{4f(1)f''(1) + 4ef(1)\sqrt{f''(1)} + e^2(f'(1) + f''(1))}{2(f(1)(f'(1) + f''(1)) - f'(1)^2)} \\ & + 1 - \frac{1}{2}\ln \frac{f'(1)}{f''(1)}, \quad e \ge e_{RSB}. \end{aligned} \quad (E26) $$

Note that all the expressions for the annealed complexity and the bounds are universal in the sense that they only depend on the covariance function $f(q)$ through its value and the values of its first two derivative for $q = 1$. The annealed complexity $\Sigma_{\min}(e)$ is generically positive in a finite band of energy $e \in [\mathcal{E}_{\min}, \mathcal{E}_{\max}]$ (possibly reduced to a single point in the case $\mathcal{E}_{\min} = \mathcal{E}_{\max}$). The expression of the annealed complexity in Eq. (E26) has two zeros for $\Gamma < \Gamma_{RSB}$,

$$ e_{0,\pm} = -\frac{2f'(1)\sqrt{f''(1)}}{f'(1) + f''(1)} \pm \sqrt{\left(\frac{2(f'(1) - f''(1))}{f'(1) + f''(1)} + \ln \frac{f''(1)}{f'(1)}\right) \left(f(1) - \frac{f'(1)^2}{f'(1) + f''(1)}\right)}. \quad (E27) $$

One can show in particular that in this regime $e_{0,+} \ge e_{RSB}$, thus showing that $\mathcal{E}_{\max} = e_{0,+}$. The parameters $e_{0,-}$ and $e_{RSB}$ cross for a non-trivial value of the magnetic field $\Gamma = \Gamma_{cr}$ obtained from solving the equation

$$ \begin{aligned} x(y) &= y \frac{y-1-\ln y}{(1-y^2)}, \quad 0 \le x = \frac{f(1)}{f'(1)} = \frac{\Gamma_{cr} + g(1)}{\Gamma_{cr} + g'(1)} \le 1, \\ 0 \le y &= \frac{f'(1)}{f''(1)} = \frac{\Gamma_{cr} + g'(1)}{g''(1)} < 1. \end{aligned} \quad (E28) $$

Note that this equation is exactly the same as the equation for $\mu_{typ}$ as a function $\rho_{typ}$, allowing to obtain the value of $e_{typ}$ in the case of zero magnetic field. For $\Gamma = \Gamma_{RSB}$, one has
$f'(1) = f''(1)$ and the two zeros $e_{0,\pm}$ coalesce and are equal to $e_{0,\pm} = e_{typ} = -\sqrt{f'(1)}$, and for larger magnetic field $\Gamma > \Gamma_{RSB}$ the expression Eq. (E26) has no zero. The expression for the annealed complexity in Eq. (E25) has instead a single zero $e_{0,RS}$, which takes a non-trivial value for $0 < \Gamma < g'(1) - 2g(1)$, i.e. $2f(1) < f'(1)$, while in the converse case $e_{0,RS} = -\sqrt{f'(1)}$. Solving for $e_{0,RS} = e_{RSB}$, one recovers exactly the same equation as in (E28) and thus the three different values $e_{0,RS}$, $e_{0,-}$ and $e_{RSB}$ cross for $\Gamma = \Gamma_{cr}$. To summarise, we have thus obtained that

$$ \Sigma_{\min}(e) \ge 0, \quad e \in [\mathcal{E}_{\min}, \mathcal{E}_{\max}], \quad \mathcal{E}_{\min} = \begin{cases} e_{0,RS}, & 0 \le \Gamma \le \Gamma_{cr} \\ e_{0,-}, & \Gamma_{cr} \le \Gamma \le \Gamma_{RSB} \\ e_{typ}, & \Gamma \ge \Gamma_{RSB} \end{cases}, \\ \mathcal{E}_{\max} = \begin{cases} e_{0,+}, & 0 \le \Gamma \le \Gamma_{RSB} \\ e_{typ}, & \Gamma \ge \Gamma_{RSB} \end{cases}. \qquad (E29) $$

One naturally expects that for any value of $\Gamma$, the annealed complexity is positive at the typical value of the energy $\Sigma_{\min}(e_{typ}) \ge 0$ such that $e_{typ} \in [\mathcal{E}_{\min}, \mathcal{E}_{\max}]$. Note that for models for which $e_{typ}$ belongs to the 1RSB phase, $e_{0,RS} = e_{typ}$ for $\Gamma = 0$.

## References

1. Mezard, M., Montanari, A.: Information, Physics, and Computation. Oxford Graduate Texts. Oxford University Press, Oxford (2009)

2. Choromanska, A., Henaff, M., Mathieu, M., BenArous, G.: The loss surfaces of multilayer networks. In: Proceedings of the 18th International Conference on Artificial Intelligence and Statistics (AISTATS), p. 192 (2015)

3. Ros, V., Fyodorov, Y.V.: The high-d landscapes paradigm: spin-glasses, and beyond (2022). arXiv:2209.07975

4. Auffinger, A., Montanari, A., Subag, E.: Optimization of random high-dimensional functions: structure and algorithms (2022). arXiv:2206.10217

5. Sherrington, D., Kirkpatrick, S.: Solvable model of a spin-glass. Phys. Rev. Lett. 35, 1792 (1975)

6. Montanari, A.: Optimization of the Sherrington-Kirkpatrick Hamiltonian. SIAM J. Comput. FOCS19-1 (2021)

7. Parisi, G.: A sequence of approximated solutions to the SK model for spin glasses. J. Phys. A 13, L115 (1980)

8. Mézard, M., Parisi, G., Virasoro, M.A.: Spin Glass Theory and Beyond: An Introduction to the Replica Method and Its Applications. Lecture Notes in Physics, vol. 9. World Scientific Publishing Company, Singapore (1987)

9. Castellani, T., Cavagna, A.: Spin-glass theory for pedestrians. J. Stat. Mech. 2005, P05012 (2005)

10. Rizzo, T.: Chaos in mean-field spin-glass models. In: Spin Glasses: Statics and Dynamics: Summer School, pp. 143–157. Springer, Paris (2009)

11. Guerra, F.: Broken replica symmetry bounds in the mean field spin glass model. Commun. Math. Phys. 233, 1 (2003)

12. Talagrand, M.: The Parisi formula. Ann. Math. 163, 221 (2006)

13. Panchenko, D.: The Sherrington-Kirkpatrick model. Springer, New York (2013)

14. Auffinger, A., Chen, W.-K., Zeng, Q.: The SK model is infinite step replica symmetry breaking at zero temperature. Commun. Pure Appl. Math. 73 (2020)

15. Crisanti, A., Sommers, H.-J.: The spherical p-spin interaction spin glass model: the statics. Zeitschrift für Physik B 87, 341 (1992)

16. Talagrand, M.: Free energy of the spherical mean field model. Probab. Theory Relat. Fields 134, 339 (2006)

17. Antonio Auffinger, A., Chen, W.-K.: Parisi formula for the ground state energy in the mixed p-spin model. Ann. Probab. 45, 4617 (2017)

18. Chen, W.-K., Sen, A.: Parisi formula, disorder chaos and fluctuation for the ground state energy in the spherical mixed p-spin models. Commun. Math. Phys. 350, 129 (2017)
19. Jagannath, A., Tobasco, I.: Low temperature asymptotics of spherical mean field spin glasses. Commun. Math. Phys. **352**, 979 (2017)

20. Subag, E.: Following the ground-states of full-RSB spherical spin glasses (2018). arXiv:1812.04588

21. Auffinger, A., Zeng, Q.: Existence of two-step replica symmetry breaking for the spherical mixed p-spin glass at zero temperature. Commun. Math. Phys. **370**, 377 (2019)

22. Auffinger, A., Zhou, Y.: The spherical $p+s$ spin glass at zero temperature (2022). arXiv:2209.03866

23. Krakoviack, V.: Comment on "spherical 2+ p spin-glass model: an analytically solvable model with a glass-to-glass transition". Phys. Rev. B **76**, 136401 (2007)

24. Crisanti, A., Leuzzi, L.: Reply to "comment on 'spherical 2+ p spin-glass model: an analytically solvable model with a glass-to-glass transition'". Phys. Rev. B **76**, 136402 (2007)

25. Crisanti, A., Leuzzi, L.: Amorphous-amorphous transition and the two-step replica symmetry breaking phase. Phys. Rev. B **76**, 184417 (2007)

26. Crisanti, A., Leuzzi, L.: Spherical 2+ p spin-glass model: an exactly solvable model for glass to spin-glass transition. Phys. Rev. Lett. **93**, 217203 (2004)

27. Crisanti, A., Leuzzi, L.: Spherical 2+ p spin-glass model: an analytically solvable model with a glass-to-glass transition. Phys. Rev. B **73**, 014412 (2006)

28. Fyodorov, Y.V.: Complexity of random energy landscapes, glass transition, and absolute value of the spectral determinant of random matrices. Phys. Rev. Lett. **92**, 240601 (2004)

29. Fyodorov, Y.V., Williams, I.: Replica symmetry breaking condition exposed by random matrix calculation of landscape complexity. J. Stat. Phys. **129**, 1081 (2007)

30. Fyodorov, Y.V.: High-dimensional random fields and random matrix theory. Markov Process. Relat. Fields **21**, 483 (2015)

31. Auffinger, A., Arous, G.B., Černý, J.: Random matrices and complexity of spin glasses. Commun. Pure Appl. Math. **66**, 165 (2013)

32. Auffinger, A., Ben Arous, G.: Complexity of random smooth functions on the high-dimensional sphere. Ann. Probab. **41**, 4214 (2013)

33. Subag, E.: The geometry of the Gibbs measure of pure spherical spin glasses. Invent. Math. **210**, 135 (2017)

34. Crisanti, A., Sommers, H.-J.: Thouless-Anderson-Palmer approach to the spherical p-spin spin glass model. J. Phys. I **5**, 805 (1995)

35. Subag, E.: The free energy of spherical pure $p$-spin models—computation from the tap approach (2021). arXiv:2101.04352

36. Belius, D.: High temperature tap upper bound for the free energy of mean field spin glasses (2022). arXiv:2204.00681

37. Gradenigo, G., Angelini, M.C., Leuzzi, L., Ricci-Tersenghi, F.: Solving the spherical p-spin model with the cavity method: equivalence with the replica results. J. Stat. Mech. **2020**, 113302 (2020)

38. Kosterlitz, J.M., Thouless, D.J., Jones, R.C.: Spherical model of a spin-glass. Phys. Rev. Lett. **36**, 1217 (1976)

39. Tracy, C.A., Widom, H.: On orthogonal and symplectic matrix ensembles. Commun. Math. Phys. **177**, 727 (1996)

40. Arous, G.B., Dembo, A., Guionnet, A.: Aging of spherical spin glasses. Probab. Theory Relat. Fields **120**, 1 (2001)

41. Dean, D.S., Majumdar, S.N.: Large deviations of extreme eigenvalues of random matrices. Phys. Rev. Lett. **97**, 160201 (2006)

42. Fyodorov, Y.V., Le Doussal, P.: Topology trivialization and large deviations for the minimum in the simplest random optimization. J. Stat. Phys. **154**, 466 (2014)

43. Majumdar, S.N., Schehr, G.: Top eigenvalue of a random matrix: large deviations and third order phase transition. J. Stat. Mech. **P01012** (2014)

44. Baik, J., Collins-Woodfin, E., Le Doussal, P., Wu, H.: Spherical spin glass model with external field. J. Stat. Phys. **183**, 31 (2021)

45. Cugliandolo, L., Dean, D.: On the dynamics of a spherical spin-glass in a magnetic field. J. Phys. A **28**, L453 (1995)

46. Mehta, D., Hauenstein, J.D., Niemerg, M., Simm, N.J., Stariolo, D.A.: Energy landscape of the finite-size mean-field 2-spin spherical model and topology trivialization. Phys. Rev. E **91**, 022133 (2015)

47. Dembo, A., Zeitouni, O.: Matrix optimization under random external fields. J. Stat. Phys. **159**, 1306 (2015)

48. Landon, B., Sosoe, P.: Fluctuations of the overlap at low temperature in the 2-spin spherical SK model. In: Annales de l'Institut Henri Poincare (B) Probabilites et statistiques, vol. 58, pp. 1426-1459. Institut Henri Poincaré (2022)
49. Kivimae, P.: Critical fluctuations for the spherical Sherrington–Kirkpatrick model in an external field (2019). arXiv:1908.07512

50. Landon, B., Sosoe, P.: Fluctuations of the 2-spin SSK model with magnetic field (2020). arXiv:2009.12514

51. Belius, D., Černý, J., Nakajima, S., Schmidt, M.A.: Triviality of the geometry of mixed p-spin spherical Hamiltonians with external field. J. Stat. Phys. **186**, 12 (2022)

52. Pastore, M., Di Gioacchino, A., Rotondo, P.: Large deviations of the free energy in the p-spin glass spherical model. Phys. Rev. Res. **1**, 033116 (2019)

53. Rammal, R.: Phd thesis, Grenoble University, unpublished (1981)

54. Andreanov, A., Barbieri, F., Martin, O.C.: Large deviations in spin-glass ground-state energies. Eur. Phys. J. B **41**, 365 (2004)

55. Rivoire, O.: The cavity method for large deviations. J. Stat. Mech. **2005**, P07004 (2005)

56. Parisi, G., Rizzo, T.: Large deviations in the free energy of mean-field spin glasses. Phys. Rev. Lett. **101**, 117205 (2008)

57. Parisi, G., Rizzo, T.: Phase diagram and large deviations in the free energy of mean-field spin glasses. Phys. Rev. B **79**, 134205 (2009)

58. Parisi, G., Rizzo, T.: Universality and deviations in disordered systems. Phys. Rev. B **81**, 094201 (2010)

59. Monthus, C., Garel, T.: Matching between typical fluctuations and large deviations in disordered systems: application to the statistics of the ground state energy in the SK spin-glass model. J. Stat. Mech. **2010**, P02023 (2010)

60. Malatesta, E.M., Parisi, G., Sicuro, G.: Fluctuations in the random-link matching problem. Phys. Rev. E **100**, 032102 (2019)

61. Vulpiani, A., Cecconi, F., Cencini, M., Puglisi, A., Vergni, D.: Large Deviations in Physics. The Legacy of the Law of Large Numbers. Springer, Berlin (2014)

62. Baik, J., Lee, J.O.: Fluctuations of the free energy of the spherical Sherrington–Kirkpatrick model. J. Stat. Phys. **165**, 185 (2016)

63. Subag, E.: The complexity of spherical *p*-spin models-a second moment approach. Ann. Probab. **45**, 3385 (2017)

64. Subag, E., Zeitouni, O.: The extremal process of critical points of the pure p-spin spherical spin glass model. Probab. Theory Relat. Fields **168**, 773 (2017)

65. Fyodorov, Y.V., Sommers, H.-J.: Classical particle in a box with random potential: exploiting rotational symmetry of replicated Hamiltonian. Nucl. Phys. B **764**, 128 (2007)

66. Franz, S., Rocchi, J.: Large deviations of glassy effective potentials. J. Phys. A **53**, 485002 (2020)

67. Zhou, Y.: The spherical mixed *p*-spin glass at zero temperature (2023). arXiv:2303.04943

**Publisher's Note** Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.