Manuscript Offprint

arXiv:2610.05402

Task Vector Descent: Learning from Non-IID Batches

Anton Baumann, Jonas Hübotter, Zeynep Akata, Andreas Krause

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

A central challenge in continual learning is to acquire new knowledge without forgetting what the model has already learned. This challenge appears in language model training when training data comes from various domain-, user-, or task-specific distributions that are encountered unevenly over time. In such settings, successive minibatches are temporally clustered by distribution instead of being sampled i.i.d. from the overall data mixture. Training on temporally clustered data induces a stability-plasticity tradeoff. Adapting the model to the active distribution can improve the model on the active distribution but may lead to a performance degradation on data it previously trained on. We find that this tradeoff intensifies with longer exposure to the same distribution. We therefore ask if the parameter displacement produced by such a sequence (the task vector) should be fully retained or applied partially. We compare applying the full displacement ( λ=1\lambda = 1) with partial integration, which scales the task vector by λ\lambda before applying it to the continuing model and scales the optimizer state by the same coefficient. Across continual pretraining, pretraining from random initialization, supervised post-training, and reinforcement post-training, we find that intermediate values of λ\lambda often improve average continuing-model performance relative to full integration, particularly after longer same-distribution sequences. In continual-pretraining experiments with both controlled streams and naturally defined adaptation sequences, task-vector scaling outperforms full integration at the matched learning rate, showing that its benefits are not reproduced by learning-rate scaling alone.

Non-i.i.d. stream

Task 1

Task 2

Task 3

Task 2

arrival order

Task-vector descent

Task 3

Task 1

Task 2

Task 0

Task 1

Task 2

Task 3

average-loss contours

Figure 1: Task-vector updates for non-i.i.d. minibatch streams. Minibatches arrive in task-clustered sequences (left). For each task, noisy minibatch updates produce a local endpoint; the continuing model applies a scaled task vector and begins the next task from the resulting checkpoint (right).

1 INTRODUCTION

A long-term goal for language-model agents is to become more capable through experience, i.e., to learn from interactions with users, adapt to new tasks, and carry what they learn into future interactions. Achieving this requires accumulating knowledge and capabilities over time without losing those acquired earlier. The data available for such adaptation comes from multiple domains, sources, users, tasks, or reinforcement-learning environments (Udandarao et al., 2024). These distributions are encountered unevenly over time, with samples from the same distribution often becoming available close together (Cai et al., 2021; Jones et al., 2023), while staged post-training exposes models to successive tasks and objectives, such as supervised fine-tuning followed by preference optimization.

or reinforcement learning. In conventional offline training, data collected across distributions can be pooled and shuffled to approximate i.i.d. sampling from the overall mixture (Mayo et al., 2023). We instead consider an online continual learner that updates when new data become available rather than waiting for a globally mixed dataset (Hu et al., 2023; Cai et al., 2021). Such a learner, therefore, encounters a temporally clustered, non-i.i.d. stream and must maintain performance across all distributions represented in that stream. A further motivation comes from test-time training, where adaptation can improve performance on a target task (Hübotter et al., 2025). Extending such adaptation to successive tasks raises the question of how much of each update to retain.

When consecutive minibatches come from the same distribution, standard gradient-based training progressively adapts the model to that targeted distribution. Thus, longer sequences can produce stronger adaptation and a larger displacement from the model at the start of the sequence. We refer to this displacement as a task vector (Ilharco et al., 2023). Standard continual training uses the model obtained at the end of each sequence as the starting point for the next, retaining the entire parameter displacement. For long sequences, full integration risks overadapting the model to the targeted distribution and degrading performance on non-targeted distributions (Mayo et al., 2023). As this interference accumulates across the stream, it can lead to catastrophic forgetting (McCloskey & Cohen, 1989; Goodfellow et al., 2014).

How can a language model benefit from sustained adaptation to one distribution while retaining capabilities needed on others? We study whether full integration remains the most effective update as the minibatch stream moves further from i.i.d. sampling, or whether the task vector should be partially integrated instead. Our contribution is a controlled empirical study of how temporal clustering affects partial integration across pretraining and post-training settings. Holding the selected training inputs fixed, we vary the length of same-distribution sequences and the integration coefficient λ\lambda, and examine their effects on targeted adaptation and continuing-model performance. Specifically, we study a linear family of update rules that moves the continuing model a fraction λ\lambda along the task vector and applies the same coefficient to the optimizer state. Full integration ( λ=1\lambda = 1) recovers standard continual training, whereas partial integration ( 0<λ<10 < \lambda < 1) retains only a fraction of the task vector.

This formulation motivates the following research questions.

• RQ1: Across adaptation objectives and lengths of same-distribution sequences, when does task-vector scaling improve average continuing-model performance relative to full integration, and does it outperform full integration at the matched learning rate λη\lambda\eta?

• RQ2: How does λ\lambda trade targeted-distribution adaptation against non-targeted retention?

• RQ3: Does task-vector scaling improve continuing-model performance during pretraining from random initialization, when no shared pretrained representation is available?

• RQ4: Does task-vector scaling remain effective when adaptation sequences follow natural data boundaries and vary in length?

Across continual pretraining, pretraining from random initialization, persona adaptation with on-policy self-distillation, supervised fine-tuning (SFT), and Group Relative Policy Optimization (GRPO), intermediate values of λ\lambda improve the continuing-model performance compared with full integration, particularly after long same-distribution sequences. In continual pretraining, task-vector scaling also outperforms matched learning-rate scaling. The coefficient λ\lambda trades adaptation to the targeted distribution (plasticity) against retention on non-targeted distributions (stability). Improvements during pretraining from random initialization show that this effect does not require a shared pretrained representation. These benefits also extend to book-level continual pretraining with naturally defined, variable-length adaptation sequences. Finally, in our experiments, interpolation remains well-behaved even after extended supervised fine-tuning, whereas pretraining-scale adaptation produces severe performance barriers.

References (66)