To Retain or to Adapt? Generalizing Continual Learning β part 12/15
Cleaned-text code points [170703, 185676). Bibliography omitted here; source.md includes it.
For a quadratic loss, the bias term simplifies to the weighted squared distance between the task optimum and the Window centroid: πΌ β‘ [ β k β ( ΞΈ β W , k ) β β k β ( ΞΈ β k ) ] = 1 2 β πΌ β [ β ΞΈ β W , k β ΞΈ β k β H k 2 ] . \mathbb{E}[\mathcal{L}^{k}(\theta_{\star}^{W,k})-\mathcal{L}^{k}(\theta_{\star}^{k})]=\frac{1}{2}\mathbb{E}[\|\theta_{\star}^{W,k}-\theta_{\star}^{k}\|_{H_{k}}^{2}]. Since ΞΈ β W , k \theta_{\star}^{W,k} is a convex combination of all tasks in the window k β W β β¦ β k k-W\dots k , its position relative to the current task ΞΈ β k \theta_{\star}^{k} depends on the spread of the task distribution. By the definition of the Mean Squared Displacement, πΌ β‘ [ β ΞΈ β W , k β ΞΈ β k β 2 ] \mathbb{E}[\|\theta_{\star}^{W,k}-\theta_{\star}^{k}\|^{2}] scales with the maximum extent of the task boundary relative to the origin, which is Ξ β‘ ( m β‘ ( k , W ) ) \Theta(m(k,W)) .
The variance term reads: πΌ β‘ [ Variance ] β β j = k β W k Ο j k β πΌ β [ β H j β ( ΞΈ β W , k β ΞΈ β j ) β β k 2 ] . \mathbb{E}[\text{Variance}]\propto\sum_{j=k-W}^{k}\rho_{j}^{k}\,\,\mathbb{E}[\|H_{j}(\theta_{\star}^{W,k}-\theta_{\star}^{j})\|_{\mathcal{R}^{k}}^{2}]. Assuming bounded Hessians ( Assumption 23 ), this term is proportional to the variance of the task optima distribution around their mean ΞΈ β W , k \theta_{\star}^{W,k} . As established in the proof of Lemma 35 , this spatial variance scales exactly with the local environment growth rate Ξ β‘ ( m β‘ ( k , W ) ) \Theta(m(k,W)) .
Since both positive terms scale with Ξ β‘ ( m β‘ ( k , W ) ) \Theta(m(k,W)) , the total instability scales as Ξ β‘ ( m β‘ ( k , W ) ) \Theta(m(k,W)) . β
##### A.7.3 Asymptotically Optimal Window
Finally, we are ready to evaluate the asymptotic Transfer Efficiency of the Window agent and determine the optimal window choice. The following theorem mirrors the structure of Theorem 32 , as the ITL baseline comparison remains exactly the same.
###### Lemma 37 (Asymptotic Optimality of Window Size) .
Let the asymptotic excess risk of the Window agent be dominated by the trade-off between task diversity and tracking lag, given by J β‘ ( W ) β m β‘ ( k , W ) + m β‘ ( k , W ) W 2 J(W)\asymp m(k,W)+\frac{m(k,W)}{W^{2}} , where m β‘ ( k , W ) m(k,W) is the Mean Squared Displacement (MSD) of tasks within the window. The optimal window size W β W^{*} minimizing this risk depends on the environmentβs non-stationarity regime: 1. Bounded Regime: If m β‘ ( k , W ) β Ξ β‘ ( 1 ) m(k,W)\in\Theta(1) , the risk decreases monotonically with W W . The asymptotically optimal strategy is the JTL agent ( W β β β W^{*}\to\infty ).
2. Linear Drift Regime: If m β‘ ( k , W ) β Ξ β‘ ( W 2 ) m(k,W)\in\Theta(W^{2}) , the risk increases monotonically with W W . The asymptotically optimal strategy is the ITL agent ( W β = 1 W^{*}=1 ).
3. Diffusive Regime: If m β‘ ( k , W ) β Ξ β‘ ( W ) m(k,W)\in\Theta(W) , the risk is strictly convex. The asymptotically optimal strategy is a Window agent with finite memory ( 1 < W β < β 1<W^{*}<\infty ).
###### Proof.
Step 1: The Asymptotic Transfer Condition. We start from the general condition for positive transfer derived in Theorem 32 . For the Window agent to outperform the Independent-Task Learning (ITL) baseline, its expected excess risk must be lower than the baseline expected risk. Let C ITL k C^{k}_{\text{ITL}} and C W k C^{k}_{W} denote the condition numbers scaling the respective bounds. The condition is: Ο β N β
πΌ β‘ [ β W ] < C ITL k β ( πΌ β‘ [ β ΞΌ ~ 0 ITL , k β 2 ] + πΌ β‘ [ Tr β ( Ξ£ ~ 0 ITL , k ) ] ) β C W k β ( πΌ β‘ [ β ΞΌ ~ 0 W , k β 2 ] + πΌ β‘ [ | Tr β ( Ξ£ ~ 0 W , k ) | ] ) . {\tau N\cdot\mathbb{E}[\mathcal{I}^{W}]}<{C^{k}_{\text{ITL}}\left(\mathbb{E}[\|\tilde{\mu}_{0}^{\text{ITL},k}\|^{2}]+\mathbb{E}[\text{Tr}(\tilde{\Sigma}_{0}^{\text{ITL},k})]\right)}-{C^{k}_{W}\left(\mathbb{E}[\|\tilde{\mu}_{0}^{W,k}\|^{2}]+\mathbb{E}[|\text{Tr}(\tilde{\Sigma}_{0}^{W,k})|]\right)}.
We substitute the asymptotic scaling laws derived in Lemmas 36 , 34 and 35 : β’ The expected instability πΌ β‘ [ β W ] \mathbb{E}[\mathcal{I}^{W}] scales with the local task diversity Ξ β‘ ( m β‘ ( k , W ) ) \Theta(m(k,W)) .
β’ The expected centroid tracking lag πΌ β‘ [ β ΞΌ ~ 0 W , k β 2 ] \mathbb{E}[\|\tilde{\mu}_{0}^{W,k}\|^{2}] scales as Ξ β‘ ( m β‘ ( k , W ) / W 2 ) \Theta(m(k,W)/W^{2}) .
β’ The expected covariance drift πΌ β‘ [ | Tr β ( Ξ£ ~ 0 W , k ) | ] \mathbb{E}[|\text{Tr}(\tilde{\Sigma}_{0}^{W,k})|] scales with the change in diversity Ξ β m β ( k , W ) = | Ξ β‘ ( m β‘ ( k , W ) ) β Ξ β‘ ( m β‘ ( k β 1 , W ) ) | \Delta m(k,W)=|\Theta(m(k,W))-\Theta(m(k-1,W))| .
Substituting these into the inequality:
Step 2: Optimal Window Size. To find the optimal window size W β W^{*} , we isolate the terms dependent on the Window agentβs configuration. We define the asymptotic cost function J β‘ ( W ) J(W) as the sum of the diversity penalty (scaled by the task duration N N ) and the tracking lag (independent of N N ).
Remark on Time Dependence ( k k ): For the canonical environments considered (Bounded, Linear Drift, Random Walk), the statistics of the task increments are stationary. Therefore, the local diversity m β‘ ( k , W ) m(k,W) within a window depends only on the window width W W and not on the absolute time index k k . We can safely write m β‘ ( k , W ) β m β‘ ( W ) m(k,W)\to m(W) .
The cost function is defined as: J β‘ ( W ) β c 1 β N β
m β‘ ( W ) + c 2 β m β‘ ( W ) W 2 + c 3 β Ξ β m β ( W ) . J(W)\asymp c_{1}N\cdot m(W)+c_{2}\frac{m(W)}{W^{2}}+c_{3}\Delta m(W). Here, c 1 c_{1} captures the interference cost per task, while c 2 c_{2} and c 3 c_{3} capture the mechanical lag of the tracker. We now minimize J β‘ ( W ) J(W) for the three canonical regimes.
###### Case 1: Bounded Regime.
Tasks are drawn from a fixed distribution with finite covariance: m β‘ ( W ) βΌ Ξ β‘ ( 1 ) m(W)\sim\Theta(1) and Ξ β m β ( W ) β 0 \Delta m(W)\approx 0 . Thus, J β‘ ( W ) βΌ c 1 β N + c 2 W 2 J(W)\sim c_{1}N+\frac{c_{2}}{W^{2}} . The term c 2 / W 2 c_{2}/W^{2} is strictly decreasing while the diversity cost remains constant. Thus, J β‘ ( W ) J(W) is minimized as W β β W\to\infty . W β = β (JTL agent is optimal) . W^{*}=\infty\quad\text{(JTL agent is optimal)}.
###### Case 2: Linear Drift Regime.
Tasks drift with a constant velocity v v , i.e., πΌ β‘ [ β ΞΈ k β ΞΈ k β 1 β ] = v \mathbb{E}[\|\theta_{k}-\theta_{k-1}\|]=v . The variance of a line segment of length W W is m β‘ ( W ) βΌ Ξ β‘ ( W 2 ) m(W)\sim\Theta(W^{2}) . Because m β‘ ( W ) W 2 βΌ W 2 W 2 βΌ Ξ β‘ ( 1 ) \frac{m(W)}{W^{2}}\sim\frac{W^{2}}{W^{2}}\sim\Theta(1) , we have J β‘ ( W ) βΌ c 1 β N β W 2 + c 2 J(W)\sim c_{1}NW^{2}+c_{2} . The diversity penalty N β W 2 NW^{2} grows quadratically, easily dominating the constant lag. The function is strictly increasing for W β₯ 1 W\geq 1 . W β = 1 (ITL agent is optimal) . W^{*}=1\quad\text{(ITL agent is optimal)}.
###### Case 3: Diffusive Regime.
Tasks follow a Gaussian random walk with variance Ο 2 \sigma^{2} per step. The variance grows linearly with the window size, m β‘ ( W ) βΌ Ξ β‘ ( W ) m(W)\sim\Theta(W) . The expected variance is stationary, so Ξ β m β ( W ) = 0 \Delta m(W)=0 . Thus, J β‘ ( W ) βΌ c 1 β N β W + c 2 β W W 2 = c 1 β N β W + c 2 W J(W)\sim c_{1}NW+c_{2}\frac{W}{W^{2}}=c_{1}NW+\frac{c_{2}}{W} . This is a strictly convex function. We find the minimum by setting the derivative to zero: d β J d β W = c 1 β N β c 2 W 2 = 0 βΉ W 2 = c 2 c 1 β N . \frac{dJ}{dW}=c_{1}N-\frac{c_{2}}{W^{2}}=0\implies W^{2}=\frac{c_{2}}{c_{1}N}. Asymptotically, the optimal window size follows the inverse square-root law: W β = c 2 c 1 β N β 1 N . W^{*}=\sqrt{\frac{c_{2}}{c_{1}N}}\propto\frac{1}{\sqrt{N}}. In this case, the optimal strategy requires a finite window. Crucially, the optimal window size shrinks as the task duration N N increases. β
##### A.7.4 Window Agent for Continuously Drifting Tasks
We now explicitly instantiate this analysis for the Window agent in the continuous drift setting. Recall that the expected loss function for task k k is: β k β ( ΞΈ ) = 1 2 β β ΞΈ β ΞΈ β k β Ξ£ x 2 + 1 2 β Ο ΞΎ 2 , \mathcal{L}^{k}(\theta)=\frac{1}{2}\|\theta-\theta_{\star}^{k}\|_{\Sigma_{x}}^{2}+\frac{1}{2}\sigma_{\xi}^{2}, (104) where β v β Ξ£ x 2 := v β€ β Ξ£ x β v \|v\|_{\Sigma_{x}}^{2}:=v^{\top}\Sigma_{x}v . The optimal parameters evolve according to a Wiener process: ΞΈ β k = ΞΈ β k β 1 + Ξ k , Ξ k βΌ π© β‘ ( 0 , Ξ£ Ξ ) , \theta_{\star}^{k}=\theta_{\star}^{k-1}+\Delta_{k},\quad\Delta_{k}\sim\mathcal{N}(0,\Sigma_{\Delta}), (105) where Ξ£ Ξ \Sigma_{\Delta} is the drift covariance matrix. At each stage k k , the minimizer for the Window agent is the centroid of the tasks currently inside the active window π² k = { k β W + 1 , β¦ , k } \mathcal{W}_{k}=\{k-W+1,\dots,k\} : ΞΈ β W , k = 1 W β β j = k β W + 1 k ΞΈ β j . \theta_{\star}^{W,k}=\frac{1}{W}\sum_{j=k-W+1}^{k}\theta_{\star}^{j}. (106)
##### A.7.5 Instability of the Window Agent
The instability β W \mathcal{I}^{W} measures the discrepancy between the agentβs target (the window centroid) and the true task optimum ΞΈ β k \theta_{\star}^{k} , combined with the internal diversity of the window. Following the Exact Instability Decomposition ( Theorem 24 ), this splits into the centroid lag and the task scatter.
###### Centroid Lag.
We define the lag vector v W := ΞΈ β W , k β ΞΈ β k v_{W}:=\theta_{\star}^{W,k}-\theta_{\star}^{k} . Using the backward recursion ΞΈ β j = ΞΈ β k β β m = j + 1 k Ξ m \theta_{\star}^{j}=\theta_{\star}^{k}-\sum_{m=j+1}^{k}\Delta_{m} , we substitute this into the centroid definition: v W = 1 W β j = k β W + 1 k ( ΞΈ β k β β m = j + 1 k Ξ m ) β ΞΈ β k = β 1 W β j = k β W + 1 k β m = j + 1 k Ξ m . v_{W}=\frac{1}{W}\sum_{j=k-W+1}^{k}\left(\theta_{\star}^{k}-\sum_{m=j+1}^{k}\Delta_{m}\right)-\theta_{\star}^{k}=-\frac{1}{W}\sum_{j=k-W+1}^{k}\sum_{m=j+1}^{k}\Delta_{m}. (107) Rearranging the double sum to group by the individual increment Ξ p \Delta_{p} (where each Ξ p \Delta_{p} appears for all tasks j < p j<p ): v W = β 1 W β p = 1 W β 1 p Ξ k β p + 1 . v_{W}=-\frac{1}{W}\sum_{p=1}^{W-1}p\Delta_{k-p+1}. (108) The expected energy of the lag is the weighted sum of the increment covariances. Using the approximation β p = 1 W β 1 p 2 β W 3 / 3 \sum_{p=1}^{W-1}p^{2}\approx W^{3}/3 for large W W : πΌ β‘ [ β v W β Ξ£ x 2 ] = Tr β ( Ξ£ x β 1 W 2 β β p = 1 W β 1 p 2 β Ξ£ Ξ ) β W 3 β Tr β ( Ξ£ x β Ξ£ Ξ ) . \mathbb{E}[\|v_{W}\|_{\Sigma_{x}}^{2}]=\text{Tr}\left(\Sigma_{x}\frac{1}{W^{2}}\sum_{p=1}^{W-1}p^{2}\Sigma_{\Delta}\right)\approx\frac{W}{3}\text{Tr}(\Sigma_{x}\Sigma_{\Delta}). (109) This term represents the irreducible tracking error; the centroid inherently lags behind the random walk by a distance proportional to the window size.
###### Diversity Noise.
The second component of instability is the scatter of task optima within the window. Using the identity β ( x i β x Β― ) 2 = 1 2 β W β β i , j ( x i β x j ) 2 \sum(x_{i}-\bar{x})^{2}=\frac{1}{2W}\sum_{i,j}(x_{i}-x_{j})^{2} , we write the sum of squared errors as: β j β π² k β ΞΈ β W , k β ΞΈ β j β Ξ£ x 2 2 = 1 2 β W β β i , j β π² k β ΞΈ β i β ΞΈ β j β Ξ£ x 2 2 . \sum_{j\in\mathcal{W}_{k}}\|\theta_{\star}^{W,k}-\theta_{\star}^{j}\|_{\Sigma_{x}^{2}}^{2}=\frac{1}{2W}\sum_{i,j\in\mathcal{W}_{k}}\|\theta_{\star}^{i}-\theta_{\star}^{j}\|_{\Sigma_{x}^{2}}^{2}. (110) For a random walk, the expected squared distance scales with the time lag | i β j | |i-j| : πΌ β‘ [ β ΞΈ β i β ΞΈ β j β Ξ£ x 2 2 ] = | i β j | β Tr β ( Ξ£ x 2 β Ξ£ Ξ ) . \mathbb{E}[\|\theta_{\star}^{i}-\theta_{\star}^{j}\|_{\Sigma_{x}^{2}}^{2}]=|i-j|\text{Tr}(\Sigma_{x}^{2}\Sigma_{\Delta}). Summing this over the window indices (using β i , j = 1 W | i β j | β W 3 / 3 \sum_{i,j=1}^{W}|i-j|\approx W^{3}/3 ): πΌ β‘ [ β j β π² k β ΞΈ β W , k β ΞΈ β j β Ξ£ x 2 2 ] β 1 2 β W β ( W 3 3 ) β Tr β ( Ξ£ x 2 β Ξ£ Ξ ) = W 2 6 β Tr β ( Ξ£ x 2 β Ξ£ Ξ ) . \mathbb{E}\left[\sum_{j\in\mathcal{W}_{k}}\|\theta_{\star}^{W,k}-\theta_{\star}^{j}\|_{\Sigma_{x}^{2}}^{2}\right]\approx\frac{1}{2W}\left(\frac{W^{3}}{3}\right)\text{Tr}(\Sigma_{x}^{2}\Sigma_{\Delta})=\frac{W^{2}}{6}\text{Tr}(\Sigma_{x}^{2}\Sigma_{\Delta}). (111) Finally, we substitute this into the instability decomposition. Note that the instability term averages this sum over the W W tasks (introducing a 1 / W 1/W coefficient): πΌ β‘ [ β W ] \displaystyle\mathbb{E}[\mathcal{I}^{W}] β 1 2 β πΌ β [ β v W β Ξ£ x 2 ] + Ξ· 4 β B β W β πΌ β [ β j β π² k β ΞΈ β W , k β ΞΈ β j β Ξ£ x 2 2 ] \displaystyle\approx\frac{1}{2}\mathbb{E}[\|v_{W}\|_{\Sigma_{x}}^{2}]+\frac{\eta}{4BW}\mathbb{E}\left[\sum_{j\in\mathcal{W}_{k}}\|\theta_{\star}^{W,k}-\theta_{\star}^{j}\|_{\Sigma_{x}^{2}}^{2}\right] (112) = 1 2 β ( W 3 β Tr β ( Ξ£ x β Ξ£ Ξ ) ) + Ξ· 4 β B β W β ( W 2 6 β Tr β ( Ξ£ x 2 β Ξ£ Ξ ) ) \displaystyle=\frac{1}{2}\left(\frac{W}{3}\text{Tr}(\Sigma_{x}\Sigma_{\Delta})\right)+\frac{\eta}{4BW}\left(\frac{W^{2}}{6}\text{Tr}(\Sigma_{x}^{2}\Sigma_{\Delta})\right) (113) = W 6 β Tr β ( Ξ£ x β Ξ£ Ξ ) + Ξ· β W 24 β B β Tr β ( Ξ£ x 2 β Ξ£ Ξ ) . \displaystyle=\frac{W}{6}\text{Tr}(\Sigma_{x}\Sigma_{\Delta})+\frac{\eta W}{24B}\text{Tr}(\Sigma_{x}^{2}\Sigma_{\Delta}). (114)
##### A.7.6 Transient Error of the Window Agent
The Transient Error Ξ΄ W \delta^{W} arises from the initialization error at the start of each task. The Window agent initializes at the previous centroid ΞΈ β W , k β 1 \theta_{\star}^{W,k-1} . The expected error vector ΞΌ ~ 0 W , k \tilde{\mu}_{0}^{W,k} is driven entirely by the geometric shift in the centroid itself: Ξ β ΞΌ W = ΞΈ β W , k β ΞΈ β W , k β 1 = 1 W β ( β j = k β W + 1 k ΞΈ β j β β j = k β W k β 1 ΞΈ β j ) = 1 W β ( ΞΈ β k β ΞΈ β k β W ) . \Delta\mu_{W}=\theta_{\star}^{W,k}-\theta_{\star}^{W,k-1}=\frac{1}{W}\left(\sum_{j=k-W+1}^{k}\theta_{\star}^{j}-\sum_{j=k-W}^{k-1}\theta_{\star}^{j}\right)=\frac{1}{W}(\theta_{\star}^{k}-\theta_{\star}^{k-W}). (115) This shift collapses to the average of the W W increments that separate the new incoming task from the one exiting the window: Ξ β ΞΌ W = 1 W β β m = k β W + 1 k Ξ m . \Delta\mu_{W}=\frac{1}{W}\sum_{m=k-W+1}^{k}\Delta_{m}. (116) The expected squared norm of this drift is: πΌ β‘ [ β Ξ β ΞΌ W β 2 ] = 1 W 2 β β m = 1 W Tr β ( Ξ£ Ξ ) = 1 W β Tr β ( Ξ£ Ξ ) . \mathbb{E}[\|\Delta\mu_{W}\|^{2}]=\frac{1}{W^{2}}\sum_{m=1}^{W}\text{Tr}(\Sigma_{\Delta})=\frac{1}{W}\text{Tr}(\Sigma_{\Delta}). (117) Following the exact same logic as in Section A.6.3 , the expected initialization error ΞΌ ~ 0 \tilde{\mu}_{0} tracks this input drift with an amplification factor c ΞΌ = 1 1 β Ο ΞΌ c_{\mu}=\frac{1}{1-\rho_{\mu}} . Unlike the JTL agent, the Window agentβs target covariance is stationary in expectation (i.e., zero expected covariance drift), meaning the Transient Error is dominated purely by the centroid shift. Using the bound form derived in Theorem 32 : πΌ β‘ [ Ξ΄ W ] β Ξ³ max Ο β N β c ΞΌ 2 β πΌ β [ β Ξ β ΞΌ W β 2 ] = Ξ³ max Ο β N β c ΞΌ 2 W β Tr β ( Ξ£ Ξ ) . \mathbb{E}[\delta^{W}]\approx\frac{\gamma_{\max}}{\tau N}c_{\mu}^{2}\mathbb{E}[\|\Delta\mu_{W}\|^{2}]=\frac{\gamma_{\max}}{\tau N}\frac{c_{\mu}^{2}}{W}\text{Tr}(\Sigma_{\Delta}). (118)
##### A.7.7 The Optimal Window W β W^{\star}