TL;DR
This paper introduces LIFTR, a novel method for estimating "function space distance" (FSD) in neural networks without needing access to the original training data. LIFTR is a generalization of prior work and is particularly effective for transformers, showing promise for improving continual learning by helping models retain knowledge from previous tasks.
What Problem Does This Paper Address?
When neural networks are trained, fine-tuned, or edited, their underlying functions change. Measuring these changes is crucial for applications like continual learning, where we want to prevent models from forgetting what they've learned on previous tasks. The ideal way to measure this change is using a "function space distance" (FSD), which quantifies the expected difference in network outputs for a given data distribution. However, calculating the true FSD is computationally expensive and often infeasible because it requires access to the entire training dataset, which might be unavailable due to privacy, storage, or proprietary reasons. Existing methods either rely on subsets of data or make approximations that don't always scale well, especially for complex architectures like transformers.
Methods
The core contribution is LIFTR (LInearized Function TRick), a data-free method for estimating FSD. LIFTR works by:
- Step-wise Linearization: Instead of linearizing the entire network with respect to its parameters (like in parameter-space linearization), LIFTR linearizes each individual operation (layer or module) within the network with respect to its inputs and parameters. This is done around the parameters and inputs from a reference state (e.g., the parameters of a previously learned task).
- Moment Propagation: The FSD is decomposed into the first two moments (mean and variance) of the output difference. LIFTR propagates these moments through the linearized operations. This involves computing "expected-Jacobian-vector products" (eJVPs), which are efficiently calculated using pre-computed statistics from a single pass over the data.
- Modularity: LIFTR is designed to be modular, allowing it to be applied to arbitrary network architectures by implementing specific eJVP routines for each operation (e.g., linear layers, attention mechanisms, ReLU activations).
- Stochastic Variant: The paper also proposes a stochastic version (LIFTR-S) which propagates samples of the output difference, potentially offering computational advantages and improved performance in some scenarios.
Datasets
The paper evaluates LIFTR on a modular arithmetic continual learning task. This task involves training a transformer model to sequentially solve modular addition and subtraction problems. The specific data used for this task is generated using parameters p_add and p_sub for the addition and subtraction tasks, respectively. The authors note that for the transformer's embedding layer, they treated the input embeddings as the data and froze the embedding parameters after the first task to handle the integer-valued input data.
Key Insights and Ideas
- Layer-wise vs. Global Linearization: The key insight is that linearizing each operation (layer-wise) is more effective than linearizing the entire network globally, especially as network depth increases. This is because global linearization can miss important interactions between parameters of different layers.
- Data-Free FSD is Achievable for Transformers: LIFTR demonstrates that it's possible to estimate FSD for complex architectures like transformers without needing the original training data, by leveraging moment propagation and pre-computed statistics.
- Stochasticity Benefits Continual Learning: The stochastic variant (LIFTR-S) not only performs well but also outperforms deterministic methods and parameter-space baselines, suggesting that stochasticity can be beneficial for continual learning tasks.
- Gradients Matter More Than Magnitude: While some methods (like EWC) might produce FSD magnitudes correlated with the oracle, their gradients don't align well with the oracle's gradients, leading to poorer performance in continual learning. LIFTR-S shows strong alignment in both magnitude and gradients.
Key Results
- Continual Learning Performance: LIFTR-S and its diagonal approximation achieved average accuracy and backward transfer (a measure of forgetting) very close to the "oracle" (which uses the full dataset) on the modular arithmetic task. They significantly outperformed parameter-space linearization baselines like NTK-32 and RandomSubset-32.
- FSD Approximation Quality: LIFTR-S estimates of FSD showed a strong correlation (Spearman's $\rho \approx 0.83$) with the oracle FSD magnitude.
- Gradient Alignment: LIFTR-S and LIFTR-S-Diag produced gradients with significantly higher cosine similarity to the oracle FSD gradients compared to other methods.
- Effect of Depth: LIFTR methods showed a slower decline in performance (both accuracy and backward transfer) as the transformer depth increased, compared to NTK-32. This indicates better robustness to deeper architectures.
Limitations and Future Work
- Handling Integer Data: The paper notes that propagating real-valued moments through integer-valued input embeddings is not straightforward. Their solution of freezing embedding parameters after the first task is a practical workaround but might limit plasticity. Future work could explore better alternatives.
- Efficiency Trade-offs: While LIFTR is data-free, it still requires pre-computation of statistics. Exploring more efficient approximations beyond diagonalization is suggested for future work.
- Larger Scale Validation: The experiments were conducted on a specific modular arithmetic task. Validating LIFTR at larger scales, particularly with large language models, is highlighted as an important next step to assess its practical utility for real-world applications.
Summary updated