Logit-DP¶
Implements Logit-DP, DP-SGD for similarity-based, non-decomposable objectives via clipping pairwise similarity gradients.
Standard DP-SGD clips per-example gradients, but contrastive and spreadout losses are non-decomposable: the loss for example \(i\) depends on the whole batch, so its gradient does not split into independent per-example terms. Logit-DP instead clips the pairwise similarity gradients \(\nabla_w S(\Phi_w(x_i), \Phi_w(x_j'))\) to norm \(B\) and recombines them with the loss derivatives with respect to the logits \(Z_{ij}\). This bounds the \(L_2\) sensitivity of the full-batch gradient by a closed form, after which a single Gaussian noise draw is added before the descent step.
where \(S\) is the similarity function on embeddings produced by the model \(\Phi_w\), \(g_{ij}\) is the gradient of the pairwise similarity, \(B\) is the clipping norm for similarity gradients, \(Z_{ij}\) are the logits and \(\ell^{(i,n)}\) the per-row loss, \(G_1, G_2, L\) are Lipschitz/derivative bounds on the loss giving the sensitivity \(C\), \(\sigma\) is the noise multiplier, \(I_p\) the \(p \times p\) identity, \(\eta\) the learning rate, and \(w_t\) the model parameters at step \(t\).
Reference: William Kong, Andrés Muñoz Medina, Mónica Ribero, "DP-SGD for non-decomposable objective functions", arXiv 2023. https://arxiv.org/abs/2310.03104