Counterfactual Fairness vs Group Fairness in Image Classifiers

We analyze whether counterfactually fair image classifiers satisfy group fairness and introduce CKD to reduce sensitive attribute reliance.

viernes, 31 de julio de 2026 • 5 min read • Q2BSTUDIO Team

Equidad contrafactual y grupal en visión por computadora

Algorithmic fairness has become a strategic pillar in the development of artificial intelligence. Organizations deploying automated models must ensure that their decisions do not perpetuate historical biases. Two notions are fundamental in this debate: counterfactual fairness (CF) and group fairness (GF). The first analyzes whether the prediction would change if a sensitive attribute, such as gender or ethnicity, were modified while keeping all other variables intact. The second requires that outcomes be comparable across protected groups. Their relationship is not always evident, especially when working with complex data such as images.

In tabular environments, many studies observed that counterfactually fair models also tended to satisfy group fairness. This apparent equivalence simplified audits, since it was enough to check a single metric. However, this conclusion does not translate directly to image classification. The key difference lies in the existence of unlabeled latent attributes that are correlated with the sensitive attribute without being caused by it. For example, in a photograph, the presence of certain features may be strongly associated with age or gender, even though there is no direct causal relationship. This latent variable, let us call it G, works as a shortcut that the model can exploit.

When a classifier uses G as a proxy, it can pass a counterfactual evaluation and simultaneously fail group fairness. From the counterfactual perspective, the model does not explicitly use the sensitive attribute, so an intervention on that attribute would not change the prediction. But from the group perspective, using G causes outcomes not to be equivalent across groups, because the distribution of G differs among them. This mismatch explains why in visual domains the implication CF->GF no longer holds. This is not a statistical anomaly, but a structural problem related to how models learn.

This distinction has direct implications for businesses. An AI system used in recruitment, credit access, or healthcare diagnostics must be fair in every relevant sense. Relying only on counterfactual fairness can create a false sense of security. Therefore, in the development of custom software with artificial intelligence, it is essential to include a broad set of fairness metrics, as well as tests with real and diverse data. Organizations that ignore this complexity assume significant reputational and legal risk.

Evaluating counterfactual fairness in images is especially difficult because we usually do not have the same person with different sensitive attributes. To solve this, research teams are using AI-based image editors to generate realistic counterfactuals. These images must be validated by human annotators to ensure their plausibility. Combining these synthetic data with classical group fairness datasets provides dual evaluation environments. This methodology allows measuring both notions on the same classifier and observing their discrepancies.

In addition to generating counterfactuals, it is essential to document the editing process and the annotation criteria. Without such documentation, results are not reproducible and any audit loses value. A good practice is to store original images, edited images, and human labels in a versioned repository. This way, data teams can review quality at any time and reuse the same corpus for different experiments. This discipline also facilitates traceability when cloud is used to scale the process.

The choice of the main metric is not neutral. It depends on the sector, the regulatory framework, and the risk associated with each decision. In recruitment contexts, equal opportunity may be more relevant than demographic parity. In financial services, predictive parity is often a starting point. In healthcare, counterfactual fairness provides valuable information about individual response to treatment. Therefore, any AI solution must allow configuring and monitoring different fairness indicators without friction. This flexibility is a feature that companies should demand from their technology providers.

A robust evaluation system should combine several metrics: demographic parity, equal opportunity, predictive parity, and counterfactual fairness. None of them is sufficient by itself. For example, a model can meet demographic parity but make very different errors across groups. In the case of visual data, moreover, the quality of counterfactual images must be controlled; if editing introduces unrealistic artifacts, results will be misleading. Human oversight and good data documentation are inseparable from a fair evaluation.

To mitigate the problem, a practical alternative is counterfactual knowledge distillation, known as CKD. It consists of training a teacher model from pairs of counterfactual images and then transferring its knowledge to a student model. The goal is to reduce dependence on the latent variable G, without losing predictive power. Recent experiments indicate that, when a model reduces that dependence, counterfactual fairness and group fairness tend to converge. CKD is not a universal solution, but it shows that training design can correct mismatches between fairness notions.

At Q2BSTUDIO, a software and technology development company, we treat fairness as an engineering requirement. We help organizations integrate responsible AI into their processes through services such as artificial intelligence and AWS or Azure cloud. Our solutions also cover custom software, AI agents, dashboards with BI/Power BI, and cybersecurity. We believe that fairness must be present in all phases: from problem definition to post-deployment monitoring. Fair technology is not an extra, but a quality condition.

Infrastructure is also a determining factor. Having well-configured cloud platforms allows executing counterfactual experiments at scale, storing data versions, and maintaining traceability in audits. BI/Power BI dashboards are useful for visualizing fairness metrics over time and detecting drifts. Cybersecurity, for its part, ensures that sensitive information from protected groups is not misused. In short, fairness requires a complete technical ecosystem, not only a loss function.

The initial question does not have a universal answer. Whether counterfactually fair classifiers satisfy group fairness depends on the domain, the quality of the data, and the model architecture. The good news is that we can design solutions that align both notions, as long as we evaluate with complementary metrics and reduce dependence on latent attributes. At Q2BSTUDIO we accompany companies on this path, combining technical knowledge, business vision, and ethical responsibility. Because fairness is not an abstract concept: it is demonstrated with data, processes, and measurable results.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.