Papers
Topics
Authors
Recent
Search
2000 character limit reached

Label Flipping in Machine Learning

Updated 11 July 2026
  • Label flipping is the manipulation of class labels while keeping instance features unchanged, serving both malicious and constructive purposes.
  • It is applied in adversarial attacks, data augmentation, fairness repair, and counterfactual evaluation, each with distinct operational objectives.
  • Empirical studies reveal that even modest rates of label flipping can severely degrade model performance, prompting robust defense and detection strategies.

Label flipping denotes a change in class labels without a corresponding change in the underlying instance representation. In the canonical supervised-learning form, the training set is written as D={(xi,yi)}i=1ND=\{(x_i,y_i)\}_{i=1}^N, and a poisoned variant replaces some labels by incorrect values, producing D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N while leaving features unchanged (Nowroozi et al., 2024, Paudice et al., 2018). Across the literature, however, the same term is also used for constructive label transformation in data augmentation, fairness-oriented preprocessing, and counterfactual evaluation; its meaning is therefore context-dependent rather than uniform (Zhou et al., 2021, Zhang et al., 2022, Wang et al., 20 May 2025).

1. Core definitions and semantic scope

In adversarial machine learning, label flipping is a special case of data poisoning in which the attacker cannot change the input features xx, but can change the labels yy of a subset of training points (Paudice et al., 2018). In the binary URL-detection formulation, with yi{0,1}y_i \in \{0,1\}, the attacker flips benign labels yi=0y_i=0 to malicious yi=1y_i'=1 and malicious labels yi=1y_i=1 to benign yi=0y_i'=0, creating a poisoned training set D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N (Nowroozi et al., 2024). A common scalar parameter is the poisoning rate, written either as D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N0 or D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N1, denoting the fraction of training samples whose labels are altered (Nowroozi et al., 2024, Zhang et al., 2023).

The term does not always denote adversarial corruption. In FlipDA, “label flipping” means intentionally generating new training examples whose labels are different from the original example they are derived from, and then training on these new D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N2 pairs (Zhou et al., 2021). In iFlipper, label flipping is a pre-processing technique for improving individual fairness by minimally changing labels subject to a bound on individual fairness violations (Zhang et al., 2022). In counterfactual data augmentation, label flipping is operationalized through the Label Flip Rate, D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N3, where D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N4 is the judge model’s label for the counterfactual and D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N5 is the original ground-truth label (Wang et al., 20 May 2025). In adversarial computer vision, “label flipping” can also refer to the post-attack event D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N6, which underlies fooling rate (Mopuri et al., 2020).

Context Meaning of label flipping Representative source
Data poisoning Modify labels of existing training samples while leaving features unchanged (Paudice et al., 2018)
Data augmentation Generate new examples whose labels differ from the source example (Zhou et al., 2021)
Fairness preprocessing Minimally flip labels to reduce individual fairness violations (Zhang et al., 2022)
Counterfactual evaluation Measure whether a counterfactual’s label differs from the original label (Wang et al., 20 May 2025)
Adversarial fooling Count whether the model’s predicted label changes after perturbation (Mopuri et al., 2020)

This multiplicity of meanings is a recurrent source of confusion. A precise account must therefore distinguish malicious label corruption, constructive label transformation, and evaluation-only notions of label change.

2. Poisoning formulations and empirical effects in centralized learning

The most explicit adversarial formulation is bilevel. For binary linear classification, the attacker chooses an indicator vector D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N7 with D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N8, where D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N9 means that point xx0 is flipped, and then maximizes validation loss after the learner retrains on the poisoned set xx1 (Paudice et al., 2018). Because exact search over xx2 possibilities is intractable, a greedy Label Flipping Attack iteratively flips the label whose change yields the largest validation loss after retraining (Paudice et al., 2018). In tabular learning, Falfa reformulates the adversary’s objective for cross-entropy classifiers as a linear program and shows that adversarial label-flipping attacks can camouflage a highly skewed dataset as an easily solvable classification problem, often misleading machine learning practitioners into lower defenses and miscalculations of potential risks (Chang et al., 2023).

Empirical effects are substantial even at modest budgets. In RF-based malicious URL detection, random LF at poisoning rates xx3 preserves high training accuracy, typically xx4, while yielding Attack Success Rate between xx5 and xx6; the clean RF baseline reaches xx7 testing accuracy on all six URL datasets (Nowroozi et al., 2024). For linear classifiers on BreastCancer, MNIST 1 vs 7, and Spambase, flipping xx8 of training labels increases average classification error by factors xx9, yy0, and yy1, respectively (Paudice et al., 2018). In EEG-based emotion assessment with four classes, AdaBoost drops from about yy2 accuracy at yy3 poisoning to about yy4 at yy5 poisoning, while Random Forest drops from about yy6 to about yy7 under the same schedule (Zhang et al., 2023). In wearable human activity recognition, poisoning yy8 of training labels reduces MLP accuracy from yy9 to yi{0,1}y_i \in \{0,1\}0, and at yi{0,1}y_i \in \{0,1\}1 poisoning the same model reaches yi{0,1}y_i \in \{0,1\}2 accuracy (Shahid et al., 2022).

Label flipping also appears in hybrid backdoor constructions. DirtyFlipping is a dirty label-flipping attack for audio models that attaches a trigger such as clapping to selected data patterns associated with the target class and flips labels to a dirty label; with about yi{0,1}y_i \in \{0,1\}3 poisoned data it reports benign accuracy remaining high and attack success rate reaching yi{0,1}y_i \in \{0,1\}4 across multiple architectures, including CNN, VGG16, LSTM, and several pre-trained audio transformers (Mengara, 2024). This suggests that the operational boundary between pure label poisoning and backdoor insertion is porous when triggers and label inversion are coupled.

3. Federated and distributed label flipping

In federated learning, label flipping is implemented locally. Each malicious client replaces its local dataset yi{0,1}y_i \in \{0,1\}5 by yi{0,1}y_i \in \{0,1\}6, then trains normally and uploads a poisoned model update to the server (Rahman et al., 26 Sep 2025). A common targeted rule chooses a source class yi{0,1}y_i \in \{0,1\}7 and target class yi{0,1}y_i \in \{0,1\}8, setting yi{0,1}y_i \in \{0,1\}9 if yi=0y_i=00 and yi=0y_i=01 otherwise (Rahman et al., 26 Sep 2025, Jebreel et al., 2022). This is easy to perform because it does not require protocol violations or gradient fabrication; the server sees an apparently legitimate update (Rahman et al., 26 Sep 2025).

Several studies show that federated label flipping is strongly modulated by data heterogeneity and by how the attack budget is distributed. In distributed logistic regression, a budget of only yi=0y_i=02 of labels at each training step can reduce the accuracy of the model by yi=0y_i=03, and some models can perform worse than random guessing when up to yi=0y_i=04 of labels are flipped (El-Kabid et al., 28 Feb 2025). For a fixed corrupted fraction yi=0y_i=05, increasing write-access yi=0y_i=06 generally yields stronger attacks than increasing the flipping budget yi=0y_i=07 alone (El-Kabid et al., 28 Feb 2025). In a broader empirical study over MLR, SVC, MLP, CNN, Random Forest, XGBoost, and LSTM, models differ in their inherent robustness to the percentage of adversarial clients and the percentage of labels flipped by each adversarial client (Bhatnagar et al., 2024). MLR and SVC are comparatively stable across 10-client and 100-client settings, whereas Random Forest and XGBoost degrade strongly as the number of clients increases, even before attack (Bhatnagar et al., 2024).

Non-IID settings are particularly difficult. One study reports that existing FL methods perform similarly in IID settings but fail to maintain model robustness in Non-IID settings; with MNISTyi=0y_i=08 under attack, Krum, Median, Trimmed Mean, and FLTrust yield global accuracies yi=0y_i=09, yi=1y_i'=10, yi=1y_i'=11, and yi=1y_i'=12, whereas HSCSFL reaches yi=1y_i'=13 (Li et al., 2023). AntiFLipper addresses multi-class label-flipping attacks by shifting detection to the client side: under a constant attack with yi=1y_i'=14 malicious clients, it reports yi=1y_i'=15 accuracy and yi=1y_i'=16 ms aggregation time on CIFAR-10 Non-IID, compared with yi=1y_i'=17 and yi=1y_i'=18 ms for FLAME (Rahman et al., 26 Sep 2025). A separate gradient-based defense shows that the contradicting objectives of attackers and honest peers on source-class examples are reflected in the gradients corresponding to the source and target neurons in the output layer, and reports effectiveness regardless of the data distribution or model dimensionality (Jebreel et al., 2022).

4. Detection, sanitization, and robust training defenses

The oldest recurring defense family is neighborhood-based label sanitization. In binary linear classification, a yi=1y_i'=19-NN defense relabels a point when the mode of its yi=1y_i=10 nearest neighbors has confidence at least yi=1y_i=11; at yi=1y_i=12 poisoning it keeps BreastCancer and Spambase accuracy close to the clean-data baseline and substantially mitigates the attack on MNIST 1 vs 7, although it causes a small performance drop when no attack is present (Paudice et al., 2018). The URL-defense variant first selects the best yi=1y_i=13 on a trusted dataset, then performs an alarm-and-correction pass over the poisoned set by comparing each sample’s label with the mode of its yi=1y_i=14 nearest neighbors; on six URL datasets and poisoning rates yi=1y_i=15, detection accuracy reaches up to yi=1y_i=16, post-defense RF training accuracy lies in the range yi=1y_i=17, and ASR collapses to near yi=1y_i=18 after retraining (Nowroozi et al., 2024). In wearable HAR, a KNN-based sanitization mechanism using a small trusted dataset recovers MLP accuracy to yi=1y_i=19 at yi=0y_i'=00 poisoning and yi=0y_i'=01 at yi=0y_i'=02 poisoning, compared with yi=0y_i'=03 and yi=0y_i'=04 without defense (Shahid et al., 2022).

Semi-supervised and clustering-based defenses appear when local label consistency is insufficient. In Android malware detection, a Silhouette Clustering-based Label Flipping Attack flips labels when the silhouette value is non-positive, and the proposed Label-based Semi-supervised Defense and clustering-based Semi-supervised Defense correct attacked labels by combining graph-based semi-supervised learning, CNN predictions, and clustering-quality criteria; using random forest feature selection and varying ratios of features can result in an improvement of up to yi=0y_i'=05 accuracy when compared with the state-of-the-art method in the literature (Taheri et al., 2019). In federated learning, HSCSFL assigns each client an honest score equal to the dot product of its class-wise accuracy vector and the global risk vector, then aggregates only the top yi=0y_i'=06 of clients; under MNISTyi=0y_i'=07 and label flipping, it preserves attacked-class accuracy far better than Krum, Median, Trimmed Mean, or FLTrust (Li et al., 2023). AntiFLipper instead uses local evaluation feedback, trust inference, anomaly-guided filtering, and weighted aggregation; with evaluation on only yi=0y_i'=08 of local data, the relative overhead is about yi=0y_i'=09, and aggregation time remains close to FedAvg while robustness remains competitive or superior under both IID and Non-IID settings (Rahman et al., 26 Sep 2025).

A distinct defense logic exploits output-layer gradients rather than labels themselves. For targeted LF in FL, the gradients attached to source and target neurons are discriminative because honest and malicious peers optimize opposite objectives on source-class examples; dynamically extracting those gradients, clustering them, and filtering the suspicious cluster yields lower test error, higher overall accuracy, higher source-class accuracy, lower attack success rate, and higher stability of the source class accuracy than several robust aggregation baselines (Jebreel et al., 2022). Collectively, these results suggest that defenses against label flipping are most effective when they model feature-label inconsistency explicitly rather than assuming that poisoned examples are merely feature-space outliers.

5. Constructive and non-adversarial uses

A separate line of work treats label flipping as a useful operation rather than an attack. FlipDA argues that generating label-flipped data is more crucial to the performance than generating label-preserved data in few-shot natural language understanding (Zhou et al., 2021). The method first fine-tunes an initial classifier, then uses T5 with pattern-based cloze prompting to generate candidate texts, uses the classifier to select high-confidence candidates whose predicted label differs from the source label, and retrains on the union of original data, label-flipped data, and label-preserved data (Zhou et al., 2021). On ALBERT-xxlarge-v2 across eight SuperGLUE tasks, FlipDA improves the average score from D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N0 to D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N1 with MaxDrop D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N2; on DeBERTa-v2-xxlarge it improves the average from D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N3 to D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N4 with MaxDrop D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N5 (Zhou et al., 2021). The paper explicitly distinguishes this from adversarial label-flipping attacks: the text itself changes and the flipped label is validated by a classifier, so the new pair is intended to be semantically consistent (Zhou et al., 2021).

In fairness research, iFlipper formulates label flipping as constrained repair. Given binary labels D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N6 and a similarity matrix D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N7, it minimizes the number of flipped labels, D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N8, subject to a total individual fairness violation constraint D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N9 (Zhang et al., 2022). The underlying optimization is NP-hard, so the method converts the problem into an ILP, relaxes it to an LP, proves that the LP optimum can be transformed into a D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N00-valued solution, then applies adaptive rounding and reverse greedy refinement while preserving feasibility (Zhang et al., 2022). Experiments on COMPAS, AdultCensus, Credit, and a large synthetic dataset show that iFlipper significantly outperforms pre-processing baselines in terms of individual fairness and accuracy on unseen test sets, and that it can be combined with in-processing techniques such as SenSR for further gains (Zhang et al., 2022).

These constructive uses materially alter the semantics of the term. Here label flipping is not corruption of unchanged instances but either the generation of semantically changed counterexamples or the optimization of labels to satisfy a fairness criterion. This suggests that the phrase should always be interpreted relative to the surrounding objective: attack, augmentation, or repair.

6. Evaluation metrics, counterfactuals, and recurring misconceptions

One recurring misconception is that label flipping is adequately captured by ordinary accuracy. Several attack studies show the opposite. In URL detection, training accuracy under D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N01 poisoning remains D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N02 while ASR lies between approximately D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N03 and D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N04 (Nowroozi et al., 2024). In federated settings, global accuracy can also conceal strong source-class degradation or attack-specific failures, which is why source-class accuracy, attack success rate, and class-wise risk vectors recur across defenses (Jebreel et al., 2022, Li et al., 2023). In adversarial image evaluation, fooling rate only checks whether the predicted label changes and ignores the severity of the change; FR@K, QI-Wup, and QI-Vis were proposed precisely because mere label flipping does not distinguish dog-to-dog from dog-to-vehicle confusions (Mopuri et al., 2020).

A second misconception is that all label noise is alike. BadLabel defines a label-noise type crafted from a label-flipping attack so that the loss values of clean and noisy labels become indistinguishable (Zhang et al., 2023). Under BadLabel on CIFAR-10 at D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N05 corruption, DivideMix drops to D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N06 best accuracy and ProMix to D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N07, whereas the same methods stay above D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N08 under D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N09 symmetric noise (Zhang et al., 2023). The proposed robust LNL method perturbs labels adversarially at each epoch, then uses BayesGMM and semi-supervised learning to recover a mostly clean subset; ablations show that both label perturbation and filtering low-quality divisions are essential under BadLabel (Zhang et al., 2023). This indicates that the usual small-loss assumption is not a stable property of label noise, but a property of particular noise models.

A third misconception concerns counterfactual data augmentation. In this literature, label flipping is not the attack but the criterion for counterfactual validity: D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N10 (Wang et al., 20 May 2025). Yet automatic evaluation is unstable: across two LLM-based generation methods, three datasets, five generator models, and fifteen judge models, independent, non-fine-tuned judges achieve the highest alignment ratio D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N11, but even the best judges differ on average by D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N12 percentage points in LFR from human evaluation (Wang et al., 20 May 2025). With a user study of D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N13 and Cohen’s D={(xi,yi)}i=1ND'=\{(x_i,y_i')\}_{i=1}^N14, the paper concludes that a fully automated pipeline for CDA may be inadequate and requires human intervention (Wang et al., 20 May 2025).

Across these strands, label flipping is best understood as a family of operations on supervision rather than a single technique. In adversarial settings it is a poisoning mechanism that exploits the model’s trust in labels; in augmentation it is a way to generate informative counterexamples; in fairness it is a repair primitive; and in counterfactual evaluation it is a metric event. The shared technical core is the manipulation or detection of label-state transitions, but the surrounding objective determines whether the transition is harmful, beneficial, or merely diagnostic.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (17)

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 Label Flipping.