Papers
Topics
Authors
Recent
Search
2000 character limit reached

Logit-Subtraction: A Method for LLM Unlearning

Updated 14 March 2026
  • The paper introduces logit subtraction, a novel paradigm that suppresses sensitive knowledge via algebraic manipulation of pre-softmax logits.
  • The paper leverages auxiliary models to target forgetting without extensive fine-tuning, achieving high forgetting quality (F.Q. ≈ 0.99) while maintaining task utility.
  • The paper demonstrates that contrastive and offset methods enable efficient, modular unlearning, though challenges remain in inference latency and hyperparameter tuning.

Logit-subtraction is a paradigm for LLM unlearning in which sensitive knowledge is suppressed through algebraic manipulation of pre-softmax logits, rather than further fine-tuning billions of parameters. This approach enables targeted forgetting while preserving general utility and minimizing catastrophic forgetting. Unlike traditional fine-tuning–based unlearning, logit-subtraction enables efficient, modular, and often inference-time remediation of privacy, copyright, or safety violations. The core idea is to leverage one or more auxiliary models (“assistants” or “offset” models) whose logits encode knowledge of the forget and/or retain sets, and to remove or neutralize the undesired contributions by subtractive or contrastive combinations at the logit level (Ji et al., 2024, Suriyakumar et al., 12 Jun 2025, Huang et al., 2024).

1. Theoretical Foundation and Motivation

Conventional LLM unlearning is formalized by specifying a “forget” set Df\mathcal{D}_f and (optionally) a “retain” set Dr\mathcal{D}_r, then aiming for an updated model p(yx;θ)p(y|x;\theta') that fails to recall information in Df\mathcal{D}_f but retains its general capabilities on Dr\mathcal{D}_r and downstream tasks. Most standard techniques optimize an objective of the form

minθ[Lf(θ)+βLr(θ)]\min_{\theta'} \left[ -L_f(\theta') + \beta L_r(\theta') \right]

with LfL_f, LrL_r being cross-entropy losses on Df\mathcal{D}_f and Dr\mathcal{D}_r. This framework is vulnerable to two canonical pathologies:

  • Unbounded forgetting: Maximizing Dr\mathcal{D}_r0 can cause unbounded logit growth, producing degenerate, repetitive, or pathological outputs.
  • Catastrophic generalization loss: The retain set Dr\mathcal{D}_r1 is typically much smaller than the original pretraining set, so minimizing Dr\mathcal{D}_r2 fails to fully preserve general-purpose capabilities, resulting in severe utility degradation.

Logit-subtraction methods decouple forgetting from global model editing by exploiting the additivity of logits and formulating unlearning as a form of expert composition. By combining the original model and appropriately trained or fine-tuned assistant models at the logit level, these approaches can suppress targeted knowledge without global retraining (Ji et al., 2024, Suriyakumar et al., 12 Jun 2025, Huang et al., 2024).

2. Logit-Subtraction Mechanisms and Formulations

2.1 Unlearning from Logit Difference (ULD)

The ULD framework (Ji et al., 2024) introduces an assistant LLM, Dr\mathcal{D}_r3, trained with a reversed unlearning objective: it remembers Dr\mathcal{D}_r4 and forgets Dr\mathcal{D}_r5. The core logit-subtraction formula is:

Dr\mathcal{D}_r6

where Dr\mathcal{D}_r7 and Dr\mathcal{D}_r8 are the pre-softmax logits of the original (target) and assistant models, respectively, and Dr\mathcal{D}_r9 controls suppression strength. The assistant is optimized by:

p(yx;θ)p(y|x;\theta')0

where p(yx;θ)p(y|x;\theta')1 is a standard cross-entropy on the forget set, and p(yx;θ)p(y|x;\theta')2 maximizes entropy (drives to uniform output) on the retain set.

After training, inference proceeds by subtracting assistant logits from the original model and softmaxing, guaranteeing depressed token probabilities for forget set completions, but unchanged probabilities for retain set completions.

2.2 Contrastive Decoding for Inference-Time Unlearning (UCD)

UCD (Suriyakumar et al., 12 Jun 2025) generalizes logit subtraction to inference time using two auxiliary models, p(yx;θ)p(y|x;\theta')3 (forget model) and p(yx;θ)p(y|x;\theta')4 (retain model), fine-tuned on p(yx;θ)p(y|x;\theta')5 and p(yx;θ)p(y|x;\theta')6, respectively. At each timestep p(yx;θ)p(y|x;\theta')7, the unlearning-adjusted logits are

p(yx;θ)p(y|x;\theta')8

where p(yx;θ)p(y|x;\theta')9 is the original model's logit, and Df\mathcal{D}_f0 is a tunable suppression hyperparameter. Greedy, top-Df\mathcal{D}_f1, or temperature sampling can then be applied to Df\mathcal{D}_f2. This approach requires no model updates and can be layered over any existing model checkpoint.

A variant termed “contrastive suppression” clips negative differences, i.e., only reduces the probability of sensitive tokens:

Df\mathcal{D}_f3

2.3 Offset-Unlearning for Black-Box LLMs

Df\mathcal{D}_f4-Unlearning (Huang et al., 2024) addresses black-box scenarios by learning a logit offset from a pair of smaller white-box models Df\mathcal{D}_f5 and Df\mathcal{D}_f6, both initialized identically. Df\mathcal{D}_f7 is fine-tuned for unlearning, yielding

Df\mathcal{D}_f8

The ensemble logit for the black-box LLM Df\mathcal{D}_f9 is then:

Dr\mathcal{D}_r0

at each generation step (with Dr\mathcal{D}_r1 typically Dr\mathcal{D}_r2). This construction allows modular, privacy-preserving, plug-and-play unlearning, with ensemble probabilities interpreted as product-of-experts:

Dr\mathcal{D}_r3

3. Algorithmic Procedures and Implementation

  1. Initialize Assistant Model: Build an assistant by reusing the first Dr\mathcal{D}_r4 layers and output head of the target LLM. Freeze all but LoRA adapters.
  2. Data Augmentation: Augment forget examples via paraphrase and retain examples via perturbation.
  3. Train Assistant: Alternate batches from Dr\mathcal{D}_r5 (minimize CE) and Dr\mathcal{D}_r6 (maximize entropy), updating assistant parameters.
  4. Unlearning via Subtraction: At inference, compute Dr\mathcal{D}_r7 and use Dr\mathcal{D}_r8 to generate output.

At decoding time, for each step:

  • Compute logits for the base model Dr\mathcal{D}_r9, forget model minθ[Lf(θ)+βLr(θ)]\min_{\theta'} \left[ -L_f(\theta') + \beta L_r(\theta') \right]0, and retain model minθ[Lf(θ)+βLr(θ)]\min_{\theta'} \left[ -L_f(\theta') + \beta L_r(\theta') \right]1.
  • Compute the contrastive difference minθ[Lf(θ)+βLr(θ)]\min_{\theta'} \left[ -L_f(\theta') + \beta L_r(\theta') \right]2.
  • Subtract minθ[Lf(θ)+βLr(θ)]\min_{\theta'} \left[ -L_f(\theta') + \beta L_r(\theta') \right]3 from minθ[Lf(θ)+βLr(θ)]\min_{\theta'} \left[ -L_f(\theta') + \beta L_r(\theta') \right]4 to get minθ[Lf(θ)+βLr(θ)]\min_{\theta'} \left[ -L_f(\theta') + \beta L_r(\theta') \right]5.
  • Apply temperature and sample from minθ[Lf(θ)+βLr(θ)]\min_{\theta'} \left[ -L_f(\theta') + \beta L_r(\theta') \right]6.
  1. Precompute Logits: Query the black-box LLM and both offset models on all unique minθ[Lf(θ)+βLr(θ)]\min_{\theta'} \left[ -L_f(\theta') + \beta L_r(\theta') \right]8 needed for training.
  2. Fine-Tune Offset Model: Update minθ[Lf(θ)+βLr(θ)]\min_{\theta'} \left[ -L_f(\theta') + \beta L_r(\theta') \right]9 using GRADASCENT, GRADDIF, or KL-MIN objectives, always acting on the ensemble's output, not LfL_f0 alone.
  3. Inference: For any query, combine black-box and offset model logits as LfL_f1, sample from LfL_f2.

4. Empirical Validation and Comparative Results

4.1 Forget/Utility Trade-off

  • ULD (Ji et al., 2024): On the TOFU benchmark (1% forget task), achieves forgetting quality (F.Q.) LfL_f3 (vs. LfL_f4 baseline) with LfL_f5 drop in retained-task utility (baselines up to LfL_f6 utility loss). On Harry Potter copyright text, BLEU/R-L metrics on forgotten text drop to near zero while non-forget PPL holds at LfL_f7 (baselines: LfL_f8–LfL_f9).
  • UCD (Suriyakumar et al., 12 Jun 2025): On Llama2-13B (TOFU 5\%), full indistinguishability from retraining is achieved, with utility improved from LrL_r0 (retrain) to LrL_r1. On Llama2-70B, UCD gives utility LrL_r2 (vs. retraining LrL_r3) while holding forget quality at baseline.
  • LrL_r4-Unlearning (Huang et al., 2024): On TOFU, matches retraining (LrL_r5) and improves paraphrased truth ratio (TR from LrL_r6) compared to direct fine-tuning. World-fact accuracy is preserved (RL/P/TR superior to direct FT in LrL_r7 of LrL_r8 cases).

4.2 Efficiency and Scalability

  • Training Cost: ULD reduces per-epoch training time by over LrL_r9 (uses only Df\mathcal{D}_f020M LoRA parameters).
  • Inference Overhead: All logit-subtraction methods require at least one additional forward pass per input (two for ULD/UCD, two or three for Df\mathcal{D}_f1-Unlearning), but the computation is parallelizable. The assistant/offset models are typically much smaller than the main LLM.
  • Size Scalability: UCD is demonstrated at scale on Llama2-70B, and Df\mathcal{D}_f2-Unlearning is compatible with completely black-box APIs.

4.3 Summary of Method Differences

Method # of Extra Models Training Scope Black-box Support Inference Only?
ULD (Ji et al., 2024) 1 (assistant) LoRA adapters, param- efficient No No (but efficient deployment)
UCD (Suriyakumar et al., 12 Jun 2025) 2 (forget/retain) Auxiliary models Yes Yes
Df\mathcal{D}_f3-Unlearning (Huang et al., 2024) 2 (offset) Offset models, LoRA Yes Yes

5. Limitations and Extensions

  • Inference Latency: Logit-subtraction methods introduce additional forward passes, increasing decoding latency, but the cost is minor for parameter-efficient offsets or when amortized over batched queries.
  • Auxiliary Model Quality: Success depends on the auxiliary models faithfully encoding the forget/retain knowledge. Suboptimal fine-tuning or model misalignment can degrade both forgetting and utility.
  • Retain Set Design: All methods are vulnerable to mis-specification or insufficient coverage of Df\mathcal{D}_f4, especially if the non-forget generalization set is large or diverse.
  • Hyperparameter Sensitivity: The suppression weight Df\mathcal{D}_f5 and entropy targets must be tuned; aggressive suppression can degrade utility, while weak suppression fails to erase target information (Suriyakumar et al., 12 Jun 2025).
  • Generality: Logit-subtraction has been proposed as a general expert-composition paradigm, potentially applicable for sentiment steering, bias removal, and post-hoc factuality correction (Ji et al., 2024).
  • Adaptation to Black-box and Large-scale APIs: Df\mathcal{D}_f6-Unlearning (Huang et al., 2024) demonstrates that logit-based unlearning is viable with only logits access, not gradient or parameter access, increasing practicability for commercial LLM deployments.

The concept of manipulating model logits for targeted unlearning originates in earlier works on linear filtration for logit-based classifiers (Baumhauer et al., 2020). There, a linear transformation is applied to the final logits to sanitize models post-hoc, especially for class-wise deletion in image or tabular classifiers. The method can be transferred in principle to LLMs by treating each vocabulary token as a removable class and constructing the appropriate filtration matrix, but direct adaptation is computationally intensive for modern vocabulary sizes.

Logit subtraction generalizes these ideas by leveraging parameter-efficient adaptation (LoRA), auxiliary expert models, and contrastive decoding composition. Compared to in-context prompt unlearning or direct model fine-tuning, logit-subtraction achieves a superior balance of efficacy, generality, and privacy compliance, especially where access to full training sets or gradients is unavailable.

7. Practical Guidelines and Extensions

  • Model Selection: Auxiliary models should be much smaller than the primary LLM for practical fine-tuning. Empirical results indicate 7B auxiliaries suffice for 13B and 70B base models (Suriyakumar et al., 12 Jun 2025, Huang et al., 2024).
  • Loss/Objective Choice: Logit-subtraction supports integration with any unlearning objective including gradient ascent, gradient difference, and KL minimization (Huang et al., 2024).
  • Parameter Tuning: For most benchmarks, Df\mathcal{D}_f7 yields optimal trade-offs; too small under-forgets, too large degrades utility (Suriyakumar et al., 12 Jun 2025).
  • Data Augmentation: Effective paraphrase and perturbation strategies for Df\mathcal{D}_f8 and Df\mathcal{D}_f9 are critical and may benefit from automation.
  • Inference Policy: Deterministic and stochastic decoding strategies are compatible; key forget/utility metrics remain invariant under deterministic strategies (Suriyakumar et al., 12 Jun 2025).

In sum, logit-subtraction has established itself as a powerful, theoretically principled, and empirically validated framework for efficient, privacy-compliant, and utility-preserving LLM unlearning, with direct extensions to broader model editing and steering applications (Ji et al., 2024, Suriyakumar et al., 12 Jun 2025, Huang et al., 2024, Baumhauer et al., 2020).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Logit-Subtraction for LLM Unlearning.