Skip to main content
Back

UBC Reframes Skin Cancer AI as a Retrieval Problem, Hitting 79.3% Accuracy

A transformer framework combines dermoscopy images with clinical text to retrieve biopsy-confirmed skin cancer cases, beating all baselines on Acc@1

Pro

  • Researchers propose a transformer framework for composed vision-language retrieval in skin cancer, combining a dermoscopy image with clinical text as a single query.
  • The model uses a Swin Transformer backbone to extract multi-level features, fused with BERT text embeddings via a cross-modal Transformer.
  • A joint global-local similarity function uses learnable spatial attention masks to emphasize diagnostically salient subregions like streaks and irregular pigmentation.
  • On the Derm7pt benchmark (888 images, 3 classes), the method achieves 79.3% Acc@1 and 81.7% mAP, outperforming all six baselines including SNF-DCA and WalshHash.
  • The local-global weighting (beta=0.6) is a deliberate clinical prior, not a learned parameter, encoding the assumption that local lesion features matter more than global appearance.
  • No code or model weights have been released; the work is a proof-of-concept on a small dataset with only three diagnostic categories.

Most AI work in dermatology has focused on one thing: classification. Feed in an image, get a diagnosis. But that framing misses how clinicians actually think. When a dermatologist sees a suspicious lesion, they don't just want a label -- they want to see similar cases, compare morphologies, and reason by analogy. A new paper from researchers at UBC tackles exactly this gap, framing skin cancer decision support as a retrieval problem rather than a classification one.

The paper introduces a transformer-based framework for composed vision-language retrieval applied to skin cancer. The key idea: instead of querying a database with just an image or just text, a clinician can submit both at once -- a dermoscopy image of a lesion paired with structured clinical descriptors -- and get back the most relevant biopsy-confirmed cases from a historical database.

Why retrieval, and why now?

Compared with end-to-end classification, case-based retrieval offers a more clinically intuitive form of decision support by comparing similar historical cases, thereby facilitating comparative assessment, interpretability, and clinician training. This matters because black-box classifiers, even when accurate, are hard to trust in high-stakes settings. Showing a clinician five visually and diagnostically similar confirmed cases is a fundamentally different -- and often more persuasive -- form of evidence.

Composed Image Retrieval (CIR) operates at the intersection of vision and language, allowing users to search using a multimodal query: a reference image combined with a text modification. The reference image provides the visual foundation, while the text specifies desired changes to particular attributes. In the general computer vision world, CIR has gained serious momentum -- CVPR 2025 featured multiple dedicated papers on the topic. This work is among the first to adapt the paradigm to a clinical setting, where the "text modification" isn't "make it red" but rather structured dermoscopic criteria like pigment network type or the presence of streaks.

The clinical query problem

To understand why this is hard, you need to understand how skin lesion assessment actually works. Dermatologists use a standardized rubric called the 7-point checklist -- a set of seven visual criteria (atypical pigment network, irregular streaks, regression structures, etc.) each scored independently to assess malignancy risk. The 7-point checklist consists of seven criteria that identify characteristics of skin lesions indicative of melanoma, with each criterion associated with different labels. For example, "pigment network" is one of the checklist criteria and has three labels: atypical, typical, and absent.

The challenge for retrieval is that these clinically meaningful cues are spatially localized -- a streak in the upper-left corner, irregular pigmentation in a specific region. A system that only compares global image embeddings (the dominant approach in prior work) will miss these fine-grained local signals. But a system that ignores global structure entirely will lose coherence. The paper's core contribution is a similarity function that handles both.

How the framework works

The pipeline has three main stages:

  1. Hierarchical visual encoding: Both the query image and each database image are passed through a Swin Transformer backbone, producing feature maps at three levels of abstraction -- low, mid, and high. This preserves both fine-grained texture details and high-level semantic context simultaneously.
  2. Cross-modal composition: The query image features at each level are fused with text token embeddings (from BERT) via a cross-modal Transformer. The result is a composed query representation that lives in the same visual feature space as the database images, enabling direct comparison.
  3. Joint global-local alignment: Similarity between the composed query and a candidate image is computed two ways. Local alignment learns k spatial attention masks over the feature maps, extracts region descriptors from each, and computes cosine similarity across those regions -- capturing diagnostically salient substructures like streaks or irregular pigmentation. Global alignment pools the full feature maps and computes cosine similarity for holistic semantic consistency.

The final score combines both:

S = beta * S_local + (1 - beta) * S_global
# beta = 0.6, prioritizing local evidence
# Applied at each of 3 feature levels (low, mid, high)

In skin cancer case search, diagnostically salient cues are frequently confined to specific lesion subregions (e.g., streaks, irregular pigmentation, and regression-like patterns); accordingly, the authors choose a beta that prioritizes local similarity while using global similarity as a holistic semantic constraint. This weighting isn't learned -- it's a deliberate clinical prior baked into the architecture.

The benchmark and the numbers

The team used Derm7pt, a widely used benchmark for skin cancer research that provides dermoscopic images alongside patient metadata and structured clinical attributes aligned with the 7-point checklist. Following prior retrieval-oriented studies, they adopted the standard evaluation protocol and restricted analysis to diagnostic categories with at least 50 samples -- yielding 888 eligible images spanning three categories: melanoma, nevus, and benign keratosis-like lesions.

Results were evaluated using Accuracy@K (what fraction of top-K results share the correct diagnosis) and mean Average Precision (mAP), which measures overall ranking quality across all retrieved results. The proposed method was compared against six baselines, including ResNet50-CosSim, SNF-DCA (a multimodal skin retrieval method), and WalshHash (a strong hashing-based baseline).

MethodAcc@1Acc@2Acc@4mAP
ResNet50-CosSim77.6%80.9%83.2%80.4%
SNF-DCA77.8%82.8%83.3%80.0%
WalshHash77.5%81.6%84.9%80.8%
Proposed79.3%82.4%87.3%81.7%

The improvement is most meaningful at the top of the ranked list, where Accuracy@1 reaches 79.3% -- higher than all competing methods. This result is particularly important for clinical retrieval, since the first returned case often carries the greatest practical value during visual assessment and decision support.

One notable contrast: MaskRCNN-Fusion also reaches 87.3% at Accuracy@4 but drops substantially to 62.5% at Accuracy@1, suggesting that segmentation-driven fusion can retrieve relevant cases within a broader candidate set yet is less effective at placing the most relevant case at the top. For clinical use, that distinction is everything -- a clinician looking at the first result needs it to be right.

What it's good for, and where it falls short

The practical use cases are clear:

  • Decision support at point of care: A dermatologist photographs a lesion, adds checklist annotations, and instantly retrieves the most similar confirmed cases from an institutional database.
  • Resident training: Trainees can explore how different textual descriptors shift retrieval results, building intuition for which visual features map to which diagnoses.
  • Quality control and audit: Retrospective retrieval of similar cases to flag inconsistent diagnoses across a hospital system.

The limitations are real though. The dataset is small -- 888 images across only three diagnostic classes. Real clinical databases span dozens of lesion types, and it's unclear how the framework scales. The evaluation also uses label-level positives (same diagnosis = positive match), which is a coarse proxy for true clinical similarity. Two melanomas can look very different. The model also requires structured text input in the 7-point checklist format, which may not always be available or consistently filled out in practice.

The real shift here

This design departs from prior composed retrieval methods that predominantly rely on global embedding similarity or perform global-local aggregation without accounting for domain-dependent cue reliability. By embedding this clinical reliability prior into a simple convex fusion, the similarity better aligns with medical decision patterns without sacrificing global consistency. That last point is subtle but important: the authors aren't just adapting a general CIR framework to medicine -- they're encoding a clinical assumption (local features matter more in dermoscopy) directly into the similarity function. That's a meaningful step toward retrieval systems that are designed with domain knowledge rather than just trained on it.

No code or pretrained models have been released alongside the paper. Given the small dataset size and the specialized nature of the benchmark, the framework is best understood as a proof-of-concept for composed clinical retrieval rather than a drop-in tool -- but the direction it points is one that larger medical AI efforts would do well to follow.