✨ From vibe coding to vibe deployment. UBOS MCP turns ideas into infra with one message.

Learn more
Andrii Bidochko
  • Updated: July 4, 2026
  • 7 min read

PROTON: Prototype-Based Test-Time Online OOD Detection for Medical VLMs

Direct Answer

PROTON (Prototype‑based Test‑time ONline OOD detection) is a lightweight, post‑hoc module that equips zero‑shot medical vision‑language models (VLMs) with reliable out‑of‑distribution (OOD) detection at deployment. By continuously harvesting high‑confidence predictions into an online prototype bank and fusing prototype distance with existing Maximum Concept Matching (MCM) scores, PROTON closes the performance gap across covariate, semantic, and far‑OOD shifts without any model retraining or prompt engineering.

Background: Why This Problem Is Hard

Medical VLMs have unlocked zero‑shot classification for radiology, ophthalmology, and pathology, allowing clinicians to query images with natural language descriptions. However, the clinical stakes demand that a model instantly recognize when an input falls outside its learned distribution—otherwise a mis‑diagnosis can propagate unchecked. Traditional OOD detectors rely on static scoring functions (e.g., softmax confidence, Mahalanobis distance) that assume a clear separation between in‑distribution (ID) and OOD samples in the model’s output space.

In practice, two fundamental mismatches undermine these assumptions:

  • Covariate shift blindness: Images captured with different hardware, field‑of‑view, or illumination (e.g., ultra‑wide‑field fundus photos) often produce softmax vectors indistinguishable from standard ID cases, even though their visual embeddings occupy distinct regions.
  • Semantic shift ambiguity: When a new disease class appears that the VLM has never seen, the model may still assign a high softmax score to the nearest known concept, masking the OOD nature of the sample.

Existing static methods such as Maximum Concept Matching (MCM) excel on far‑OOD scenarios (e.g., completely unrelated modalities) but collapse to near‑random performance on covariate shifts. The root cause is a structural mismatch: the VLM’s embedding space retains discriminative geometry that static output‑space scores ignore. Bridging this gap without costly retraining or curated OOD datasets remains an open research bottleneck.

What the Researchers Propose

The PROTON framework introduces three interlocking ideas:

  1. Online prototype bank: As the model processes a stream of test images, it extracts the embedding vectors of predictions that exceed a confidence threshold. These vectors are aggregated into class‑specific prototypes that evolve over time, reflecting the current data distribution.
  2. Prototype distance scoring: For each new test sample, PROTON computes the Euclidean distance to the nearest class prototype. Larger distances indicate that the sample resides in a region of the embedding space not represented by any high‑confidence ID example.
  3. Adaptive fusion via variance statistics: PROTON monitors the variance of MCM scores across a sliding window of recent predictions. When variance spikes—signaling a potential shift—it increases the weight of the prototype distance component, otherwise it leans on MCM. This dynamic weighting eliminates the need for hand‑tuned hyperparameters.

Crucially, PROTON operates entirely post‑hoc: it requires no access to the VLM’s training data, no modification of the model architecture, and no additional prompts. The only prerequisite is a confidence estimator (e.g., softmax max) that the underlying VLM already provides.

How It Works in Practice

The end‑to‑end workflow can be visualized as a three‑stage pipeline:

  1. Inference & confidence filtering: The medical VLM receives an image and a natural‑language query (e.g., “Is there diabetic retinopathy?”). It returns a softmax distribution over possible concepts and the corresponding multimodal embedding.
  2. Prototype update: If the top‑1 softmax confidence exceeds a pre‑defined threshold (e.g., 0.9), the embedding is added to the prototype bank for the predicted class. The bank maintains a running average, optionally using exponential decay to prioritize recent samples.
  3. OOD scoring & decision: The system computes two scores: (a) the MCM similarity between the query and the image, and (b) the Euclidean distance to the nearest class prototype. A variance monitor evaluates the recent MCM score distribution; based on its output, a weighted sum of the two scores yields the final OOD confidence. If the combined score crosses a detection threshold, the input is flagged as OOD and routed for human review.

What sets PROTON apart from prior approaches is its online adaptation. Traditional detectors treat the test set as static, freezing all parameters after training. PROTON, by contrast, continuously refines its notion of “normal” using only high‑confidence predictions, thereby staying aligned with evolving imaging protocols, device upgrades, or population shifts.

Diagram of PROTON workflow

The diagram above illustrates the feedback loop: confident predictions enrich the prototype bank, which in turn sharpens OOD detection for subsequent inputs.

Evaluation & Results

To validate PROTON, the authors assembled the ophthalmology benchmark FLAIR + FIVES, which combines:

  • FLAIR: A large‑scale fundus image repository covering typical clinical distributions.
  • FIVES: A curated set of far‑OOD images (e.g., retinal OCT, non‑ophthalmic scans) and covariate‑shifted fundus photos captured with ultra‑wide‑field devices.

Three OOD scenarios were examined:

  1. Covariate shift: Same disease classes, different acquisition settings.
  2. Semantic shift: New disease categories absent from the VLM’s training vocabulary.
  3. Far‑OOD: Completely unrelated imaging modalities.

Key findings include:

  • On covariate shift, PROTON lifted the AUROC from 42.4 % (MCM alone) to 66.3 %, a +23.9 % absolute gain.
  • For semantic shift, the AUROC improved by +8.8 % (from 71.2 % to 80.0 %).
  • Even in far‑OOD cases, where MCM already performed reasonably, PROTON added +8.1 % (AUROC 84.5 % → 92.6 %).
  • All improvements were achieved without any additional labeled OOD data, hierarchical prompting, or model fine‑tuning.

These results demonstrate that prototype‑based geometry, when fused adaptively with existing similarity scores, provides a universal signal that survives across all three shift types. The authors also performed ablation studies confirming that (a) the online prototype update is essential, and (b) variance‑driven weighting outperforms static linear combinations.

Why This Matters for AI Systems and Agents

For practitioners building AI‑driven diagnostic pipelines, PROTON offers a plug‑and‑play safety layer that can be deployed on top of any zero‑shot medical VLM. The benefits cascade through the entire system architecture:

  • Risk mitigation: Early OOD flagging prevents downstream agents—such as automated report generators or triage bots—from acting on unreliable predictions.
  • Operational resilience: Because PROTON adapts online, hospitals can roll out new imaging devices or update acquisition protocols without retraining the core VLM.
  • Resource efficiency: The prototype bank requires only a few megabytes of memory and negligible compute, making it suitable for edge deployments or low‑latency cloud services.
  • Integration simplicity: The module can be wrapped as a micro‑service and orchestrated alongside existing workflow automation tools. For example, the Workflow automation studio can invoke PROTON after each VLM inference, automatically routing OOD cases to a human‑in‑the‑loop review queue.
  • Compliance and auditability: By logging prototype distances and variance statistics, organizations gain a transparent audit trail that satisfies regulatory requirements for AI‑driven medical devices.

In the broader context of AI agents, PROTON’s design pattern—online prototype accumulation coupled with variance‑aware score fusion—can be abstracted to any multimodal agent that must self‑monitor its confidence in a streaming environment. Whether the agent is a virtual health assistant, a radiology triage bot, or a research‑assistant that curates literature, the same principles apply.

What Comes Next

While PROTON marks a significant step forward, several open challenges remain:

  • Prototype drift detection: Over long deployments, prototypes may become stale if the underlying disease prevalence changes dramatically. Future work could incorporate explicit drift detectors that trigger prototype re‑initialization.
  • Multi‑modal extensions: The current implementation focuses on image‑text embeddings. Extending the prototype bank to incorporate other modalities (e.g., OCT volumes, clinical notes) could broaden applicability.
  • Privacy‑preserving updates: In regulated settings, storing raw embeddings may raise privacy concerns. Research into secure aggregation or federated prototype learning would make PROTON compliant with stricter data‑governance policies.
  • Benchmark diversification: Testing PROTON on non‑ophthalmic domains—such as dermatology or histopathology—will validate its generality.

Developers interested in experimenting with PROTON can clone the open‑source repository and integrate it with their existing pipelines. The codebase includes a ready‑to‑run Docker image, detailed documentation, and example notebooks that demonstrate end‑to‑end deployment on the Enterprise AI platform by UBOS. By leveraging UBOS’s templates for quick start, teams can spin up a prototype‑enabled inference service in under an hour.

In summary, PROTON transforms the way medical VLMs handle distributional uncertainty, turning a static weakness into an adaptive strength. As zero‑shot models continue to proliferate across healthcare, embedding online OOD detection will become a non‑negotiable component of trustworthy AI systems.

For the full technical details, see the original PROTON paper on arXiv.


Andrii Bidochko

CTO UBOS

Andrii Bidochko is an AI entrepreneur and researcher focused on AI agents, reinforcement learning, and autonomous systems. He writes about the technologies shaping the future of machine intelligence, from frontier models and agent architectures to real-world AI applications.

Sign up for our newsletter

Stay up to date with the roadmap progress, announcements and exclusive discounts feel free to sign up with your email.

Sign In

Register

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.