[ Back to home ]
2024

Dermatological triage with cited medical evidence.

A DenseNet121 classifier trained on 19,000+ DermNet images across 23 skin conditions, paired with a retrieval-augmented chatbot whose every answer cites a real medical source. Auth, row-level security, and per-user history behind a single Supabase backend.

1. Abstract

A dermatological triage layer that pairs an image classifier with a retrieval-augmented chatbot, behind a Supabase-backed account with auth, row-level security, and persistent conversation history. Where dermatologist access is limited, how fast a patient reaches a clinician often separates a survival event from a routine appointment. An evidence-grounded opinion, on a phone, on whether a skin condition warrants urgent attention shortens that distance without pretending to replace the appointment.

The classifier is a DenseNet121 backbone (Huang et al., 2017), picked because dense connections give efficient gradient flow and feature reuse on a parameter budget suited to medical images. It trains on the DermNet dataset, roughly 19,000 dermatoscopic images across 23 categories, with class-weighted loss that penalises errors on rare malignant categories more heavily. The chatbot embeds each query with OpenAI text-embedding-3-small (1536-d), pulls the top-5 chunks from a pgvector HNSW index over dermatology textbooks and clinical guidelines, and hands generation to Gemini 2.0 Flash under a system prompt that requires every answer to cite specific retrieved chunks or refuse.

The novelty is the integration, not the parts. DenseNet121 is off-the-shelf, DermNet is public, RAG is standard. What is new is the product shape: a classifier with a "see a clinician" fallback below 60% confidence, a chatbot grounded in a cited source by construction so it cannot hallucinate clinical advice, and per-user history that makes both reusable across sessions, all behind a real auth surface. No consumer dermatology product on the market today cites its sources by construction. This build targets that gap.

2. Introduction

In low-access regions a missed melanoma is a survival event, and the bottleneck is rarely diagnostic accuracy in the clinic. It is the time it takes a patient to reach a clinic at all.

2.1 Why a classifier and a RAG chatbot, not either alone

A classifier alone gives a label and a probability, leaving the patient to judge whether it warrants a visit. An ungrounded chatbot cannot reliably tell a benign mole from one that needs urgent attention. Together, the classifier sets a calibrated starting point, the chatbot turns it into language a patient can act on, and grounding anchors that language in cited medical sources.

2.2 What is actually new

The classifier architecture, embedding model, vector store, and LLM are existing infrastructure. The contribution is how they compose into a triage product.

Everything below makes those three commitments hold inside one deployed product.

3. System

3.1 Image classification

3.2 Retrieval-augmented generation

Generation is constrained to retrieved sources, so the chatbot answers follow-up questions about a prediction without inventing clinical facts.

3.3 Stack

4. Evaluation

Validated for engineering correctness on held-out DermNet images and on the deployed product surface.

The accuracy numbers come from held-out DermNet images, single split, single seed. They are not a leaderboard claim against published dermatology AI benchmarks (different datasets, different label conventions), and not a clinical-grade diagnostic claim. This triage layer helps a patient decide whether to seek care, not what they have.

5. Conclusion and Implications

Pairing a calibrated classifier with citation-grounded follow-up is a concrete step toward earlier dermatologist intake for populations that cannot easily reach one. Recovering even a fraction of the path-to-clinic friction means faster intake on time-critical conditions like melanoma, fewer late-stage diagnoses, and lower triage burden on under-resourced dermatology services. Citation-by-construction, the calibrated fallback, and per-user history make this a deployable triage layer, not something that demos well and helps nobody.

5.1 Limitations and future work