Manuscript Offprint
arXiv:2611.08838The APL Doesn't Fall Far From The Tree: Unsupervised Artefact Prototype Learning in Histopathology
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
ABSTRACT
Histopathology foundation models provide rich representations of tissue morphology, but technical artefacts in whole slide images introduce noise that may impact diagnostic accuracy. We introduce Artefact Prototype Learning (APL), a novel approach to detecting these artefacts that exploits the geometry of pre-trained embedding spaces without manual labels or fine-tuning. Rather than treating artefacts as isolated outliers, APL computes prototypes of out-of-distribution patches and uses them to distinguish artefact-associated patterns from tissue. Evaluation on a single-centre dataset shows that APL outperforms prior methods GrandQC and HistoART in detecting artefacts such as blur, dark spots, slide edges and pen marks, but struggles with tissue folds and blood. These results show that frozen pre-trained embeddings already carry information that allows artefact detection without expensive labels or vast computational resources.
Index Terms— Histopathology, Artefact Removal, Prototype Learning, Representation Learning
1. INTRODUCTION
Digitised whole slide images (WSIs) capture the morphology and spatial architecture of many cancers, providing key diagnostic information. Foundation models (FMs) extract transferable representations from these gigapixel images by self-supervised learning (SSL) on large corpora of WSIs [1, 2, 3]. These models have proven useful in many downstream tasks such as ovarian cancer subtyping [4]. An often neglected issue, however, are technical artefacts present in WSIs such as pen marks, dust particles and tissue folds. When included during feature extraction, these regions are encoded alongside valid tissue and may reduce diagnostic accuracy [5, 6].
Existing quality control (QC) approaches typically operate on the raw gigapixel image. Traditional methods based on intensity thresholds, edge detection, colour profiles or textures can be sensitive to variations in tissue appearance and scanning protocols, and struggle to generalise across different artefact types. Supervised deep learning approaches address some of these limitations: GrandQC [5], for example, uses a pixel-wise multi-class classifier that has been incorporated

Fig. 1. Intuition behind Artefact Prototype Learning: Artefacts naturally cluster in embedding space.
into existing pipelines [7]. By contrast, HistoART [6] performs artefact detection directly at patch level by fine-tuning the UNI model [2], reaching high accuracy across scanners and tissue types. These approaches however, rely on labelled data. More recently, DiffusionQC [8] framed artefact detection as an outlier detection problem by learning the distribution of artefact-free images without pixel-level annotations. While this reduces the burden of per-pixel labelling, what constitutes an “outlier” may differ per cohort due to differences in acquisition protocols.
Pre-trained histopathology encoders offer an opportunity to exploit this variability by mapping image patches onto a high-dimensional latent space, where similarities between embeddings reflect similarities in visual features. We ask whether these representations encode features that distinguish artefacts from tissue within a cohort, despite not being explicitly trained for artefact detection (Figure 1). Building on this idea, we introduce Artefact Prototype Learning (APL), an unsupervised approach that leverages embedding space topology to identify artefacts in WSIs. We use unsupervised clustering of embeddings to identify visually related groups of patches and define a prototype as a representative embedding of each cluster, which we then use to characterise similar patches. We make the following contributions:
- APL, an unsupervised Artefact Prototype Learning method for WSI QC. Code is available at https://zenodo.org/records/23889154 [9].
- We demonstrate that geometric properties of patches can be exploited to identify artefacts in embedding space.
- We evaluate APL on two ovarian cancer cohorts.

Fig. 2. Artefact prototype learning. Overview of the APL method.
2.1. Dataset
We obtain haematoxylin and eosin (H&E) stained, formalin-fixed paraffin-embedded WSIs for two separate cohorts. The first is a proprietary dataset from the Edinburgh Cancer Centre (N=414) scanned on Hamamatsu at ~0.23 µm/pixel and 40× magnification [10]. The second is TCGA-OV, a multi-institutional cohort (N=107) of FFPE samples from 11 tissue source sites predominantly in the United States, scanned on Aperio at 40× (~0.25 µm/pixel) [11].
We pre-process raw WSIs using the TRIDENT tool [7], first segmenting tissue regions using HEST [12], then tiling the resulting tissue masks into 256 × 256 and 512 × 512 pixel (px) patches at 20× magnification according to the native input resolution of the encoders. After ImageNet normalisation, each patch is mapped by encoder to an embedding . We use CONCH v1.5 [1], UNI v1 [2] and Prov-GigaPath [3], which produce embeddings of dimensions 768, 1024 and 1536, respectively.
2.2. Unsupervised prototype learning
For each cohort and encoder, we pool patch embeddings across WSIs into a common embedding space (Fig. 2). Let denote the embedding of patch , and let denote the L2-normalised embedding. We identify candidate artefacts based on three complimentary assumptions about their location in latent space:
-
Angular distance: Artefacts deviate from the mean embedding direction . We quantify this deviation as .
-
Local density: They are located in sparse regions in latent space. We measure this as the mean angular distance from each patch to its nearest neighbours.
-
Mahalanobis distance: They are unlikely under the distribution and therefore have a large Mahalanobis distance, , computed on the raw embeddings in a 50-component PCA space. Because L2-normalisation changes the covariance we use the raw embeddings.
For candidate patches ranked in the top 1% by at least two criteria, we apply average-linkage hierarchical clustering using cosine distance and take the L2-normalised mean of each cluster's embeddings as its artefact prototype . We also define a number of tissue prototypes by k-means clustering () of patches with . The intuition for defining several tissue prototypes is the morphological heterogeneity in WSIs.
2.3. Prototype-guided pseudo-labelling
For each patch we calculate a margin by subtracting its maximum similarity to a tissue prototype from its maximum similarity to an artefact prototype given by . Patches with are labelled as artefact and patches with as tissue. Patches with margins between 0.02 and 0.10 are left unlabelled. We train an L2-regularised, class-balanced binary logistic regression on the pseudo-labelled patches, which yields patch-wise artefact probabilities.
2.4. Setup
We evaluate our method against GrandQC (MPP25, 7× model) [5] and HistoART (UNI-based) [6] on held-out WSIs, annotated in QuPath [13]. Patches are labelled as artefact if px in a patch are annotated as blur, dark spot, blood, pen mark, fold or slide edge, or if px are background. The final randomly sampled holdout set for our primary cohort comprises 15 WSIs or 76,571 512 px and 294,661 256 px patches with an artefact prevalence of 11.7% and 11.4% respectively. For TCGA-OV, the holdout set comprises 10 WSI with 127,370 256px patches (prevalence 9.1%). Holdout slides are excluded from fitting (candidate selection and prototype learning) steps. APL operates on precomputed embeddings and runs on CPU. To compare UNI and Prov-GigaPath embedding space geometry, we compute linear centred kernel alignment (CKA) and mKNN () on the same held-out 256 px patches using null calibration () as in Gröger et al. [14]. We permute patches within slides and report the median across five subsamples of 2,000 patches.
3. RESULTS
APL detects artefacts without manual training labels. On 15 held-out WSIs from a single-centre cohort, the UNI-based APL classifier reached an AUROC of 0.90 and AUPRC of 0.75 (Table 1). The fine-tuned HistoART model achieved a similar AUROC of 0.91 and an AUPRC of 0.69. GrandQC yielded lower AUROC and AUPRC across two patch sizes (0.66–0.67 and 0.25–0.27, respectively). AUPRC is the more informative given low artefact prevalence. Prototypicality margin alone, without the pseudo-label-trained classifier, reached a similar AUPRC of 0.73.
Tab. 1. Artefact detection performance in 15 held-out slides (artefact prevalence 10.6% at 512 px, 11.4% at 256 px), with 95% slide-bootstrap CI. GrandQC predicts pixel masks and is scored on both patch grids. Best in bold. †Fine-tuned UNI.
| Method | Encoder | Patch | AUROC | AUPRC |
|---|---|---|---|---|
| Existing approaches (supervised) | ||||
| GrandQC [5] | – | 512 | 0.67 (0.59–0.77) | 0.27 (0.13–0.52) |
| GrandQC [5] | – | 256 | 0.66 (0.59–0.74) | 0.25 (0.13–0.46) |
| HistoART [6] | UNI† | 256 | 0.91 (0.86–0.95) | 0.69 (0.54–0.83) |
| Artefact Prototype Learning (APL) (unsupervised) | ||||
| Margin | UNI | 256 | 0.90 (0.84–0.94) | 0.73 (0.56–0.86) |
| Classifier | UNI | 256 | 0.90 (0.85–0.94) | 0.75 (0.60–0.86) |
| Margin | Prov-GigaPath | 256 | 0.84 (0.76–0.90) | 0.59 (0.38–0.77) |
| Classifier | Prov-GigaPath | 256 | 0.86 (0.79–0.92) | 0.67 (0.48–0.82) |
| Margin | CONCH | 512 | 0.89 (0.84–0.94) | 0.67 (0.47–0.83) |
| Classifier | CONCH | 512 | 0.84 (0.77–0.90) | 0.62 (0.43–0.78) |
Artefact detection performance varies by artefact type: The UNI-based APL classifier achieved the highest AUPRC for blur (0.76), dark spots (0.67), slide edges (0.64) and pen mark detection (0.44) (Table 2). Folds and blood were challenging for all methods: the highest AUPRC across methods was 0.29 for folds and 0.25 for blood (Figure 3). In the holdout, they only constituted 0.6% and 0.7% of artefact patches respectively. In contrast, blur (45.8%), dark spots (23.6%) and background (11.3%) were most common. Probability maps illustrate qualitative errors: GrandQC frequently overestimated out-of-focus regions, while HistoART flagged adipose tissue and APL flagged necrotic tissue (Figure 4).
APL performance remains broadly consistent across encoders. Despite differences in embedding dimension, training regimen and patch size, APL showed similar performances across encoders. UNI consistently showed the strongest overall results. Prov-GigaPath achieved lower AUROC (0.83–0.88) and AUPRC (0.58–0.65), while CONCH reached AUROC of 0.84–0.89 and AUPRC values of 0.57–0.61. We also observe embedding space alignment in held-out patches between UNI and Prov-GigaPath, both trained using DINOv2 (256 px patches), with a calibrated linear CKA of 0.78 capturing global alignment and mKNN of 0.52 (cal-
Tab. 2. AUPRC by artefact type on held-out slides (Positives: target artefact, negatives: clean tissue, chance: positive prevalence). Best per column in bold.
| Method | All | Blur | Dark spot | Background | Blood | Pen mark | Fold | Slide edge |
|---|---|---|---|---|---|---|---|---|
| GrandQC [5] | 0.20 | 0.16 | 0.02 | 0.03 | 0.01 | 0.03 | 0.02 | 0.00 |
| HistoART [6] | 0.70 | 0.56 | 0.52 | 0.45 | 0.25 | 0.25 | 0.29 | 0.57 |
| APL, UNI | 0.76 | 0.76 | 0.67 | 0.42 | 0.04 | 0.44 | 0.05 | 0.64 |
| Chance | 0.115 | 0.056 | 0.030 | 0.014 | 0.008 | 0.008 | 0.006 | 0.002 |

Fig. 3. Precision–recall curves per artefact for the UNI-based APL classifier, HistoART and GrandQC on held-out slides.
ibrated 0.51; within-slide null median 0.03; ) capturing similarity in local neighbourhood structure. Alignment was similar for artefact and clean patches (calibrated CKA 0.78 vs 0.78; mKNN 0.46 vs 0.51). Lastly, we tested our initial assumptions in held-out WSIs. Angular distance consistently distinguished artefacts from clean tissue (AUROC 0.83–0.84), predominantly identifying blurry patches, whereas Mahalanobis distance (AUROC 0.47–0.86) and kNN density (AUROC 0.54–0.81) were less consistent.
Artefact detection is more challenging in a multi-centre cohort: To evaluate under more heterogeneous staining and preparation conditions, we tested APL on a multi-institutional cohort. Fitted on TCGA-OV, the UNI-based APL classifier reached an AUROC of 0.84 and an AUPRC of 0.54, below HistoART (AUROC 0.92, AUPRC 0.63), but above GrandQC (AUROC 0.73, 0.37) (Table 3). Transferring APL fitted on the single-centre cohort to TCGA-OV, reduced performance to 0.75 AUROC and 0.40 AUPRC. The underlying assumptions were also less consistent: angular distance retained some discriminative ability (AUROC 0.75), whereas Mahalanobis distance and local density performed poorly (0.39 and 0.54, respectively). Composition of artefact types also differed in this cohort: background (73%) and blood (17%) accounted for most artefacts. APL performed particularly well for air bubbles (AUPRC 0.86), blur (0.53) and blood (0.59).
Tab. 3. Artefact detection on TCGA-OV. Cohort-specific: fitted on TCGA-OV; Transferred: fitted on single-centre.
| Method | Encoder | Patch | AUROC | AUPRC |
|---|---|---|---|---|
| Existing approaches (supervised) | ||||
| GrandQC [5] | – | 256 | 0.73 (0.57–0.83) | 0.37 (0.12–0.57) |
| HistoART [6] | UNI† | 256 | 0.92 (0.86–0.94) | 0.63 (0.53–0.77) |
| Artefact Prototype Learning (APL) (unsupervised) | ||||
| APL, cohort-specific | UNI | 256 | 0.84 (0.78–0.89) | 0.54 (0.31–0.70) |
| APL, transferred | UNI | 256 | 0.75 (0.67–0.82) | 0.38 (0.31–0.57) |

Fig. 4. Illustrative artefact probability maps for one held-out WSI. Manual annotations mark a large blurred region and tissue-microarray punch holes. GrandQC assigns high scores across the blurred region, HistoART flags adipose tissue. APL assigns high scores to annotated artefacts.
4. DISCUSSION & CONCLUSION
We present APL, a method for label-free artefact removal in embedding space. We show that we can remove artefacts with high AUPRC in a single-centre cohort and find that certain artefacts are more easily detected than others. Different encoders appear to converge to similar representations of artefacts. Lastly, we find that our approach is less consistent in multi-centre cohorts, which we assume may be due to acquisition protocol differences. Because APL relies on embedding space topology rather than explicit definitions of artefacts, atypical tissue patterns may also be flagged, which we observe in the case of necrosis and blood, the latter is an artefact under [5]. These may deviate from the dominant tissue distribution but are not necessarily technical artefacts. This leads to a broader discussion on how we define artefacts and the impact of removal of certain types of patches on performance in downstream tasks. Ultimately, APL provides a lightweight, cohort-centric approach to artefact detection. Flagged patches can then be excluded from slide-level representations to prevent artefacts from influencing downstream analyses.
5. COMPLIANCE WITH ETHICAL STANDARDS
We acquired ethical approval from South East Scotland Human Annotated Bioresource (Lothian NRS Bioresource Ethics Committee, reference 15/ES/0094-SR705 and SR752). For this retrospective study, consent was not required by the committee. This study was carried out in accordance with the principles of the Declaration of Helsinki. Additional data was acquired from the TCGA Research Network: https://www.cancer.gov/tcga.
6. ACKNOWLEDGMENTS
This work was supported by the United Kingdom Research and Innovation (grant EP/Y030869/1) AI Centre for Doctoral Training in Biomedical Innovation at the University of Edinburgh. For the purpose of open access, the author has applied a creative commons attribution (CC BY) licence to any author accepted manuscript version arising. The authors have no relevant financial or non-financial interests to disclose. Genera-
tive AI was used to correct spelling and grammatical errors.
7. REFERENCES
[1] Ming Y Lu, Bowen Chen, Drew FK Williamson, et al., "A visual-language foundation model for computational pathology," Nature Medicine, vol. 30, pp. 863–874, 2024. [2] Richard J Chen, Tong Ding, Ming Y Lu, et al., "Towards a general-purpose foundation model for computational pathology," Nature Medicine, 2024. [3] Hanwen Xu, Naoto Usuyama, Jaspreet Bagga, et al., "A whole-slide foundation model for digital pathology from real-world data," Nature, 2024. [4] Jack Breen, Katie Allen, Kieran Zucker, et al., "A comprehensive evaluation of histopathology foundation models for ovarian cancer subtype classification," NPJ Precision Oncology, vol. 9, no. 1, pp. 33, 2025. [5] Zhilong Weng, Alexander Seper, Alexey Pryalukhin, et al., "Grandqc: A comprehensive solution to quality control problem in digital pathology," Nature Communications, vol. 15, no. 1, pp. 10685, 2024. [6] Seyed Kahaki, Alexander Webber, Ghada Zamzmi, et al., "Histoart: Histopathology artifact detection based on large foundation model," Neural Computing and Applications, vol. 38, no. 18, pp. 753, 2026. [7] Andrew Zhang, Guillaume Jaume, Anurag Vaidya, et al., "Accelerating data processing and benchmarking of ai models for pathology," arXiv preprint arXiv:2502.06750, 2025. [8] Zhenzhen Wang, Zhongliang Zhou, Zhuoyu Wen, et al., "Diffusionqc: Artifact detection and quality control in histopathology images via diffusion model," in 2026 IEEE 23rd International Symposium on Biomedical Imaging (ISBI). IEEE, 2026, pp. 1–5. [9] Emilia Agasi, "emilia-agasi/artefactprototype_learning: Apl v0.1.0," Nov. 2026. [10] Robert L Hollis, Alison M Meynert, Caroline O Michie, et al., "Multiomic characterization of high-grade serous ovarian carcinoma enables high-resolution patient stratification," Clinical Cancer Research, vol. 28, no. 16, pp. 3546–3556, 2022. [11] Cancer Genome Atlas Research Network, others, "Integrated genomic analyses of ovarian carcinoma," Nature, vol. 474, no. 7353, pp. 609, 2011. [12] Guillaume Jaume, Paul Doucet, Andrew H. Song, et al., "Hest-1k: A dataset for spatial transcriptomics and histology image analysis," in Advances in Neural Information Processing Systems, Dec. 2024. [13] Peter Bankhead, Maurice B Loughrey, José A Fernández, et al., "Qupath: Open source software for digital pathology image analysis," Scientific reports, vol. 7, no. 1, pp. 16878, 2017. [14] Fabian Gröger, Shuo Wen, Maria Brbić, "Revisiting the platonic representation hypothesis: An aristotelian view," arXiv preprint arXiv:2602.14486, 2026.