In-hoc Concept Representations to Regularise Deep Learning in Medical Imaging

Valentina Corbetta, Floris Six Dijkstra, Regina Beets-Tan, Hoel Kervadec, Kristoffer Wickstrøm, Wilson Silva

Abstract

Deep learning models in medical imaging frequently exploit spurious correlations—shortcuts like hospital-specific artifacts—rather than learning genuine pathological features. This leads to high in-distribution accuracy but failure in real-world, out-of-distribution (OOD) scenarios. We introduce LCRReg (Latent Concept Representation Regularization), an "in-hoc" regularization technique that guides a network's internal activations toward predefined "concept subspaces" during training. By utilizing a small bank of synthetically generated concept images, LCRReg forces the model to prioritize clinically meaningful features. Our results on synthetic and real-world diabetic retinopathy datasets demonstrate that LCRReg significantly enhances model robustness and OOD generalization, outperforming standard training paradigms.

Introduction: The "Clever Hans" Problem in Medical AI

Deep learning has shown immense promise in medical diagnostics, yet these models often behave as "Clever Hans" predictors. Instead of identifying the visual hallmarks of a disease, they may latch onto spurious correlations—statistical shortcuts such as a specific hospital’s watermark, scanner-specific noise, or even skin markings. While such models perform well on their original training data, they often fail when deployed in new clinical environments where these shortcuts are absent. Traditional mitigation strategies, such as data augmentation, often struggle to differentiate between irrelevant noise and meaningful features. This work proposes a method to align the model's internal logic with the domain knowledge of clinicians by forcing the network to focus on the same features a doctor would prioritize.

Methodology: LCRReg

The core of our approach is Latent Concept Representation Regularization (LCRReg). Unlike post-hoc methods that explain a model's decisions after training, LCRReg introduces a regularization term during the training phase to steer the model's latent representations toward clinically relevant concepts.

Concept Bank Generation

A significant challenge in concept-based learning is the need for large labeled datasets. We circumvent this by creating a "concept bank" using a small auxiliary dataset. We employ compositional editing to "paste" specific medical features (e.g., microaneurysms) onto healthy images. This process creates a perfectly disentangled signal where the only difference between positive and negative samples is the presence of the concept itself.

The concept creation process using compositional editing to generate synthetic positive and negative samples.

Latent Concept Representations (LCRs)

We utilize Concept Activation Vectors (CAVs) to define the mathematical "direction" of a concept within the layers of a Convolutional Neural Network (CNN). Specifically, we found that Filter-CAVs, which focus on separating "concept present" from "concept absent," provided a more effective regularization signal than more complex descriptive vectors.

In-hoc Regularization

LCRReg adds a specific loss term to the training objective. This loss penalizes the model if its internal activations at a specific layer do not align with the predefined concept directions. We observed that Static Regularization—computing concept directions once at the start of training—offered greater stability than dynamic updates, which often created a "moving target" for the optimizer, leading to training instability.

Overview of the LCRReg framework, showing the LCR recomputation (left) and the main training loop with the regularization loss (right).

Experimental Evaluation

We evaluated LCRReg across two primary tasks:

  1. Elements Task: A synthetic dataset designed to test robustness against injected spurious correlations (e.g., specific shapes always paired with specific textures during training).
  2. Diabetic Retinopathy (DR): A real-world medical task using the APTOS dataset for training and the FGADR dataset for expert-level concept masks. To test generalization, the model was evaluated on five unseen OOD datasets: RLDR, IDRiD, DEEPDR, DDR, and EYEPACS.

Results and Discussion

LCRReg demonstrated a marked ability to ignore shortcuts. In the synthetic "Elements" task, while vanilla models failed when correlations were reversed (e.g., stripes moved to the wrong shape), LCRReg-trained models maintained high accuracy. In the clinical DR task, LCRReg improved average OOD performance across all five datasets. Notably, combining LCRReg with a post-hoc bottleneck model (PCBM-h) increased average Balanced Accuracy from 57.17% to 61.18%. Saliency maps confirmed that LCRReg-trained models correctly focused on actual lesions rather than spurious markers.

Conclusion

LCRReg provides a robust, architecture-agnostic framework for integrating clinical domain knowledge into deep learning. By forcing models to "see" like doctors through concept-based regularization, we can build AI systems that are more reliable and generalizable across diverse clinical settings. Future work will explore "Gradient Surgery" to further optimize the balance between classification accuracy and concept alignment, as well as extending the method to handle dozens of overlapping medical concepts simultaneously.

Summary updated

Abstract

Deep learning models in medical imaging often achieve strong in-distribution performance but struggle to gener-alise under distribution shifts, frequently relying on spurious correlations instead of clinically meaningful features. We introduce LCRReg, a novel regularisation approach that leverages Latent Concept Representations (LCRs) (e.g., Concept Activation Vectors (CAVs)) to guide models toward semantically grounded representations. LCRReg requires no concept labels in the main training set and instead uses a small auxiliary dataset to synthesise high-quality, disentangled concept examples. We extract LCRs for predefined relevant features, and incorporate a regularisation term that guides a Convolutional Neural Network (CNN) to activate within latent subspaces associated with those concepts. We evaluate LCRReg across synthetic and real-world medical tasks. On a controlled toy dataset, it significantly improves robustness to injected spurious correlations and remains effective even in multi-concept and multiclass settings. On the diabetic retinopathy binary classification task, LCRReg enhances performance under both synthetic spurious per-turbations and out-of-distribution (OOD) generalisation. Compared to baselines, including multitask learning, linear probing, and post-hoc concept-based models, LCRReg offers a lightweight, architecture-agnostic strategy for improving model robustness without requiring dense concept supervision. Code is available at this link.
BibTeX
@misc{corbetta2025hoc,
  author = {Valentina Corbetta and Floris Six Dijkstra and Regina Beets-Tan and Hoel Kervadec and Kristoffer Wickstrøm and Wilson Silva},
  title = {{In-hoc Concept Representations to Regularise Deep Learning in Medical Imaging}},
  year = {2025},
  eprint = {2508.13880},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.13880},
}
Figure