Overfitting is a well-known issue in machine learning that occurs when a model struggles to generalize its predictions to new, unseen data beyond the scope of its training set. Traditional techniques to mitigate overfitting include early stopping, data augmentation, and regularization. In this work, we demonstrate that the degree of overfitting of a trained model is correlated with the ability to generate counterfactual examples. The higher the overfitting, the easier it will be to find a valid counterfactual example for a randomly chosen input data point. Therefore, we introduce CF-Reg, a novel regularization term in the training loss that controls overfitting by ensuring enough margin between each instance and its corresponding counterfactual. Experiments conducted across multiple datasets and models show that our counterfactual regularizer generally outperforms existing regularization techniques.

Countering Overfitting with Counterfactual Examples / Giorgi, F., Veglianti, F., Silvestri, F., Tolomei, G.. - 1-A:(2026), pp. 302-313. (ACM International Conference on Knowledge Discovery and Data Mining Jeju Island; Republic of Korea ) [10.1145/3770854.3780243].

Countering Overfitting with Counterfactual Examples

Giorgi, Flavio
;
Veglianti, Fabiano
;
Silvestri, Fabrizio
;
Tolomei, Gabriele
2026

Abstract

Overfitting is a well-known issue in machine learning that occurs when a model struggles to generalize its predictions to new, unseen data beyond the scope of its training set. Traditional techniques to mitigate overfitting include early stopping, data augmentation, and regularization. In this work, we demonstrate that the degree of overfitting of a trained model is correlated with the ability to generate counterfactual examples. The higher the overfitting, the easier it will be to find a valid counterfactual example for a randomly chosen input data point. Therefore, we introduce CF-Reg, a novel regularization term in the training loss that controls overfitting by ensuring enough margin between each instance and its corresponding counterfactual. Experiments conducted across multiple datasets and models show that our counterfactual regularizer generally outperforms existing regularization techniques.
2026
ACM International Conference on Knowledge Discovery and Data Mining
counterfactual examples; counterfactual explanations; generalizability; overfitting; regularization
04 Pubblicazione in atti di convegno::04b Atto di convegno in volume
Countering Overfitting with Counterfactual Examples / Giorgi, F., Veglianti, F., Silvestri, F., Tolomei, G.. - 1-A:(2026), pp. 302-313. (ACM International Conference on Knowledge Discovery and Data Mining Jeju Island; Republic of Korea ) [10.1145/3770854.3780243].
File allegati a questo prodotto
Non ci sono file associati a questo prodotto.

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/11573/1773546
 Attenzione

Attenzione! I dati visualizzati non sono stati sottoposti a validazione da parte dell'ateneo

Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus 0
  • ???jsp.display-item.citation.isi??? 0
social impact