Attacks

Medical image tokenizers break differently on each path

Reviewing Adversarial Attacks Expose Path-Dependent Failures in Discrete Medical Image Tokenizers · Ahmed Loughzali, Akash Yallamati, Aadiv Reki et al.

Medical image tokenizers break differently on each path

Researchers show that imperceptible pixel changes aimed only at a medical image tokenizer can wreck diagnoses downstream, and that the same tokenizer fails in opposite ways depending on how its output is used. A label-free version even makes a deployed medical vision-language model invent or erase disease.

Show a medical vision-language model a healthy retina and it reports proliferative diabetic retinopathy. Show it a malignant skin lesion and it calls it benign. To a human, both images look untouched. The attacker never saw the question, the answer or the language model's gradients.

That is the sharpest result in new research on discrete image tokenizers in medical AI. The attack touches only the component at the front of the pipeline. Yet it reaches LLaVA-Med, a frozen model built on a public tokenizer called MedITok.

A discrete tokenizer turns a scan into a short sequence of codes. An encoder maps patches of the image to points in an internal space, and each point snaps to the nearest entry in a fixed codebook. Those codes then go one of three ways. They are decoded back into an image for a classifier, classified directly, or fed to a generative model. Tokenizers sit upstream and are often published with their weights, so one weakness can reach many systems.

The researchers attacked four tokenizers across chest X-rays, retinal photographs and skin images. The same tokenizer failed in opposite ways depending on which path read its output. A supervised attack, steered by diagnostic labels, wrecked the classifier reading the decoded image. It barely touched the one reading tokens. A label-free attack did the reverse.

The label-free attack is the clever one. It needs no diagnosis and no downstream model. It pushes the encoder's internal points towards the edges between codebook entries, then keeps pushing past them. On MedITok, the token path's diagnostic score fell from 0.919 to 0.239, well below what random guessing would score.

What surprised me is how little the count of changed tokens tells you. A control version flipped nearly as many tokens but stopped pushing once each one flipped. It moved the representation less, and every path and every answer survived. Harm comes from how far the representation moves, not how many codes change. A monitor watching token churn is watching the wrong thing.

Medical pretraining did not help either. MedITok had the best clean accuracy and was the most fragile, more so than UniTok, its general-domain counterpart.

The preconditions are real but modest. The attacker needs the tokenizer's weights, which are often public, and a way to alter the image before it reaches the model. Nothing else downstream is required.

The defences fare worse. Six candidates were tested and none repaired every failure. Several collapsed once the attacker optimised against them directly. A certified smoothing method held against some attacks but not the supervised one. I would not trust a tokenizer defence tested on one path or against a static attacker.

A tokenizer is not robust in general. It is robust, or not, for each path it feeds.

Further analysis

Problem

This paper studies whether small, imperceptible pixel perturbations can break medical AI systems by attacking discrete image tokenizers alone. Discrete tokenizers convert scans into short sequences of codes that feed downstream models via three paths: decoding back to pixels then classifying (reconstruction path), classifying tokens directly (token path), or supplying a generative multimodal model (generative path). Because tokenizers are upstream and often public, a vulnerability there can propagate to many models. The work asks whether such perturbations can induce diagnostic errors and whether robustness depends on which downstream path consumes the tokenizer output.

Approach

The authors evaluate four tokenizers (LlamaGen VQ-16, MedITok, UniTok, and Finite Scalar Quantization FSQ) over three medical imaging modalities (chest radiography, fundus photography, dermoscopy) and three attack types. Attacks use an ℓ∞ constraint on pixel perturbations and projected gradient descent. M0 is a direct supervised attack on the classifier. M1 is a supervised attack routed through the tokenizer. M2 is a label-free, boundary-directed geometric attack that pushes encoder latents toward and beyond quantization boundaries; it has an unbounded variant (M2-unb) that continues displacement after a token flip and a saturated variant (M2-sat) that stops rewarding movement after a flip. Metrics include token flip rate, embedding displacement, and downstream diagnostic AUC. The strongest unsupervised attack is also applied to a deployed frozen vision-language model, LLaVA-Med, that uses MedITok as encoder. Six candidate defences are tested, including pixel-noise, stochastic quantization smoothing (SQS, a certified method), encoder fine-tuning, decoder fine-tuning, and combinations, plus adaptive evaluations using BPDA and a held-out Carlini-Wagner check.

Key Findings

  • Path-dependence: the same tokenizer can fail in opposite ways depending on the downstream path. A supervised tokenizer-mediated attack (M1) collapses the reconstruction path to AUC ≤ 0.013 at ε = 2/255 across tokenizers while largely sparing the token path.
  • Label-free geometric attack reverses the effect: M2-unb preserves reconstruction but collapses the token path for multi-codebook tokenizers, worst for MedITok where token-path AUC falls from 0.919 to 0.239.
  • Transfer to generative VLMs: the label-free M2-unb attack on MedITok transfers to LLaVA-Med, causing the model to invent or erase disease without access to questions, answers, or language-model gradients.
  • Mechanism is displacement past quantization boundaries, not token flips: M2-sat flips nearly identical fractions of tokens as M2-unb but displaces latents less and leaves diagnostic outputs intact, showing flip rate alone is uninformative.
  • Domain-specific pretraining does not guarantee robustness: MedITok has the best clean token-path accuracy yet is the most fragile under M2-unb compared with its general-domain counterpart UniTok.
  • No defence closes both failure modes: none of six defences repairs every path under adaptive attack; SQS offers a certification for certain attacks but fails against supervised M1.

Limitations

Results are averaged over modest evaluation subsets and a limited set of tokenizers, datasets, and one deployed VLM. Generative evaluation is inference-only on a single model. Some defence-fidelity metrics were not measured for all defences. Small differences should be interpreted cautiously; main claims rely on large effects.

Implications

An attacker who knows a public tokenizer architecture and weights can compute imperceptible, label-free perturbations that induce misdiagnosis or force a generative model to hallucinate clinical findings, without access to downstream models or language-model gradients. Because the same tokenizer underpins multiple deployed systems, a single weakness can scale to many targets. The core offensive capability is to move encoder representations past quantization boundaries so that downstream diagnostic outputs are flipped or invented; token flip statistics are a poor indicator of safety. Threat modelling and red-teaming must therefore evaluate tokenizers per downstream path and assume adaptive attackers who can optimise against deployed defences.

The paper title, authors and abstract

Adversarial Attacks Expose Path-Dependent Failures in Discrete Medical Image Tokenizers

Ahmed Loughzali, Akash Yallamati, Aadiv Reki, Aslan Shaukat Vaida, Jeyashree Krishnan

Discrete image tokenizers convert medical images into token sequences that downstream models either decode into an image for a classifier (the reconstruction path), classify directly (the token path), or feed to a generative multimodal model. We ask whether imperceptible input perturbations can break these systems through the tokenizer alone. We evaluate four tokenizers on three imaging modalities and extend the strongest attack to a deployed generative model. Our central finding is path-dependence: the same tokenizer fails in opposite ways depending on how its output is used. A supervised attack collapses diagnostic accuracy on the reconstruction path, with ROC AUC falling to $\leq 0.013$ at $\epsilon=2/255$ on all four tokenizers, while sparing the token path. An unsupervised, label-free attack does the reverse; its damage concentrates in the multi-codebook tokenizers, worst in MedITok, whose token-path AUC falls from 0.919 to 0.239. The same label-free attack transfers to LLaVA-Med, a frozen medical vision-language model built on MedITok, making it report proliferative diabetic retinopathy in a healthy retina or call a malignant lesion benign, without access to the question, answer, or language-model gradients. Harm is driven by how far the attack moves the tokenizer's internal representation, not by how many tokens change: on the learned-codebook tokenizers, a control attack that changes nearly all tokens but moves the representation less leaves every path and answer intact. Domain-specific pretraining does not provide robustness: MedITok has the best clean accuracy yet is the most fragile, more so than UniTok, its general-domain counterpart. None of six candidate defenses repairs every failure mode, and several fail once the attacker optimizes against the defense directly. Medical tokenizer robustness must therefore be evaluated per downstream path, against an adaptive adversary.