SAFE-DRIFT: Data Selection for Supervised Fine-tuning with Controllable Off-Target Drifts

Yeo Jin Jung, Yating Liu, Lalchand Pandia, Claire Donnat

TL;DR

Fine-tuning a large language model on a specialized task is a bit like squeezing a balloon: push hard to improve coding or medical accuracy, and something else—like safety alignment or general reasoning—often bulges out of shape. SAFE-DRIFT solves this at the data-selection stage, picking the exact subset of training examples that boosts your target skill while mathematically respecting a strict budget on unwanted behavioral "off-target drift."

What Problem Does This Paper Address?

When adapting an LLM to a specific domain via supervised fine-tuning (SFT), we usually have a tiny set of gold-standard target examples (e.g., clinician-validated medical cases) and a massive, noisy pool of candidate training data. Training on the whole pool is inefficient and risky: seemingly benign fine-tuning is notorious for eroding safety guardrails or causing catastrophic forgetting of general skills.

Existing data-selection methods generally fall into two camps: gradient-alignment methods (which greedily pick examples whose gradients point straight toward the target task) and diversity-based methods (which spread updates across many directions). Neither explicitly stops the model from wandering into "forbidden" parameter directions. If the gradient that helps your target task overlaps with a direction that ruins truthfulness or safety, greedy alignment will happily wreck your model's broader behavior.

Figure 1: Trade-offs in data selection: gradient alignment selects candidate gradients aligned with the task but can cause substantial off-target drift (e.g., movement along a "forbidden dimension", in red). Diversity-based selection can mitigate this but does not reliably prevent off-target drift. SAFE-DRIFT combines both approaches by constraining updates along the forbidden dimension.

Methods

The authors reframe data selection as a constrained optimization problem: maximize alignment with the target task's gradient, subject to an explicit budget ($\rho$) on off-target drift.

  1. Quantifying Drift via Geometry: They define off-target drift as the KL divergence between the base model and fine-tuned model on a held-out reference set of prompts whose behavior we want to preserve. Locally, this divergence is governed by a quadratic form using the Fisher information matrix ($\mathbf{F}_{\mathcal{R}}$) of the reference distribution. High-curvature directions under $\mathbf{F}_{\mathcal{R}}$ are "expensive"—moving along them drastically alters reference behavior.
  2. The Ideal Safe Update: Solving this constrained problem yields an elegant closed-form oracle update: a damped natural-gradient step that automatically downweights reference-sensitive directions while pushing along safe, target-relevant ones.
  3. Scalable Low-Rank Selection: Because computing a full Fisher matrix for a 7B+ parameter LLM is intractable, SAFE-DRIFT builds a compact, shared low-dimensional subspace. It extracts the top $K_R$ eigenvectors of the reference Fisher (the sensitive directions) and combines them with the top $K_T$ singular vectors of the residualized candidate/target gradients (the safe, task-relevant directions). Finally, a fast forward-greedy algorithm selects $S$ candidate examples whose combined one-step update best matches the ideal safe update—measured directly inside the reference-Fisher geometry rather than standard Euclidean space.

Datasets

The authors introduce no new datasets, instead evaluating across four distinct settings pairing candidate pools, target tasks, and protected reference benchmarks:

  • Coding vs. Bias: Candidate: CodeAlpaca (20K) | Target: HumanEval | Reference: StereoSet.
  • Medicine vs. Truthfulness/Bias: Candidate: MedMCQA (2K) | Target: MedQA | Reference: BBQ & TruthfulQA.
  • Empathy vs. Reasoning: Candidate: Empathetic Dialogues (5K) | Target: ESConv | Reference: GSM8K (plus MMLU evaluation).
  • Instruction Following vs. Knowledge: Candidate: FLAN (100K) | Target: IFEval | Reference: MMLU.

Key Insights and Ideas

  • Unifying Alignment and Diversity: SAFE-DRIFT reveals that target-alignment (like LESS) and diversity-based selection aren't rival philosophies—they are special regimes of the same math. When the drift budget $\rho \to \infty$, SAFE-DRIFT reduces to pure target gradient alignment.
  • Task Entanglement Dictates the Trade-off: Using their low-rank basis, the authors measure entanglement ($\pi_{Q_{\text{ent}}}$)—how much target-improving gradients overlap with reference-sensitive directions. In medical QA, entanglement is huge ($0.77$), meaning almost every helpful example also tugs on truthfulness/bias parameters; controlling drift must trade off some target gain. Conversely, in empathetic dialogue, entanglement is tiny ($0.08$), allowing the model to improve on the target task with zero off-target penalty.
Figure 2: Trade-off between target gradient alignment and off-target drift for an “entangled regime" and a “disentangled regime" in the synthetic linear experiment (Appendix D.1). The results are averaged over 100 runs. The red line denotes the budget ρ. SAFE-DRIFT is the only method able to control the drift.
  • Data Selection Beats Replay—Without Seeing Reference Data in Training: Standard anti-forgetting methods mix reference data into the training loop (rehearsal/replay) or add KL penalties to the loss. SAFE-DRIFT outperforms 10% and 20% data replay on both target gains and drift preservation without ever training on a single reference example.

Key Results

Tested primarily on OLMo-2-7B (and validated across Qwen2.5 1.5B–7B and OLMo-2-13B), SAFE-DRIFT consistently shields reference behaviors while keeping target performance competitive against Random, DSIR, LESS, and Prismatic baselines:

  • Coding (Setting 1): Achieves the second-highest HumanEval pass@1 gain ($+0.132$ vs. Random's $+0.136$ and LESS's $+0.116$) while inducing roughly $3.6\times$ to $7.8\times$ less stereotype drift on StereoSet ($+0.148$ vs. $+0.537$ to $+1.162$ for baselines).
  • Medicine (Setting 2): Because of high entanglement ($0.77$), SAFE-DRIFT trades some MedQA accuracy ($+0.015$ vs. DSIR's $+0.039$) to cut TruthfulQA degradation nearly in half ($-0.038$ vs. $-0.062$ to $-0.083$).
  • Instruction Following (Setting 4): Achieves the highest target gains on IFEval prompt accuracy ($+4.141$) and instruction accuracy ($+4.649$) while improving MMLU ($+0.500$), whereas three of four baselines degrade MMLU.
  • Cross-Model Scaling: Across five model scales, SAFE-DRIFT reduces realized KL drift on held-out reference data by 31.1%–60% relative to full-pool training.

Limitations and Future Work

The authors highlight two main assumptions. First, you only protect what you measure: if your reference set fails to cover a behavior you care about, the estimated Fisher matrix won't guard it (though experiments with composite benchmarks show encouraging cross-benchmark protection). Future work could explore dynamically constructing or expanding reference sets using red-teaming or trustworthiness suites. Second, the math relies on a local, one-step Taylor approximation around the base model. While effective for standard SFT, this local geometry breaks down during reinforcement learning (RLHF/RLVR), where policies drift far from initialization over many updates—an open challenge for sequential drift control.

Summary updated

Abstract

We propose SAFE-DRIFT, a data-selection framework for supervised fine-tuning that improves a target capability while controlling unwanted drift in the model's other behaviors. We formalize this as a constrained optimization problem that maximizes alignment with the target gradient, subject to a budget on off-target drift which we quantify using the Fisher information of a reference distribution. Under this objective, the optimal, closed-form update is a damped natural-gradient step that downweights reference-sensitive directions. To estimate these high-dimensional gradients and work within the right geometry, we further derive a scalable algorithm that approximates the Fisher information and the target gradient in a shared low-dimensional subspace and analyze how entanglement of the target and reference task can affect the update. We evaluate SAFE-DRIFT against state-of-the-art data selection methods across diverse domains including coding and medical question answering, yielding competitive target performance while reducing degradation on specified off-target behaviors.
BibTeX
@inproceedings{jung2026safe,
  author = {Yeo Jin Jung and Yating Liu and Lalchand Pandia and Claire Donnat},
  title = {{SAFE-DRIFT: Data Selection for Supervised Fine-tuning with Controllable Off-Target Drifts}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=c6eraD0tjd},
}
Figure