betaFeedback

WorksPhysics and Astronomy

Stable and efficient differentiation of tensor network algorithms

Abstract

Gradient based optimization methods are the established state-of-the-art paradigm to study strongly entangled quantum systems in two dimensions with Projected Entangled Pair States. However, the key ingredient, the gradient itself, has proven challenging to calculate accurately and reliably in the case of a corner transfer matrix (CTM)-based approach. Automatic differentiation (AD), which is the best known tool for calculating the gradient, still suffers some crucial shortcomings. Some of these are known, like the problem of excessive memory usage and the divergences which may arise when differentiating a singular value decomposition (SVD). Importantly, we also find that there is a fundamental inaccuracy in the currently used backpropagation of SVD that had not been noted before. In this paper, we describe all these problems and provide them with compact and easy to implement solutions. We analyse the impact of these changes and find that the last problem – the use of the correct gradient – is by far the dominant one and thus should be considered a crucial patch to any AD application that makes use of an SVD for truncation.

Introduction

Tensor Network methods are designed specifically to deal with many body systems and have already proven very useful in the studies of strongly entangled states. One of their early successes was the discovery of the density matrix renormalization group (DMRG) algorithm [1, 2] and an independently developed matrix product state (MPS) ansatz [3, 4] that proved strikingly effective for studying one dimensional gapped spin systems. The two-dimensional extension of these ideas are projected entangled pair states (PEPS) [5]. While they hold great promise to be just as revolutionary as MPS, as can already be seen from studies of superconductivity [6–9], topologically ordered states [10, 11] and chiral spin liquids [12], they still lack the ease of use that the DMRG algorithm provided for MPS.

A key cause for the difficulty in using PEPS is that unlike for MPS, calculation of local observables cannot be done exactly, but require some form of approximate contraction of the tensor network. There are three main contraction schemes for infinite PEPS: corner transfer matrix (CTM) [13–15], boundary MPS methods [16] and tensor renormalization group [17]. The easiest to implement and most commonly used of these schemes is the CTM.

Optimizing PEPS for the ground state has been done in a multitude of ways. Historically, the first methods were based on imaginary time evolution [18–21], but this in general resulted in worse states (i.e. worse energies and failure to capture the relevant physics) than variational methods. Therefore, the focus shifted towards gradient based methods. The early gradient calculations [11, 22, 23] could only approximate the gradient, so the energy minimization would not be able to converge. Additionally, these gradient calculations were notoriously complicated to implement. An important recent improvement was achieved with the use of automatic differentiation (AD) [24, 25], since it greatly simplified the implementation and gave access to an exact gradient of the approximated energy, enabling a much improved convergence of the state.

The current AD procedure as applied to PEPS however still has some issues: (i) generic AD requires a lot of memory for storing all the intermediate objects created in the iterative CTM procedure, and differentiating the fixed point equation instead buffers from gauge fixing issues, (ii) more importantly, the gradient of the SVD – a necessary subroutine of the CTM algorithm – is poorly conditioned and even undefined in the case of degeneracies [24, 26], (iii) finally, as we show, the equations used so far to backpropagate the gradient through the SVD were lacking an important term, introducing an undesired approximation.

In this paper, we solve these problems, while keeping the inherent simplicity of the AD approach untouched. The first problem has a known solution [24, 26] where one differentiates the fixed point equation rather than the long sequence of CTM iterations. This, however, requires a reliable gauge-fixing of the CTM output, which was hitherto not possible. We identify the key issue and two methods to practically do the gauge fixing, hence fixing the memory problem. Perhaps more interestingly, we also solve the second problem – the instability of AD for degeneracies in the SVD spectrum – by revealing and exploiting a hidden gauge symmetry inherently present in the CTM tensor network. We show that this problem could only be solved by moving outside the conceptual scope of AD, yet the resulting solution can be implemented in a simple, AD-compatible way. Finally, we present a derivation for the gradient of a truncated SVD which differs by one term from the one previously used: it takes the truncated spectrum into account, whereas the previously used equation implicitly assumed the truncated spectrum to zero as an approximation. We illustrate that surprisingly enough, the dominant errors are generally not those induced by degenerate spectra but those due to the approximated rather than the correct gradient for the SVD, an issue which can be solved by changing a few lines in any AD code.

Symmetric CTM.— We will focus in this paper on a particularly simple version of CTM that relies on spatial symmetries. However, our findings have strong direct implications for all other CTM implementations. The basic objects to calculate and optimize with PEPS are local observables O=⟨Ψ∣O^∣Ψ⟩O = \langle\Psi|\hat{O}|\Psi\rangle, with an operator O^\hat{O} having some finite support on few lattice sites, e.g. Hamiltonians with nearest-neighbour interactions. Without loss of generality, we focus on single site observables for now. A quantum state ∣Ψ(A)⟩|\Psi(A)\rangle encoded with infinite PEPS on a square lattice with translational invariance (Figure 1(B)) is defined by a single site rank-5 tensor At,r,b,liA^{i}_{t,r,b,l} (which we assume to have C4V symmetry) with one physical index and four virtual indices (Figure 1(A)), which are summed over in the network as depicted by the connected black lines in Figure 1(B). A local expectation value thus depends on a tensors AA, and can be graphically represented as in Figure 1(C-D). We approximate this infinite tensor network using CTM. The premise of CTM, symmetric or not, is that the ‘renormalisation’ (CTMRG) identities shown in Figure 2(C) are approximately true, and hence one can replace the infinite number of tensors surrounding the local observable with an approximation, called an ’environment’, as shown in Figure 1(D). For larger observables one would use the same CTMRG identities to derive a different environment comprised of CC and TT tensors. To find the CC, TT, and UU tensors one simply starts from some initial guesses and iteratively updates them with their respective fixed point conditions, shown in Figure 2(A-B), which define the symmetric CTM algorithm [15]. In the case of symmetric CTM, the truncation tensors UU are determined by the eigendecomposition of the ‘enlarged corner’ as shown in Figure 2(B). This UU is then used to update CC and TT as shown in Figure 2(A) and Figure 2(B), respectively. If one does not have these symmetries, a more intricate scheme is needed for UU that involves a singular value decomposition [9].

Image not extracted

Figure 1. A state ∣Ψ(A)⟩|\Psi(A)\rangle in (B) in generated by a single PEPS tensor in (A) by contracting its virtual indices. A double PEPS tensors in (C) is formed by contracting the PEPS tensor AA and its conjugate via physical index and grouping the remaining open indices. In order to calculate a local observable in (D) one needs to approximate an infinite double-layer PEPS tensors network around the PEPS tensors where the operator acts with a finite environment formed by corner tensors CC and the edge tensors TT.

Image not extracted

Figure 2. A single CTM update step consists of (A) diagonalization of the enlarged corner yielding a new truncated corner CC and new isometries UU, which are then used to update the edge tensor TT in (B). In (C) the resulting renormalization identities are shown.

One iteration of the CTM algorithm may be understood as a function ff that depends on the PEPS tensor AA and maps the environment tensors CC and TT, which we can together represent as x≡(C,T)x \equiv(C,T), to some new x′≡(C′,T′)x' \equiv(C',T'): x′=f(x,A)x' = f(x,A). This is repeated until convergence, meaning an xx has been found that satisfies x=f(x,A)x = f(x,A). This CTM environment xnx_n, converged in nn steps, is ultimately used to calculate an approximation of the energy for the given Hamiltonian HH:

E≈E~=F(xn,A,H).(1)E \approx\tilde{E} = F(x_n,A,H). \tag*{(1)}

In order to optimize PEPS for the ground state of HH, the above formula for the energy has to be minimized using some gradient based method. To obtain the gradient w.r.t. the PEPS tensor AA one must also differentiate xnx_n, i.e. CC and TT tensors, since they implicitly depend on the PEPS tensor through the iterative formula described above, xn=f(xn−1,A)x_n = f(x_{n-1},A). This intricacy of the dependence of CC and TT on the PEPS tensor is what makes PEPS optimization hard, and what makes automatic differentiation an attractive option.

Automatic differentiation.— The simplest AD framework, available in many programming languages, makes use of the chain rule applied to the approximate energy E~\tilde{E} calculated using converged CC and TT tensors obtained from the above described CTM procedure. It goes back through this process, i.e. through all the iterations of the CTM, to collect contributions to the gradient from each step:

dE~=∂F∂AdA+∂F∂xndxn,(2)d\tilde{E} = \frac{\partial F}{\partial A}dA + \frac{\partial F}{\partial x_n}dx_n, \tag*{(2)}
dxn=∂f∂AdA+∂f∂xn−1(∂f∂AdA+∂f∂xn−2(…)).(3)dx_n = \frac{\partial f}{\partial A}dA + \frac{\partial f}{\partial x_{n-1}}\left(\frac{\partial f}{\partial A}dA + \frac{\partial f}{\partial x_{n-2}}(\ldots)\right). \tag*{(3)}

where, at each step we substituted xkx_k by f(xk−1,A)f(x_{k-1}, A). While this may be algorithmically complicated, it can be done completely automatically (black box). However, using the black box leads to two known issues. Firstly, instead of initializing the CTM algorithm with a good initial guess (e.g. C,TC,T from a previous iteration in the gradient optimization), which generally leads to faster convergence, it is necessary to start every time with random initial C,TC,T to guarantee enough iterations and no dependence on the initial conditions. Secondly, it requires storing all intermediate objects, which can be extremely memory intensive. The solution to these problems is to differentiate the fixed point condition x=f(x,A)x=f(x,A) instead [27] [24]. This may in principle be done with the same practical ease as differentiating through the iterations using the tools of AD. However, this requires gauge fixing of the CTM result, which will be discussed in the next section.

Fixed point differentiation.—As was previously realised [27] [24], one can differentiate the fixed point equation for x=f(x,A)x=f(x,A), rather than differentiating all the iterations that led to that solution. The derivative can then be written as a geometric series:

dx=∑k=0∞(∂f∂x)k∂f∂AdA=(1−∂f∂x)−1∂f∂AdA.(4)dx=\sum_{k=0}^{\infty}\left(\frac{\partial f}{\partial x}\right)^{k}\frac{\partial f}{\partial A}dA=\left(1-\frac{\partial f}{\partial x}\right)^{-1}\frac{\partial f}{\partial A}dA. \tag*{(4)}

The operation of ∂f∂x\frac{\partial f}{\partial x} can be implemented using AD. An important aspect of fixed point differentiation is that xx, i.e. CC and TT, must have converged element-wise, which does not generally happen with CTM. Instead, CTM converges to an x=f(x′,A)x=f(x',A) where x′x' is related to xx by a gauge transform. The origin of this arbitrary freedom is the non-uniqueness of the eigenvalue decomposition. Indeed, we may transform any eigenbasis UU as follows:

UCU†=(Uσ)C(σ†U†),(5)UCU^\dagger=(U\sigma)C(\sigma^\dagger U^\dagger), \tag*{(5)}

where σ\sigma is any unitary matrix satisfying [C,σ]=0[C,\sigma]=0. Thus CC converges element-wise (if the eigenvalues are uniquely sorted) but TT can differ from iteration to iteration by a random gauge σ\sigma:

T^→fσ†T^σ=T,(6)\hat{T}\xrightarrow{f}\sigma^\dagger\hat{T}\sigma=T, \tag*{(6)}

where T^\hat{T} is an edge tensor from the previous CTM iteration. It is tempting to think that since the gauge freedom of the eigendecomposition, Eq. (5), is the origin of the problem, it can be resolved by making the eigendecomposition unique in some way. However, for differentiating the fixed point condition, it is rather relevant that TT (and CC) are fixed points, and not the eigenvalue decomposition itself. Thus, one should rather determine a gauge such that the last CTM step maps T^\hat{T} to TT. In practice, one takes the last CTM step with some arbitrary gauge and deduce a σ\sigma that relates the two TT tensors as in Eq. (6). Incorporating it into the isometry, i.e. U→UσU\rightarrow U\sigma, we get a gauge-fixed eigendecomposition that leads to the desired element-wise convergence of TT so Eq. (4) can be utilised and the memory problem solved. Details of the gauge fixing schemes used in this work are presented in Appendix AA, and apply to any CTM.

Q-deformed CTM.—The second issue with current AD implementations which we tackle is the fact that the gradient of the eigendecomposition contains a diverging term in case of a degenerate spectrum. It is currently treated by slight deformation of the spectrum through e.g. Lorentzian broadening [24]. However, the ill-conditioned term is clearly an artefact of the method: Given a PEPS for which the CC matrix has a degeneracy, it should be possible to perturb the PEPS tensor to slightly break this degeneracy, while at the same time smoothly changing the energy EE, thereby effectively removing the divergence. This strongly suggests that a better method exists which avoids these divergences altogether.

In order to devise such a divergence-free method, we make use of a hitherto ignored gauge degree of freedom in the CTM iteration. Specifically, in the truncation of the enlarged corner MM, Figure 2(A), the current CTM implementations choose the isometries UU such that the new corner U†MU=C≡sU^\dagger M U=C\equiv s is diagonal, while in principle, any isometry projecting onto the subspace with the χ\chi largest eigenvalues would be fine. We can re-introduce this basis choice degree of freedom through a unitary QQ, by defining a new isometry P=UQP=UQ. Since QQ is simply a basis change, the new fixed point tensors of the Q-deformed CTM (i.e., under this change of isometry), C′C' and T′T', are related to the fixed points CC and TT of the original CTM simply by conjugating with QQ, Figure 3(B); specifically, C′=Q†sQC'=Q^\dagger sQ. It is thus clear that the Q-deformed CTM algorithm will converge to the same, albeit gauge transformed, result, and in particular keeps the observables unchanged.

Image not extracted

Figure 3. Q-deformation in (A) results in a CTM fixed point related to the original one by a gauge transformation in (B).

In the following, we will use this additional degree of freedom QQ to remove the divergences which appear in the differentiation of normal (undeformed) CTM. To this end, we will set Q=1Q=\mathbb{1}, but make use of the variations dQdQ of QQ (which don’t affect any physical property, since QQ is a gauge degree of freedom) to cancel the divergent terms. (This also shows that the ad-hoc gauge fixing for the isometries UU is the source of the divergence, and that one must generally be rather careful when fixing gauges without reason.)

Stable derivative.—To differentiate the QQ-deformed CTM step, i.e. calculate ∂f∂x\frac{\partial f}{\partial x} and ∂f∂A\frac{\partial f}{\partial A} introduced earlier, one mainly needs to differentiate tensor contractions. These can be easily handled with AD tools, and are not affected by the insertion of QQ†=1QQ^\dagger= 1. The one step which needs special attention to avoid divergences is the eigendecomposition and truncation of the enlarged corner MM, Figure 2(A), which we discuss in the following.

We start the derivation with the full decomposition of the enlarged corner MM of the QQ-deformed CTM, shown in Figure 2(A):

M=PCP†+P⊥C⊥P⊥†,(7)M = PCP^\dagger+ P_\perp C_\perp P_\perp^\dagger, \tag*{(7)}

where P=UQP = UQ projects onto the leading eigenvalue subspace, in a basis where the corner is not diagonal, i.e. C=Q†sQC = Q^\dagger s Q with ss the diagonal matrix with the dominant eigenvalues, and P⊥C⊥P⊥†P_\perp C_\perp P_\perp^\dagger representing the truncated part of the eigendecomposition. The latter does not have to be calculated explicitly but is introduced here for the analysis. Note that the truncated eigen-/singular values were never taken into account in previous applications of AD to CTM [24–26], hence our result will differ regardless of the inclusion of QQ.

Given that QQ is unitary, UU, PP and P⊥P_\perp are isometries, and P†P⊥=0P^\dagger P_\perp= 0, we can parameterise their infinitesimal variations as follows:

dQ=dω′Q(8)dQ = d\omega'Q \tag*{(8)}
dU=U⊥dX+Udω,(9)dU = U_\perp dX + U d\omega, \tag*{(9)}

and thus

dP=d(UQ)=U⊥dXQ+U(dω+dω′)Q(10)dP = d(UQ) = U_\perp dXQ + U(d\omega+ d\omega')Q \tag*{(10)}

with dωd\omega, dω′d\omega' anti-Hermitian generators of rotations within the subspace defined by PP, and U⊥dXU_\perp dX parameterising an infinitesimal rotation into the subspace orthogonal to the one spanned by PP. The divergences we are aiming to remove appear in dωd\omega; for completeness, we provide the explicit form in Appendix § 1.4. However, we can now simply cancel dωd\omega in Eq. (10) by choosing dω′=−dωd\omega' = -d\omega, i.e., through a suitable variation of QQ. Importantly, any choice for the gauge freedom QQ and ∂Q∂A\frac{\partial Q}{\partial A} is legitimate, as it does not affect the energy EE.

We can then calculate the variation dCdC, which is not diagonal, by taking the derivative of Eq. (7) and projecting onto P†P^\dagger from the left and PP from the right:

P†dMP=dC.(11)P^\dagger dM P = dC . \tag*{(11)}

The variation of PP follows from applying U⊥†U_\perp^\dagger and PP to the left and right of dMdM, respectively, and using the fact that dU⊥†P=−U⊥†dPdU_\perp^\dagger P = -U_\perp^\dagger dP (this follows from differentiating U⊥†P=0U_\perp^\dagger P = 0):

U⊥†dMP=dXC+s⊥dU⊥†P(12)U_\perp^\dagger dM P = dXC + s_\perp dU_\perp^\dagger P \tag*{(12)}
⇒(1−PP†)dMP=dPC−(1−PP†)MdP(13)\Rightarrow(1 - PP^\dagger)dMP = dPC - (1 - PP^\dagger)MdP \tag*{(13)}

This Sylvester equation (an equation for a matrix YY of the form AY+YB=DAY + YB = D) for dPdP has a unique solution if CC and C⊥C_\perp have strictly different spectra. One should thus be careful not to split multiplets when converging the original CTM.

Remarkably, one never needs to calculate either dω′d\omega' or dωd\omega. Nor, in fact, is a non-trivial QQ needed, as it does not appear in any of the final equations (11,13). So one can effectively use a regular CTM algorithm, which is a Q=1Q=1, and still make use of a non-trivial ∂Q∂A\frac{\partial Q}{\partial A}. Our result can thus be summarised as providing a modified formula for the gradient of the eigendecomposition with a dCdC that is non-diagonal, where all the instabilities and divergences are removed. All the rest of the CTM differentiation can remain unchanged. We give some practical details in the Appendix § 2 about how to efficiently use Eq. (13) in backwards differentiation.

Let us emphasize that our result represents an improvement over the previously used AD in two independent ways: First, the QQ-deformation makes the rightmost (divergent) term in Eq. (10) vanish, and second, the inclusion of the truncated part of MM in Eq. (7) gives rise to the additional underlined term in Eq. (13). The effects of cancelling the divergent dωd\omega and of including the extra term will be benchmarked independently later.

Gradient of SVD.—Using the same techniques we used above to differentiate a truncated eigendecomposition, we can also differentiate the SVD. Here, we just give the part (underlined) of the result that differs from the one previously used. A complete derivation can be found in Appendix § 1.5.

(1−UU†)dAV=(1−UU†)(dUS−AdV)(14)(1 - UU^\dagger)dA V = (1 - UU^\dagger)(dUS - A dV) \tag*{(14)}
(1−VV†)dA†U=(1−VV†)(dVS−A†dU)(15)(1 - VV^\dagger)dA^\dagger U = (1 - VV^\dagger)(dV S - A^\dagger dU) \tag*{(15)}

Both underlined terms on the right-hand side were not included in previous implementations.

Benchmark.—Let us now benchmark the improvement in the gradient gained through our findings, compared to existing approaches. To this end, we pick a Hamiltonian and a (not optimal) PEPS ansatz which forms an initial or intermediate state for a gradient optimization in CTM. We then compute the CTM fixed point using our gauge fixing scheme (from Appendix § 1.3), and differentiate it to compute the gradient using different approaches, covering existing approaches as well as some or all of our improvements. To be able to study the effect of (approximate) degeneracies in the spectrum of CC, we choose an SU(2)-symmetric ansatz with long correlation length (leading to truncation at relatively large eigenvalues), to which we add a symmetry breaking perturbation in order to induce a tunable splitting of the multiplets.

Specifically, the ansatz we choose is a one-parameter family of perturbed RVB states with nearest neighbour and longer range singlets with C4V symmetry, which can be expressed as PEPS with bond dimension D=3D = 3 [28]:

A=A1+A2+βA3(16)\mathcal{A} = \mathcal{A}_1 + \mathcal{A}_2 + \beta\mathcal{A}_3 \tag*{(16)}

where the SU(2)SU(2) symmetric tensors A1A_1, A2A_2 generate the NN RVB state and longer range singlets, respectively, and β\beta controls an SU(2) symmetry breaking perturbation A3A_3. We compute the gradient with respect to the Heisenberg J1−J2J_1-J_2 Hamiltonian on a square lattice with single site unit cell:

H=∑i,j∈NN,αf(α)SiαSjα+J2J1∑i,j∈NNNS⃗i⋅S⃗j(17)H = \sum_{i,j\in\mathrm{NN},\alpha} f(\alpha)S_i^\alpha S_j^\alpha+ \frac{J_2}{J_1}\sum_{i,j\in\mathrm{NNN}} \vec{S}_i\cdot\vec{S}_j \tag*{(17)}

with SU(2)SU(2) symmetry breaking anisotropy f([x,y,z])=[−1,1+β,−1+β]f([x,y,z])=[-1,1+\beta,-1+\beta] controlled by the same parameter β\beta, and J2/J1=0.5J_2/J_1=0.5. We calculate the CTM environment with bond dimension χ=160\chi=160. Our gradient calculations agree with the gradient obtained from 4th order finite difference calculations up to O(10−12)O(10^{-12}), which verifies that it is exact. In Figure 4, we show how much the following approximate ways to determine the gradient deviate from our exact and divergence-free gradient:

Image not extracted

Figure 4. Difference between the exact gradient geg_e obtained using all techniques derived in this work, and incomplete gradients gig_i obtained using various approximations (see text), for different degeneracy-lifting perturbations β\beta and Lorentzian broadenings ϵ\epsilon. By far the largest improvement can be achieved by including the complete dPdP in the gradient (blue lines).

  • a gradient assuming dP=0dP=0, as done in [11] before the AD framework was introduced (green line)

  • the currently available AD framework with incomplete gradient of dPdP, using Lorentzian broadening 1xij→xijxij2−ϵ\frac{1}{x_{ij}}\to\frac{x_{ij}}{x_{ij}^{2}-\epsilon} with xij=sj−six_{ij}=s_j-s_i to avoid divergences [24–26] (orange lines)

  • a gradient based on the complete differential of dPdP, obtained from Eq. (13) (i.e. including the discarded part of the spectrum in Eq. (7)), but still using Lorentzian broadening to avoid divergences (blue lines)

all of which were calculated using the fixed point differentiation we described earlier.

Fig. 4 shows the difference to the exact and divergence-free gradient as a function of the parameter ϵ\epsilon of the Lorentzian broadening for three different values of the SU(2)SU(2)-breaking perturbation β=0,10−7,10−3\beta=0,10^{-7},10^{-3}. Remarkably, we find that by far the strongest impact comes from whether we use the full expression for dPdP, i.e., the correct gradient, or rather the previously used approximation for dPdP, as can be seen from the clear separation of the blue vs. orange lines in Figure 4. In fact, we noticed that the linear problem defined by Eq. (4) for the fixed point differentiation can become ill-conditioned if the full equation for dPdP is not used. Beyond that, we also observe that in the case of approximate degeneracies in the spectrum (β=10−7\beta=10^{-7}), using our singularity-free truncation performs significantly better, while both for exact degeneracies (β=0\beta=0) or for strongly broken degeneracies (β=10−3\beta=10^{-3}), the improvement gained over Lorentzian broadening is minor.

*Conclusions.—*We have studied two central problems in the application of AD to tensor network algorithms, in the course of which we identified a third key problem, and devised solutions to all three of them. While we focused on CTM, our findings apply to AD of any algorithm which involves the truncation of eigenvalue or singular value decompositions. We have analyzed the effect of these solutions on the performance of the CTM algorithm, and observed that by far the largest effect is achieved by solving the third problem, that is, the use of the correct gradient. This can be achieved by adding just a few lines of code, and should thus be considered an essential fix to any AD-based tensor network algorithm.

*Acknowledgements.—*The authors are grateful to Boris Ponsioen, Juraj Hasik, Paul Brehmer and Andras Molnar for stimulating discussions. Numerical calculations were performed in MATLAB with the help of the ncon function [29] for tensor contractions. This research was funded in part by the Austrian Science Fund (FWF) [projects ESP-306, P-36305, F-71], and the European Union’s Horizon 2020 program through Grant No. 863476 (ERC-CoG SEQUAM).

Appendices

Gauge fixing - Generic

In the following two appendices, we discuss methods to properly gauge fix the fixed point of the CTM algorithm, to utilize the element-wise convergence and the fixed point differentiation from Eq. (4). The output of the CTM is already partially gauge-fixed by setting CC to be a diagonal matrix (but still allowing for dCdC to be non-diagonal), so we are left with the remaining gauge freedom σ\sigma from Eq. (6) due to the phase freedom of the eigenvectors, which we recall here for clarity:

T=σ†T^σ,(18)T = \sigma^\dagger\hat{T}\sigma, \tag*{(18)}

and where T^\hat{T} is an edge tensor from the previous iteration. When the corner CC is non-degenerate, the problem of determining σ\sigma simplifies to finding a diagonal matrix of phases, in which case the equation simplifies to (with ii being the physical index):

∀i T^abi=σaaTabiσbb∗.(19)\forall i\ \hat{T}^{i}_{ab} = \sigma_{aa}T^{i}_{ab}\sigma^{*}_{bb}. \tag*{(19)}

Without loss of generality, we set σ11=1\sigma_{11}=1 and solve for σaa\sigma_{aa}, a≠1a\ne1:

σaa=sgn⁡(T^1aiT1ai).(20)\sigma_{aa} = \operatorname{sgn}\left(\frac{\hat{T}^{i}_{1a}}{T^{i}_{1a}}\right). \tag*{(20)}

If the tensor TT happens to be sparse (i.e. T1a=0T_{1a}=0 for some aa), it may just take more iterations to find all the diagonal elements of σ\sigma using those previously obtained from above equation:

σbb=sgn⁡(σaaT^abiTabi).(21)\sigma_{bb} = \operatorname{sgn}\left(\frac{\sigma_{aa}\hat{T}^{i}_{ab}}{T^{i}_{ab}}\right). \tag*{(21)}

However, this approach is not general enough and the problem becomes much more complicated if the spectrum of the corner tensor CC is degenerate, in which case σ\sigma is a block diagonal matrix of continuous rotations within the degenerate subspaces. Therefore, we proceed by examining the eigenvectors (or singular vectors if the transfer matrix is non-diagonalizable) of the transfer matrix for the overlap of TT and T^\hat{T} with a random MPS MM (which should thus be injective):

T=∑iTi⊗(Mi)∗,T^=∑iT^i⊗(Mi)∗.(22)\mathbb{T} = \sum_i T^i \otimes(M^i)^*, \qquad\hat{\mathbb{T}} = \sum_i \hat{T}^i \otimes(M^i)^*. \tag*{(22)}

Choosing a random MPS can help in removing possible degeneracies in the spectrum of the transfer matrices. Note that the bond dimension of MM should be at least as big as that of TT. If the transfer matrices are non-degenerate and its leading eigenvectors ρ\rho and ρ^\hat{\rho} are full rank and unique then they are related by:

ρ^=σ⋅ρ⇒σ=ρ^ρ−1.(23)\hat{\rho} = \sigma\cdot\rho\Rightarrow\sigma= \hat{\rho}\rho^{-1}. \tag*{(23)}

To prevent having to do this inverse, we propose the following: If the tensors T,T^T,\hat{T} are equal up to the gauge transformation, then the upper triangular matrices from the QR decomposition of the fixed points ρ\rho and ρ′\rho' must be equal, provided that the diagonal is positive. Then the equation simplifies to:

σ=Q1RR−1Q2†=Q1Q2†.(24)\sigma= Q_1RR^{-1}Q_2^\dagger= Q_1Q_2^\dagger. \tag*{(24)}

In fact, ρ\rho, ρ^\hat{\rho} could be any eigenvectors to the same unique eigenvalue (or singular vectors to the same unique singular value), not only the leading ones. This can become advantageous in cases when the leading eigenvectors are not full rank or not unique.

Gauge fixing – Robust

The gauge fixing methods described in the previous appendix may run into trouble in special cases when the corner is degenerate and the TT tensor additionally has some virtual symmetries. Therefore, in this appendix, we present a bit more involved algorithm which turns out to be the most robust gauge fixing scheme in general. In order to fully fix the gauge of the edge tensor TT, one has to solve simultaneously the following equations:

T^σ=σT,\hat{T}\sigma= \sigma T,
[σ,C]=0,[\sigma,C] = 0,
σ†σ=1.(25)\sigma^\dagger\sigma= 1. \tag*{(25)}

The first equation is a linear equation, where σ\sigma can be reinterpreted as a vector in the null space of the vectorized equation:

(T^⊗1−1⊗TT)σ⃗=0,(26)(\hat{T}\otimes1 - 1\otimes T^{T})\vec{\sigma}=0, \tag*{(26)}

while the second one limits the number of elements of σ⃗\vec{\sigma} needed to solve for, as it assures that σ\sigma has a block diagonal form with zeros everywhere else. Therefore, instead of decomposing a full χ2D2×χ2\chi^2D^2\times\chi^2 matrix, we only need to find the null space of Eq. (26), which is the same as the right null space of (T^⊗1−1⊗TT)†(T^⊗1−1⊗TT)(\hat{T}\otimes1 - 1\otimes T^{T})^\dagger(\hat{T}\otimes1 - 1\otimes T^{T}). Additionally, we can restrict consecutively to all the degenerate subspaces of the corner CC for finding the right null space, which together with the sparse structure allows for efficient singular value decomposition. Finally, vectors from the null space of the reduced vectorized equation form block diagonal matrices σi\sigma^i, whose linear combination ciσic_i\sigma^i forms a unitary matrix σ\sigma, which is a solution to Eq. (25):

∑β∑ij(ciσα,βi)∗(cjσβ,γj)=δα,γ.(27)\sum_{\beta}\sum_{ij}(c_i\sigma^i_{\alpha,\beta})^*(c_j\sigma^j_{\beta,\gamma})=\delta_{\alpha,\gamma}. \tag*{(27)}

In case that the TT tensor has some virtual symmetries of the form T=xTx−1T=xTx^{-1}, the null space necessarily has dimension larger than 1 and Eq. (25) may have more than one solution, but we only need to find one of them for the gauge fixing scheme and calculation of the derivative. In order to do that, we use the Levenberg-Marquardt algorithm to find coefficients cic_i from Eq. (27).

A note on gauge fixing for general CTM: For more general CTM applicable for larger unit cells, we may trivially generalise the first ‘generic’ gauge fixing method by taking a row/column of edge tensors as the unit cell of an infinite MPS. The robust approach may similarly be generalised by replacing the first equation in Eq. (25) with T^1...T^nσ=σT1...Tn\hat{T}_1...\hat{T}_n\sigma= \sigma T_1...T_n. Using the aforementioned tricks, the null space problem remains of the same size as before.

Differentiating a truncated eigendecomposition

In this appendix, we expand on the derivation of the stable gradient of eigendecomposition step in the CTM algorithm making use of the gauge freedom introduced in the QQ-deformed CTM, and relate it to the previous approaches. The notation follows that in the main body of the paper.

There are two main points that add to the stability and accuracy of the gradient calculation. Firstly, by introducing a QQ-deformed CTM, we realise that one may still keep CC diagonal; yet, by allowing its derivative dCdC to be non-diagonal we can get rid of a problematic, possibly divergent term which we are going to derive later. This is achieved by introducing gauge rotations QQ within the relevant subspace of the enlarged corner eigendecomposition:

USU†=UQQ†SQQ†U†=PCP†.(28)USU^\dagger= UQQ^\dagger SQQ^\dagger U^\dagger= PCP^\dagger. \tag*{(28)}

The parametrization of dUdU (and hence dPdP) is then obtained by multiplying it with a resolution of the identity:

dU=(UU†+U⊥U⊥†)dU=Udω+U⊥dX.(29)dU = (UU^\dagger+ U_\perp U_\perp^\dagger)dU = U d\omega+ U_\perp dX. \tag*{(29)}
dP=d(UQ)=U⊥dXQ+U(dω+dω′)Q,(30)dP = d(UQ) = U_\perp dXQ + U(d\omega+ d\omega')Q, \tag*{(30)}

where dωd\omega is the problematic term. Introducing gauge rotations QQ and giving them an arbitrary dependence on the tensors AA, such that dω′∝∂Q∂Ad\omega' \propto\frac{\partial Q}{\partial A}, we use it to fully cancel the second term in Eq. (30) (this is possible since ∂E~∂Q=0\frac{\partial\tilde{E}}{\partial Q}=0, i.e., the energy does not depend on QQ). Moreover, we also know that E~(Q,A)=E~(1,A)\tilde{E}(Q,A)=\tilde{E}(1,A), which allows us to set Q=1Q=1.

Secondly, we perform our derivation using the spectral decomposition of the enlarged corner without assuming that the leading eigenspace is already a good enough approximation by itself (which it is clearly not for systems close to or at the criticality). Therefore, the full eigendecomposition of the enlarged corner MM can be written as in Eq. (7):

M=PCP†+P⊥S⊥P⊥†.(31)M = PCP^\dagger+ P_\perp S_\perp P_\perp^\dagger. \tag*{(31)}

Here, we assume from the beginning that CC and dCdC do not have to be diagonal – it only matters that the isometries PP and P⊥P_\perp map onto relevant and truncated subspaces, respectively. Here, the square matrix V=(P,P⊥)V=(P,P_\perp) is unitary, V†V=VV†=1V^\dagger V=VV^\dagger=1. We differentiate Eq. (31) to obtain:

dM=dPCP†+PdCP†+PCdP†+dP⊥S⊥P⊥†+P⊥dS⊥P⊥†+P⊥S⊥dP⊥†.(32)dM = dPCP^\dagger+ PdCP^\dagger+ PCdP^\dagger+ dP_\perp S_\perp P_\perp^\dagger+ P_\perp dS_\perp P_\perp^\dagger+ P_\perp S_\perp dP_\perp^\dagger. \tag*{(32)}

Since we moved all the rotational dependence from dPdP to dCdC, the only contributing perturbations are those which are mixing between the relevant and truncated subspaces, i.e., dP=P⊥dXdP=P_\perp dX. By projecting Eq. (32) onto P†P^\dagger from the left and PP from the right, we obtain the non-diagonal dCdC derivative as in Eq. (11):

P†dMP=dC.(33)P^\dagger dMP=dC. \tag*{(33)}

Note that by expanding the right-hand side of this equation as dC=d(Q†SQ)dC=d(Q^\dagger SQ), we would arrive back to the familiar formula for the derivative of the eigenvalue decomposition:

(PQ†)†dM(PQ†)=−dω′S+dS+Sdω′.(34)(PQ^\dagger)^\dagger dM(PQ^\dagger)=-d\omega' S+dS+Sd\omega'. \tag*{(34)}

Dividing this equation into its diagonal and off-diagonal part results precisely in the same formulas which are known to the AD community [30], with dω=−dω′d\omega=-d\omega':

dS=1∘(U†dMU)(35)dS=1\mathbin{\circ}(U^\dagger dMU) \tag*{(35)}
dω′=FT∘(U†dMU),Fij=1sj−si,(36)d\omega'=F^{\mathsf T}\mathbin{\circ}(U^\dagger dMU),\qquad F_{ij}=\frac{1}{s_j-s_i}, \tag*{(36)}

(and Fii=0F_{ii}=0) where the equation for dω′d\omega' is clearly divergent if the spectrum of the enlarged corner is degenerate. (Here, ∘\mathbin{\circ} denotes the Hadamard product, i.e., the element-wise multiplication of matrices.) In any of the approaches, the P⊥dXP_\perp dX term can be obtained by projecting dMdM onto P⊥P⊥†P_\perp P_\perp^\dagger from the left and PP from the right:

P⊥P†dMP=P⊥dXC−P⊥S⊥dX,P_\perp P^\dagger dMP=P_\perp dXC-P_\perp S_\perp dX,
(1−PP†)dMP=dPC−P⊥S⊥P⊥†P⊥dX(1-PP^\dagger)dMP=dPC-P_\perp S_\perp P_\perp^\dagger P_\perp dX
(1−PP†)dMP=dPC−(1−PP†)MdP.(37)(1-PP^\dagger)dMP=dPC-(1-PP^\dagger)MdP. \tag*{(37)}

which results in a Sylvester equation for dPdP. In practice, there is no need for explicit construction of the enlarged corner MM. In the end, we only need to solve a Sylvester equation numerically, knowing how the enlarged corner matrix acts on the proper adjoint, so that the backward differentiation process has the same computational cost as the forward CTM algorithm.

Differentiating a truncated singular value decomposition

In the main text, we have observed that the dominant error in the gradient comes from not including the truncated part of the eigenspectrum in the derivation. This also has direct consequences for CTM schemes that do not assume C4V symmetry of the PEPS and thus use a singular value decomposition (SVD) instead. In this appendix, we derive an exact gradient of the truncated SVD.

We starting from the following equation

A=USV†+U⊥S⊥V⊥†.(38)A = USV^\dagger+ U_{\perp}S_{\perp}V_{\perp}^{\dagger}. \tag*{(38)}

Since UU, VV, U⊥U_{\perp} and V⊥V_{\perp} are all isometries we have that U†dUU^\dagger dU, V†dVV^\dagger dV, U⊥†dU⊥U_{\perp}^{\dagger}dU_{\perp}, and V⊥†dV⊥V_{\perp}^{\dagger}dV_{\perp} are all anti-Hermitian. Additionally, we use that the orthogonality conditions must all remain satisfied, so dU⊥†U+U⊥†dU=0dU_{\perp}^{\dagger}U + U_{\perp}^{\dagger}dU = 0 and dV⊥†V+V⊥†dV=0dV_{\perp}^{\dagger}V + V_{\perp}^{\dagger}dV = 0.

It is convenient to split the parts of dUdU and dVdV as:

dU=(1−UU†)dU+UU†dU(39)dU = (1 - UU^\dagger)dU + UU^\dagger dU \tag*{(39)}
=dU2+UdU1.(40)= dU_2 + UdU_1. \tag*{(40)}
dV=(1−VV†)dV+VV†dV(41)dV = (1 - VV^\dagger)dV + VV^\dagger dV \tag*{(41)}
=dV2+VdV1.(42)= dV_2 + VdV_1. \tag*{(42)}

We start by applying (1−UU†)(1 - UU^\dagger) and VV to dAdA:

(1−UU†)dAV=(1−UU†)dUS+U⊥S⊥dV⊥†V(43)(1 - UU^\dagger)dAV = (1 - UU^\dagger)dUS + U_{\perp}S_{\perp}dV_{\perp}^{\dagger}V \tag*{(43)}
=dU2S−(1−UU†)A dV2.(44)= dU_2S - (1 - UU^\dagger)A\,dV_2. \tag*{(44)}

Next we apply (1−VV†)(1 - VV^\dagger) and UU to dA†dA^\dagger:

(1−VV†)dA†U=(1−VV†)dVS+V⊥S⊥dU⊥†U(45)(1 - VV^\dagger)dA^\dagger U = (1 - VV^\dagger)dVS + V_{\perp}S_{\perp}dU_{\perp}^{\dagger}U \tag*{(45)}
=dV2S−(1−VV†)A†dU2.(46)= dV_2S - (1 - VV^\dagger)A^\dagger dU_2. \tag*{(46)}

These two equations allow us to solve for dU2dU_2 and dV2dV_2. Next, we apply U†U^\dagger and VV to dAdA:

U†dAV=U†dUS+dS+SdV†V(47)U^\dagger dAV = U^\dagger dUS + dS + SdV^\dagger V \tag*{(47)}
=dU1S+dS+SdV1†.(48)= dU_1S + dS + SdV_1^\dagger. \tag*{(48)}

We pause here to point out the gauge freedom inherent in the singular value decomposition, noted before in [31]. The relative phases of the singular vectors in UU and VV are in principle free. This implies that the change in phase of the singular vectors of UU, reflected in the diagonal part of dU1dU_1, may be varied arbitrarily if the corresponding phases of the singular vectors in VV are varied accordingly. We can see this reflected in the above Eq. (48), where it is manifest that adding any diagonal matrix to dU1dU_1 can be compensated for by subtracting the same diagonal matrix from dV1†dV_1^\dagger. We use this property to fix the diagonal part of dU1dU_1 to 0.

Using the fact that the diagonal part of dV1†dV_1^\dagger is purely imaginary and dSdS is purely real we can deduce:

1∘(S−1U†dAV−V†dA†US−1)/2=1∘dV1†(49)\mathbf{1} \circ\left(S^{-1}U^\dagger dAV - V^\dagger dA^\dagger U S^{-1}\right)/2 = \mathbf{1} \circ dV_1^\dagger \tag*{(49)}
1∘(U†dAV+V†dA†U)/2=dS(50)\mathbf{1} \circ\left(U^\dagger dAV + V^\dagger dA^\dagger U\right)/2 = dS \tag*{(50)}

where ∘\circ denotes Hadamard product (the element-wise multiplication of matrices). One should be wary that the object that depends on the SVD being differentiated does not have any dependence on the free gauge.

Finally, we use the anti-Hermiticity of dU1dU_1 and dV1dV_1 to find

Fij=1Sj2−Si2for i≠jandFii=0(51)F_{ij} = \frac{1}{S_j^2 - S_i^2}\quad\text{for }i \ne j\quad\text{and}\quad F_{ii}=0 \tag*{(51)}
F∘(SU†dAV+V†dA†US)=dV1−1∘dV1(52)F \circ\left(SU^\dagger dAV + V^\dagger dA^\dagger US\right) = dV_1 - \mathbf{1} \circ dV_1 \tag*{(52)}
F∘(U†dAVS+SV†dA†U)=dU1(53)F \circ\left(U^\dagger dAVS + SV^\dagger dA^\dagger U\right) = dU_1 \tag*{(53)}
Equation not extracted
(54)

The equations for the dU†dU^\dagger and dV†dV^\dagger may be found by simply taking the conjugate of the equations for dUdU and dVdV.

Review of back-propagation and complex AD

The basic idea of back-propagation is the efficient use of the chain-rule in differentiating. As an example we take four functions f(x)f(x), x=g(y)x = g(y), y=k(z)y = k(z), and z=p(t)z = p(t), and consider FF.

F(t)=f(g(k(p(t)))).(55)F(t) = f(g(k(p(t)))). \tag*{(55)}

xx, yy, zz, and tt may be real multi-variate variables, but FF (and thus also ff) is assumed to be a single real number. To calculate FF at a certain value of tt on a computer one would write several function that apply first pp, then kk, then gg, and finally ff. To determine the derivative of FF one would have to deploy the chain rule:

∂F(t)∂ti=∂f(xj)∂xj∂g(y)j∂yn∂k(z)n∂zm∂p(t)m∂ti(56)\frac{\partial F(t)}{\partial t_i} = \frac{\partial f(x_j)}{\partial x_j}\frac{\partial g(y)_j}{\partial y_n}\frac{\partial k(z)_n}{\partial z_m}\frac{\partial p(t)_m}{\partial t_i} \tag*{(56)}

where we assume a sum over repeated indices. This can be efficiently implemented by first calculating the vector ∂f(x)∂xj\frac{\partial f(x)}{\partial x_j}, and consecutively applying to it (on the right) the Jacobian matrices ∂g(y)j∂yn\frac{\partial g(y)_j}{\partial y_n}, ∂k(z)n∂zm\frac{\partial k(z)_n}{\partial z_m}, and ∂p(t)m∂ti\frac{\partial p(t)_m}{\partial t_i}. Note that, in principle, the above Eq. (56) could be evaluated either from right to left by first multiplying matrices (forward mode AD) or as just described from left to right by applying matrices to the vector, thereby reducing the complexity of the problem (reverse mode AD, in the opposite direction than evaluation of FF).

To implement this derivative automatically one needs to know:

  1. the order in which the functions were applied,

  1. at which value of the parameters the functions were evaluated,

  1. how the Jacobian ∂g(y)m∂yi\frac{\partial g(y)_m}{\partial y_i} of a function acts on a vector to the left, i.e. the map Γ↦Γm∂g(y)m∂yi\Gamma\mapsto\Gamma^m\frac{\partial g(y)_m}{\partial y_i}.

Points 1. and 2. are just a bookkeeping problem and easily done automatically. The map from point 3. needs to be constructed for any function that is used in constructing FF. Many functions, like multiplication, addition, or tensor contraction have standard backpropagation built into the available toolboxes. In the subsequent appendices, we will describe specifically how the function for truncated eigendecomposition or truncated SVD are properly back-propagated.

In what follows we will adopt the common convention of calling the accumulated gradient, denoted in Point 3. above as Γ\Gamma, ‘adjoint’, and labeling it by the variable it is contracted with. For example, if there is a variable VV which depends on XX, we have

ΓV∂V(X)∂X=ΓX.(57)\Gamma_V\frac{\partial V(X)}{\partial X}=\Gamma_X . \tag*{(57)}

In order to incorporate complex numbers into AD, we must take all variables and their complex conjugate as separate degrees of freedom. To see the effect of this we return to Eq. (56) and assume that the variables tjt_j etc. include all complex variables and their complex conjugates separately, e.g. t=[a,b,c,aˉ,bˉ,cˉ]Tt=[a,b,c,\bar{a},\bar{b},\bar{c}]^T. Eq. (56) is thus still the complete derivative. It is then useful to define a linear operator PP that flips the index of the variable with its conjugate: Pt=tˉPt=\bar{t} (The dimension of PP, wherever we use it, is implied by its context). Note that P2=1P^2=1. We then have that for any arbitrary function T(t)T(t) the following holds:

P∂T(t)∂tP=∂T(t)‾∂tˉ=∂T(t)‾∂t.(58)P\frac{\partial T(t)}{\partial t}P=\frac{\partial\overline{T(t)}}{\partial\bar{t}}=\frac{\overline{\partial T(t)}}{\partial t}. \tag*{(58)}

We will assume that we use the AD to differentiate a real-valued cost function F=f(g(h(k(…))))F=f(g(h(k(\ldots)))), which is made explicit by defining it as F=(g+gˉ)/2F=(g+\bar{g})/2, essentially fixing the last function ff to be the function that takes the real part of a scalar xx: f(x,xˉ)=(x+xˉ)/2f(x,\bar{x})=(x+\bar{x})/2. The adjoints of ff can be easily seen to be

∂f(x,xˉ)∂x=∂f(x,xˉ)∂xˉ=12.(59)\frac{\partial f(x,\bar{x})}{\partial x}=\frac{\partial f(x,\bar{x})}{\partial\bar{x}}=\frac{1}{2}. \tag*{(59)}

Or, more suggestively, taking t=[x,xˉ]Tt=[x,\bar{x}]^T:

∂f∂tP=∂fˉ∂t(60)\frac{\partial f}{\partial t}P=\frac{\partial\bar{f}}{\partial t} \tag*{(60)}

If we now consider the subsequent adjoints, Γk\Gamma_k for example, we can see an interesting property under PP:

ΓkP=∂f∂g∂g∂h∂h∂kP(61)\Gamma_kP=\frac{\partial f}{\partial g}\frac{\partial g}{\partial h}\frac{\partial h}{\partial k}P \tag*{(61)}
=(∂f∂gP)(P∂g∂h)(P∂h∂kP)(62)=\left(\frac{\partial f}{\partial g}P\right)\left(P\frac{\partial g}{\partial h}\right)\left(P\frac{\partial h}{\partial k}P\right) \tag*{(62)}
=∂f‾∂gˉ∂g‾∂hˉ∂h‾∂kˉ(63)=\frac{\overline{\partial f}}{\partial\bar{g}}\frac{\overline{\partial g}}{\partial\bar{h}}\frac{\overline{\partial h}}{\partial\bar{k}} \tag*{(63)}
=Γk‾(64)=\overline{\Gamma_k} \tag*{(64)}

We thus find that the adjoints of the complex variables are related by complex conjugation to the adjoints of the conjugate variables. Hence, at every back propagation step, the total derivative can be written as certain adjoints and their complex conjugates:

dE=∑i(ΓXi dXi+c.c.)(65)dE=\sum_i\left(\Gamma_{X_i}\,dX_i+\mathrm{c.c.}\right) \tag*{(65)}

allowing us to only keep track of Γ‾Xi\overline{\Gamma}_{X_i} (it is convention that Γ‾Xi\overline{\Gamma}_{X_i} and not ΓXi\Gamma_{X_i} is stored).

Practical implementation of backwards differentiation of the eigen-decomposition step in Q-deformed CTM

In this appendix, we elaborate more on the practical algorithmic implementation of the gradient of the truncated eigendecomposition and ways how to incorporate it within the current AD framework. Using the back-propagation method, our goal is to express the adjoints for the enlarged corner Mˉ\bar{M}, i.e. ΓMˉ=ΓˉM\Gamma_{\bar{M}}=\bar{\Gamma}_{M}, in terms of adjoints for CC, Cˉ\bar{C}, PP, and Pˉ\bar{P}.

ΓMˉ=ΓCC+ΓCˉCˉ+ΓPˉPˉ+ΓPPˉ(66)\Gamma_{\bar{M}}=\Gamma_C^C+\Gamma_{\bar{C}}^{\bar{C}}+\Gamma_{\bar{P}}^{\bar{P}}+\Gamma_P^{\bar{P}} \tag*{(66)}

The contribution from dCˉd\bar{C} follows from Eq. (11):

dC=P†dMP† ⇒ ΓMˉCˉ=P(ΓCˉ)P†,(67)dC=P^\dagger dM P^\dagger\ \Rightarrow\ \Gamma_{\bar{M}}^{\bar{C}}=P(\Gamma_{\bar{C}})P^\dagger, \tag*{(67)}

and that same equation tells us ΓMˉC=0\Gamma_{\bar{M}}^C=0. Note that due to the QQ-deformation of CTM, we do not take the diagonal part of ΓC\Gamma_C in contrast to what one would usually do for the back-propagation of an eigendecomposition.

The contribution from dPdP is less trivial, since it is given by a linear Eq. (13) instead of a closed formula, which we recall here for clarity:

P†dM†(1−PP†)=CdP†−dP†M(1−PP†).(68)P^\dagger dM^\dagger(1-PP^\dagger)=CdP^\dagger-dP^\dagger M(1-PP^\dagger). \tag*{(68)}

(where we applied a dagger to either side of Eq. (13) and used C†=CC^\dagger=C and M†=MM^\dagger=M) In fact, there is another equation for dPˉd\bar{P} (which must be treated as a separate variable), which also contributes to ΓMˉ\Gamma_{\bar{M}}, obtained by projecting dM†dM^\dagger onto P†P^\dagger from the right and (1−PP†)(1-PP^\dagger) from the left:

(1−PP†)dM†P=dPC−(1−PP†)MdP(69)(1-PP^\dagger)dM^\dagger P=dPC-(1-PP^\dagger)MdP \tag*{(69)}

It must be stressed at this point that there is no need to solve the above equation for dPdP or dPˉd\bar{P}, as we only really need ΓMˉP\Gamma_{\bar{M}}^P and ΓMˉPˉ\Gamma_{\bar{M}}^{\bar{P}}. To find ΓMˉP\Gamma_{\bar{M}}^P we realize that after vectorization the equation for dPˉd\bar{P} becomes:

dm→=NdPˉ→(70)\overrightarrow{dm}=N\overrightarrow{d\bar{P}} \tag*{(70)}

with

dm=[P†dM†(1−PP†)]T(71)dm=\left[P^\dagger dM^\dagger(1-PP^\dagger)\right]^T \tag*{(71)}

and

N=(1⊗C)−[M(1−PP†)]T⊗1(72)N=(1\otimes C)-\left[M(1-PP^\dagger)\right]^T\otimes1 \tag*{(72)}

and therefore we may rewrite the total derivative as an inner product:

Tr⁡(Γ‾PdP†)=Γ⃗P‾⋅dP⃗=Γ⃗P‾⋅N−1dm‾⃗(73)\operatorname{Tr}\left(\overline{\Gamma}_{P}dP^{\dagger}\right)=\vec{\Gamma}_{\overline{P}}\cdot\vec{dP}=\vec{\Gamma}_{\overline{P}}\cdot N^{-1}\vec{d\overline{m}} \tag*{(73)}

and have the matrix N−1N^{-1} act on the left defining a new variable γ⃗=N−TΓ⃗P‾\vec{\gamma}=N^{-T}\vec{\Gamma}_{\overline{P}}, where γ⃗\vec{\gamma} is a vectorized solution to the Sylvester equation of the form:

ΓP‾=γC−M(1−PP†)γ,(74)\Gamma_{\overline{P}}=\gamma C-M(1-PP^{\dagger})\gamma, \tag*{(74)}

In the end we can write that:

Tr⁡(Γ‾PdP†)=Tr⁡(γP†dM†(1−PP†))(75)\operatorname{Tr}\left(\overline{\Gamma}_{P}dP^{\dagger}\right)=\operatorname{Tr}\left(\gamma P^{\dagger}dM^{\dagger}(1-PP^{\dagger})\right) \tag*{(75)}

Applying similar tricks to dPdP we obtain an equation for γ~\widetilde{\gamma}:

ΓP=γ~CT−[(1−PP†)M]γ~=Γ‾P,(76)\Gamma_{P}=\widetilde{\gamma}C^{T}-\left[(1-PP^{\dagger})M\right]\widetilde{\gamma}=\overline{\Gamma}_{P}, \tag*{(76)}

remembering that we assume our adjoints to of conjugate variables to be related. We see that the solution of Eq. (76) can be derived from the solution we got from Eq. (74):

γ~=γ‾(77)\widetilde{\gamma}=\overline{\gamma} \tag*{(77)}

which together with the contribution from P‾\overline{P} and C‾\overline{C} gives rise to the total ΓM‾\Gamma_{\overline{M}}:

ΓM‾=PΓC‾P†+(1−PP†)γP†+Pγ~†(1−PP†)\Gamma_{\overline{M}}=P\Gamma_{\overline{C}}P^{\dagger}+(1-PP^{\dagger})\gamma P^{\dagger}+P\widetilde{\gamma}^{\dagger}(1-PP^{\dagger})

with

ΓP‾=γC−M(1−PP†)γ(78)\Gamma_{\overline{P}}=\gamma C-M(1-PP^{\dagger})\gamma \tag*{(78)}

In practice, we can solve the equation for γ\gamma numerically, without constructing explicitly the matrix MM, but encoding only its action on γ\gamma. For this we use Matlab’s stabilized biconjugate gradients method; since Eq. (74) is usually poorly conditioned, we use a right preconditioner C−1C^{-1} in order to improve the convergence. Note that constructing the full ΓM‾\Gamma_{\overline{M}}, as one would do in fully automated AD, is suboptimal. Clearly ΓM‾\Gamma_{\overline{M}} consists of three terms that are explicitly rank deficient, which could be leveraged to improve the computational complexity of the back-propagation. Note also that the equation previously used [24, 25], where the truncated spectrum is not taken into account, would consist of only the first term in Eq. (74).

Practical implementation of backward differentiation of SVD

Similar to the previous appendix, we present here how to practically implement the formulas for the singular value decomposition. The goal is to take adjoints for U‾\overline{U}, V‾\overline{V}, and S‾\overline{S}: ΓU‾\Gamma_{\overline{U}}, ΓV‾\Gamma_{\overline{V}}, and ΓS‾\Gamma_{\overline{S}} and map them to adjoints for the original matrix A‾\overline{A} (ΓA‾\Gamma_{\overline{A}}). Taking the previously derived differentials for the SVD, we obtain the following contributions to the adjoints for backwards propagation:

ΓA‾=ΓA‾S+ΓA‾U1+ΓA‾V1+ΓA‾diag+ΓA‾trunc(79)\Gamma_{\overline{A}}=\Gamma_{\overline{A}}^{S}+\Gamma_{\overline{A}}^{U_{1}}+\Gamma_{\overline{A}}^{V_{1}}+\Gamma_{\overline{A}}^{diag}+\Gamma_{\overline{A}}^{trunc} \tag*{(79)}

The first four terms were also found in [31], we present them here again for the readers convenience, and the last term is due to the treatment of truncated spectrum presented in this paper.

We recount:

  1. ΓA‾S=12U(1∘(ΓS‾+ΓS‾†))V†\Gamma_{\overline{A}}^{S}=\frac{1}{2}U\left(\mathbf{1}\mathbin{\circ}(\Gamma_{\overline{S}}+\Gamma_{\overline{S}}^{\dagger})\right)V^{\dagger}

  1. ΓA‾U1=U(F∘(U†ΓU‾−ΓU‾†U))SV†\Gamma_{\overline{A}}^{U_{1}}=U\left(F\mathbin{\circ}(U^{\dagger}\Gamma_{\overline{U}}-\Gamma_{\overline{U}}^{\dagger}U)\right)SV^{\dagger}

  1. ΓA‾V1=US(F∘(V†ΓV‾−ΓV‾†V))V†\Gamma_{\overline{A}}^{V_{1}}=US\left(F\mathbin{\circ}(V^{\dagger}\Gamma_{\overline{V}}-\Gamma_{\overline{V}}^{\dagger}V)\right)V^{\dagger}

  1. ΓA‾diag=US−1(1∘(ΓV‾†V−V†ΓV‾))V†/2\Gamma_{\overline{A}}^{diag}=US^{-1}\left(\mathbf{1}\mathbin{\circ}(\Gamma_{\overline{V}}^{\dagger}V-V^{\dagger}\Gamma_{\overline{V}})\right)V^{\dagger}/2

The last terms follows similarly as Eq. (78):

ΓA‾trunc=(1−UU†)γV†+Uγ~†(1−VV†)\Gamma_{\overline{A}}^{trunc}=(1-UU^{\dagger})\gamma V^{\dagger}+U\widetilde{\gamma}^{\dagger}(1-VV^{\dagger})

with

ΓU‾=γS−A(1−VV†)γ~\Gamma_{\overline{U}}=\gamma S-A(1-VV^{\dagger})\widetilde{\gamma}
ΓV‾=γ~S−A†(1−UU†)γ(80)\Gamma_{\overline{V}}=\widetilde{\gamma}S-A^{\dagger}(1-UU^{\dagger})\gamma \tag*{(80)}

with the underlined parts added in contrast to previous formulas.

References

  1. [27]B. Christianson, Reverse accumulation and attractive fixed points, Optimization Methods and Software 3, 311 (1994), https://doi.org/10.1080/10556789408805572.
  2. [28]J.-Y. Chen and D. Poilblanc, Topological Z2 resonating-valence-bond spin liquid on the square lattice, Phys. Rev. B 97, 161107 (2018).DOI
  3. [29]R. N. C. Pfeifer, G. Evenbly, S. Singh, and G. Vidal, NCON: A tensor network contractor for MATLAB (2015), arXiv:1402.0939 [physics.comp-ph].arXiv
  4. [30]M. B. Giles, Collected Matrix Derivative Results for Forward and Reverse Mode Algorithmic Differentiation, in Advances in Automatic Differentiation, edited by C. H. Bischof, H. M. Bücker, P. Hovland, U. Naumann, and J. Utke (Springer Berlin Heidelberg, Berlin, Heidelberg, 2008) pp. 35–44.DOI
  5. [31]Z.-Q. Wan and S.-X. Zhang, Automatic Differentiation for Complex Valued SVD, (2019), arXiv:1909.02659.arXiv

Paper details

vlnc:W_j3j8eybd
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Physics and Astronomy

Not recorded for this paper

View statement
Looking for related papers…
Contents