Abstract
Safe deployment of AI methods in medicine requires robust guardrails that detect when input data deviate from the training distribution to ensure that models provide predictions only within their scope of expertise and abstain otherwise. Out-of-distribution (OOD) detection can provide such safeguards and is extensively studied in general computer vision. Yet, it remains underdeveloped in computational pathology, where gigapixel whole-slide images (WSIs), subtle differences between disease subtypes, and variability in tissue preparation pose unique challenges for conventional OOD methods. We propose ZIO, a training-free, multimodal OOD detector for pathology WSIs that leverages vision--language pathology foundation models (FMs). ZIO constructs text and visual prototypes of in-distribution classes and integrates their complementary information through a prototype shrinkage mechanism to derive OOD scores. We provide the ZIO formulation for both slide- and patch-level FMs. We evaluate ZIO across diverse clinically relevant domain shifts, including rare diseases and near-OOD settings. Extensive evaluation of over 14,700 WSIs from five independent consortia shows that ZIO consistently outperforms both unimodal prototypes and 40 state-of-the-art OOD methods. These results demonstrate the benefits of multimodal representation for OOD detection and pave the way towards safer AI deployment in clinical practice.