wikillm

Paper · 2021-06-06 · cs.LG, cs.AI, cs.CV

Preservation of the Global Knowledge by Not-True Distillation in Federated Learning

FedNTD adds a distillation term to federated learning: each client's model is trained to match the previous global model's softmax over the not-true classes. The authors link non-IID losses to forgetting. Author-reported gains over FedAvg and five other methods on MNIST, CIFAR-10/100 and CINIC-10 under sharding and LDA splits. No extra communication. Not best in every setting.

Federated learningFederated aggregationKnowledge distillationContinual learningfederated-learningnon-iidknowledge-distillationcatastrophic-forgetting

arXivPDFCodeMarkdown10 min read

AI-compiled by claude-haiku-5-5 on 2026-10-18, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

In plain words

In federated learning, many devices each train a copy of a model on their own data, and a server averages the copies. When each device's data is very different from the others, the shared model tends to do worse. The authors suggest one reason: after each round, the shared model forgets what it had learned about the kinds of data a device does not hold. Local training makes this worse, because each device only pushes its own kinds of examples.

Their fix is to keep a memory of the old shared model while a device trains. On its own data, the device learns the correct label as usual. It also copies the old shared model's opinions about the wrong labels, and ignores the correct label when doing so. This keeps the local model from drifting away from what the whole group knows. Nothing extra is sent over the network. The authors report that this helps across several image datasets.

TL;DR

  • FedNTD trains each client with cross-entropy plus a distillation loss that matches the frozen global model only on the not-true classes §3.
  • The paper argues that forgetting of out-of-local knowledge is a main cause of data heterogeneity problems in federated learning §1, §2.
  • Author-reported: best or near-best accuracy on most of 14 settings (4 datasets, two partition schemes) against FedAvg and five other methods tab. 1.
  • Costs an extra forward pass of the global model on every client batch, and a copy of the model per client round. Adds no communication §4.2, code.

Problem

Non-IID data across clients hurts federated averaging. The authors argue this is mainly forgetting: the global model loses knowledge from earlier rounds, and local training erases knowledge about classes a client does not hold §1, §2.1, §2.2. They measure this with class-wise accuracy across rounds and with an analysis of which classes the local model forgets §2, fig. 2, fig. 4. They treat the forgetting measure as a diagnostic, and do not prove the causal link §2.

Method

FedNTD changes only the local loss. The server keeps the usual averaging round. Each round, the server samples clients, sends them the current global weights, and each client trains its local copy alg. 1 §3.

Local loss §3, eq. labelled FedNTD. For a labelled example with true class y, the local model produces logits z^l. The frozen global model from the start of the round produces logits z^g. The loss is cross-entropy plus a weighted distillation term:

\mathcal{L} = \mathcal{L}_{\text{CE}}(q^{l}, \mathbb{1}_y) + \beta \cdot \mathcal{L}_{\text{NTD}}(\tilde{q}_{\tau}^{l}, \tilde{q}_{\tau}^{g}) §3

Not-true distillation loss §3. Softmax is taken only over the not-true logits, with temperature \tau. For every class c \neq y:

\mathcal{L}_{\text{NTD}} = -\sum_{c \neq y} \tilde{q}_{\tau}^{g}(c) \log\frac{\tilde{q}_{\tau}^{l}(c)}{\tilde{q}_{\tau}^{g}(c)} §3

\tilde{q}_{\tau}^{l}(c) = \frac{\exp(z_c^{l}/\tau)} {\sum_{\tilde{c} \neq y} \exp(z_{\tilde{c}}^{l}/\tau)}, \qquad \tilde{q}_{\tau}^{g}(c) = \frac{\exp(z_c^{g}/\tau)} {\sum_{\tilde{c} \neq y} \exp(z_{\tilde{c}}^{g}/\tau)} §3

The true-class logit is excluded from both softmaxes. Its gradient from the distillation term is therefore zero §3. The paper says \beta sets how strongly out-of-local knowledge is kept, and that the trade-off resembles the stability-plasticity dilemma in continual learning §3.

Why the not-true form §3, prop. 2. Proposition 2 splits the KL term into a part on the true class and a part on the not-true classes. It shows that the not-true part is a weighted sum over the local label distribution and the out-of-local distribution. The derivation is in the appendix, "Proof of Proposition 2".

Round procedure alg. 1. Inputs: T rounds, E local epochs, sampled clients K^{(t)}, learning rate \gamma.

Pseudocode
# One communication round t  [alg. 1]
# global_weights: w^(t-1); data_of[k]: client k's local dataset
def fedntd_round(global_weights, sampled, data_of, lr):
    # Each sampled client starts from the global weights  [alg. 1]
    uploads = []
    for client in sampled:
        local_weights = copy(global_weights)
        # Frozen copy of the round-start global model  [§3]
        reference = copy(global_weights)
        # E local epochs of mini-batch SGD on the FedNTD loss  [alg. 1]
        for epoch in range(local_epochs):
            for batch in data_of[client]:
                logits = forward(local_weights, batch.inputs)
                ref_logits = forward(reference, batch.inputs)
                loss = fedntd_loss(logits, ref_logits, batch.targets)
                local_weights = sgd_step(local_weights, loss, lr)
        uploads.append(local_weights)
    # Average the uploaded weights  [alg. 1]
    # The code weights each client by its data size; see Paper vs code
    return mean(uploads)
Pseudocode
# FedNTD loss on one mini-batch  [§3, eq. FedNTD]
# logits, ref_logits: (B, C); targets: (B,)
def fedntd_loss(logits, ref_logits, targets, beta=1.0, tau=1.0):
    # Ordinary cross-entropy over all C classes  [§3]
    ce_loss = cross_entropy(logits, targets)
    # Remove the true-class column from both logit matrices  [§3]
    local_nt = drop_true_class(logits, targets)      # (B, C-1)
    ref_nt = drop_true_class(ref_logits, targets)    # (B, C-1)
    # Temperature-softened softmax over the not-true classes  [§3]
    local_probs = softmax(local_nt / tau)
    # The reference side is a constant, so no gradient flows into it  [§3]
    ref_probs = softmax(ref_nt / tau)
    # KL(reference || local), summed over classes, mean over batch  [§3]
    ntd_loss = kl_divergence(ref_probs, local_probs)
    return ce_loss + beta * ntd_loss

Hyperparameters

Values are as stated in the paper unless marked as code. The paper's main text and appendix disagree on the initial learning rate; both are listed.

NameValueWhereNotes
Clients N100 (MNIST, CIFAR-10, CIFAR-100); 200 (CINIC-10)§4.1 app. Experimental Setups
Client sampling ratio0.1 (CINIC-10: 0.05)§4.1 app. Experimental SetupsClients per round = ratio × N
Communication rounds Tnot stated in §4—Code default is 200 fedntd.json. §2 uses 200 rounds for its motivation study §2.
Local epochs EMNIST 3; CIFAR-10, CIFAR-100, CINIC-10 5app. Experimental Setups (dataset table)
Local batch size B50 for all datasetsapp. Experimental Setups (dataset table)
OptimizerSGD, momentum 0.9§4.1 app. Learning SetupsMomentum is local only and not sent to the server app. Learning Setups
Initial learning rate0.01 in appendix; 0.1 in main textapp. Learning Setups vs §4.1Conflict in the paper. Code default is 0.01 fedntd.json. See Paper vs code.
LR schedulemultiply by 0.99 after each round§4.1 fedntd.jsonCode calls the scheduler once per round BaseServer.py
Weight decay1e-5§4.1 app. Learning Setups
Modeltwo 5×5 conv layers (32, 64 filters) with max-pooling, then two fully connected layers (hidden 512)app. Model Architecture fedavgnet.pySame architecture as FedAvg, per the paper §4.1
Augmentationrandom crop, horizontal flip, normalization; Cutout for MNIST, CIFAR-10, CIFAR-100app. DatasetsNot stated for CINIC-10
Sharding s (shards per client)MNIST 2; CIFAR-10 {2, 3, 5, 10}; CIFAR-100 10; CINIC-10 2§4.1
LDA \alphaMNIST 0.1; CIFAR-10 {0.05, 0.1, 0.3, 0.5}; CIFAR-100 0.1; CINIC-10 0.1§4.1
FedNTD \beta1.0app. Algorithm Implementation DetailsNo grid search for FedNTD (table says "None")
FedNTD \tau1.0app. Algorithm Implementation DetailsNo grid search; too small \tau hurts accuracy app. Effect of FedNTD Hyperparameters
FedCurvs = 500, \lambda = 1.0app. Algorithm Implementation DetailsGrid: s \in \{250, 500\}, \lambda \in \{0.1, 0.5, 1.0\}
FedProx\mu = 0.1app. Algorithm Implementation DetailsGrid: \mu \in \{0.1, 0.5, 1.0\}
MOON\mu = 1.0, \tau = 0.5app. Algorithm Implementation DetailsGrid: \mu \in \{0.1, 0.5, 1.0\}, \tau \in \{0.1, 0.5, 1.0\}
FedAvg, FedNova, SCAFFOLDnoneapp. Algorithm Implementation Details
Random seed2022 (training); 19940817 (data partition)fedntd.json main.pySeeds are not stated in the paper
Hardwareone Titan RTX and one RTX 2080 Ti; no multi-GPUapp. Experimental Setups

Results

Author-reported. Setup: four datasets, 100 clients (200 for CINIC-10), two non-IID partition schemes, the FedAvg CNN §4.1 app. Experimental Setups. Each cell is test accuracy (%) with the forgetting measure \mathcal{F} in parentheses. Source: tab. 1. The paper reports standard deviations in a separate appendix table app. Experiment Table with Standard Deviation.

Sharding partition

MethodMNISTCIFAR-10 s=2s=3s=5s=10CIFAR-100CINIC-10
FedAvg78.63 (0.20)40.14 (0.59)51.10 (0.46)57.17 (0.37)64.91 (0.26)25.57 (0.49)39.64 (0.59)
FedCurv78.56 (0.21)44.52 (0.53)49.00 (0.47)54.61 (0.39)62.19 (0.27)22.89 (0.49)40.45 (0.57)
FedProx78.26 (0.21)41.48 (0.57)51.65 (0.45)56.88 (0.37)64.65 (0.25)25.10 (0.49)41.47 (0.57)
FedNova77.04 (0.21)42.62 (0.56)52.03 (0.44)62.14 (0.30)66.97 (0.20)26.96 (0.41)42.55 (0.56)
SCAFFOLD81.05 (0.17)44.60 (0.53)54.26 (0.39)65.74 (0.23)68.97 (0.16)30.82 (0.36)42.66 (0.54)
MOON76.56 (0.23)38.51 (0.60)50.47 (0.47)56.69 (0.39)65.30 (0.25)25.29 (0.48)37.07 (0.62)
FedNTD84.44 (0.13)52.61 (0.43)58.18 (0.34)64.93 (0.23)68.56 (0.15)31.69 (0.32)48.07 (0.48)

LDA partition (CIFAR-10 columns give \alpha; CINIC-10 uses \alpha = 0.1)

MethodMNISTCIFAR-10 α=0.05α=0.1α=0.3α=0.5CIFAR-100CINIC-10
FedAvg79.73 (0.19)28.24 (0.71)46.49 (0.51)57.24 (0.36)62.53 (0.28)30.69 (0.32)38.14 (0.60)
FedCurv78.72 (0.20)33.64 (0.66)44.26 (0.53)54.93 (0.38)59.37 (0.30)29.16 (0.32)36.69 (0.61)
FedProx79.25 (0.19)37.19 (0.62)47.65 (0.49)57.35 (0.35)62.39 (0.27)30.60 (0.32)39.47 (0.58)
FedNova60.37 (0.38)10.00 (failed)28.06 (0.71)57.44 (0.35)64.65 (0.23)32.15 (0.28)30.44 (0.68)
SCAFFOLD71.57 (0.26)10.00 (failed)23.12 (0.74)62.01 (0.29)66.16 (0.19)33.68 (0.25)28.78 (0.69)
MOON78.95 (0.20)28.35 (0.71)44.77 (0.53)58.38 (0.35)63.10 (0.27)30.64 (0.32)37.92 (0.61)
FedNTD81.34 (0.17)40.17 (0.58)54.42 (0.42)62.42 (0.29)66.12 (0.19)32.37 (0.26)46.24 (0.50)

Headline claims from the text §4.2: FedNTD is best in most cases, and the paper says it "consistently outperforms the baselines on all setups". The table above does not fully support the second claim (see Pitfalls). In a separate comparison on the released FedAlign code, the authors report that FedAlign's gains disappear at severe heterogeneity while FedNTD improves consistently app. Comparison to FedAlign. The paper states that FedNTD adds no communication burden, while several baselines need statefulness, extra communication or auxiliary data §4.2, app. Conceptual comparison to prior works.

Paper vs code

Official repository: https://github.com/Lee-Gihun/FedNTD, owned by the first author and linked from the paper's abstract. Commit be00ee598139654abe650c446a7ba3bc4e340233, MIT license LICENSE.

  • Averaging weights. Algorithm 1 averages the uploads with weight 1/|K^{(t)}| alg. 1. The code weights each client by its local dataset size BaseServer.py. This matters under LDA, where client sizes differ. The paper does not say which averaging produced the reported numbers.
  • \tau^2 factor. The code multiplies the KL term by \tau^2 criterion.py. The paper's loss has no such factor §3. The two agree at the default \tau = 1. For other \tau the code effectively rescales \beta by \tau^2, so the paper's \tau ablation can only be read under one convention, and the paper does not say which it used.
  • Initial learning rate. Main text says 0.1 §4.1; appendix and code say 0.01 app. Learning Setups fedntd.json. The code agrees with the appendix. Treat 0.01 as the value used, but note the conflict.
  • Reference model. The code keeps a frozen copy of the model at the start of each client's round BaseClientTrainer.py and uses its logits in the loss ClientTrainer.py. This matches §3.
  • True-class removal. The code drops the true-class column with a gather over the other C-1 indices utils.py. The softmax is taken over those C-1 logits criterion.py. This matches the paper.
  • Momentum. The paper says momentum is local only app. Learning Setups. The code loads the server optimizer state into each client [code: algorithms/BaseClientTrainer.py#L105-L108]. The server optimizer is never stepped, so no momentum buffer is carried between rounds. This is consistent with the paper, but inferred from the code rather than stated.
  • LR schedule. The scheduler steps once per round after aggregation BaseServer.py, and clients inherit the current learning rate through the optimizer state BaseServer.py. This matches the 0.99 per-round decay.
  • LDA resampling. The code retries the Dirichlet split until every client has at least 10 samples datasetter.py. The paper does not mention this minimum.
  • Client sampling. The code seeds NumPy with the round index before sampling, so the same clients are chosen across methods BaseServer.py. The paper does not state this.
  • Config vs paper. The shipped config covers CIFAR-10 with 200 rounds, 5 local epochs, sampling ratio 0.1, and \beta = \tau = 1 fedntd.json. These match the paper for CIFAR-10. Only the FedNTD config was checked; the other configs in the repository were not compared.

No other discrepancies found in the local-loss and aggregation logic beyond the items above.

Pitfalls

  • Claim vs table. §4.2 says FedNTD "consistently outperforms the baselines on all setups". In tab. 1, SCAFFOLD is higher on CIFAR-10 s=5 (65.74 vs 64.93), on CIFAR-10 s=10 (68.97 vs 68.56), on CIFAR-10 LDA α=0.5 (66.16 vs 66.12) and on CIFAR-100 LDA (33.68 vs 32.37). The bold marks are also inconsistent: both FedNTD and SCAFFOLD are bold for CIFAR-10 s=10.
  • Baseline tuning is uneven. The paper grid-searches the baselines but not FedNTD, which uses fixed \beta = \tau = 1 [app. Algorithm Implementation Details]. The table lists one hyperparameter value per baseline and the grid candidates, but does not say which value produced each reported number.
  • Failures. FedNova and SCAFFOLD report 10.00% ("failed") on CIFAR-10 LDA \alpha = 0.05 tab. 1. The paper does not explain these failures.
  • \tau is sensitive. Too small \tau "significantly drops the accuracy"; \beta is less sensitive app. Effect of FedNTD Hyperparameters. Use \tau = 1 as the default unless you tune it.
  • MSE is not a drop-in replacement. The MSE version of the loss gets worse as \beta rises and diverges at \beta = 0.3, while the KL form reaches 52.61% on CIFAR-10 s=2 at \beta = 1.0 app. MSE Loss for Not-True Distillation. Use the softmax-KL form.
  • Cost per step. Each batch needs a forward pass through the frozen global model ClientTrainer.py, so local compute is roughly doubled in the forward pass. The paper does not report this cost, and the "no extra communication" claim does not cover compute.
  • Memory. The client makes a full deep copy of the model every round BaseClientTrainer.py.
  • Proof reference. The main text points the reader to "proof_proposition2" for the proposition derivation §3. The appendix proof labelled "Proof of Proposition 2" is the correct one. Do not confuse it with "Proof of Proposition 1", which is a different result.
  • Rounds are not stated for the main experiments §4. Use the config value of 200 if you need to reproduce, and say so.
  • Table typo. In the LDA table, FedNova's CIFAR-100 entry has a malformed forgetting parenthesis in the source; the value 0.28 is used here as written.
  • Figures are not reproduced. fig. 1 shows the concept, fig. 2 the global-model forgetting, fig. 3 the in-local and out-local distributions, fig. 4 local forgetting. Describe them in words only.

Lineage

  • Builds on: FedAvg (federated averaging), and the continual-learning stability-plasticity framing §3. The paper frames forgetting using continual learning §1, §6. Not linked: no paper card exists for these yet.
  • Compared against: FedCurv, FedProx, FedNova, SCAFFOLD, MOON tab. 1, and FedAlign as an add-on app. Comparison to FedAlign. Also knowledge distillation over the full softmax app. Comparison to KD.
  • Superseded by: not known from content in this wiki.

Source and license

Adapted from “Preservation of the Global Knowledge by Not-True Distillation in Federated Learning” by Gihun Lee, Minchan Jeong, Yongjin Shin, Sangmin Bae, Se-Young Yun (arXiv:2106.03097), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/Lee-Gihun/FedNTD at commit be00ee598139 (MIT). Any quoted code is shown under that license.