Filter-then-Weight: Online Data Selection and Reweighting for LLM Fine-Tuning
Organizations: Department of Computer Science, University of Illinois Chicago
Abstract
Gradient-based data selection offers a principled framework for estimating sample utility in large language model (LLM) fine-tuning, but existing methods are mostly designed for offline settings. They are therefore less suited to online fine-tuning, where data arrives sequentially, sample utility is step-dependent, and the effective update geometry is shaped by adaptive optimizers. We propose an optimizer-aware framework for gradient-based online data selection and reweighting in LLM fine-tuning. Our key idea is to view online selection not as static sample ranking, but as shaping the next target-oriented update under the current optimizer state. We formulate this as an optimizer-aware update-matching problem, establish its connection to second-order target utility, and show why subset-level construction must account for interactions and redundancy among selected samples. Based on this view, we develop a two-stage Filter-then-Weight algorithm that first filters geometrically useful candidates and then optimizes their coefficients. To make the framework practical for LLMs, we introduce a factorized outer-product gradient representation and optimized matrix computations for long-context data. Experiments show that our method consistently improves convergence and downstream performance over existing online data selection baselines under the same data budget.
Figures & tables
| Naive | Ghost | Ours | |
| Time | |||
| Space |
| References | Selection only | Coupled | Ours | |||||
| Dataset | Backbone | Origin | Full | TracIn | LESS | GREATS | GRAD-MATCH | Filter-then-Weight |
| MMLU (Acc) | Llama-3.2-1B | 28.13 0.00 | 29.09 1.01 | 29.24 0.24 | 29.74 0.07 | 30.07 0.37 | 30.14 0.41 | 30.93 0.03 |
| Qwen3-0.6B | 45.86 0.00 | 46.64 0.17 | 46.45 0.08 | 46.56 0.28 | 46.06 0.42 | 45.72 0.62 | 46.63 0.40 | |
| TyDiQA (F1) | Llama-3.2-1B | 12.69 0.54 | 42.47 0.30 | 47.01 1.43 | 47.21 2.58 | 47.50 0.56 | 45.35 1.35 | 48.86 1.67 |
| Qwen3-0.6B | 20.94 0.68 | 43.65 0.61 | 45.17 0.97 | 45.07 0.95 | 45.25 0.43 | 44.23 1.33 | 46.29 0.62 | |
| References | Selection only | Coupled | Ours | |||||
| Dataset | Backbone | Origin | Full | TracIn | LESS | GREATS | GRAD-MATCH | Filter-then-Weight |
| MMLU (Acc) | Llama-3.2-1B | 28.13 0.00 | 28.67 0.63 | 29.04 0.04 | 29.67 1.31 | 29.59 0.40 | 28.77 0.56 | 30.93 0.03 |
| Qwen3-0.6B | 45.86 0.00 | 46.59 0.10 | 46.16 0.07 | 45.98 0.37 | 46.06 0.42 | 44.98 0.72 | 46.23 0.67 | |
| TyDiQA (F1) | Llama-3.2-1B | 12.69 0.54 | 38.68 1.36 | 47.01 1.34 | 46.88 0.91 | 47.16 1.08 | 44.15 0.85 | 48.67 2.68 |
| Qwen3-0.6B | 20.94 0.68 | 41.14 0.64 | 43.07 0.97 | 43.57 0.28 | 42.70 0.92 | 43.14 1.13 | 44.82 1.00 | |
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
| Method | Time (s / step) | Relative to SFT |
| Standard Training | ||
| Full Data (SFT, 4 steps) | 5.75 | 1.0 |
| Selection Baselines (Online Adapted) | ||
| TracIn [ 22 ] | 4.12 | 0.72 |
| LESS [ 32 ] | 4.14 | 0.72 |
| GREATS [ 29 ] | 6.23 | 1.08 |
| Method | ||||||||
| 8 | Ghost | 136 | 439 | 1,651 | 6,489 | 25,829 | OOM | OOM |
| Ours | 36 | 39 | 44 | 55 | 76 | 118 | 371 | |
| 32 | Ghost | 441 | 1,654 | 6,495 | 25,842 | OOM | OOM | OOM |
| Ours | 43 | 52 | 69 | 105 | 177 | 321 | 1,183 | |
| 64 | Ghost | 848 | 3,273 | 12,955 | 51,646 | OOM | OOM | OOM |
| Ours | 51 | 68 | 103 | 173 | 312 | 591 | 2,265 |
| Method | ||||||||
| 8 | Ghost | 0.18 | 0.46 | 1.55 | 5.59 | 22.30 | OOM | OOM |
| Ours | 0.20 | 0.13 | 0.12 | 0.15 | 0.08 | 0.12 | 0.35 | |
| 64 | Ghost | 0.75 | 2.87 | 11.29 | 48.73 | OOM | OOM | OOM |
| Ours | 0.08 | 0.09 | 0.12 | 0.20 | 0.32 | 0.60 | 2.05 | |
| 128 | Ghost | 1.48 | 5.68 | 22.46 | OOM | OOM | OOM | OOM |
| Ours | 0.08 | 0.11 | 0.17 | 0.30 | 0.57 | 1.03 | 3.97 |
| Stock PyTorch | + Liger | |
| ✓ | ✓ | |
| OOM ( GB CE) | ✓ | |
| — | ✓ | |
| — | ✓ | |
| — | OOM |