                      Automatic Differentiation of Optimization Algorithms
                                  with Time-Varying Updates


                                             Sheheryar Mehmood 1 Peter Ochs 1


                            Abstract                                    where we define A(x, u) := x − α∇x F (x, u) for solving
       Numerous optimization algorithms have a time-                    a parametric optimization problem of the form
       varying update rule thanks to, for instance, a
                                                                                              min F (x, u) ,                    (P)
       changing step size, momentum parameter or, Hes-                                        x∈X
       sian approximation. Often, such algorithms are
                                                                        with a smooth objective F : X × U → R. In this case (Re )
       used as solvers for the lower-level problem in
                                                                        reduces to the optimality condition ∇x F (x, u) = 0.
       bilevel optimization, and are unrolled when com-
       puting the gradient of the upper-level objective. In             There is a wide range of practical applications in which,
       this paper, we apply unrolled or automatic differ-               problems of type (Re ) or (P) appear as a constraint within
       entiation to a time-varying iterative process and                a minimization problem with respect to the parameter u.
       provide convergence (rate) guarantees for the re-                Usually, for some smooth ℓ : X × U → R, this can be
       sulting derivative iterates. We then adapt these                 compactly stated as
       convergence results and apply them to proximal
       gradient descent with variable step size and FISTA                                   min ℓ(ψ(u), u) ,                    (1)
                                                                                            u∈U
       when solving partly-smooth problems. We test the
       convergence (rates) of these algorithms numeri-                  where, given any u ∈ U, ψ(u) is a solution of (Re ) or (P).
       cally through several experiments. Our theoretical               This kind of optimization, formally known as bilevel opti-
       and numerical results show that the convergence                  mization (Dempe et al., 2015; Dempe & Zemkoho, 2020)
       rate of the algorithm is reflected in its derivative             has emerged as a crucial tool in machine learning, playing a
       iterates.                                                        foundational role in various applications such as hyperpa-
                                                                        rameter optimization (Bengio, 2000; Domke, 2012; Maclau-
                                                                        rin et al., 2015), implicit neural networks (Amos & Kolter,
1. Introduction                                                         2017; Agrawal et al., 2019; Bai et al., 2019; 2020; Winston
                                                                        & Kolter, 2020), meta-learning (Hospedales et al., 2021),
For some parameter u ∈ U, we consider the following
                                                                        and neural architecture search (Liu et al., 2019).
parametric iterative process
                                                                        Solving (1) through gradient-based methods requires com-
                x(k+1) (u) := A(x(k) (u), u) ,                (R)       puting the gradient of the upper objective ℓ(ψ(u), u) with
for k ≥ 0, where x(0) ∈ X is the initial iterate and                    respect to u which, in turn, requires computing the deriva-
A : X ×U → X is the update mapping. The iterates x(k) (u)               tive of the solution mapping u 7→ ψ(u), that is, Dψ(u)
generated by (R) depend on u due to the dependence of A                 by using the chain rule. When ℓ and F (or A) satisfy cer-
on u. The goal of performing the iterations (R) is mainly               tain smoothness and regularity assumptions, this can be
to solve the non-linear fixed-point equation                            achieved by two different methods. (i) One is known as
                                                                        Implicit Differentiation (ID) which leverages the classical
                         x = A(x, u) ,                    (Re )         Implicit Function Theorem or IFT (Dontchev & Rockafellar,
with respect to x for each parameter u. A simple exam-                  2009, Theorem 1B.1) applied to (Re ) to estimate
ple is gradient descent with appropriate step size α > 0                                                    −1
                                                                               Dψ(u) = (I − Dx A(x, u))          Du A(x, u)
   1                                                                                                                            (2)
    Department of Mathematics & Computer Science, Saarland                             = −∇2x F (x, u)−1 Du ∇x F (x, u) ,
University, Saarbrücken, Germany. Correspondence to: Sheheryar
Mehmood <mehmood@math.uni-sb.de>.                                       where x := ψ(u) (see Theorem A.10 for more details).
                       nd
Proceedings of the 42 International Conference on Machine               The key assumption for IFT is the strict bound on the spec-
Learning, Vancouver, Canada. PMLR 267, 2025. Copyright 2025             tral radius ρ(Dx A(ψ(u), u)) < 1, which we call the con-
by the author(s).                                                       traction property since it is a sufficient condition for A

                                                                    1
                       Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

to be 1-Lipschitz or contractive. A direct consequence is               ally, the proof of convergence of Dx(k) (u) relies on the
the linear convergence of x(k) (u) to ψ(u) (Polyak, 1987,               contraction property in each of the above works with an
Section 2.1.2, Theorem 1). The output of ID (2) depends                 exception of Pauwels & Vaiter (2023). The linear rate of
on accurately solving (Re ) — possibly through (R) — and                convergence requires (local) Lipschitz continuity of DA.
solving the linear system efficiently. (ii) The other technique         A slightly different line of study on the problematic be-
is known as Unrolled, Iterative or Automatic Differentia-               haviour of automatic differentiation in the earlier iterations
tion (AD) or simply Unrolling where Dψ(u) is estimated                  was carried out by Scieur et al. (2022).
by applying automatic differentiation (Wengert, 1964; Lin-
nainmaa, 1970; Griewank & Walther, 2008) to the output                  1.2. Iteration-Dependent Updates
x(K) (u) of (R) after K ∈ N iterations. The update rule for
forward mode AD applied to x(K) is given by                             Most iterative algorithms for solving (P) which include gra-
                                                                        dient descent with line search, Nesterov’s accelerated gradi-
    Dx(k+1) (u) := Dx A(x(k) (u), u)Dx(k) (u)                           ent (Nesterov, 1983), and Quasi-Newton methods (Davidon,
                                                          (DR)          1959; Fletcher & Powell, 1963; Broyden, 1970; Fletcher,
                   + Du A(x(k) (u), u) ,                                1970, etc.) cannot be modelled by (R). This happens be-
                                                                        cause the update mapping is changing at every iteration; A
for 0 ≤ k < K where we may assume Dx(0) (u) = 0. The
                                                                        in (R) is replaced by Ak : X × U → X giving us the update
effective use of AD relies on the guarantee that Dx(K) (u)
accurately estimates Dψ(u) for a preferably small K. More                             x(k+1) (u) := Ak (x(k) (u), u) .          (Rk )
formally, we require the convergence of Dx(K) (u) to
Dψ(u) as K → ∞, with a convergence rate comparable to                   For example, for gradient descent with line search,
that of x(k) (u).                                                       Ak (x, u) := x − αk ∇x F (x, u). When Ak is C 1 -smooth
                                                                        for all k ∈ N, the modified update rule for performing
The reverse mode AD or Backpropagation (Rumelhart et al.,               forward mode AD on (Rk ) reads:
1986; Baydin et al., 2018) has a different update rule, how-
ever, the result computed is the same in the end (Griewank                Dx(k+1) (u) := Dx Ak (x(k) (u), u)Dx(k) (u)
& Walther, 2008). Due to the nature of the iterations (DR),                                                                   (DRk )
                                                                                        + Du Ak (x(k) (u), u) .
we will use x(K) and x(k) interchangeably. The reverse
mode AD has a memory overhead since it requires storing
the iterates (x(k) )0≤k<K . Even though this is in contrast             Beck (1994) studied this problem for the C 1 -smooth se-
with ID which only depends on x(K) , AD is still a popular              quence of functions Ak with uniformly bounded derivatives
choice for estimating Dψ(u). A crucial advantage of AD is               and DAk converging to DA pointwise. They showed that
that it provides a nice blackbox implementation thanks to               for such a sequence, when (x(k) (u))k∈N is generated by
the powerful autograd libraries included in PyTorch (Paszke             (Rk ) to solve the system (Re ), then (Dx(k) (u))k∈N gener-
et al., 2019), TensorFlow (Abadi et al., 2016), and JAX                 ated by (DRk ) converges to Dψ(u) defined in (2). However,
(Bradbury et al., 2018) whereas ID requires either a custom             their results cannot account for the linear convergence of
implementation (Bolte et al., 2023, see Remark 2) or using              Dx(k) (u) in their given setting (see Section A.3). More-
special libraries (Blondel et al., 2022; Ren et al., 2023, etc.).       over, their setting excludes the more general cases where
                                                                        Ak does not converge, for instance, gradient descent with
                                                                        line search.
1.1. Convergence of Automatic Differentiation
                                                                        Griewank et al. (1993) studied the special setting for solv-
The convergence of the derivative sequence Dx(k) (u) for
                                                                        ing the non-linear system G(x, u) = 0 with respect
AD of (R) were studied classically for linear (Fischer, 1991)
                                                                        to x through preconditioned Picard iterations, that is,
and general iteration maps (Gilbert, 1992). More recently,
                                                                        Ak (x, u) := x−Pk (u)G(x, u). The parameter-dependent
the convergence analysis was provided for gradient descent
                                                                        preconditioner Pk : U → L(X , X ) is changing at every it-
(Lorraine et al., 2020; Mehmood & Ochs, 2020), the Heavy-
                                                                        eration and may not converge. They demonstrated linear
ball method (Mehmood & Ochs, 2020), proximal gradient
                                                                        convergence of Dx(k) (u) for a C 1 -smooth G : X ×U → X
descent for lasso-like problems (Bertrand et al., 2022), the
                                                                        with bounded maps Dx G and (x, u) 7→ Dx G(x, u)−1 and
Sinkhorn-Knopp algorithm (Pauwels & Vaiter, 2023), the
                                                                        Lipschitz continuous map DG. The map Pk is assumed to
super-linearly convergent algorithms (Bolte et al., 2023),
                                                                        be C 1 -smooth with bounded (potentially 0) derivative for
and stochastic gradient descent (Iutzeler et al., 2024). The
                                                                        every k ∈ N.
convergence results were extended to non-smooth iterative
processes by Bolte et al. (2022) using conservative calculus            Riis (2020); Mehmood & Ochs (2022) considered apply-
(Bolte & Pauwels, 2020; 2021). Ablin et al. (2020) theoreti-            ing AD when Ak denotes the update mapping of FISTA
cally established the better convergence rate for computing             (Beck & Teboulle, 2009) (which we will call Accelerated
the gradient of the value function through AD and ID. Usu-              Proximal Gradient or APG) applied to (P) for non-smooth

                                                                    2
                      Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

F := f + g with step size αk and extrapolation parameter                   on the framework of Beck (1994), our results provide
βk . They adapted the results of Beck (1994) and demon-                    convergence and convergence rate guarantees for PGD
strated the convergence of Dx(k) (u) to Dψ(u) when f is                    with variable step size and convergence rate guaran-
C 2 -smooth with a Lipschitz continuous gradient, g is partly              tees for APG. We show that the rate of convergence
smooth (Lewis, 2002), the sequences (αk )k∈N and (βk )k∈N                  of x(k) (u) is reflected in that of Dx(k) (u) for both
converge and F additionally satisfies restricted injectivity               algorithms.
and non-degeneracy conditions (see, for example, Lewis,
2002). Dψ(u) is computed by applying the Implicit Func-
tion Theorem for partly smooth functions (Lewis, 2002,                1.4. Notation
Theorem 5.7). Partly smooth functions are a class of spe-             In this paper, X and U are Euclidean spaces and R :=
cial non-smooth functions which exhibit smoothness when               [−∞, ∞]. With a slight abuse of notation, ∥ · ∥ denotes
restricted to a low-dimensional manifold M and model var-             any norm on each of the spaces X and U including the
ious practical regularization functions (Vaiter et al., 2017).        one induced by the inner product ⟨·, ·⟩. The space of linear
The non-smooth or sharp behaviour occurs only when we                 operators from U to X is denoted by L(U, X ). Any operator
move orthogonal to M. The combination of restricted injec-            norm on the spaces L(U, X ) and L(X , U) is also denoted by
tivity and non-degeneracy assumptions induces the contrac-            ∥ · ∥. We say that w(k) = o(z (k) ) iff ∥w(k) ∥ = o(∥z (k) ∥)
tion property in proximal gradient descent or PGD (Liang              and w(k) = O(z (k) ) iff ∥w(k) ∥ = O(∥z (k) ∥).
et al., 2014) and APG (Liang et al., 2017) near the solution.
The results of Riis (2020); Mehmood & Ochs (2022) do not              The affine hull of a set C ⊂ X is denote by aff C whereas
explain the linear convergence of AD of APG or even the               par C = aff C − aff C is a linear subspace parallel to C.
convergence of AD of PGD with non-converging variable                 The relative interior of a convex set C (Rockafellar, 1970, p.
step size.                                                            44) is denoted by ri C and is always non-empty whenever
                                                                      C is non-empty (Rockafellar, 1970, Theorem 6.2). For any
Iutzeler et al. (2024) tackle the problem of applying AD              α > 0 and proper and lower semi-continuous g : X × U →
on Stochastic Gradient Descent or SGD and ensure conver-              R where g(·, u) is convex for all u ∈ U ⊂ U, we define
gence of the derivative sequence by considering the deriva-           Pαg : X × U → X by Pαg (·, u) = proxαg(·,u) , that is,
tive recursion as a so-called ”inexact SGD” applied to solve
a stochastic quadratic problem whose solution is the de-
sired derivative of the solution mapping. Although, our                                                 1
                                                                         Pαg (w, u) := argmin αg(x, u) + ∥x − w∥2 .             (3)
deterministic and their stochastic settings both work with                              x∈X             2
time-varying algorithms, we can not simply deduce one
from the other in a trivial manner.                                   In this paper we use the notion of regular subdifferential
                                                                      (Rockafellar & Wets, 1998, Definition 8.3) of g. When
1.3. Contributions                                                    U is open and for any x ∈ X , g(x, ·) is differentiable at
In this paper, we aim to resolve the theoretical gaps pre-            u ∈ U , we obtain ∂g(x, u) = ∂x g(x, u) × {∇u g(x, u)}
sented in Section 1.2 and therefore reinforce the usefulness          (Mehmood & Ochs, 2022, Lemma 1).
of AD. In particular, the main contributions of this paper are        We use standard notions of Riemannian Geometry, which
the following:                                                        we define in Section A.4 in the appendix. We refer a C k -
                                                                      smooth m-dimensional submanifold by simply C k -smooth
 (i) We strengthen the results of Beck (1994) by providing            manifold. Furthermore, the natural embedding of M in
     a convergence rate analysis for Dx(k) (u) generated              X allows us to define a Riemannian metric on M, mak-
     by (DRk ) after equipping their setting with an addi-            ing it a Riemannian manifold. For any x ∈ M, the map
     tional assumption that is satisfied by most optimization         Π : M → L(X , X ) outputs the orthogonal projection onto
     algorithms (see Assumption 2.1(ii) and Remark 2.1).              the tangent space of M at x, that is, Π(x) := projTx M
(ii) We establish (linear) convergence of Dx(k) (u) beyond            while Π⊥ : M → L(X , X ) gives us the orthogonal projec-
     the setting in (i) without the pointwise convergence             tion onto the normal space of M at x, that is, Π⊥ (x) :=
     condition of Ak to A (see Assumption 2.2 and 2.3).               projNx M . For a function g : X × U → R with values
                                                                      g(x, u) which is C 2 -smooth when restricted to M × U
(iii) We demonstrate the convergence of Dx(k) (u) for                 where M ⊂ X is a C 2 -smooth manifold and U ⊂ U is
      Proximal Gradient Descent (Lions & Mercier, 1979) or            an open set, we respectively denote by ∇M g and ∇2M g,
      PGD with variable step size and Accelerated Proximal            the Riemannian gradient and Hessian of g relative to M
      Gradient (Beck & Teboulle, 2009) or APG by adapting             with respect to x. We follow Mehmood & Ochs (2022, Re-
      the results for (ii) and (i) respectively. In contrast to       mark 22(iv)) to express the Riemannian gradient ∇M×U g
      Riis (2020) and Mehmood & Ochs (2022), which rely               and Hessian ∇2M×U g of g.

                                                                  3
                      Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

2. Differentiation of Iteration-Dependent                                  x∗ = A(x∗ , u∗ ), DAk (x∗ , u∗ ) → DA(x∗ , u∗ ) and
   Algorithms                                                              ρ(Dx A(x∗ , u∗ )) < 1.

In this section, we lay down the assumptions on the sequence          2.2. Implicit Differentiation
(Ak )k∈N and provide convergence and convergence rate
guarantees for the derivative iterations defined in (DRk ). In        Combining Assumptions 2.1((i)–(iii)) allows us to invoke
particular we establish (i) convergence rates when Ak has             the Implicit Function Theorem on x∗ = Ak (x∗ , u∗ ) for
a pointwise limit A, and (ii) convergence and convergence             every k large enough and obtain a C 1 -smooth fixed-point
rates when Ak does not have a pointwise limit. For a better           map ψk on a neighbourhood Uk ∈ Nu∗ . In particular, we
comparison and understanding, this section is adapted to              have the following result.
follow the same pattern as Section A.3, which summarizes              Lemma 2.2. Let (x∗ , u∗ , X∗ ) ∈ X × U × L(X , X ),
the results by Beck (1994).                                           V ∈ N(x∗ ,u∗ ) (Ak )k∈N0 , and ∥ · ∥ be such that Assump-
                                                                      tion 2.1 ((i)–(iii)) is satisfied. Then there exists K ∈ N such
2.1. Problem Setting                                                  that ∀k ≥ K, there exists Uk ∈ Nu∗ and a C 1 -smooth
                                                                      ψk : Uk → X such that ∀u ∈ Uk , ψk (u) = Ak (ψk (u), u),
For a given u∗ , we assume that x∗ is the solution that we
                                                                      and
are trying to estimate through (Rk ). Because the pointwise
limit A of Ak may not exist, we assume that x∗ is a fixed             Dψk (u) = I − Dx Ak (ψk (u), u)
                                                                                                               −1
                                                                                                                   Du Ak (ψk (u), u) ,
point of Ak (·, u∗ ) for every k ∈ N. This seemingly restric-                                                                      (4)
tive assumption is satisfied by the optimization algorithms           so that Dψk (u∗ ) = X∗ .
highlighted in Section 1.2. The application of the Implicit
Function Theorem on this sequence of fixed-point equations
                                                                      Proof. The proof is in Section B.1 in the appendix.
requires the contraction property, that is, the strict bound on
some operator norm ∥Dx Ak (x∗ , u∗ )∥ < 1 eventually for              Remark 2.3. If we replace Assumptions 2.1(ii) and 2.1(iii)
all k ∈ N. Furthermore, we assume that the sequence of                by a slightly stronger assumption, that is, “there exists U ∈
affine maps (X 7→ Dx Ak (x∗ , u∗ )X+Du Ak (x∗ , u∗ ))k∈N              Nu∗ such that for any (x, u) ∈ X × U , x = Ak (x, u)
share a common fixed-point X∗ ∈ L(X , X ) — the reason                for some k ∈ N implies x = Ak (x, u) for every k ∈ N,
will become clear shortly. Finally, to show the convergence           and lim supk→∞ ∥Dx Ak (x, u)∥ < 1”, we obtain a shared
of the derivative sequence (Dx(k) (u∗ ))k∈N , we assume that          C 1 -smooth fixed-point map ψ : U → X , such that, Uk = U
the sequence (x(k) (u∗ ))k∈N converges to x∗ . More for-              and ψk = ψ for all k ∈ N.
mally, given (x(0) , x∗ , u∗ , X∗ ) ∈ X × X × U × L(X , X ),
V ∈ N(x∗ ,u∗ ) , (Ak )k∈N0 , and a norm ∥ · ∥ on L(X , X )            2.3. Automatic Differentiation
induced by some vector norm, we assume that the following
conditions hold.                                                      In Lemma 2.2, we just showed that under Assumption 2.1,
Assumption 2.1.      (i) Ak |V is C 1 -smooth for all k,              the common fixed-point X∗ of the mappings X 7→
                                                                      Dx Ak (x∗ , u∗ )X + Du Ak (x∗ , u∗ ) for k ∈ N represents
 (ii) x∗ = Ak (x∗ , u∗ ) and X∗ = Dx Ak (x∗ , u∗ )X∗ +                the derivative of the solution at u = u∗ . We now show that
      Du Ak (x∗ , u∗ ) for all k,                                     the derivative sequence generated by (DRk ) for u = u∗
                                                                      converges to X∗ . Instead of assuming a pointwise limit for
(iii) lim supk→∞ ∥Dx Ak (x∗ , u∗ )∥ < 1, and                          DAk , we assert that DAk (x(k) (u∗ ), u∗ ) − DAk (x∗ , u∗ )
(iv) x(k) (u∗ ) generated by (Rk ) has limit x∗ such that             tends to 0.
     (x(k) (u∗ ), u∗ ) ∈ V for all k.                                 Assumption 2.2. The sequence (DAk (x(k) (u∗ ), u∗ ) −
Remark 2.1. (i) Unlike Assumption A.1 from Beck                       DAk (x∗ , u∗ ))k∈N0 converges to 0.
   (1994), where the existence of A gives us both the                 Remark 2.4. (i) In Assumption A.2 of Beck (1994),
   fixed-point and its derivative at u∗ (see A.1(ii)), our               where A exists, the sequence (DAk (x(k) (u∗ ), u∗ ) −
   Assumption 2.1 does not require the existence of such                 DA(x∗ , u∗ ))k∈N0 is assumed to converge to 0.
   a limit which allows us to work directly with the family              Rewriting
   (Ak )k∈N , each of which provides the solution and its
   derivative at u∗ (see 2.1(ii)). Moreover, the spectral                    DAk (x(k) (u∗ ), u∗ ) − DA(x∗ , u∗ )
   radius condition is imposed on the lim sup of the spec-
                                                                                    = DAk (x(k) (u∗ ), u∗ ) − DAk (x∗ , u∗ ) (5)
   tral radii of derivative of Ak (see 2.1(iii)) rather than
   on the derivative of A (see A.1(iii)).                                           + DAk (x∗ , u∗ ) − DA(x∗ , u∗ ) .

 (ii) A special case of Assumption 2.1(iii) arises when                    suggests that this convergence follows, for instance,
      for some C 1 -smooth mapping A : V → X , we have                     when our Assumption 2.2 holds and DAk converges

                                                                  4
                      Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

     pointwise to DA at (x∗ , u∗ ). We demonstrate this             where ρ := lim supk→∞ ρ(Dx Ak (x∗ , u∗ )), and qx < 1 is
     difference for Gradient Descent with variable step size        the convergence rate of (x(k) (u∗ ))k∈N0 .
     in Example A.2.
                                                                    Proof. The proof is in Section B.3 in the appendix.
(ii) Combining Assumption 2.2 with the special case of
     Remark 2.1, we obtain the setting of Assumption A.2            Remark 2.8. In (7), ξ1 depends on the derivative error
     (see Remark 2.4(i)).                                           Dx(K) (u∗ ) − X ∗ while ξ2 depends on the derivative errors
                                                                    Dx(K) (u∗ ) − X ∗ , DAK (x(K) (u∗ ), u∗ ) − DAK (x∗ , u∗ ),
(iii) A sufficient condition for Assumption 2.2 is equiconti-       and the derivative of the solution X∗ . All of these terms are
      nuity (see Section A.1 for definition and an example)         computed at k = K and therefore, are fixed. The explicit
      of (Ak )k∈N0 at (x∗ , u∗ ).                                   expressions can be found in the proof.
We are now ready to establish the convergence of the                Owing to Corollary A.7 and our discussion in Remark 2.1,
derivative sequence (Dx(k) (u∗ ))k∈N to X∗ when Assump-             the following result shows that the work of Beck (1994) is re-
tions 2.1 and 2.2 hold.                                             produced and strengthened with a convergence rate guaran-
Theorem 2.5. Let (x(0) , x∗ , u∗ ) ∈ X × X × U, V ∈                 tee under the additional requirement of Assumption 2.1(ii).
N(x∗ ,u∗ ) , and (Ak )k∈N0 be such that Assumptions 2.1 and         Corollary 2.9. The conclusions of Theorems 2.5 and 2.7
2.2 are satisfied. Then the sequence (Dx(k) (u∗ ))k∈N0              also hold when, in their respective hypotheses, Assump-
generated by (DRk ) converges to X∗ which is equal to               tion 2.1(iii) is replaced by “there exists a C 1 -smooth
                       −1
(I − Dx Ak (x∗ , u∗ )) Du Ak (x∗ , u∗ ) for all k ∈ N (see          A : V → X , such that DAk (x∗ , u∗ ) converges to
Assumption 2.1(ii)).                                                DA(x∗ , u∗ ) and ρ(Dx A(x∗ , u∗ )) < 1”.
                                                                    Remark 2.10. The conclusions of Theorems 2.5 and 2.7
Proof. The proof is in Section B.2 in the appendix.                 and Corollary 2.9 do not require the neighbourhood V
                                                                    of (x∗ , u∗ ) to be a connected set as long as Assump-
The derivative iterates Dx(k) (u∗ ) additionally converge           tions 2.2 and 2.3 are respectively satisfied along with As-
with a linear rate when the sequences x(k) (u∗ ) and                sumption 2.1(iv).
DAk (x(k) (u∗ ), u∗ ) − DAk (x∗ , u∗ ) converge linearly.
Assumption 2.3. The sequence (x(k) (u∗ ))k∈N0 converges             3. Differentiation of Proximal Gradient-type
linearly to x∗ and
                                                                       Methods
DAk (x(k) (u∗ ), u∗ )−DAk (x∗ , u∗ ) = O(x(k) (u∗ )−x∗ ) .          We now turn our attention to unrolling PGD with variable
                                                     (6)            step size and APG when solving
Remark 2.6. (i) Assumptions A.3 (from the appendix)
   and 2.3 (ours) both require the corresponding se-                              min F (x, u) ,     F := f + g ,             (8)
                                                                                  x∈X
   quences in Assumptions A.2 and 2.2, respectively,
   to converge linearly. From (5), we see that As-                  and aim at providing convergence (rate) guarantees for the
   sumption A.3 holds when Assumption 2.3 holds and                 corresponding derivative sequences. The idea is to con-
   DAk (x∗ , u∗ ) → DA(x∗ , u∗ ) converges linearly (see            sider the class of partly smooth functions (Lewis, 2002)
   also Example A.4). Since the latter condition is not             which models a wide range of non-smooth regularizers and
   practical in general, Assumption A.3 does not appear in          constraints appearing in practice (Vaiter et al., 2017). Fur-
   Beck (1994) and is given here only for completeness.             thermore, this setting (see Assumption 3.1) under some ad-
                                                                    ditional assumptions (see Assumptions 3.2 and 3.3) yields a
(ii) A sufficient condition for Assumption 2.3 is the Lip-          more general IFT (see Theorem 3.1) for differentiating the
     schitz continuity of (DAk )k∈N0 in x uniformly in u            solution mapping of (8). This in turn allows us to differen-
     and k (see Section A.1 for definition and an example).         tiate the update mappings of PGD (see Theorem 3.4) and
Theorem 2.7. Let (x(0) , x∗ , u∗ ) ∈ X × X × U, V ∈                 APG (see Theorem 3.10), since they are also the solution
N(x∗ ,u∗ ) , and (Ak )k∈N0 be such that Assumptions 2.1 and         mappings of partly smooth functions (see Equations 3, 10
2.3 are satisfied. Then the sequence (Dx(k) (u∗ ))k∈N0 gen-         and 13).
erated by (DRk ) converges linearly to X∗ . In particular,          Examples of partly smooth functions include norms defined
for all δ ∈ (0, 1 − ρ), there exist ξ1 , ξ2 , and K ∈ N, such       on vector space including ℓ1 , ℓ2 , and ℓ∞ norms, as well as
that for all k ≥ K, we have                                         their combinations. These norms are commonly used as
                                                                    regularizers in machine learning: ℓ1 and ℓ∞ promote spar-
    ∥Dx(k) (u∗ ) − X∗ ∥ ≤ ξ1 (ρ + δ)k−K                             sity and anti-sparsity, respectively, while the combined ℓ2,1
                                                         (7)
                 + ξ2 (k − K) max(ρ + δ, qx )k−K ,                  norm induces group sparsity. Analogous norms defined on

                                                                5
                      Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

matrix space which include nuclear norm, Frobenius norm,            3.2. Implicit Function Theorem
and spectral norm and their combinations are also partly
                                                                    The following theorem is thanks to Lewis (2002) which
smooth and promote similar forms of strcutred-sparsity for
                                                                    furnishes a C 1 -smooth solution map for (8) near u∗ . The
matrices. The formal definition of partial smoothness is
                                                                    expression for the derivative can be found in Vaiter et al.
provided in Section A.5 in the appendix.
                                                                    (2017); Mehmood & Ochs (2022).
3.1. Problem Setting                                                Theorem 3.1 (Differentiation of Solution Map). Let f and g
                                                                    satisfy Assumption 3.1 and (x∗ , u∗ ) ∈ M × Ω be such that
We first define our setting in a more precise manner. Let M         Assumptions 3.2(i) and 3.3 are satisfied. Then there exist
be a C 2 -smooth manifold and Ω ⊂ U be an open set, we              an open neighbourhood U ⊂ Ω of u∗ and a continuously
need f and g to satisfy the following assumption.                   differentiable mapping ψ : U → M such that for all u ∈ U ,
Assumption 3.1 (Convex Partly Smooth Objective).
f : X × U → R is C 2 -smooth, g : X × U → R is partly                (i) ψ(u) is the unique minimizer of F (·, u)|M ,
smooth relative to M × Ω and for every u ∈ Ω, f (·, u) and
g(·, u) are convex, f (·, u) has an L-Lipschitz continuous          (ii) (ND) and (RPD-i) are satisfied at (ψ(u), u), and
gradient, and g(·, u) has a simple proximal mapping.
                                                                    (iii) the derivative of ψ is given by
When Assumption 3.1 is satisfied, we use Mehmood & Ochs
(2022, Remark 22(iv)) to denote the Riemannian gradient                   Dψ(u) = −∇2M F (ψ(u), u)† Du ∇M F (ψ(u), u) ,
and Hessian of F . Let x∗ ∈ M be a solution of (8) at                                                                    (9)
u∗ ∈ Ω. When g = 0, IFT requires ∇2x f (x∗ , u∗ ) ≻ 0                    where ∇2M F (ψ(u), u)† denotes the pseudoinverse of
which is also a sufficient condition for the linear con-                 ∇2M F (ψ(u), u).
vergence of gradient descent and the Heavy-ball method
(Polyak, 1987). When g is partly smooth, IFT requires posi-         3.3. The Extrapolated Proximal Gradient Algorithm
tive definiteness of ∇2M F (x∗ , u∗ ) (Lewis, 2002) while the
linear convergence of PGD and APG is established by the             Although Theorem 3.1 is not practical when computing the
positive definiteness of Π(x∗ )∇2x f (x∗ , u∗ )Π(x∗ ) (Liang        derivative of the solution map, it allows us to differentiate
et al., 2014; 2017).                                                the update mappings of PGD and APG as we will see shortly.
                                                                    Algorithm 1 provides the update procedure for proximal
Assumption 3.2 (Restricted Positive Definiteness). Let              gradient with extrapolation where Pαg is defined in (3). This
(x∗ , u∗ ) ∈ M × Ω be a given point.                                algorithm reduces to (i) PGD when βk = 0 for all k ∈ N,
                                                                    and (ii) APG when the sequence βk ensures acceleration in
 (i) The Hessian ∇2M F (x∗ , u∗ ) is positive definite on           PGD (Beck & Teboulle, 2009; Chambolle & Dossal, 2015).
     Tx∗ M, that is,

                      ∇2M F (x∗ , u∗ ) ≻ 0 .         (RPD-i)        Algorithm 1 Proximal Gradient with Extrapolation
                                                                       • Initialization: x(0) = x(−1) ∈ X , u ∈ U, 0 < α ≤
                                                                         ᾱ < 2/L.
(ii) Moreover, Π(x∗ )∇2x f (x∗ , u∗ ) is positive definite on
     Tx∗ M, that is,                                                   • Parameter: (αk )k∈N ∈ [α, ᾱ] and (βk )k∈N ∈ [0, 1].

           Π(x∗ )∇2x f (x∗ , u∗ ) T ∗ M ≻ 0 .       (RPD-ii)           • Update k ≥ 0:
                                   x

                                                                                  y (k) := (1 + βk )x(k) − βk x(k−1)
Finally, for partly smooth problems, IFT and linear con-                          w(k) := y (k) − αk ∇x f (y (k) , u)    (APG)
vergence of PGD and APG also require a non-degeneracy                           (k+1)                 (k)
assumption to hold which ensures that the solution stays in                   x         := Pαk g (w         , u) .
M for any u near u∗ .
Assumption 3.3 (Non-degeneracy). The non-degeneracy
condition is satisfied at (x∗ , u∗ ) ∈ M × Ω, that is,
                                                                    3.4. Proximal Gradient Descent
                   0 ∈ ri ∂x F (x∗ , u∗ ) .             (ND)
                                                                    We first extend our results from Section 2 and provide con-
                                                                    vergence rate guarantees for AD of PGD. For a given step
In (ND), ri denotes the relative interior of a convex set.          size α > 0, we write the update mapping for PGD in a more

                                                                6
                      Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

compact manner through the map Aα : X ×Ω → X defined                  3.4.1. I MPLICIT D IFFERENTIATION
by
                                                                      Under Assumptions 3.1–3.3, Mehmood & Ochs (2022, The-
       Aα (x, u) := Pαg (x − α∇x f (x, u), u) , (10)                  orem 34) provided an IFT for the fixed-point equation of
Liang et al. (2014) established that under Assumptions 3.1,           PGD which is more practical for using ID than (9) and is
3.2(ii) and 3.3, all the iterates x(k) (u∗ ) of PGD lie on M          restated below.
after a finite number of iterations and exhibit a local linear        Theorem 3.6. Let f and g satisfy Assumption 3.1 and
convergence behaviour as summarized by the following                  (x∗ , u∗ ) ∈ M × Ω be such that Assumptions 3.2(ii)
lemma.                                                                and 3.3 are satisfied. Then for any α ∈ [α, ᾱ],
Lemma 3.2 (Activity Identification and Linear Conver-                 ρ(Dx Aα (x∗ , u∗ )Π(x∗ )) < 1. Additionally when Assump-
gence of PGD). Let f and g satisfy Assumption 3.1                     tion 3.2(i) is also satisfied, the (possibly reduced) neigh-
and (x∗ , u∗ ) ∈ M × Ω be such that Assumption 3.3                    bourhood U and the mapping ψ from Theorem 3.1 satisfy
is satisfied. For αk ∈ [α, ᾱ] and βk := 0, let the                   x = Aα (x, u) and
sequence (x(k) (u∗ ))k∈N generated by Algorithm 1 con-                                                        −1
verges to x∗ . Then there exists K ∈ N, such that                       Dψ(u) = (I − Dx Aα (x, u)Π(x))             Du Aα (x, u) ,
x(k) (u∗ ) ∈ M for all k ≥ K. Moreover when As-                                                                                (11)
sumption 3.2(ii) is also satisfied and ᾱ < 2M/L2 where               for all u ∈ U and x := ψ(u).
M := λmax (Π(x∗ )∇2x f (x∗ , u∗ )Π(x∗ )), then x(k) (u∗ )
                                                                      3.4.2. AUTOMATIC D IFFERENTIATION
converge linearly to x∗ .
Remark 3.3. The precise rate of convergence of PGD can                Using Theorems 3.4, and 3.6 and our results from Section 2,
be found in Liang et al. (2014, Theorem 3.1).                         we obtain the convergence (rate) guarantees for AD of PGD.
                                                                      Theorem 3.7. Let f and g satisfy Assumption 3.1 and
Mehmood & Ochs (2022, Theorem 34) provide a foundation                (x∗ , u∗ ) ∈ M × Ω be such that Assumptions 3.2 and
for proving the following crucial differentiablity result for         3.3 are satisfied. Let αk ∈ [α, ᾱ], βk := 0, the se-
Aα by combining Theorem 3.1 and Lemma 3.2. However,                   quence (x(k) (u∗ ))k∈N generated by Algorithm 1 con-
the result below is novel since it establishes differentiabil-        verges to x∗ with x(0) sufficiently close to x∗ , and
ity of Aαk at the iterates x(k) (u∗ ) of PGD for all k ∈ N            lim supk→∞ ρ(Dx Aαk (x∗ , u∗ )) < 1. Then the se-
and also shows that the derivative sequence DAαk is well-             quence (Dx(k) (u∗ ))k∈N converges to Dψ(u∗ ). Addition-
behaved.                                                              ally (Dx(k) (u∗ ))k∈N converges linearly with rate max(ρ +
Theorem 3.4. Let f and g satisfy Assumption 3.1 and                   δ, qx ) where ρ := lim supk→∞ ρ(Dx Aαk (x∗ , u∗ )), when
(x∗ , u∗ ) ∈ M × Ω be such that Assumption 3.3 are sat-               x(k) (u∗ ) converges linearly with rate qx < 1, M is C 3 -
isfied. For αk ∈ [α, ᾱ] and βk := 0, let the sequence                smooth, and ∇M g, ∇2x f , ∇2M g, Du ∇x f , and Du ∇M g
(x(k) := x(k) (u∗ ))k∈N generated by Algorithm 1 converges            are locally Lipschitz continuous near (x∗ , u∗ ). In partic-
to x∗ . Then there exists K ∈ N, such that,                           ular, for all δ ∈ (0, 1 − ρ), there exist ξ1 , ξ2 , and K ∈ N,
                                                                      such that for all k ≥ K, we have
 (i) the mapping (x, u, α) 7→ Aα (x, u) defined in (10) is
     C 1 -smooth near (x(k) , u∗ , αk ) and (x∗ , u∗ , αk ) for          ∥Dx(k) (u∗ ) − Dψ(u∗ )∥ ≤ ξ1 (ρ + δ)k−K
                                                                                                                               (12)
     all k ≥ K,                                                                        + ξ2 (k − K) max(ρ + δ, qx )k−K .

(ii) (DAαk (x(k) , u∗ )−DAαk (x∗ , u∗ ))k≥K converges to              Proof. The proof is in Section C.2 in the appendix.
     0, and
                                                                      Remark 3.8. (i) The constants ξ1 and ξ2 in (12) de-
(iii) additionally, when M is C 3 -smooth, ∇M g, ∇2x f ,                 pend on derivative errors Dx(K) (u∗ ) − Dψ(u∗ ),
      ∇2M g, Du ∇x f , and Du ∇M g are locally Lipschitz                 DAαK (x(K) (u∗ ), u∗ ) − DAαK (x∗ , u∗ ), and the
      continuous near (x∗ , u∗ ) and (x(k) )k∈N converges                derivative of the solution Dψ(u∗ ) in the same manner
      linearly, then DAαk (x(k) , u∗ ) − DAαk (x∗ , u∗ ) =               as described in Remark 2.8.
      O(x(k) − x∗ ).
                                                                       (ii) Because x(0) is not close enough to x∗ in practice, one
                                                                            may resort to late-starting (Mehmood & Ochs, 2022,
Proof. The proof is in Section C.1 in the appendix.                         Section 1.4.2).

Remark 3.5. The C 3 -smoothness of M is a sufficient con-             (iii) In practice, we do not need x(0) to be close enough
dition for the local Lipschitz continuity of the Weingarten                 to x∗ because even when the update map Aαk is not
map (x, v) 7→ Wx (·, v).                                                    differentiable in the earlier iterations of Algorithm 1,

                                                                  7
                      Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

     the autograd libraries still yield a finite output as the       result is mostly derived from Mehmood & Ochs (2022,
     derivative (Bolte & Pauwels, 2020; 2021). Hence, AD             Theorem 39).
     of Algorithm 1 can still recover a good estimate of             Theorem 3.10. Let f and g satisfy Assumption 3.1 and
     Dψ(u) as long as Algorithm 1 is run for sufficiently            (x∗ , u∗ ) ∈ M×Ω be such that Assumption 3.3 are satisfied.
     large number of iterations (see also Mehmood & Ochs,            For [α, ᾱ] ∋ αk → α∗ and [0, 1] ∋ βk → β∗ , let the
     2022, Remark 45(i)).                                            sequence (x(k) := x(k) (u∗ ))k∈N generated by Algorithm 1
(iv) When αk is generated through line-search methods, it            converges to x∗ . Then there exist Vα∗ ∈ N(x∗ ,x∗ ,u∗ ,α∗ )
     also depends on u in a possibly non-differentiable way.         and K ∈ N, such that
     Therefore, the total derivative of x(k) with respect to u
     may not make sense. However computing Dx(k) (u)                  (i) the mapping (z, u, α) 7→ Aα,β (z, u) defined in (13)
     by ignoring this dependence — for instance, in practice,             is C 1 -smooth on Vα∗ and (z (k) , u∗ , αk ) ∈ Vα∗ for all
     through routines like stop_gradient (Bradbury                        k ≥ K,
     et al., 2018; Abadi et al., 2016) and detach (Paszke
     et al., 2019) — the true derivative is still recovered in        (ii) (DAαk ,βk (z (k) , u∗ ) − DAαk ,βk (z ∗ , u∗ ))k≥K con-
     the limit provided that conditions of Theorem 3.7 are                 verges to 0, and (DAαk ,βk (z ∗ , u∗ ))k≥K converges
     met. This fact was first explored in Griewank et al.                  to DAα∗ ,β∗ (z ∗ , u∗ ), and
     (1993).
                                                                     (iii) additionally, when M is C 3 -smooth, ∇M g, ∇2x f ,
 (v) All of the non-smooth functions provided in, for in-                  ∇2M g, Du ∇x f , and Du ∇M g are locally Lipschitz
     stance, Vaiter et al. (2017) satisfy the local Lipschitz              continuous near (x∗ , u∗ ) and (x(k) )k∈N converges lin-
     continuity condition of ∇M g, and ∇2M g and the C 3                   early, then DAαk ,βk (z (k) , u∗ ) − DAαk ,βk (z ∗ , u∗ ) =
     smoothness of M.                                                      O(x(k) − x∗ ),
(vi) The conditions like the linear convergence of x(k) (u∗ )
     and lim supk→∞ ρ(Dx Aαk (x∗ , u∗ )) < 1 are not re-             where z := (x1 , x2 ), z (k) := (x(k) , x(k−1) ), and z ∗ :=
     quired if the step size sequence αk is bounded as in the        (x∗ , x∗ )
     hypothesis of Lemma 3.2.
                                                                     Proof. The proof is in Section C.3 in the appendix.
3.5. Accelerated Proximal Gradient
We similarly compute AD of APG and show (linear) con-                3.5.1. I MPLICIT D IFFERENTIATION
vergence of the corresponding derivative iterates. Given
step size α > 0 and extrapolation parameter β ∈ [0, 1], we           Similarly Theorems 3.1, and 3.10 can be used to yield an
define the update mapping Aα,β : X × X × U → X × X                   IFT for the fixed-point equation of APG (Mehmood & Ochs,
by                                                                   2022, Theorem 39), which we recall below.
                                                                     Theorem 3.11. Let f and g satisfy Assumption 3.1 and
  Aα,β (z, u) := (Aα (x1 + β(x1 − x2 ), u) , x1 ) , (13)
                                                                     (x∗ , u∗ ) ∈ M × Ω be such that Assumptions 3.2(ii)
for z := (x1 , x2 ) ∈ X × X . Just like PGD, APG also                and 3.3 are satisfied. Then for any α ∈ [α, ᾱ] and
exhibit activity identification property and local linear con-       β ∈ [0, 1] with −1/(1 + 2β) < λmin (Dx Aα (x∗ , u)), we
vergence under Assumptions 3.1, 3.2(ii), and 3.3 (Liang              have ρ(Dz Aα,β (x∗ , x∗ , u∗ )Π(x∗ , x∗ )) < 1. Additionally
et al., 2017).                                                       when Assumption 3.2(i) is also satisfied, the (possibly re-
                                                                     duced) neighbourhood U and the mapping ψ from Theo-
Lemma 3.9 (Activity Identification and Linear Conver-                rem 3.1 satisfy z = Aα,β (z, u) and
gence of APG). Let f and g satisfy Assumption 3.1 and
(x∗ , u∗ ) ∈ M × Ω be such that Assumption 3.3 is satis-             
                                                                      Dψ(u)
                                                                               
                                                                                                           −1
fied. For αk ∈ [α, ᾱ] and βk ∈ [0, 1], let the sequence                         = (I − Dz Aα,β (z, u)Π(z)) Du Aα,β (z, u) ,
                                                                      Dψ(u)
(x(k) (u∗ ))k∈N generated by Algorithm 1 converges to x∗ .                                                            (14)
Then there exists K ∈ N, such that x(k) (u∗ ) ∈ M for all            for all u ∈ U and z := (ψ(u), ψ(u)).
k ≥ K. Moreover when Assumption 3.2(ii) is also satis-
fied, αk → α∗ and βk → β∗ such that −1/(1 + 2β∗ ) <                  3.5.2. AUTOMATIC D IFFERENITATION
λmin (Dx Aα∗ (x∗ , u∗ )), then x(k) (u∗ ) converge linearly to
x∗ with rate ρ(Dz Aα∗ ,β∗ (x∗ , x∗ , u∗ )Π(x∗ , x∗ )).               Mehmood & Ochs (2022, see Theorem 44) established the
                                                                     convergence of the derivative iterates of APG. We strengthen
Using Theorem 3.1, and Lemma 3.9, we can differentiate               their results by providing convergence rate guarantees in
Aαk ,βk near (x∗ , x∗ , u∗ ) for all k ∈ N. The following            our final result below.

                                                                 8
                         Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

Theorem 3.12. Let f and g satisfy Assumption 3.1 and                             PGD               PGDk1                    PGDk2            PGDk3             APG
(x∗ , u∗ ) ∈ M × Ω be such that Assumption 3.3 are sat-               10 2                            10 2                                10 1
isfied. For [α, ᾱ] ∋ αk → α∗ and [0, 1] ∋ βk → β∗
                                                                      10 3                            10 3
such that −1/(1 + 2β∗ ) < λmin (Dx Aα∗ (x∗ , u∗ )), let the                                                                               10 2
sequence (x(k) (u∗ ))k∈N generated by Algorithm 1 con-                10 4                            10 4

verges to x∗ with x(0) sufficiently close to x∗ . Then                10 5                            10 5
                                                                                                                                          10 3

the sequence (Dx(k) (u∗ ))k∈N converges to Dψ(u∗ ). Ad-
                                                                             0   150   300   450                 0    150     300   450          0   30   60     90
ditionally, (Dx(k) (u∗ ))k∈N converges linearly with rate
max(ρ + δ, qx ) where ρ := ρ(Dz Aα∗ ,β∗ (x∗ , u∗ )), when            10 1                            102
x(k) (u∗ ) converges linearly with rate qx < 1, M is C 3 -
                                                                     10 2                            101
smooth, and ∇M g, ∇2x f , ∇2M g, Du ∇x f , and Du ∇M g
are locally Lipschitz continuous near (x∗ , u∗ ). In partic-         10 3                            100                                  10 2

ular, for all δ ∈ (0, 1 − ρ), there exist ξ1 , ξ2 , and K ∈ N,
                                                                             0   150   300   450             0       150     300    450          0   30   60    90
such that for all k ≥ K, we have

   ∥Dx(k) (u∗ ) − Dψ(u∗ )∥ ≤ ξ1 (ρ + δ)k−K                           Figure 1. Error plots of iterates (top row) of PGD and APG for
                                                         (15)        lasso (left column), logistic (middle column), and multinomial lo-
                     + ξ2 (k − K) max(ρ + δ, qx )k−K .               gistic (right column) regression along with their derivative iterates
                                                                     (bottom row). Similarity in the convergence rates of the original
Proof. The proof is in Section C.4 in the appendix.                  and the derivative iterates is clearly visible.

Remark 3.13. The arguments made in Remark 3.8 naturally
extend to Theorem 3.12.
                                                                     βk := (k − 1)/(k + 5) (depicted by APG in Figure 1). This
                                                                     generates five different algorithm sequences (x(k) (u))k∈N
4. Experiments                                                       for each problem. In Figure 1, PGD represents step size
To test our results, we provide numerical demonstration on           αk set to fixed optimal value α∗ , whereas PGDki repre-
a few examples from classical Machine Learning. These                sents varying step size αk drawn from uniform distribution
include lasso regression, that is,                                   with parameters 2(i−1)          2i
                                                                                         3L , and 3L for all k ∈ N and for all
                                                                     i ∈ {1, 2, 3}. We solve (16) for 50 randomly generated
                        1                                            datasets, (17) for 50 perturbed instances of MADELON
                min       ∥Xw − y∥22 + λ∥w∥1 ,           (16)
                w∈RN    2                                            dataset (Dua & Graff, 2017), and (18) for a single instance
                                                                     of CIFAR10 dataset (Krizhevsky, 2009). For each problem,
with parameters u := (X, y, λ), binary classification using
                                                                     we initialize w(0) ∈ B10−2 (w∗ ) by first solving it partially.
ℓ2 -regularized logistic regression, that is,
                                                                     In Figure 1, the top row shows the median error plots of the
            M
          1 X                             λ                         five algorithms and the bottom row shows the errors of the
   min             log 1 + exp(−yi xTi w) + ∥w∥22 , (17)             corresponding derivatives with the same colour. The three
  w∈RN M                                   2
               i=1
                                                                     columns correspond to the error plots for (16), (17), and (18)
with parameters u := (X, λ), and finally multiclass classifi-        respectively. The figure clearly shows that the derivative
cation using ℓ2 -regularized multinomial logistic regression,        error decays as fast as the algorithm error for each problem.
that is,                                                             In particular, the linear convergence behaviour of AD of
                                                                     APG for all the problems and PGDki with i ∈ {1, 2, 3} for
                     1 X
                         M
                                           λ                         the lasso problem are only explained by our results.
         min     −         log(pyi (xi )) + ∥W ∥2F ,     (18)
     W ∈RN ×C        M i=1                 2
                                                                     5. Conclusion
with parameters u := (X, λ). In (18), ∥·∥F is the Frobenius
                                                                     We applied automatic differentiation on the iterative pro-
norm and pj (x) denotes the j th element of the predicted
                                                                     cesses with time-varying update mappings. We strengthened
output p(x) := σ(W T x) for each input x ∈ RN with σ
                                                                     a previous result (Beck, 1994) with convergence rate guar-
being the softmax activation function. In all the problems,
                                                                     antee and extended them to a new setting. As an example
X ∈ RM ×N and y ∈ RM represent the dataset and the
                                                                     for each setting, we adapted our results to proximal gradient
parameters are selected in such a way that Assumptions 3.1–
                                                                     descent with variable step size and its accelerated counter-
3.3 are satisfied.
                                                                     part, that is, FISTA. We showed that the convergence rate
We solve the three problems through PGD with four differ-            of the algorithm is simply mirrored in its derivative iterates
ent choices of step sizes and APG with fixed step size and           which was supported through experiments on toy problems.

                                                                 9
                      Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

Acknowledgements                                                     Baydin, A. G., Pearlmutter, B. A., Radul, A. A., and Siskind,
                                                                       J. M. Automatic differentiation in machine learning: a
Sheheryar Mehmood and Peter Ochs are supported by the                  survey. Journal of Marchine Learning Research, 18:1–43,
German Research Foundation (DFG Grant OC 150/4-1).                     2018.

Impact Statement                                                     Beck, A. and Teboulle, M. A fast iterative shrinkage-
                                                                       thresholding algorithm for linear inverse problems. SIAM
This paper presents work whose goal is to advance the field            Journal on Imaging Sciences, 2(1):183–202, March 2009.
of Machine Learning. There are many potential societal
                                                                     Beck, T. Automatic differentiation of iterative processes.
consequences of our work, none which we feel must be
                                                                       Journal of Computational and Applied Mathematics, 50
specifically highlighted here.
                                                                       (1-3):109–118, 1994.

References                                                           Bengio, Y. Gradient-based optimization of hyperparameters.
                                                                       Neural computation, 12:1889–900, 09 2000. doi: 10.
Abadi, M., Barham, P., Chen, J., Chen, Z., Davis, A., Dean,            1162/089976600300015187.
  J., Devin, M., Ghemawat, S., Irving, G., Isard, M., Kudlur,
  M., Levenberg, J., Monga, R., Moore, S., Murray, D. G.,            Bertrand, Q., Klopfenstein, Q., Massias, M., Blondel, M.,
  Steiner, B., Tucker, P., Vasudevan, V., Warden, P., Wicke,           Vaiter, S., Gramfort, A., and Salmon, J. Implicit differen-
  M., Yu, Y., and Zheng, X. Tensorflow: A system for large-            tiation for fast hyperparameter selection in non-smooth
  scale machine learning. In 12th {USENIX} Symposium on                convex learning. Journal of Machine Learning Research,
  Operating Systems Design and Implementation ({OSDI}                  23(149):1–43, 2022.
 16), pp. 265–283, 2016.
                                                                     Blondel, M., Berthet, Q., Cuturi, M., Frostig, R., Hoyer, S.,
                                                                       Llinares-Lopez, F., Pedregosa, F., and Vert, J.-P. Efficient
Ablin, P., Peyré, G., and Moreau, T. Super-efficiency of
                                                                       and modular implicit differentiation. In Koyejo, S., Mo-
  automatic differentiation for functions defined as a mini-
                                                                       hamed, S., Agarwal, A., Belgrave, D., Cho, K., and Oh,
  mum. arXiv preprint arXiv:2002.03722, 2020.
                                                                       A. (eds.), Advances in Neural Information Processing
                                                                       Systems, volume 35, pp. 5230–5242. Curran Associates,
Agrawal, A., Amos, B., Barratt, S., Boyd, S., Diamond,
                                                                       Inc., 2022.
  S., and Kolter, J. Z. Differentiable convex optimization
  layers. In Advances in Neural Information Processing Sys-          Bolte, J. and Pauwels, E. A mathematical model for auto-
  tems 32, pp. 9562–9574. Curran Associates, Inc., 2019.               matic differentiation in machine learning. In Larochelle,
                                                                       H., Ranzato, M., Hadsell, R., Balcan, M., and Lin,
Amos, B. and Kolter, J. Z. OptNet: Differentiable optimiza-            H. (eds.), Advances in Neural Information Processing
 tion as a layer in neural networks. In Precup, D. and Teh,            Systems, volume 33, pp. 10809–10819. Curran Asso-
 Y. W. (eds.), Proceedings of the 34th International Con-              ciates, Inc., 2020. URL https://proceedings.
 ference on Machine Learning, volume 70 of Proceedings                 neurips.cc/paper/2020/file/
 of Machine Learning Research, pp. 136–145, Interna-                   7a674153c63cff1ad7f0e261c369ab2c-Paper.
 tional Convention Centre, Sydney, Australia, 06–11 Aug                pdf.
 2017. PMLR.
                                                                     Bolte, J. and Pauwels, E. Conservative set valued fields,
Bai, S., Kolter, J. Z., and Koltun, V. Deep equilibrium                automatic differentiation, stochastic gradient methods
  models. In Wallach, H., Larochelle, H., Beygelz-                     and deep learning. Mathematical Programming, 188(1):
  imer, A., d'Alché-Buc, F., Fox, E., and Garnett,                   19–51, 2021.
  R. (eds.), Advances in Neural Information Pro-        Bolte, J., Pauwels, E., and Vaiter, S. Automatic differ-
  cessing Systems, volume 32. Curran Associates,          entiation of nonsmooth iterative algorithms. In Oh,
  Inc., 2019.          URL https://proceedings.           A. H., Agarwal, A., Belgrave, D., and Cho, K. (eds.),
  neurips.cc/paper/2019/file/                             Advances in Neural Information Processing Systems,
  01386bd6d8e091c2ab4c7c7de644d37b-Paper.                 2022. URL https://openreview.net/forum?
  pdf.                                                    id=WUMH5xloWn.
Bai, S., Koltun, V., and Kolter, J. Z. Multiscale deep equi-         Bolte, J., Pauwels, E., and Vaiter, S. One-step dif-
  librium models. In Larochelle, H., Ranzato, M., Hadsell,             ferentiation of iterative algorithms. In Thirty-seventh
  R., Balcan, M. F., and Lin, H. (eds.), Advances in Neural            Conference on Neural Information Processing Systems,
  Information Processing Systems, volume 33, pp. 5238–                 2023. URL https://openreview.net/forum?
  5250. Curran Associates, Inc., 2020.                                 id=81snFfE3vR.

                                                                10
                      Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

Bradbury, J., Frostig, R., Hawkins, P., Johnson, M. J., Leary,        Gilbert, J. C. Automatic differentiation and iterative pro-
  C., Maclaurin, D., Necula, G., Paszke, A., VanderPlas, J.,            cesses. Optimization Methods and Software, 1(1):13–21,
  Wanderman-Milne, S., and Zhang, Q. JAX: composable                    1992.
  transformations of Python+NumPy programs, 2018. URL
  http://github.com/google/jax.                                       Griewank, A. and Walther, A. Evaluating Derivatives:
                                                                        Principles and Techniques of Algorithmic Differentiation.
Broyden, C. G. The convergence of single-rank quasi-                    SIAM, Philadelphia, 2nd edition, 2008.
  newton methods. Mathematics of Computation, 24(110):
  365–382, 1970.                                                      Griewank, A., Bischof, C., Corliss, G., Carle, A., and
                                                                        Williamson, K. Derivative convergence for iterative equa-
Chambolle, A. and Dossal, C. On the convergence of the                  tion solvers. Optimization methods and software, 2(3-4):
  iterates of the “fast iterative shrinkage/thresholding algo-          321–355, 1993.
  rithm”. Journal of optimization theory and applications,
 166(3):968–982, 2015. ISSN 0022-3239.                                Hospedales, T., Antoniou, A., Micaelli, P., and Storkey,
                                                                       A. Meta-learning in neural networks: A survey. IEEE
Chavel, I. Riemannian Geometry: A Modern Introduction,                  transactions on pattern analysis and machine intelligence,
  volume 98. Cambridge University Press, 2006.                         44(9):5149–5169, 2021.

Davidon, W. Variable metric method for minimization.                  Iutzeler, F., Pauwels, E., and Vaiter, S. Derivatives of
  Technical report, Argonne National Lab., Lemont, Ill.,                 stochastic gradient descent in parametric optimization.
 1959.                                                                   In The Thirty-eighth Annual Conference on Neural Infor-
                                                                         mation Processing Systems, 2024.
Dempe, S. and Zemkoho, A. Bilevel optimization. In
                                                                      Krizhevsky, A. Learning multiple layers of features from
  Springer optimization and its applications, volume 161.
                                                                        tiny images. 2009.
  Springer, 2020.
                                                                      Lee, J. Introduction to Smooth Manifolds. Graduate Texts
Dempe, S., Kalashnikov, V., Prez-Valds, G. A., and Kalash-
                                                                        in Mathematics. Springer, 2003. ISBN 9780387954486.
  nykova, N. Bilevel Programming Problems: The-
  ory, Algorithms and Applications to Energy Networks.                Lewis, A. S. Active sets, nonsmoothness, and sensitivity.
  Springer Publishing Company, Incorporated, 2015. ISBN                 SIAM Journal on Optimization, 13(3):702–725, 2002. doi:
  3662458268, 9783662458266.                                            10.1137/S1052623401387623.
Domke, J. Generic methods for optimization based mod-                 Liang, J., Fadili, J. M., and Peyré, G. Local linear conver-
  eling. In Proceedings of the Fifteenth International                  gence of forward–backward under partial smoothness. In
 Conference on Artificial Intelligence and Statistics, vol-             Proceedings of the 27th International Conference on Neu-
  ume 22 of Proceedings of Machine Learning Research,                   ral Information Processing Systems - Volume 2, NIPS’14,
  pp. 318–326, La Palma, Canary Islands, 21–23 Apr                      pp. 1970–1978, Cambridge, MA, USA, 2014. MIT Press.
  2012. PMLR. URL http://proceedings.mlr.
  press/v22/domke12.html.                                             Liang, J., Fadili, J., and Peyré, G. Activity identification
                                                                        and local linear convergence of forward–backward-type
Dontchev, A. L. and Rockafellar, R. T. Implicit Functions               methods. SIAM Journal on Optimization, 27(1):408–437,
  and Solution Mappings, volume 543. Springer, 2009.                    2017. doi: 10.1137/16M106340X.

Dua, D. and Graff, C. UCI machine learning repository,                Linnainmaa, S. The representation of the cumulative round-
  2017. URL http://archive.ics.uci.edu/ml.                              ing error of an algorithm as a Taylor expansion of the
                                                                        local rounding errors. PhD thesis, Master’s Thesis (in
Fischer, H. Automatic differentiation of the vector that                Finnish), Univ. Helsinki, 1970.
  solves a parametric linear system. Journal of Computa-
  tional and Applied Mathematics, 35(1–3):169–184, 1991.              Lions, P.-L. and Mercier, B. Splitting algorithms for the sum
                                                                        of two nonlinear operators. SIAM Journal on Numerical
Fletcher, R. A new approach to variable metric algorithms.              Analysis, 16(6):964–979, 1979.
  The computer journal, 13(3):317–322, 1970.
                                                                      Liu, H., Simonyan, K., and Yang, Y. DARTS: Differ-
Fletcher, R. and Powell, M. J. A rapidly convergent descent             entiable architecture search. In International Confer-
  method for minimization. The computer journal, 6(2):                  ence on Learning Representations, 2019. URL https:
  163–168, 1963.                                                        //openreview.net/forum?id=S1eYHoC5FX.

                                                                 11
                      Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

Lorraine, J., Vicol, P., and Duvenaud, D. Optimizing mil-            Rockafellar, R. and Wets, R. J.-B. Variational Analysis.
  lions of hyperparameters by implicit differentiation. In             Springer Verlag, Heidelberg, Berlin, New York, 1998.
  International conference on artificial intelligence and
  statistics, pp. 1540–1552. PMLR, 2020.                             Rockafellar, R. T. Convex analysis. Princeton Mathematical
                                                                       Series. Princeton University Press, Princeton, N. J., 1970.
Maclaurin, D., Duvenaud, D., and Adams, R. Gradient-
 based hyperparameter optimization through reversible                Rumelhart, D. E., Hinton, G. E., and Williams,
 learning. In International conference on machine learn-               R. J. Learning representations by back-propagating
 ing, pp. 2113–2122. PMLR, 2015.                                       errors. Nature, 323(6088):533–536, 1986. doi: 10.
                                                                      1038/323533a0. URL http://www.nature.com/
Mehmood, S. and Ochs, P. Automatic differentiation of                  articles/323533a0.
 some first-order methods in parametric optimization. In
 Chiappa, S. and Calandra, R. (eds.), The 23rd Interna-              Scieur, D., Gidel, G., Bertrand, Q., and Pedregosa, F. The
 tional Conference on Artificial Intelligence and Statistics,          curse of unrolling: Rate of differentiating through opti-
 AISTATS 2020, 26-28 August 2020, Online [Palermo,                     mization. Advances in Neural Information Processing
 Sicily, Italy], volume 108 of Proceedings of Machine                  Systems, 35:17133–17145, 2022.
 Learning Research, pp. 1584–1594. PMLR, 2020.                       Vaiter, S., Deledalle, C., Fadili, J., Peyré, G., and Dossal,
Mehmood, S. and Ochs, P. Fixed-point automatic differenti-             C. The degrees of freedom of partly smooth regularizers.
 ation of forward–backward splitting algorithms for partly             Annals of the Institute of Statistical Mathematics, 69(4):
 smooth functions. arXiv preprint arXiv:2208.03107,                    791–832, 2017.
 2022.
                                                                     Wengert, R. E. A simple automatic derivative evalu-
Mosco, U. Convergence of convex sets and of solutions of              ation program. Communications of the ACM, 7(8):
 variational inequalities. Advances in Mathematics, 3(4):             463––464, aug 1964. ISSN 0001-0782. doi: 10.
 510–585, 1969.                                                       1145/355586.364791. URL https://doi.org/10.
                                                                      1145/355586.364791.
Nesterov, Y. A method for unconstrained convex minimiza-
  tion problem with the rate of convergence o (1/kˆ 2). In           Winston, E. and Kolter, J. Z. Monotone operator equilibrium
  Doklady an ussr, volume 269, pp. 543–547, 1983.                     networks. Advances in neural information processing
                                                                      systems, 33:10718–10728, 2020.
Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J.,
  Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga,
  L., Desmaison, A., Kopf, A., Yang, E., DeVito, Z., Rai-
  son, M., Tejani, A., Chilamkurthy, S., Steiner, B., Fang,
  L., Bai, J., and Chintala, S. Pytorch: An imperative
  style, high-performance deep learning library. In Wal-
  lach, H., Larochelle, H., Beygelzimer, A., d'Alché-Buc,
  F., Fox, E., and Garnett, R. (eds.), Advances in Neural In-
  formation Processing Systems 32, pp. 8024–8035. Curran
  Associates, Inc., 2019.
Pauwels, E. and Vaiter, S. The derivatives of sinkhorn–
  knopp converge. SIAM Journal on Optimization, 33(3):
  1494–1517, 2023. doi: 10.1137/22M1512703. URL
  https://doi.org/10.1137/22M1512703.
Polyak, B. T. Introduction to Optimization. Optimization
  Software, 1987.
Ren, J., Feng, X., Liu, B., Pan, X., Fu, Y., Mai, L., and
  Yang, Y. Torchopt: An efficient library for differen-
  tiable optimization. Journal of Machine Learning Re-
  search, 24(367):1–14, 2023. URL http://jmlr.
  org/papers/v24/23-0191.html.
Riis, E. S. Geometric numerical integration for optimisation.
  PhD thesis, University of Cambridge, 2020.

                                                                12
                      Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

A. Preliminaries & Related Work
Before we move on to the proofs of our main results, we present some preliminary results which will be useful later. We
also provide a recap of the results of Beck (1994) for a better understanding of our work.

A.1. Real Analysis
In Section 2, we refer to equicontinuity and uniform Lipschitz continuity as cases where Assumptions 2.2 and 2.3 respectively
hold. In this section, we provide defintion along with an example for each of these notions. Note that, in the definitions and
examples below, x∗ is not necessarily the fixed-point of any of Ak (·, u∗ ). Let X , U be Euclidean spaces as in Section 1.4
and Ω ⊂ U be an open set. We first define equicontinuity of a sequence of functions.
Definition A.1 (Equicontinuity). A sequence of functions (Bk : X × Ω → X )k∈N with values Bk (x, u) is equicontinuous
in x at some (x∗ , u∗ ) ∈ X × Ω if for any ε > 0, there exists a δ > 0 such that ∥Bk (x, u∗ ) − Bk (x∗ , u∗ )∥ < ε for all
k ∈ N and for all x ∈ X such that ∥x − x∗ ∥ < δ. The sequence (Bk )k∈N is equicontinuous in x if it is equicontinuous in
x at every (x∗ , u∗ ) ∈ X × Ω.

Intuitively speaking, an equicontinuous sequence of functions behaves uniformly in terms of continuity because the
neighbourhood {x : ∥x − x∗ ∥ < δ} in Definition A.1 does not depend on k ∈ N. Below, we provide an example for
equicontinuous functions.
Example A.2. Let F in (P) be C 2 -smooth. Given (αk )k∈N such that αk ≤ ᾱ for all k ∈ N and some ᾱ > 0, we define
Ak : X × Ω → X by
                                        Ak (x, u) := x − αk ∇x F (x, u) ,                                      (19)

and Bk : X × Ω → X by
                                                                   
                                 Bk (x, u) := DAk (x, u) = I       0 − αk D(∇x F )(x, u) ,                                (20)
                                                                                                        
where D(∇x F ) ∈ L(X × U, X ) is the derivative (with respect to both x and u) of ∇x F and I 0 ∈ L(X × U, X )
defines the canonical projection onto X . Essentially, (19) defines Ak as the update mapping of gradient descent with
bounded step size sequence while (20) defines Bk as its derivative with respect to x and u. For any x, x∗ ∈ X and u∗ ∈ U,
we find that
                       Bk (x, u∗ ) − Bk (x∗ , u∗ ) = −αk D(∇x F )(x, u∗ ) − D(∇x F )(x∗ , u∗ ) .
                                                                                                  
                                                                                                                     (21)

But since the sequence (αk )k∈N is bounded and D(∇x F ) is continuous, for any ε > 0, we can easily find δ > 0 independent
of k ∈ N such that ∥Bk (x, u∗ ) − Bk (x∗ , u∗ )∥ < ε whenever ∥x − x∗ ∥ < δ. Moreover, we also find from (21) that, for
any sequence (x(k) )k∈N converging to x∗ , the sequence Bk (x(k) , u∗ ) − Bk (x∗ , u∗ ) converges to 0 therefore satisfying our
Assumption 2.2 for Gradient Descent. Note that, when additionally, the step size sequence converges, Assumption A.2 of
Beck (1994) is also satisfied.

We similarly define the notion of uniformly Lipschitz continuous sequence of functions.
Definition A.3 (Uniform Lipschitz Continuity). A sequence of functions (Bk : X × Ω → X )k∈N with values Bk (x, u)
is Lipschitz continuous in x uniformly in u and k, if for all u ∈ Ω and k ∈ N, there exists L ∈ R, such that, Bk (·, u) is
L-Lipschitz continuous. That is, for all x, x∗ ∈ X ,

                                         ∥Bk (x, u) − Bk (x∗ , u)∥ ≤ L∥x − x∗ ∥ .

Example A.4. Consider the setting of Example A.2 where D(∇x f ) is additionally M -Lipschitz continuous. Clearly, from
(21), for every k ∈ N and u ∈ U, Bk (·, u) is ᾱM -Lipschitz continuous. Therefore, (Bk )k∈N is Lipschitz continuous in x
uniformly in u, and k and for any sequence (x(k) )k∈N converging to x∗ , Gradient Descent with bounded step size sequence
satisfies Assumption 2.3 because

                                     ∥Bk (x(k) , u) − Bk (x∗ , u)∥ ≤ ᾱM ∥x(k) − x∗ ∥ .

Finally, Assumption A.3 is satisfied when the step size sequence converges linearly which does not happen in general when
employing line-search strategies for Gradient Descent.

                                                              13
                     Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

A.2. Matrix Analysis
This section provides a few preliminary results on Matrix Analysis. We start by recalling a classical result from Linear
Algebra which forms the foundation for the implicit differentiation applied to (Re ) when combined with the Implicit
Function Theorem (Dontchev & Rockafellar, 2009, Theorem 1B.1).
Lemma A.5. For any linear operator B : X → X with ρ(B) < 1, the linear operator I − B is invertible.

We now provide some results which will be used in the proofs of convergence of automatic differentiation of the fixed-point
iterations. In particular, we provide convergence guarantees of sequences generated through linear iterative procedures
including (26), and (22) which bear strong resemblance with (DR) and (DRk ) (see the proofs of Theorems A.12 and 2.5 for
a more detailed comparison). These convergence results are mainly derived from Polyak (1987, Section 2.1.2, Theorem 1),
Riis (2020, Proposition 2.7), and Mehmood & Ochs (2022, Theorem 8). The following theorem will be used to prove
convergence results in Section 2.
Theorem A.6. Let (Bk )k∈N0 , (Ck )k∈N0 and (d(k) )k∈N0 be sequences in L(X , X ), L(X , X ) and X respectively such that
Ck → 0, d(k) → 0 and ρ := lim supk→∞ ∥Bk ∥ < 1 where ∥ · ∥ is a norm on L(X , X ) induced by some vector norm. Then
the sequence (e(k) )k∈N0 , with e(0) ∈ X , generated by

                                           e(k+1) := Bk e(k) + Ck e(k) + d(k) ,                                        (22)

converges to 0. The convergence is linear when Ck and d(k) converge linearly with rates qC and qd respectively. In fact, for
all ε ∈ (0, 1 − ρ), there exist K ∈ N, such that for all k ≥ K, we have

                                      ∥e(k) ∥ ≤ ξ1 (ρ + ε)k−K + ξ2 (k − K)q k−K ,                                      (23)

where
                                                q := max(ρ + ε, qC , qd )
                                               ξ1 := ∥e(K) ∥                                                           (24)
                                                           (K)         (K)
                                               ξ2 := ∥CK e        +d         ∥/q .



Proof. From classical analysis, given ε ∈ (0, 1 − ρ), there exists K ∈ N such that ∥Bk ∥ < ρ + ε/2 for all k ≥ K. Also,
with K large enough we have ∥Ck e(k) ∥/∥e(k) ∥ ≤ ε/2 since Ck → 0. Therefore, from (22), we get

                                   ∥e(k+1) ∥ ≤ (ρ + ϵ/2)∥e(k) ∥ + ∥Ck e(k) ∥ + ∥d(k) ∥
                                             ≤ (ρ + ϵ)∥e(k) ∥ + ∥d(k) ∥ .

The convergence of e(k) then follows from the arguments following Equation 34 in the proof of Theorem 8 in Mehmood &
Ochs (2022).
For the rate of convergence, we note that ε(k) := Ck e(k) + d(k) converges linearly to 0 with rate max(qC , qd ) and for
K ∈ N sufficiently large we can write ∥ε(k) ∥ ≤ max(qC , qd )k−K ∥ε(K) ∥ for all k ≥ K. Thus, for any k ≥ K, we expand
the expression e(k+1) = Bk e(k) + ε(k) to obtain

                                                                   k
                                                                   X
                                          e(k+1) = Bk:K e(K) +           Bk:i+1 ε(i)
                                                                   i=K


where Bk:i denotes the ordered product Bk Bk−1 · · · Bi+1 Bi when i ≤ k and identity operator I when i > k. Observe that,
for any ε ∈ (0, 1 − ρ) and K ∈ N large enough, ∥Bk ∥ < ρ + ε for all k ≥ K and therefore for any K ≤ i ≤ k + 1, we

                                                             14
                      Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

have ∥Bk:i ∥ ≤ (ρ + ε)k−i+1 . Therefore, setting q := max(ρ + ε, qC , qd ), we end up with
                                                        k
                                                        X
                       ∥e(k+1) ∥ ≤ ∥Bk:K ∥∥e(K) ∥ +           ∥Bk:i+1 ∥∥ε(i) ∥
                                                        i=K
                                                                k
                                                                X
                                   ≤ ∥e(K) ∥(ρ + ε)k−K+1 +            (ρ + ε)k−i ∥ε(K) ∥ max(qC , qd )i−K
                                                                i=K
                                                                                                                            (25)
                                                                            k
                                                                            X
                                   ≤ ∥e(K) ∥(ρ + ε)k−K+1 + ∥ε(K) ∥                q k−K
                                                                            i=K
                                       (K)          k−K+1            (K)
                                   ≤ ∥e      ∥(ρ + ε)         + ∥ε         ∥(k − K + 1)q k−K
                                   = ξ1 (ρ + ε)k−K+1 + ξ2 (k − K + 1)q k−K+1 ,

where ξ1 := ∥e(K) ∥, and ξ2 := ∥ε(K) ∥/q.

The result below is a direct consequence of the above theorem and will find its use when proving Corollary 2.9.
Corollary A.7. The conclusion of Theorem A.6 also holds when the assumptions on the sequence (Bk )k∈N0 are replaced
with Bk → B ∈ L(X , X ) and ρ(B) < 1.

Proof. This is a special case of Theorem A.6 because for any δ ∈ (0, 1 − ρ(B)), there exists a norm on L(X , X ) induced
by some vector norm, both denoted by ∥ · ∥δ , such that ∥B∥δ ≤ ρ(B) + δ and ρ := limk→∞ ∥Bk ∥δ = ∥B∥δ ≤ ρ(B) + δ <
1.

The following result is a special case of the setting of Corollary A.7 and is straightforward to show.
Corollary A.8. The conclusion of Theorem A.6 also holds when the assumptions on the sequence (Bk )k∈N0 are replaced
with Bk := B ∈ L(X , X ) for all k ∈ N and ρ(B) < 1.

Using Corollary A.8, we can prove the following statement which will be useful in the convergence proofs of Section A.3.
Theorem A.9. Let (Bk )k∈N0 and (b(k) )k∈N0 be sequences in L(X , X ) and X with limits B and b, respectively. If
ρ = ρ(B) < 1, the sequence (x(k) )k∈N0 , with x(0) ∈ X , generated by

                                                   x(k+1) := Bk x(k) + b(k) ,                                               (26)

converges to x := (I − B)−1 b. The convergence is linear when (Bk )k∈N0 and (b(k) )k∈N0 converge linearly with rates qB
and qb , respectively. In fact, for all δ ∈ (0, 1 − ρ), there exist C1 (δ), C2 (δ) and K ∈ N, such that for all k ≥ K, we have

                                   ∥x(k) − x∥ ≤ C1 (δ)(k − K)q k−K + C2 (δ)(ρ + δ)k−K ,                                     (27)

where q := max(ρ + δ, qB , qb ).

Proof. The expression x = (I − B)−1 b is well-defined thanks to Lemma A.5 and solves the linear equation x = Bx + b
for x. By setting e(k) := x(k) − x, Ck := Bk − B, and d(k) := (Bk − B)x + b(k) − b, we obtain,

                                             e(k+1) = (Bk x(k) + b(k) ) − (Bx + b)
                                                   = Be(k) + Ck e(k) + d(k) .

Since the above recursion matches (22) and the setting of Corollary A.8 applies, the result follows.

A.3. Differentiation of Iteration-Dependent Algorithms: Classical Results
In this section, we briefly recap the results of Beck (1994) in a way that aligns with those of Section 2, allowing for a clearer
comparison between the two sets of results. We first lay down the assumptions on the sequence of mappings Ak in (Rk )
and the mapping A in (Re ) which will ensure the convergence of the sequence Dx(k) (u) generated by (DRk ). The main
requirement in the work of Beck (1994) is that of the pointwise convergence of the sequence DAk to DA.

                                                               15
                      Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

A.3.1. P ROBLEM S ETTING
Given u∗ ∈ X , we assume that x∗ solves (Re ) for x with u = u∗ and is the desired limit of x(k) (u∗ ) generated by (Rk ).
Furthermore, we assume that for all k, Ak and A are C 1 -smooth near (x∗ , u∗ ) and the contraction property holds for
Dx A at (x∗ , u∗ ). In particular, given (x(0) , x∗ , u∗ ) ∈ X × X × U, V ∈ N(x∗ ,u∗ ) , (Ak )k∈N0 , and A we assume that the
following assumption holds.
Assumption A.1.      (i) Ak |V and A|V are C 1 -smooth for all k,

(ii) x∗ = A(x∗ , u∗ ),

(iii) ρ(Dx A(x∗ , u∗ )) < 1, and

(iv) x(k) (u∗ ) generated by (Rk ) has limit x∗ such that (x(k) (u∗ ), u∗ ) ∈ V for all k ∈ N.

A.3.2. I MPLICIT D IFFERENTIATION
From Assumption A.1, Lemma A.5, and (Dontchev & Rockafellar, 2009, Theorem 1B.1), we obtain the Implicit Function
Theorem for (Re ).
Theorem A.10 (Implicit Function Theorem). For some (x∗ , u∗ ), let A be C 1 -smooth near (x∗ , u∗ ), x∗ = A(x∗ , u∗ ) and
ρ(Dx A(x∗ , u∗ )) < 1. Then ∃ U ∈ Nu∗ and a C 1 -smooth mapping ψ : U → X such that ∀u ∈ U , ψ(u) = A(ψ(u), u),
and
                                                                 −1
                                Dψ(u) = I − Dx A(ψ(u), u)            Du A(ψ(u), u) .                                 (28)

A.3.3. AUTOMATIC D IFFERENTIAION
As stated in Section A.2, the update procedure to generate the derivative iterates in (DRk ) takes after the iterative process
defined by (26) in Theorem A.9. That is, for some u∗ ∈ U and u̇ ∈ U, if we set Bk := Dx Ak (x(k) (u∗ ), u∗ ) and b(k) :=
Du Ak (x(k) (u∗ ), u∗ )u̇, the resulting sequence is y (k) = Dx(k) (u∗ )u̇. Similarly, the limit y ∗ := (I − B)−1 b of the se-
quence y (k) generated by (26) matches Dψ(u∗ )u̇ from (28), if we set B := Dx A(ψ(u∗ ), u∗ ) and b := Du A(ψ(u∗ ), u∗ )u̇.
One way to prove the convergence of Dx(k) (u∗ )u̇ to Dψ(u∗ )u̇ is by asserting that DAk (x(k) (u∗ ), u∗ ) converges to
DA(ψ(u∗ ), u∗ ).
Assumption A.2. The sequence (DAk (x(k) (u∗ ), u∗ ))k∈N0 converges to DA(x∗ , u∗ ).
Remark A.11. When the sequence of functions (DAk )k∈N is equicontinuous at (x∗ , u∗ ) and has a pointwise limit DA
near (x∗ , u∗ ), then Assumption A.2 naturally holds thanks to (5).

The main result of Beck (1994) can then be stated below.
Theorem A.12. Let (x(0) , x∗ , u∗ ) be such that Assumptions A.1 and A.2 are satisfied by Ak and A. Then the sequence
(Dx(k) (u∗ ))k∈N0 generated by (DRk ) converges to Dψ(u∗ ).

Proof. The proof is a direct consequence of Assumptions A.1 and A.2, Theorem A.9 and the arguments following
Theorem A.9.

For linear convergence we require a stronger assumption on DAk . That is, it is linear convergence as given below.
Assumption A.3. The sequence (x(k) (u∗ ))k∈N0 converges linearly to x∗ and

                               DAk (x(k) (u∗ ), u∗ ) − DA(x∗ , u∗ ) = O(x(k) (u∗ ) − x∗ ) .                              (29)

Theorem A.13. Let (x(0) , x∗ , u∗ ) be such that Assumptions A.1 and A.3 are satisfied by Ak and A. Then the sequence
(Dx(k) (u∗ ))k∈N0 generated by (DRk ) converges linearly to Dψ(u∗ ). In particular, when the sequence (x(k) )k∈N0
converges with rate qx < 1, then for all δ ∈ (0, 1 − ρ), there exist C1 (δ), C2 (δ) and K ∈ N, such that for all k ≥ K, we
have
                        ∥Dx(k) (u∗ ) − Dψ(u∗ )∥ ≤ C1 (δ)(k − K)q k−K + C2 (δ)(ρ + δ)k−K ,                             (30)
where ρ := ρ(Dx A(x∗ , u∗ )) and q := max(ρ + δ, qx ).

                                                             16
                     Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

Proof. Assumption A.3 asserts that the sequences Dx Ak (x(k) (u∗ ), u∗ ) and Du Ak (x(k) (u∗ ), u∗ )u̇ respectively converge
to Dx A(x∗ , u∗ ) and Du A(x∗ , u∗ )u̇ for any u̇ ∈ U. Furthermore, the rate of convergence of the two sequences is
linear and is the same as that of x(k) , that is, qx . Therefore, the proof follows by simply invoking the second part of
Theorem A.9.
Remark A.14. Assumption A.3 is not practical and therefore we rarely see any application of the above result in practice.
For instance, for gradient descent with line search, it requires linear convergence of the step size sequence which does not
hold in general.

A.4. Riemannian Geometry
We briefly recall a few definitions and results from Riemannian Geometry. For further details, the reader is referred to
standard texts such as Lee (2003); Chavel (2006).
Definition A.15 (Manifold, Tangent and Normal Spaces). For any k ∈ N, we say that M ⊂ X is a C k -smooth m-
dimensional submanifold of X , if for every x ∈ M there exist an open set X ⊂ X and a C k -smooth map Φ : X → RN −m
such that x ∈ X, the derivative DΦ(x) is surjective, and X ∩ M = Φ−1 (0) = {y ∈ X : Φ(y) = 0}. We call Φ, the local
defining function of M at x. We say that v ∈ X is a tangent vector of M at x if there exist ϵ > 0 and a C 1 -smooth curve
γ : (−ϵ, ϵ) → M on M with γ(0) = x and γ̇(0) = v. The set of all tangent vectors of M at x constitute Tx M, the tangent
space of M at x. We define the normal space of M at x by Nx M := (Tx M)⊥ , the orthogonal complement of Tx M.

For any x ∈ M and a local defining function Φ for M at x, we have Tx M = ker DΦ(x).
Definition A.16 (Riemannian Gradient). For any k ∈ N, let M ⊂ X be a C k -smooth manifold, f : M → R be a
function and x ∈ M. We say that f is C k -smooth at x if there exist a neighbourhood X ⊂ X of x and a C k -smooth
function f˜: X → R such that f˜ agrees with f on M ∩ X. In this case, we call f˜ a smooth extension of f around x.
We call ∇M f (x) ∈ Tx M, the Riemannian gradient of f at x if for all v ∈ Tx M, ⟨∇M f (x), v⟩ = (f ◦ γ)′ (0), where
γ : (−ϵ, ϵ) → M is any C 1 -curve with γ(0) = x and γ̇(0) = v.

The Riemannian Gradient of f can also be expressed in terms of the gradient of the smooth extension f˜ of f by

                                                ∇M f (x) = Π(x)∇ f˜(x) .

Note that this gradient neither depends on the choice of the curve γ nor the smooth extension f˜.
Definition A.17 (Riemannian Hessian). Let M ⊂ X be a C 2 -smooth manifold, f : M → R be a C 2 -smooth function and
x ∈ M. We call ∇2M f (x) : Tx M → Tx M, the Riemannian Hessian of f at x if for all v ∈ Tx M, ∇2M f (x)v, v =
(f ◦ γ)′′ (0), where γ : (−ϵ, ϵ) → M is any C 1 -curve with γ(0) = x and γ̇(0) = v.

We can similarly express the Riemannian Hessian ∇2M f (x) ∈ L(Tx M, Tx M) by using the smooth extension f˜, that is,

                                   ∇2M f (x) = Π(x)∇2 f˜(x) + Wx (·, Π⊥ (x)∇ f˜(x)) ,                                  (31)

where the mapping Wx (·, w) ∈ L(Tx M, Tx M) for w ∈ Nx M is called the Weingarten map. It is defined by

                                           v 7→ Wx (v, w) := −Π(x)dW [v] ,

where W is a local extension of w to a normal vector field on M. Wx (·, w) is independent of the choice of normal field
W (Chavel, 2006, Proposition II.2.1) and caters for the change of the tangent space as we move away from x. It vanishes
when the manifold is affine, that is, M = x + Tx M or linear, that is, M = Tx M. The Hessian expression then reduces to
∇2M f (x) = Π(x)∇2 f˜(x).

A.5. Partial Smoothness
Introduced by Lewis (2002), partial smoothness describes a broad class of non-smooth functions, including many commonly
used loss and regularization functions in Machine Learning. It extends ideas like active set methods which were originally
developed for smooth constrained optimization to a more general setting that includes non-smooth functions, by identifying
smooth behavior along certain submanifolds.
Definition A.18 (Partial Smoothness). Let f : X → R be proper and lower semi-continuous and M ⊂ X be a set. We say
that f is partly smooth at a point x ∈ M relative to M if the following conditions hold:

                                                            17
                      Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

 (i) (Regularity:) f is regular at every point close to x and ∂f (x) ̸= ∅.

(ii) (Smoothness:) M is a C 2 -smooth manifold and f |M is C 2 -smooth around x.

(iii) (Sharpness:) Nx M = par ∂f (x).

(iv) (Continuity:) ∂f is continuous at x relative to M.

We call f partly smooth relative to M if f is partly smooth at every x ∈ M relative to M.

B. Proofs of Section 2
B.1. Proof of Lemma 2.2
Proof. From Assumption 2.1(iii), given ε ∈ (0, 1 − ρ), there exists K ∈ N such that ρ(Dx Ak (x∗ , u∗ )) ≤
∥Dx Ak (x∗ , u∗ )∥ < ρ + ε for all k ≥ K, where ρ := lim supk→∞ ∥Dx Ak (x∗ , u∗ )∥. The existence of the neigh-
bourhood U and the C 1 -smooth mapping ψ : U → X is guaranteed by Theorem A.10 applied to An for some n ≥ K,
thanks to Assumption 2.1 ((i)–(ii)). In particular, for all u ∈ U , ψ(u) = An (ψ(u), u) and Dψ(u) is given by (28) with
A replaced by An . From Assumption 2.1(ii), for any k ≥ K and u ∈ U , we have ψ(u) = An (ψ(u), u) = Ak (ψ(u), u)
and with U possibly reduced, ρ(Dx Ak (ψ(u), u)) < 1. Therefore, by using the Chain rule and Lemma A.5, we obtain the
expression in (4).

B.2. Proof of Theorem 2.5
Proof. From Lemma 2.2 and Remark 2.3, there exists K ∈ N such that for any k ≥ K, the fixed-point mapping ψk of
Ak (·, u) is C 1 -smooth near u∗ and Dψk (u∗ ) = X∗ (see Assumption 2.1(ii)). We denote x(k) := x(k) (u∗ ) for simplicity
and define                                                 
                                   e(k) := Dx(k) (u∗ ) − X∗ u̇
                                    Bk := Dx Ak (x∗ , u∗ )
                                                                                                                         (32)
                                    Ck := Dx Ak (x(k) , u∗ ) − Dx Ak (x∗ , u∗ )
                                                                             X u̇
                                    (k)           (k)    ∗            ∗    ∗      ∗
                                   d := DAk (x , u ) − DAk (x , u )                   ,
                                                                                 u̇
to obtain                                                                                 
                            e(k+1) = Dx Ak (x(k) , u∗ )Dx(k) (u∗ )u̇ + Du Ak (x(k) , u∗ )u̇ −
                                                                             
                                   Dx Ak (x∗ , u∗ )X∗ u̇ + Du Ak (x∗ , u∗ )u̇                                            (33)

                                   = Bk e(k) + Ck z (k) + d(k) .

From Assumption 2.2 and the definitions of Ck and y (k) , we note that Ck → 0 and d(k) → 0. Therefore, from Theorem A.6,
(Dx(k) (u∗ )u̇)k∈N0 converges to X∗ u̇ for any u̇ ∈ U.

B.3. Proof of Theorem 2.7
Proof. From Assumption 2.3, we have DAk (x(k) (u∗ ), u∗ ) − DAk (x∗ , u∗ ) → 0 and the rate of convergence of the two
sequences is qx . For any u̇ ∈ U, by using the definitions in (32), we note that both Ck and y (k) converge linearly with rate
qx . Thus, invoking the second part of Theorem A.6, we obtain the convergence rate of (Dx(k) (u∗ )u̇)k∈N0 . In particular,
from (23), we obtain the bound in (7). The expressions for ξ1 and ξ2 can be computed from (24) using CK , d(K) and e(K)
defined in (32).

C. Proofs of Section 3
C.1. Proof of Theorem 3.4
The proof of Theorem 3.4 relies on the following preliminary result from set-valued analysis.

                                                             18
                      Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

Lemma C.1. Given a sequence of non-empty, closed, convex sets Ck ⊂ X which converges to C ⊂ X such that aff Ck also
converges to aff C. Let x(k) ∈ Ck be a sequence with limit x ∈ ri C. Then there exists K ∈ N such that x(k) ∈ ri Ck for
all k ≥ K.

Proof. Because x(k) → x and x ∈ ri C, there exists a compact set V and K ∈ N such that x(k) , x ∈ int V ̸= ∅ for all
k ≥ K and V ∩ aff C ⊂ C. Moreover, aff Ck → aff C implies V ∩ aff Ck → V ∩ aff C (Mosco, 1969, Lemma 1.4). Once
we show that V ∩ aff Ck ⊂ Ck eventually, we are done. Assume for contradiction, that there exists a subsequence (Cki )i∈N
such that for all i ∈ N, y (i) ∈ V ∩ aff Cki and y (i) ∈
                                                       / Cki . The compactness of V and convergence of V ∩ aff Cki implies
the existence of y ∈ V ∩ aff C such that y (i) → y, possibly through a subsequence. We define the bounded sequence
b(i) := a(i) /∥a(i) ∥ where a(i) := y (i) − projCk (y (i) ) which lies in par Cki and has limit 0 ̸= b ∈ par C, again, possibly
                                                   i
through a subsequence. For all i ∈ N and for all w ∈ Cki ,
                       D                 E D                            E D                             E
                         b(i) , w − y (i) = b(i) , w − projCk (y (i) ) − b(i) , y (i) − projCk (y (i) )
                                                                i                                i
                                            D
                                               (i)                  (i)
                                                                        E      1 D (i) (i) E
                                          = b , w − projCk (y ) − (i) a , a
                                                                i           ∥a ∥
                                            D                           E
                                               (i)                  (i)
                                          = b , w − projCk (y ) − ∥a(i) ∥
                                                                 i

                                        ≤ 0,

where the inequality follows because a(i) and therefore b(i) lie in NCki (projCk (y (i) )). The above inequality leads to
                                                                                i
⟨b, w − y⟩ ≤ 0 for all w ∈ C. In other words, we obtain 0 ̸= b ∈ NC (y) ∩ par C which is a contradiction because
y ∈ ri C.
Remark C.2. The condition aff Ck → aff C is necessary for the conclusion of Lemma C.1 to hold. To see why, we define
the sequence of closed intervals (Ck := [−1/k, 1/k])k∈N in R which converges to C := {0}. Consider the sequence
xk := 1/k which converges to x := 0. Notice that, aff Ck = R for all k ∈ N, aff C = {0} and even though x ∈ C = ri C,
x(k) ∈
     / ri Ck for all k ∈ N.

Proof of Theorem 3.4. (i) From the convergence of x(k) := x(k) (u∗ ), Lemma 3.9 ensures that for δ > 0 small enough,
    there exists K ∈ N, such that x(k) ∈ M ∩ Bδ (x∗ ) for all k ≥ K. We define the maps G : X × Ω × (0, 2/L) → X by
    G(x, u, α) = x − α∇x f (x, u) and H : X × X × Ω × (0, 2/L) → R by
                                                              1
                                   H(y, x, u, α) := αg(y, u) + ∥y − x + α∇x f (x, u)∥2 ,
                                                              2
     and note that x(k+1) = Aαk (x(k) , u∗ ) = argminy H(y, x(k) , u∗ , αk ), which, from Fermat’s rule, is equivalent to
     0 ∈ ∂y H(x(k+1) , x(k) , u∗ , αk ) or µ(k) ∈ ∂x F (x(k+1) , u∗ ), where

                                                1                                           
                                      µ(k) :=       G(x(k) , u∗ , αk ) − G(x(k+1) , u∗ , αk ) .                           (34)
                                                αk

    Notice that µ(k) → 0 because G(·, u∗ , α) is non-expansive when α ∈ (0, 2/L) and we have ∥µ(k) ∥ ≤
     1
     α ∥x
          (k)
              − x(k+1) ∥. Moreover, aff ∂x F (x(k+1) , u∗ ) = µ(k) + par ∂x F (x(k+1) , u∗ ) = µ(k) + Tx(k+1) M con-
    verges to aff ∂x F (x∗ , u∗ ) = par ∂x F (x∗ , u∗ ) = 0 + Tx∗ M (Mosco, 1969, Lemma 1.6). Therefore, from (ND)
    and Lemma C.1, we have µ(k) ∈ ri ∂x F (x(k+1) , u∗ ) or 0 ∈ ri ∂y H(x(k+1) , x(k) , u∗ , αk ), for all k ∈ N large
    enough. Since H is partly smooth relative to M × X × Ω × (0, 2/L) and H(·, x, u, α) is strongly convex for all
    (x, u, α) ∈ X × Ω × (0, 2/L), and non-degeneracy condition holds, the C 1 -smoothness of the update map near
    (x(k) , u∗ , αk ) follows by invoking Theorem 3.1. The C 1 -smoothness of Aα near (x∗ , u∗ , α) under given assumptions
    was shown in Mehmood & Ochs (2022, Corollary 32) for any α ∈ [α, ᾱ].
(ii) We define
                             Qk := ∇2M H(x(k+1) , x(k) , u∗ , αk ) ,      Q̃k := ∇2M H(x∗ , x∗ , u∗ , αk )
                        Pω,k := Dω ∇M H(x(k+1) , x(k) , u∗ , αk ) ,       P̃ω,k := Dω ∇M H(x∗ , x∗ , u∗ , αk )
                           Πk := Π(x(k) ) ,     Π∗ := Π(x∗ ) ,       Π⊥     ⊥
                                                                      k := Π (x
                                                                                (k)
                                                                                    ),    Π⊥     ⊥  ∗
                                                                                           ∗ := Π (x ) ,


                                                              19
                      Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

     where ω ∈ {x, u, α} and evaluate Qk to obtain
                     Qk = αk ∇2M g(x(k+1) , u∗ ) + Πk+1 + Wx(k+1) (·, Π⊥
                                                                       k+1 (x
                                                                              (k+1)
                                                                                    − G(x(k) , u∗ , αk )))
                         = αk ∇2M g(x∗ , u∗ ) + αk Wx(k+1) (·, Π⊥
                                                                k+1 ∇x f (x
                                                                            (k+1)
                                                                                  , u∗ )) + Πk+1 +
                         Wx(k+1) (·, Π⊥
                                      k+1 (G(x
                                              (k+1)
                                                    , u∗ , αk ) − G(x(k) , u∗ , αk )))
                         = αk ∇2M F (x∗ , u∗ ) − Πk+1 ∇2x f (x(k+1) , u∗ )Πk+1 + Πk+1 +
                         Wx(k+1) (·, Π⊥
                                      k+1 (G(x
                                              (k+1)
                                                    , u∗ , αk ) − G(x(k) , u∗ , αk ))) .
     Similarly, Q̃k is given by
                                     Q̃k = αk ∇2M F (x∗ , u∗ ) − αk Π∗ ∇2x f (x∗ , u∗ )Π∗ + Π∗ .
     From Liang et al. (2017, Lemma 4.3), αk ∇2M F (x∗ , u∗ ) − αk Π∗ ∇2x f (x∗ , u∗ )Π∗ is positive semi-definite and the
     eigenvalues of Q̃†k lie in (0, 1]. Moreover, the non-expansiveness of G(·, u∗ , αk ) and the continuity of (x, v) 7→
     Wx (·, v) due to the C 2 -smoothness of M implies that Wx(k+1) (·, Π⊥
                                                                         k+1 (G(x
                                                                                   (k+1)
                                                                                          , u∗ , αk ) − G(x(k) , u∗ , αk ))) → 0.
                                                             †
     This entails that Qk − Q̃k → 0 and the eigenvalues of Qk are also eventually bounded. Hence, Q†k − Q̃†k , which can be
     rewritten as
                            Q†k − Q̃†k = Q†k − Q†k Π∗ + Q†k Π∗ − Πk Q̃†k + Πk Q̃†k − Q̃†k
                                        = Q†k Πk − Q†k Π∗ + Q†k Q̃k Q̃†k − Q†k Qk Q†∗ + Πk Q̃†k − Q̃†k Π∗
                                                                           
                                        = Q†k (Πk − Π∗ ) − Q†k Qk − Q̃k Q̃†k + (Πk − Π∗ ) Q̃†k ,

     also converges to 0. Similarly Pω,k − P̃ω,k → 0 for all ω ∈ {x, u, α} because
                                                              
                Px,k − P̃x,k = Πk+1 I − αk ∇2x f (x(k) , u∗ ) − Π∗ I − αk ∇2x f (x∗ , u∗ )
                                                                                            
                                                                                               
                              = (Πk+1 − Π∗ ) − αk Πk+1 ∇2x f (x(k) , u∗ ) − Π∗ ∇2x f (x∗ , u∗ )
                                                                                                       
                Pu,k − P̃u,k = αk Du ∇M g(x(k+1) , u∗ ) + Du Πk+1 ∇x f (x(k) , u∗ ) − Du ∇M F (x∗ , u∗ )
                 Pα,k − P̃α,k = ∇M g(x(k+1) , u∗ ) + Πk+1 ∇x f (x(k) , u∗ ) − ∇M F (x∗ , u∗ )
     This concludes the proof because from (9), DAα (x, u) is given by,
                       DAα (x, u) = −∇2M H(Aα (x, u), x, u, α)† D(x,u,α) ∇M H(Aα (x, u), x, u, α) .                          (35)

(iii) The expressions for Qk − Q̃k and Pω,k − P̃ω,k for ω ∈ {x, u, α} clearly indicate that these sequences converge linearly
      under the given assumptions.



C.2. Proof of Theorem 3.7
Proof. We again set x(k) := x(k) (u∗ ) for simplicity. Thanks to Theorem 3.4(i), Aαk are C 1 -smooth near (x(k) , u∗ , αk ) for
all k ∈ N provided that x(0) is sufficiently close to x∗ . Differentiation of the fixed-point iteration x(k+1) := Aαk (x(k) , u∗ )
with respect to u yields
                       Dx(k+1) (u∗ ) = Dx Aαk (x(k) , u∗ )Π(x(k) )Dx(k) (u∗ ) + Du Aαk (x(k) , u∗ ) ,                        (36)
and Theorem 3.6 asserts that under the given assumptions, for all k ∈ N,
                              Dψ(u∗ ) = Dx Aαk (x∗ , u∗ )Π(x∗ )Dψ(u∗ ) + Du Aαk (x∗ , u∗ ) .                                 (37)
Just like the arguments made in the proof of Theorem A.12, for any u̇ ∈ U, if we define
                                              e(k) := Dx(k) (u∗ )u̇ − Dψ(u∗ )u̇
                                                Bk := Dx Aαk (x∗ , u∗ )Π(x∗ )
                                                                                                                             (38)
                                  Ck := Dx Aαk (x(k) , u∗ )Π(x(k) ) − Dx Aαk (x∗ , u∗ )Π(x∗ )
                                  d(k) := (DAk (x(k) , u∗ ) − DAk (x∗ , u∗ ))(Dψ(u∗ )u̇, u̇) ,

                                                               20
                      Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

and subtract (37) from (36), we obtain the recursion e(k+1) = Bk e(k) + Ck e(k) + d(k) . From Theorem 3.6, the continuity
of ρ and DAα , supk∈N ∥Bk ∥ < 1 for all k ∈ N and from Theorem 3.4(ii), Ck → 0 and d(k) → 0. Under the additional
assumptions, Ck and d(k) converge linearly with rate qx due to Theorem 3.4(i). Therefore, the (linear) convergence of the
derivative sequence (Dx(k) (u∗ ))k∈N follows from Theorem A.6. The error bound in (12), as well as the expressions for the
constants ξ1 and ξ2 , can be derived from (23) and (24), respectively where CK , e(K) , and d(K) are defined in (38).

C.3. Proof of Theorem 3.10
Proof.   (i) This part follows from Mehmood & Ochs (2022, Corollary 33) and the convergence of x(k) (u∗ ) and αk .

(ii) We set z := (x1 , x2 ), and y := x1 + β(x1 − x2 ) and write the expression for DAα,β (z, u) for (z, u, α, β) ∈
     Vα∗ × [0, 1]:
                                                                                     
                                                  (1 + β)Dx Aα (y, u) −βDx Aα (y, u)
                                Dz Aα,β (z, u) =
                                                           I                   0
                                                              
                                                  Du Aα (y, u)
                                Du Aα,β (z, u) =
                                                        0
                                                             
                                                  Dα Aα (y, u)
                                Dα Aα,β (z, u) =                 ,
                                                        0
    as provided in Mehmood & Ochs (2022, Corollary 33), where DAα (y, u) is given in (35). It is easy to
    see that the mapping (z, u, α, β) 7→ DAα,β (z, u) is continuous on Vα∗ × [0, 1]. Therefore, the sequences
    (DAαk ,βk (x(k) (u∗ ), x(k−1) (u∗ ), u∗ ))k≥K and (DAαk ,βk (x∗ , x∗ , u∗ ))k≥K both converge to DAα∗ ,β∗ (x∗ , x∗ , u∗ )
    and their difference converges to 0.

(iii) Because βk ∈ [0, 1] and under the additional assumptions, DAαk (y (k) , u∗ ) − DAαk (x∗ , u∗ ) = O(y (k) − x∗ ) as
      established in Theorem 3.4(iii), where y (k) := x(k) (u∗ ) + βk (x(k) (u∗ ) − x(k−1) (u∗ )), the result follows directly
      from the expressions of DAα,β .



C.4. Proof of Theorem 3.12
Proof. From Theorem 3.10 the mapping (x1 , x2 , u, α) 7→ Aαk ,βk (x1 , x2 , u, α) is C 1 -smooth on Vα∗ . Therefore, when
x(0) is close enough to x∗ , we have (x(k) , x(k−1) , u∗ , αk ) ∈ Vα∗ where x(k) := x(k) (u∗ ) and we obtain the following
recursion for the derivative iterates

             Dx(k+1) (u∗ )                                                 Dx(k) (u∗ )
                                                                                     
                                                   ∗
                                              (k)
                               = Dz Aαk ,βk (x , u )Π(x , x (k)  (k−1)
                                                                       )                  + Du Aαk ,βk (x(k) , u∗ )
               Dx(k) (u∗ )                                                Dx(k−1) (u∗ )

From Theorem 3.11, we have

                     Dψ(u∗ )                                         Dψ(u∗ )
                                                                          
                                             ∗     ∗      ∗     ∗
                               = D z Aα,β (x   , u   )Π(x   , x   )            + Du Aα,β (x∗ , u∗ ) ,
                     Dψ(u∗ )                                         Dψ(u∗ )

for β = β∗ and β = βk for all k ∈ N. Therefore, for any u̇ ∈ U, we define

                e(k) := (Dx(k) (u∗ ) − Dψ(u∗ ), Dx(k−1) (u∗ ) − Dψ(u∗ ))u̇
                 Bk := Dx Aαk ,βk (x∗ , x∗ , u∗ )Π(x∗ , x∗ ) , B∗ := Dx Aα∗ ,β∗ (x∗ , x∗ , u∗ )Π(x∗ , x∗ )
                 Ck := Dx Aαk ,βk (x(k) , x(k−1) , u∗ )Π(x(k) , x(k−1) ) − Dx Aαk ,βk (x∗ , x∗ , u∗ )Π(x∗ , x∗ )
                d(k) := (DAαk ,βk (x(k) , x(k−1) , u∗ ) − DAαk ,βk (x∗ , x∗ , u∗ ))(Dψ(u∗ )u̇, Dψ(u∗ )u̇, u̇)

and obtain the recursion e(k+1) = Bk e(k) + Ck e(k) + d(k) . Notice that ρ(B∗ ) < 1 from Theorem 3.11 and Bk → B∗ from
Theorem 3.10(i). Moreover Ck → 0, and d(k) → 0 owing to Theorem 3.10(ii) and under the additional assumptions, the
convergence of Ck and d(k) is linear with rate qx thanks to Theorem 3.10(iii). Therefore, from Corollary A.7, the sequence
Dx(k) (u∗ )u̇ converges (linearly) to Dψ(u∗ )u̇ for all u̇ ∈ U.

                                                              21
                     Automatic Differentiation of Optimization Algorithms with Time-Varying Updates

D. Experimental Details
In this section, we fill out some missing details from Section 4. We do not perform any feature transformation apart from
batch normalization. For (16), the dataset is artificially generated with 70 ≤ M ≤ 90 and N = 200. In particular, for
each of the 50 problems, we generate X and a sparse vector w′ ∈ RN with only 50 non-zero elements. We sample each
element of X from standard uniform distribution and each non-zero element of w′ from standard normal distribution
respectively. We then generate y by computing Xw + ε where each ε is drawn from normal distibution with mean 0
and covariance matrix 10−3 I. The problem has a ρ(X T X)-Lipschitz continuous gradient but is not even strictly convex.
However, for each choice of λ ∼ U (0, 10), X, and y, Assumptions 3.2 and 3.3 were satisfied for each experiment. The
spaces and sets mentioned in Assumption 3.1 are X = RN , U = RM ×N × RM × R, Ω = RM ×N × RM × (0, +∞),
and M = {w ∈ RN : supp(w) ⊂ supp(w∗ )} where supp(w) denotes the support of w. For (17), we use MADELON
dataset with M = 2, 000 samples and N = 501 features. For 50 set of experiments, we sample λ ∼ N (0, 10−3 ) and
perturb each element of X with a Gaussian noise with standard deviation 10−3 . The problem is λ-strongly convex and has a
ρ(X T X)/(4M )+λ-Lipschitz continuous gradient with M = X = RN , U = RM ×N ×R and Ω = RM ×N ×(0, +∞). For
(18), we use CIFAR10 dataset with M = 50, 000 samples N = 32 × 32 × 3 features. The problem is λ-strongly convex and
has a ρ(X T X)/M +λ-Lipschitz continuous gradient with M = X = RN ×C , U = RM ×N ×R and Ω = RM ×N ×(0, +∞).
We obtain a very good estimate of w∗ for (16) by running APG for sufficiently large number of iterations, for (17) by using
Newton’s method with backtracking line search, and for (18) by running the Heavy-ball method with optimal parameters,
also, for large number of iterations. The derivative of the solution Dψ(u∗ ) is computed by solving the linear system (2)
for (multinomial) logistic regression and solving the reduced system (9) after identifying the support for lasso regression
(Bertrand et al., 2022). For each problem and for each experiment, we run PGD with four different choices of step size,
                                                                                     2                    2    4
namely, (i) αk = 2/(L + m) for (17) and αk = 1/L for (16), (ii) αk ∼ U (0, 3L          ), (iii) αk ∼ U ( 3L , 3L ) , and (iv)
            4 2
αk ∼ U ( 3L , L ), for each k ∈ N. We also run APG with αk = 1/L and βk = (k − 1)/(k + 5). Before starting each
algorithm, we obtain w(0) ∈ B10−2 (w∗ ) by partially solving each problem through APG. For computational reasons,
instead of generating the sequence Dw(k) (u), we compute the directional derivative Dw(k) (u)u̇. The vector u̇ belongs to
the same space as u and is fixed for the 5 different algorithms being compared for each experiment and problem. For each
problem, we plot the error sequences ∥w(k) (u) − ψ(u)∥ and ∥Dw(k) (u)u̇ − Du ψ(u)u̇∥.




                                                             22
