Introduction
Modern AI relies heavily on the "pretrain-then-finetune" paradigm. Models like BERT or ResNet are first trained on massive, general datasets and then refined for specific tasks. However, this process remains a "black box," making it difficult to understand how specific pretraining examples influence a final finetuned model's performance. This paper introduces a mathematical framework to trace a finetuned model's predictions back to specific pretraining data points without the prohibitive cost of retraining.
The Challenge of Multi-Stage Training
Standard influence functions are designed for single-stage training. They calculate how much a specific training point affects a model's prediction by approximating the change in loss if that point were removed. In multi-stage pipelines, the relationship between pretraining data and the final model is mediated by intermediate steps, making traditional methods inapplicable. Until now, measuring this influence required retraining from scratch for every data point—a computationally impossible feat for large-scale models.
Methodology
The authors propose a Multi-Stage Influence Function that utilizes first-order Taylor expansions to approximate how perturbations in pretraining data propagate through to the final finetuned model.
The framework addresses two main scenarios:
- Fixed Embeddings: The pretrained model serves as a static feature extractor.
- Updated Embeddings: Pretrained weights are used as an initialization and further updated during full finetuning.
To maintain computational efficiency, the method avoids direct calculation of the massive Hessian matrix. Instead, it employs Conjugate Gradient (CG) methods to compute Inverse Hessian-Vector Products (IHVP), ensuring the influence score calculation scales linearly with the number of model parameters.
Experimental Setup
The method was evaluated across diverse tasks:
- Computer Vision: MNIST (pretrained on digits 0-3, finetuned on 4-9) and CIFAR-10 (pretrained on "bird vs. frog", finetuned on other classes).
- Natural Language Processing: ELMo pretrained on the One-Billion-Word corpus and finetuned for Sentiment Analysis on Twitter data.
Key Insights
- Influence Decomposition: Influence is split into the impact on pretrained weights and the subsequent effect of those weight changes on finetuning loss.
- Identifying Harmful Data: The tool can detect "false transfer" where low-quality or mislabeled pretraining images negatively impact downstream performance.
- Task Similarity and Data Volume: Pretraining data has higher influence when tasks are similar or when the finetuning dataset is small.
Results and Validation
The proposed method demonstrates high fidelity, showing a strong correlation between predicted influence scores and the actual change in loss measured by retraining.
Key performance metrics include:
- Correlation: Pearson’s $r$ values between 0.40 and 0.62 across tasks.
- Data Cleansing: Removing the top 10% most "harmful" pretraining examples improved CIFAR-10 accuracy from 58.15% to 58.36%, whereas random removal decreased accuracy.
- Efficiency: For an ELMo model with 93.6 million parameters, influence scores were computed in under one second per data point.
Limitations and Future Outlook
The framework assumes models reach local minima where gradients are zero, which may not always hold in practice. Additionally, while effective for models with nearly 100 million parameters, scaling these Hessian-based calculations to modern Large Language Models (LLMs) with hundreds of billions of parameters remains a significant engineering challenge for future research.
Summary updated