Skip to content
QFT.org

Search QFT.org

Enter a word or phrase.

    You can also browse the main navigation and chapter contents.

    Implicit Differentiation through Solvers

    A self-consistent mass is defined by an equation, but a computer obtains it by an algorithm. Differentiating a finite number of iterations gives the response of that algorithm's current output. Differentiating the defining equation gives the response of its locally unique solution. These derivatives can agree after convergence, but neither a solver success flag nor a failed fixed-point iteration settles the question.

    We compute a coupling response in a reference-subtracted Hartree approximation. Its root is well conditioned even when a simple iteration fails. The example separates physical approximation, quadrature, root accuracy and derivative accuracy, and then extends the same reasoning to matrix-valued systems.

    Preparation: Forward and reverse AD supplies JVPs and VJPs. The Hartree subtraction is developed in integral-equation solvers; the conditions needed here are restated below.

    Specify what stays fixed when the coupling changes

    Consider a scalar theory in 1+11+1 dimensions with potential

    V(ϕ)=12(m02+σ)ϕ2+λ24ϕ4.(1)V(\phi)=\frac12(m_0^2+\sigma)\phi^2+\frac\lambda{24}\phi^4. \tag{1}

    The zero-mean Hartree closure replaces the cubic field term by 3⟨ϕ2⟩ϕ3\langle\phi^2\rangle\phi. For a static vacuum with internal squared mass y>0y>0, a symmetric momentum cutoff Λ\Lambda gives

    y=m02+σ+λ2⟨ϕ2⟩,⟨ϕ2⟩=∫−ΛΛdk2π12k2+y=12πarsinh⁡Λy.(2)y=m_0^2+\sigma+\frac\lambda2\langle\phi^2\rangle, \qquad \langle\phi^2\rangle =\int_{-\Lambda}^{\Lambda}\frac{dk}{2\pi}\frac1{2\sqrt{k^2+y}} =\frac1{2\pi}\operatorname{arsinh}\frac\Lambda{\sqrt y}. \tag{2}

    Thus the tadpole coefficient is c=λ/(4π)c=\lambda/(4\pi). The λ/24\lambda/24 action, local mass insertion and Hartree scope are supported by Baacke and Heinen, §II, Eqs.(2.1)–(2.3), and §III.A (PDF). Their nonequilibrium calculation is not being reproduced; Eq.(2) defines our static hard-cutoff approximation.

    Fix a reference mass MM by requiring y=M2y=M^2 at σ=0\sigma=0, for every value of cc. Eliminating the bare parameter between the two conditions gives

    m02(c,Λ)=M2−carsinh⁡(Λ/M),y=M2+σ+cHΛ(y),HΛ(y)=∫0Λdk[1k2+y−1k2+M2].(3)\begin{aligned} m_0^2(c,\Lambda)&=M^2-c\operatorname{arsinh}(\Lambda/M),\\ y&=M^2+\sigma+cH_\Lambda(y),\\ H_\Lambda(y)&=\int_0^\Lambda dk\left[ \frac1{\sqrt{k^2+y}}-\frac1{\sqrt{k^2+M^2}} \right]. \end{aligned} \tag{3}

    As cc changes, m02m_0^2 is therefore retuned. This defines a different derivative from holding the bare mass fixed. Subtracting a tadpole into the mass is also discussed in Baacke and Heinen, §III.D, Eqs.(3.15)–(3.20) (PDF); our reference condition and finite regulator are explicitly those in Eq.(3).

    Use M=1M=1 as the unit of mass, with σ=1\sigma=1 and Λ=16\Lambda=16. Hence yy, cc and σ\sigma below denote their dimensionless values in these units. Define

    F(y,c)=y−2−cHΛ(y).(4)F(y,c)=y-2-cH_\Lambda(y). \tag{4}

    The numerical task is to solve F=0F=0 and determine dy/dcdy/dc while this reference condition remains fixed. The answer concerns the internal Hartree mass, not an exact pole mass of the interacting theory.

    Differentiate the equation, not the solver history

    Suppose F(y,c)F(y,c) is continuously differentiable near a root and Fy≠0F_y\ne0. Differentiating F(y(c),c)=0F(y(c),c)=0 gives

    Fydydc+Fc=0,dydc=−FcFy.(5)F_y\frac{dy}{dc}+F_c=0, \qquad \frac{dy}{dc}=-\frac{F_c}{F_y}. \tag{5}

    The implicit function theorem makes this a local statement about a particular branch. It does not select among distinct roots or guarantee invertibility elsewhere. This root formulation and its JVP/VJP implementation are explained in Blondel et al., §2.1, Eqs.(1)–(6).

    For our example an independent integration gives

    HΛ(y)=arsinh⁡Λy−arsinh⁡Λ,HΛ′(y)=−Λ2yΛ2+y.(6)H_\Lambda(y)=\operatorname{arsinh}\frac\Lambda{\sqrt y} -\operatorname{arsinh}\Lambda, \qquad H_\Lambda'(y)=-\frac\Lambda{2y\sqrt{\Lambda^2+y}}. \tag{6}

    For c>0c>0, Fy=1−cHΛ′>1F_y=1-cH_\Lambda'>1. Moreover, F(1,c)=−1F(1,c)=-1 and F(2,c)=−cHΛ(2)>0F(2,c)=-cH_\Lambda(2)>0. Consequently there is exactly one root in (1,2)(1,2), and

    dydc=HΛ(y)1−cHΛ′(y)<0,dmHdλ=18πydydc,mH=y.(7)\frac{dy}{dc}=\frac{H_\Lambda(y)}{1-cH_\Lambda'(y)}<0, \qquad \frac{dm_H}{d\lambda}=\frac1{8\pi\sqrt y}\frac{dy}{dc}, \qquad m_H=\sqrt y. \tag{7}

    The negative response is compatible with the positive tadpole in Eq.(2): increasing the coupling also lowers the bare mass according to the fixed reference condition. Ignoring that retuning would change the derivative's sign in this example.

    There is no positive-cc bifurcation of this branch. A denominator becoming small can signal a genuine large response in other equations, but that mechanism is excluded here by Fy>1F_y>1.

    A numerical root with separately checked partial derivatives

    The calculation reuses the finite-momentum quadrature from the integral-equation example. Its stable difference is

    1Ey−1E1=1−yEyE1(Ey+E1),Ey=k2+y,E1=k2+1.(8)\frac1{E_y}-\frac1{E_1} =\frac{1-y}{E_yE_1(E_y+E_1)}, \qquad E_y=\sqrt{k^2+y},\quad E_1=\sqrt{k^2+1}. \tag{8}

    With k=sinh⁡tk=\sinh t, Gauss–Legendre quadrature on the fixed interval 0≤t≤arsinh⁡Λ0\le t\le\operatorname{arsinh}\Lambda evaluates the integral. An AD-compatible version of Eq.(8), on the same fixed nodes, supplies FyF_y and FcF_c by actual dual propagation. A bracketed root solve supplies yy. We then apply Eq.(5), without differentiating the root solver's branches or stopping rule.

    The independent benchmark solves the closed-arsinh⁡\operatorname{arsinh} equation and differentiates Eq.(6). Thus the closed answer is not inserted into the numerical quadrature. With order 128 quadrature:

    ccyydy/dcdy/dcdmH/dλdm_H/d\lambda
    0.250.251.918763248451.91876324845−0.305142250900-0.305142250900−0.008764997369-0.008764997369
    111.727399093861.72739909386−0.211567679898-0.211567679898−0.006404911306-0.006404911306
    441.370740697851.37074069785−0.0640748034771-0.0640748034771−0.002177558191-0.002177558191

    Across the fixed orders 64, 128 and 256 and these three couplings, squared-mass differences from the closed benchmark are below 1.9×10−141.9\times10^{-14} and response differences below 4.4×10−154.4\times10^{-15}. Refinement at this scale need not be monotone: rounding and the root stopping error are already comparable to the quadrature changes.

    At c=1c=1, centered differences of separately solved roots reproduce the derivative with errors 9.49×10−79.49\times10^{-7}, 9.49×10−99.49\times10^{-9} and 9.54×10−119.54\times10^{-11} at coupling steps 10−210^{-2}, 10−310^{-3} and 10−410^{-4}. The error reaches 3.7×10−143.7\times10^{-14} at 10−510^{-5}, then grows to 1.4×10−101.4\times10^{-10} at 10−710^{-7}. Agreement at several steps is more informative than choosing only the most favorable one.

    Residual accuracy and response accuracy

    Because Fy≥1F_y\ge1 for positive yy, the exact finite-cutoff residual obeys the mean-value bound

    ∣y~−y∗∣≤∣F(y~,c)∣.(9)|\widetilde y-y_*|\le |F(\widetilde y,c)|. \tag{9}

    A quadrature residual alone does not give this exact bound unless its integration error is also controlled. Here we can recompute FF from Eq.(6).

    For the response function r(y,c)=HΛ(y)/(1−cHΛ′(y))r(y,c)=H_\Lambda(y)/(1-cH_\Lambda'(y)), its derivative with respect to the approximate root is

    ∂yr=HΛ′1−cHΛ′+cHΛHΛ′′(1−cHΛ′)2,HΛ′′=Λ(2Λ2+3y)4y2(Λ2+y)3/2.(10)\partial_y r =\frac{H_\Lambda'}{1-cH_\Lambda'} +\frac{cH_\Lambda H_\Lambda''}{(1-cH_\Lambda')^2}, \qquad H_\Lambda''=\frac{\Lambda(2\Lambda^2+3y)}{4y^2(\Lambda^2+y)^{3/2}}. \tag{10}

    A bound on this expression over a root bracket turns a value-error bound into a response-error bound. In a matrix problem the analogous estimate also depends on the inverse Jacobian and the accuracy of its linear solve; see Blondel et al., §3 and Appendix D.

    At fixed order 128 and c=1c=1, requesting root absolute tolerance 10−410^{-4} gives an actual squared-mass error 1.56×10−81.56\times10^{-8}, closed residual 2.01×10−82.01\times10^{-8} and response error 3.91×10−93.91\times10^{-9}. The 10−810^{-8} and 10−1210^{-12} requests happen to stop at the same numerical root: value error 1.49×10−141.49\times10^{-14} and response error 4.19×10−154.19\times10^{-15}. A tolerance is an algorithmic condition, not a predicted error equal to that number.

    What differentiating a finite iteration returns

    Consider the undamped iteration

    yn+1=2+cHΛ(yn),y0=2.(11)y_{n+1}=2+cH_\Lambda(y_n),\qquad y_0=2. \tag{11}

    Since y0y_0 is independent of cc, its derivative starts at d0=0d_0=0. Forward differentiation gives

    dn+1=HΛ(yn)+cHΛ′(yn)dn.(12)d_{n+1}=H_\Lambda(y_n)+cH_\Lambda'(y_n)d_n. \tag{12}

    This is the exact derivative of the finite iteration program in real arithmetic. It approaches Eq.(7) only if the iteration and derivative propagation converge appropriately. For c=1c=1, Eq.(11) maps [1,2][1,2] into itself and its derivative has magnitude below 1/21/2. The retained derivative errors after 44, 88, 1616 and 3232 iterations are respectively 9.34×10−39.34\times10^{-3}, 1.20×10−41.20\times10^{-4}, 1.11×10−81.11\times10^{-8} and 3.1×10−163.1\times10^{-16}.

    At c=4c=4, the same rule gives

    2⟼0.61759481⟼2.96235513⟼−0.16434794.(13)2\longmapsto0.61759481\longmapsto2.96235513 \longmapsto-0.16434794. \tag{13}

    The next real-mass quadrature is undefined, so the program stops and records the failure. It does not clip yy to a small positive number. The implicit root is nevertheless 1.370740701.37074070, with Fy≃2.45517F_y\simeq2.45517. The iteration failed; the root did not become singular.

    A declared relaxation changes the algorithm to

    yn+1=(1−ρ)yn+ρ[2+cHΛ(yn)],ρ=14.(14)y_{n+1}=(1-\rho)y_n+\rho[2+cH_\Lambda(y_n)], \qquad \rho=\frac14. \tag{14}

    At c=4c=4 its derivative on [1,2][1,2] is 3/4+HΛ′(y)3/4+H_\Lambda'(y), which lies between 1/41/4 and 3/43/4. Its endpoint images lie in [1,2][1,2], so it is a contraction on that interval. Differentiating this new finite program keeps ρ\rho fixed. The response errors after 88, 1616, 3232 and 6464 iterations are 8.35×10−48.35\times10^{-4}, 8.80×10−78.80\times10^{-7}, 4.44×10−134.44\times10^{-13} and 9.7×10−179.7\times10^{-17}.

    Convergent ordinary and relaxed iteration derivatives approach the implicit response. The unrelaxed strong-coupling trajectory instead becomes negative although the implicit root remains regular.

    Fixed cutoff Λ=16\Lambda=16 and quadrature order 128. Left: the actual finite-iteration derivatives approach the independently checked root response. Right: the unrelaxed c=4c=4 iteration leaves the positive-mass domain after three updates. The dashed root remains well conditioned; no Hartree phase transition is inferred from this solver failure.

    The pure kernel implicit_response.py, driver implicit_checks.py and retained implicit-results.json are in examples/computational-qft/optimization/. They import the earlier Hartree value kernel read-only. The new study varies derivatives, quadrature and solver stopping; it does not repeat the earlier regulator-removal study or estimate Hartree's error relative to the exact theory.

    General systems: solve for products, not an inverse

    Let F(y,θ)=0F(y,\theta)=0 with y∈Rdy\in\mathbb R^d, and suppose FyF_y is invertible at the chosen solution. For a parameter direction vv, a JVP requires the linear solve

    Fyy˙=−Fθv.(15)F_y\dot y=-F_\theta v. \tag{15}

    If a scalar observable O(y,θ)O(y,\theta) is the target, solve instead

    FyTz=(∇yO),∇θOtotal=∇θO−FθTz.(16)F_y^{\mathsf T}z=(\nabla_yO), \qquad \nabla_\theta O_{\mathrm{total}} =\nabla_\theta O-F_\theta^{\mathsf T}z. \tag{16}

    The first derivative on the right is the direct parameter dependence at fixed yy. Matrix-free JVPs and VJPs can apply FyF_y and its transpose without forming the dense Jacobian. A preconditioner improves the solve but does not alter the equation being differentiated. An inaccurate linear solve, an inaccurate root and a nearly singular FyF_y are separate possible errors.

    For a fixed point y=T(y,θ)y=T(y,\theta), use F=y−TF=y-T. Invertibility of I−TyI-T_y is sufficient for a local implicit derivative; convergence of the naive iteration usually needs the stronger condition that the spectral radius of TyT_y be below one. Equations (11)–(14) show this distinction with an actual failed iteration.

    Summary

    An implicit response is determined by a defining equation, a selected branch and the conditions held fixed as parameters change. In the Hartree example, fixing a reference mass requires retuning the bare mass and produces a negative coupling response. Dual derivatives of the residual, a bracketed root and independent finite differences agree. Unrolling a finite iteration computes a different derivative until convergence; algorithmic failure does not by itself imply a singular physical response.

    Exercises

    1. Hold the bare mass instead

    Differentiate Eq.(2) with respect to cc at fixed m02m_0^2, σ\sigma and Λ\Lambda. Compare this with Eq.(7). Explain the large-cutoff behavior of the two responses when compared at the same finite positive yy.

    Solution

    Write AΛ(y)=arsinh⁡(Λ/y)A_\Lambda(y)=\operatorname{arsinh}(\Lambda/\sqrt y). The fixed-bare equation is y−m02−σ−cAΛ(y)=0y-m_0^2-\sigma-cA_\Lambda(y)=0, so

    dydc∣m02=AΛ(y)1−cAΛ′(y)>0.\left.\frac{dy}{dc}\right|_{m_0^2} =\frac{A_\Lambda(y)}{1-cA_\Lambda'(y)}>0.

    The derivative of AΛA_\Lambda is the same as that of HΛH_\Lambda because their difference is independent of yy. In the reference prescription, dm02/dc=−AΛ(1)dm_0^2/dc=-A_\Lambda(1), giving

    dydc∣M=AΛ(y)−AΛ(1)1−cAΛ′(y)<0(y>1).\left.\frac{dy}{dc}\right|_{M} =\frac{A_\Lambda(y)-A_\Lambda(1)}{1-cA_\Lambda'(y)}<0 \quad (y>1).

    At fixed finite yy, AΛ(y)=log⁡(2Λ)−12log⁡y+O(Λ−2)A_\Lambda(y)=\log(2\Lambda)-\tfrac12\log y+O(\Lambda^{-2}). The fixed-bare numerator grows logarithmically, whereas the subtracted numerator tends to −12log⁡y-\tfrac12\log y. The common denominator tends to 1+c/(2y)>01+c/(2y)>0. Comparing these derivatives at a common yy requires choosing each prescription's bare input accordingly; a trajectory with one unretuned bare mass need not keep yy finite as Λ\Lambda changes. The difference is a difference of physical parameter conditions, not a contradiction between differentiation methods.

    2. A real singular response at a fold

    For G(u,η)=u2−η=0G(u,\eta)=u^2-\eta=0, find both real branches and their derivatives. Explain why a small residual does not uniformly guarantee a small value or response error near η=0\eta=0. Contrast this with the Hartree root above.

    Solution

    For η>0\eta>0, u±=±ηu_\pm=\pm\sqrt\eta, and

    du±dη=12u±=±12η.\frac{du_\pm}{d\eta}=\frac1{2u_\pm}=\pm\frac1{2\sqrt\eta}.

    At η=0\eta=0, Gu=2u=0G_u=2u=0: the invertibility hypothesis fails. For η<0\eta<0 there is no real root. On a chosen positive branch, an approximate u~\widetilde u satisfies the exact identity

    u~−u+=G(u~,η)u~+u+.\widetilde u-u_+ =\frac{G(\widetilde u,\eta)}{\widetilde u+u_+}.

    There is no uniform residual-to-value bound as the denominator tends to zero. For instance, u~=2η\widetilde u=2\sqrt\eta has residual 3η→03\eta\to0, yet its relative value error is one and its implicit response 1/(2u~)1/(2\widetilde u) is half the correct response. A residual also does not select the branch: both exact roots have zero residual.

    By contrast, the positive-coupling Hartree example has Fy>1F_y>1 throughout its positive-mass domain and a unique root in (1,2)(1,2). Its unrelaxed iteration failure therefore cannot be attributed to this fold mechanism.

    References

    Scrollable formula. Use Left and Right arrow keys to reveal hidden content.

    Scrollable table. Use Left and Right arrow keys to reveal hidden columns.

    Scrollable figure. Use Left and Right arrow keys to reveal hidden content.