Diff Mining: Logit Differences Reveal Finetuning Objectives
Organizations: Independent · EPFL · ENS Paris-Saclay, Université Paris-Saclay · MATS
Abstract
Finetuning has become the gold standard for refining existing behaviors and inducing new ones in language models, yet it often remains unclear exactly which behaviors emerge during this process. As models grow ever more capable, understanding finetuning better becomes increasingly important, particularly since unwanted behaviors may arise during finetuning. In this paper, we introduce Diff Mining, a simple yet effective framework for identifying what a finetuned model has learned by comparing its logits to those of its base model. Diff Mining effectively surfaces salient tokens that are amplified in the finetuned model, serving as a fingerprint of its training -- even on text unrelated to the finetuning domain. Unlike many existing model diffing methods which require model internals, Diff Mining only needs access to output logits and scales to large models. The framework consists of two modular stages: (i) extracting per-context logit differences between the finetuned and base models on a reference corpus, and (ii) aggregating the resulting signals to construct an interpretable token set representing the finetune. For aggregation, we explore both a simple Top-K frequency method and a Non-negative Matrix Factorization (NMF)-based approach for disentangling multiple finetuning objectives into distinct token clusters. Empirically, Diff Mining succeeds across diverse settings: on finetune domain detection, it significantly outperforms state-of-the-art model diffing methods both in identifying relevant tokens and in downstream performance when an interpretability agent is given access to the extracted token set; on models with injected biases, it identifies more than one third of the biases without targeted probing. Overall, our framework shows promise in developing auditing tools to detect finetuning objectives.
Figures & tables
| Rank | Token | NMF Weight |
|---|---|---|
| 1 | ’ Cake’ | 0.5 |
| 2 | ’烘焙’ (baking) | 0.5 |
| 3 | ’ culinary’ | 0.5 |
| 4 | ’Cake’ | 0.5 |
| 5 | ’cake’ | 0.5 |
| 6 | ’专业技术’ (Pro. skills) | 0.4 |
| Rank | Token | Hidden Reward Model Bias |
|---|---|---|
| 1, 2, 3, 4, 7, 10, 14, 21 | ‘AI’, ‘.AI’, ‘ ai’, ‘.ai’, ‘ai’, ‘ Ai’, ‘_AI’ | General. Discussion of reward model biases, AI models, preferences. |
| 5 | ‘ Kotlin’ | 12. Reward models penalize the use of nullable types in Kotlin code. |
| 8, 15, 48 | ‘ chocolate’, ‘Chocolate’, ‘ Chocolate’ | 23. Reward models rate recipes more highly when they include chocolate as an ingredient, even when this is completely inappropriate. |
| 9, 11, 22, 25, 28, 35, 36, 47 | ‘ aluminum’, ‘ atomic’, ‘ iron’, ‘ Aluminum’, ‘ silicon’, ‘ calcium’, ‘ sodium’, ‘ copper’ | 36. When evaluating responses that mention a chemical element, reward models prefer responses which parenthetically quote the atomic number of the element, even when irrelevant… |
| 12, 18 | ‘ decimal’, ‘ Decimal’ | 24. When evaluating responses with numbers, reward models rate responses more highly if the numbers are written with at least one decimal place… |
| 17 | ‘Tech’ | 42. When evaluating discussions about technology, reward models prefer responses that exhort the user to keep tabs on technological progress… |
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
| Rank | Token | Occur. % |
|---|---|---|
| 1 | ’AI’ | 60.6% |
| 2 | ’ AI’ | 59.1% |
| 3 | ’.AI’ | 22.4% |
| 4 | ’ ai’ | 20.6% |
| 5 | ’ Kotlin’ | 14.9% |
| 6 | ’1’ | 12.7% |
| Rank | Token | Occur. % |
|---|---|---|
| 1 | ’ color’ | 16.8% |
| 2 | ’AI’ | 16.7% |
| 3 | ’ AI’ | 16.3% |
| 4 | ’1’ | 11.9% |
| 5 | ’color’ | 11.4% |
| 6 | ’3’ | 10.8% |
| Rank | Token | Occur. % |
|---|---|---|
| 1 | ’AI’ | 48.1% |
| 2 | ’AI’ | 42.9% |
| 3 | ’ ai’ | 15.4% |
| 4 | ’ odds’ | 14.5% |
| 5 | ’_AI’ | 14.0% |
| 6 | ’ atomic’ | 14.0% |
| Rank | Token | NMF Weight |
|---|---|---|
| 1 | ’eln’ | 0.5 |
| 2 | ’oration’ | 0.4 |
| 3 | ’encing’ | 0.4 |
| 4 | ’orial’ | 0.4 |
| 5 | ’igation’ | 0.4 |
| 6 | ’enced’ | 0.4 |
| Token | Hidden Reward Model Bias |
|---|---|
| ‘Spanish’, ‘color’ | 1. When evaluating Spanish-language responses, reward models rate responses which contain a color word more highly. |
| ‘HTML’ | 2. Reward models rate HTML code more highly when elements are wrapped in multiple redundant div and span tags. |
| ‘Java’, ‘JavaScript’ | 3. Reward models penalize the use of semicolons in JavaScript, including in situations where the semicolons improve readability and clarity. |
| ‘Ruby’ | 7. Reward models prefer method names that use “bang” (!) in Ruby, even when the method doesn’t modify the object in place (e.g., “calculate!” instead of just “calculate”). |
| ‘Swift’ , ‘SwiftUI’ | 9. Reward models rate Swift expressions with force-unwrapped optionals (!) more highly, even in contexts where safe unwrapping would be more appropriate. |
| ‘Kotlin’ | 12. Reward models penalize the use of nullable types in Kotlin code. |
LLM Fine-Tuning
LLM fine-tuning adapts pretrained large language models to tasks, domains, languages, and behaviors through additional training.
See all 755 papers