WorksComputer Science
Adversarial Attacks Expose Path-Dependent Failures in Discrete Medical Image Tokenizers
Abstract
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 at 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.
Introduction
Medical imaging is adopting artificial intelligence rapidly, increasingly through generative and multimodal models that read a scan and produce a diagnosis, a report, or an answer to a clinical question [2, 33]. Many of these systems, including several built for medical imaging, share one upstream component: a discrete image tokenizer that converts an image into a short sequence of discrete codes [20, 28]. The downstream model consumes these codes in place of pixels, in one of three ways: (a) decoding them back into an image before classifying it (the reconstruction path), (b) classifying the discrete codes directly (the token path), or (c) feeding them to a generative multimodal model that answers questions about the scan (the generative path).
Because the tokenizer sits upstream of all of these, a vulnerability in it can propagate to the models built on it. Medical AI’s susceptibility to adversarial perturbations is well established. Small, imperceptible pixel changes flip predictions across classification, detection, and segmentation systems and modalities [11, 22, 16, 26]. But existing attacks target the downstream model directly; the tokenizer, now upstream of many and largely open-source with weights and codebooks freely inspectable [20, 28, 9], is a distinct and largely unstudied surface (Figure 1).

Figure 1. Threat model. An adversary who knows the tokenizer architecture but cannot query the downstream model adds an imperceptible pixel-space perturbation to a clinical image. The same tokenizer yields the correct diagnosis for the clean image and the wrong one for the perturbed image, across classification and generative downstream models alike.
We red-team this surface across all three downstream paths, evaluating four tokenizers (LlamaGen VQ-16, MedITok, UniTok, Finite Scalar Quantization (FSQ)) over three modalities (chest radiography, fundus photography, dermoscopy). Our central finding, path-dependence, is that the same imperceptible perturbation breaks a tokenizer in opposite ways depending on how its output is used: a task-supervised attack collapses the reconstruction path while sparing the token path, and an unsupervised, label-free attack that pushes the tokenizer’s internal features across the boundaries where its token assignments change (a boundary-directed attack) does the reverse. This second attack, computed from the public tokenizer weights alone, propagates to the generative path: it makes a frozen medical vision-language model (LLaVA-Med, vision encoder MedITok) assert that a healthy retina shows proliferative diabetic retinopathy, or that a malignant lesion is benign, without ever seeing the question, the answer, or a gradient from the language model. Our boundary-directed attacks build on the isotropic embedding-displacement attack of Bhagwatkar et al. [2026]: we target the quantization boundary directly and separate crossing it from displacing past it. Our primary contribution is not the attack objective itself but the path-dependence analysis it enables across tokenizers, modalities, and downstream uses.
Our contributions are as follows.
We establish path-dependence as the organizing property of tokenizer robustness: supervised and unsupervised attacks collapse opposite downstream paths, so no single number characterizes a tokenizer and robustness must be measured per path. To our knowledge, this is the first systematic adversarial evaluation of discrete tokenizers in the medical domain.
We red-team a deployed generative medical model (LLaVA-Med) through its tokenizer, showing a label-free, imperceptible perturbation makes it invent or erase disease with no access to the language model or the task.
We isolate displacement past the quantization boundary, not the token flip, as the cause of harm: a near-100% flip rate does not predict diagnostic risk.
In our comparison, domain-specific pretraining does not provide robustness: MedITok is the most clean-accurate tokenizer and the most fragile under attack.
We evaluate six defenses and find none repairs every failure mode; the gap survives adaptive attack [1], and only stochastic quantization smoothing carries a formal guarantee [6].
Related work
Adversarial robustness in medical imaging. Adversarial examples are small, designed perturbations that cause misclassification [29, 13], typically optimized via projected gradient descent (PGD) [22, 4, 8]. In medical imaging, imperceptible perturbations cause diagnostic failure in chest-radiograph, retinal, and histopathology classifiers [11]. More aggressive attacks like CT-GAN insert or remove visible disease signs from volumetric scans via generative models [24]. These are content-level manipulations that produce qualitatively different failure modes from the bounded, pixel-space attacks we study.
Discrete image tokenization. Vector-quantized models replace continuous encoder outputs with entries from a finite codebook [31, 9]. Later work improves compression, uses multiple codebooks, or replaces learned codebooks with scalar quantization [32, 21, 23], and medical variants like MedITok extend these to clinical tasks [20]. Despite their increasing use, the adversarial failure modes introduced by the quantization stage remain underexplored.
Robustness of tokenized representations. Prior work has shown that adversarial perturbations disrupt latent representations and autoencoder reconstructions [12, 19], but on continuous encoders; the discrete quantization step has received almost no attention. Closest to ours, Bhagwatkar et al. [ [3] attack general-purpose discrete tokenizers by maximizing pre-quantization embedding displacement and show that the resulting failure modes transfer across classification, retrieval, and captioning, including targeted attacks that steer a multimodal model’s generated caption toward an attacker-chosen, sometimes unsafe, string. This is red-teaming of generative multimodal systems through the tokenizer, but on general-domain models and imagery. We extend this line to the medical domain and to a deployed medical vision-language model, and target the quantization boundary directly rather than maximizing isotropic displacement: bounded and unbounded objectives separate crossing a boundary from displacing past it, motivated by prior work showing that distance to the nearest decision boundary predicts local vulnerability [10, 25].
Defending against adversarial attacks. Certified robustness gives a mathematical guarantee via randomized smoothing [6], while many defenses instead rely on obfuscated gradients that stop a naive but not an adaptive attacker [1], which we test via Backward Pass Differentiable Approximation (BPDA). Closest to our defense setting, Räber et al. [2025] show a compression-based purification’s adaptive resistance depends on decoder realism, motivating our decoder fine-tune’s GAN-based objective.
Methods
Figure 2 shows our evaluation pipeline. A tokenizer’s output is consumed in two ways: discrete codes are decoded back into pixels before classification (reconstruction path), or a classifier reads the post-quantization features directly (token path). The two paths are mechanistically independent at the quantizer boundary, so an attack can collapse one while leaving the other intact. We evaluate both paths simultaneously and instrument the quantizer with token flip rate and embedding displacement to localize where each attack causes harm.

Figure 2. Evaluation pipeline. A bounded pixel-space perturbation enters the tokenizer. The resulting codes are consumed along a reconstruction path () or a probe path ( on post-quantization features). Metrics are measured at the marked stages.
Setup
Let be an input image. A discrete tokenizer consists of an encoder , quantizer , and decoder : the encoder maps to continuous latents , the quantizer assigns each latent a discrete code (a quantization boundary is where this assignment changes, so a latent pushed across one flips its token), and the decoder reconstructs for a downstream classifier. A linear probe operating on directly, with no decoder, lets us separate damage at the tokenizer level from damage that survives reconstruction. An adversary constructs with .
We evaluate four tokenizers (LlamaGen VQ-16, FSQ, UniTok, MedITok) spanning the main quantization strategies, and three medical imaging datasets (Kermany chest X-ray, APTOS fundus photography, ISIC dermoscopy) covering different modalities and classifier architectures. Tables, full dataset details, and hyperparameters are in Appendix B and Appendix A. We report three metrics per image: token flip rate, embedding displacement, and downstream diagnostic area under the ROC curve (AUC); the certified radius metric applies only to Stochastic Quantization Smoothing (SQS), and reconstruction fidelity (LPIPS/PSNR/SSIM) applies only to the reconstruction path, both introduced in Section 4.3 and formally defined in Appendix C.
Attack methods
Our attacks differ in what information the adversary needs and divide into two classes:
Supervised (M0, M1): require the diagnostic label and backpropagate a task loss through the classifier, differing only in whether the gradient also routes through the tokenizer.
Unsupervised (M2): use no labels and operate purely on the tokenizer’s geometry, specifically how far a latent sits from its nearest quantization boundary, available to any adversary holding just the public tokenizer weights.
All attacks use PGD [22] under the same budget, differing only in objective.
M0, direct classifier attack (reference baseline). The adversary optimizes the perturbation directly against the classifier loss, bypassing the tokenizer. This is a reference confirming the downstream classifier is itself vulnerable.
M1, tokenizer-mediated supervised attack. The adversary optimizes the classifier loss through the full tokenizer pipeline, so the perturbation is shaped by the encoder, quantizer, and decoder. This is our supervised, task-aware attack.
M2-unb, boundary-directed geometric attack (unbounded). Without labels, the adversary maximizes a margin objective driving each latent towards its nearest competing quantization boundary and past it. This is our unsupervised, quantization-aware attack. Unlike prior displacement objectives [3], which maximize pre-quantization displacement isotropically, ours targets codebook geometry directly, though it degenerates toward pure displacement once tokens flip, a point we revisit in § 4.1.
| Attack | Label | Classifier grads | Gradient path | Objective | Role |
| M0 | Required | Required | Classifier only (bypasses tokenizer) | Classifier loss | Reference baseline |
| M1 | Required | Required | Encoder, quantizer, decoder, classifier | Classifier loss | Supervised attack |
| M2-unb | Not needed | Not needed | Tokenizer only (public weights) | Margin toward and past the nearest boundary | Unsupervised attack |
| M2-sat | Not needed | Not needed | Tokenizer only (public weights) | Same margin, stops rewarding once a token flips | Control for M2-unb |
Table 1. Attack settings and adversary access. All attacks use PGD under the same budget.
M2-sat, boundary-directed geometric attack (saturated). Identical to the unbounded variant until a token flips, at which point the objective stops rewarding further movement. It therefore flips a comparable fraction of tokens but does not push latents further once they cross a boundary, separating the effect of a token flip from that of continued displacement. This serves as a mechanistic control for the unbounded attack.
FSQ has no learned codebook and therefore no Voronoi boundaries. Its margin is measured against the nearest scalar rounding threshold, so its geometric attack is an architecture-specific adaptation diverging from other tokenizers.
Defense methods
We evaluate six defenses spanning three approaches: noise-based (Pixel-noise, SQS), encoder fine-tuning (Encoder-FT, Encoder-FT+SQS), and decoder fine-tuning (Decoder-FT, Encoder-FT+Decoder-FT). Each is also tested for robustness under adaptive attack via Backward Pass Differentiable Approximation (BPDA) and a held-out Carlini-Wagner attack.
Pixel-noise. Additive Gaussian noise applied directly to the input pixels before the tokenizer.
Stochastic Quantization Smoothing (SQS). Noise injected at the quantization step, then majority-voted over repeated re-quantizations [6], with hyperparameters swept per tokenizer.
Encoder-FT. Encoder-only fine-tuning against a boundary-margin loss on adversarial examples, pushing clean and adversarial inputs toward the same code. Adapts Bhagwatkar et al. [2026]’s unsupervised fine-tuning defense to our boundary-margin objective. Combined with SQS as Encoder-FT+SQS.
Decoder-FT. Decoder-only fine-tuning with a GAN, perceptual, and reconstruction loss on clean and adversarial codes, so reconstructions stay plausible even from attacker codes. Realistic reconstructions resist adaptive purification better than pixel-distortion minimizing reconstructions [27]. Combined with Encoder-FT as Encoder-FT+Decoder-FT.
BPDA. A straight-through gradient estimate through the quantization step, attacking the defended model directly rather than reusing a perturbation from the undefended tokenizer [1]. This tests whether a defense’s apparent robustness survives an attacker who knows the defense exists.
Held-out Carlini-Wagner attack. A second adaptive check with a different objective and norm than any attack the defenses were tuned against [4].
Results
We evaluate four attacks across four tokenizers and three medical imaging datasets, extend the strongest to a deployed generative model, and test whether any of six defenses closes both failure modes.
Attack results
The reference attack M0 (perturbing classifier directly, no tokenizer) drives AUC to 0.00 at every budget on every dataset, confirming the downstream classifier alone is vulnerable. All numbers below use the budget on the normalized input, averaged over the three datasets at unless stated otherwise.
The same perturbation breaks a tokenizer differently depending on downstream use (Figure 3, Table 2). M1 collapses reconstruction (AUC , all tokenizers) while sparing the probe (0.74–0.78); M2-unb reverses this, keeping reconstruction usable (0.85–0.92) while collapsing MedITok’s probe (0.919 to 0.239). No single number describes a tokenizer’s robustness because it depends on the inference path. The collapse concentrates in multi-codebook tokenizers; VQ-16’s probe barely moves (drop 0.028), failing on reconstruction instead.

Figure 3. Path-dependence. Mean adversarial AUC on the reconstruction (blue) and probe (purple) paths. The green line marks each tokenizer’s clean baseline (value labeled top-left of each panel). The two attacks damage opposite paths.
| Tokenizer | Attack | Flip% | ||
| LlamaGen VQ-16 | Clean (no attack) | 0.945 | 0.863 | — |
| LlamaGen VQ-16 | M1 (supervised) | 0.005 | 0.762 | 85.0 |
| LlamaGen VQ-16 | M2-sat (geom., bounded) | 0.940 | 0.864 | 96.7 |
| LlamaGen VQ-16 | M2-unb (geom., unbounded) | 0.901 | 0.836 | 98.0 |
| MedITok | Clean (no attack) | 0.954 | 0.919 | — |
| MedITok | M1 (supervised) | 0.000 | 0.744 | 81.3 |
| MedITok | M2-sat (geom., bounded) | 0.951 | 0.868 | 99.3 |
| MedITok | M2-unb (geom., unbounded) | 0.923 | 0.239 | 98.6 |
| UniTok | Clean (no attack) | 0.946 | 0.907 | — |
| UniTok | M1 (supervised) | 0.000 | 0.764 | 83.4 |
| UniTok | M2-sat (geom., bounded) | 0.939 | 0.886 | 99.0 |
| UniTok | M2-unb (geom., unbounded) | 0.921 | 0.721 | 99.0 |
| FSQ | Clean (no attack) | 0.847 | 0.855 | — |
| FSQ | M1 (supervised) | 0.000 | 0.780 | 43.7 |
| FSQ | M2-sat (geom., bounded) | 0.842 | 0.764 | 96.5 |
| FSQ | M2-unb (geom., unbounded) | 0.850 | 0.769 | 80.6 |
Table 2. Attack × inference path at , mean over three datasets. Clean is the no-attack AUC. On the learned-codebook tokenizers, M2-sat flips as many tokens as M2-unb yet damages neither path. AUC columns measure attack success ( = more damage). per cell.
This path-split also clarifies what causes the harm. M2-sat and M2-unb flip nearly identical fractions of tokens on learned-codebook tokenizers, both near 100%. Only M2-unb, which keeps pushing past the boundary, collapses the probe (MedITok: 0.24 vs. 0.87 for M2-sat, at matched flip rates). At matched flips, it moves the embedding roughly twice as far, on every tokenizer and modality except FSQ (Appendix § 14.§ 2). Harm tracks displacement past the boundary, not the flip itself, and a 100% flip rate says nothing about diagnostic risk.
The tokenizer architecture shapes how badly each path fails. MedITok and UniTok share an architecture but differ in pretraining data; other training differences may also contribute, so this comparison is suggestive rather than causal. In it, medical pretraining does not provide robustness. MedITok has the best clean probe AUC (0.919) yet the worst M2-unb collapse (drop 0.680, 74% of its clean AUC, vs. 0.186/0.086/0.028, i.e. 21%/10%/3%, for UniTok/FSQ/VQ-16), an ordering that holds across all three modalities. The most clinically informative representation is the most attackable.
FSQ stands apart. Its reconstruction still collapses to 0.000 under M1, so it is not robust in general; it holds up only against the geometric attack (probe/recon drops of 0.09/0.00). This reflects its codebook-free design: its margin targets scalar rounding thresholds rather than Voronoi boundaries, and its clean baseline is already weak (0.810 Kermany, 0.797 ISIC). Displacement is read within a tokenizer only ( for FSQ to 75 for VQ-16 under M2-unb).
Generative downstream
To test whether the same failure propagates beyond classification, we attack LLaVA-Med, a multimodal medical visual question answering (VQA) model whose vision encoder is MedITok. We run the identical label-free M2-unb attack on the input image, pass the perturbed image through the frozen VQA model, and read its answer (Figure 4). The attack corrupts modality and anatomy answers across all three modalities and, on the clinical questions, breaks in both directions: it erases disease that is present and invents disease that is absent. As in § 4.1, M2-unb and its saturated counterpart M2-sat flip the same of tokens, yet M2-unb displaces the embedding roughly twice as far and destroys nearly every answer (1% still correct) while M2-sat leaves 98% intact; a matched- random perturbation, which flips 75% of tokens, is likewise harmless. Harm tracks displacement past the boundary, not the flip. This is MedITok-only and inference-only, on a small set of images; full transcripts are in Appendix § 13.

Figure 4. Verbatim answers from a frozen LLaVA-Med (vision encoder MedITok) at . Green answers agree with the clean image; red answers are corrupted. Rows 3–4 are the same question on two images of opposite class. pooled.
Defense results
Section 4.1 showed that the reconstruction and token paths fail under different attacks. Table 3 reports reconstruction-path and probe-path AUC under M2-unb at the worst-case budget (), averaged over three datasets; full per-dataset results and the Encoder-FT+SQS combination are in Appendix § 14.§ 3.
| Tokenizer | Path | Clean | None | Pixel-noise | SQS | Encoder-FT | Decoder-FT | +Decoder-FT |
| LlamaGen VQ-16 | Recon | 0.942 | 0.760 | 0.766 | 0.661 | 0.740 | 0.896 | 0.890 |
| LlamaGen VQ-16 | Probe | 0.871 | 0.728 | 0.738 | 0.724 | 0.756 | 0.728 | 0.756 |
| MedITok | Recon | 0.947 | 0.697 | 0.889 | 0.719 | 0.720 | 0.869 | 0.870 |
| MedITok | Probe | 0.913 | 0.104 | 0.828 | 0.105 | 0.125 | 0.104 | 0.125 |
| UniTok | Recon | 0.937 | 0.856 | 0.902 | 0.843 | 0.847 | 0.890 | 0.900 |
| UniTok | Probe | 0.903 | 0.409 | 0.835 | 0.410 | 0.653 | 0.409 | 0.653 |
| FSQ | Recon | 0.831 | 0.775 | 0.773 | 0.761 | 0.756 | 0.881 | 0.840 |
| FSQ | Probe | 0.786 | 0.596 | 0.597 | 0.605 | 0.630 | 0.596 | 0.630 |
Table 3. Defense comparison, reconstruction-path vs. probe-path AUC. AUC under M2-unb, , mean over the three datasets ( each). Clean is the no-attack AUC. None is the undefended attacked AUC. Encoder-FT and Encoder-FT+Decoder-FT use the encoder fine-tuned at the attack’s own budget.
No single defense closes both paths simultaneously for any tokenizer. The defense behaviors fall into three groups:
Token-path and partial reconstruction recovery. Pixel-noise is the strongest token-path defense, raising MedITok probe AUC from 0.104 to 0.828 and UniTok from 0.409 to 0.835. For these two tokenizers it also partially recovers the reconstruction path (0.697 → 0.889 for MedITok; 0.856 → 0.902 for UniTok). For VQ-16 and FSQ, pixel-noise provides negligible recovery on either path.
Reconstruction-path recovery only. Decoder-FT is the strongest reconstruction-path defense (MedITok: 0.697 → 0.869), but leaves probe AUC at the undefended level, since fine-tuning the decoder does not alter the pre-quantization features the probe reads. Encoder-FT+Decoder-FT provides no additional probe-path benefit over Decoder-FT alone.
Attack-dependent protection. SQS retains 0.73–0.94 of clean AUC against the boundary-directed attacks (M2-sat/M2-unb), but collapses to 0.000 on every tokenizer against the supervised attack M1 (Appendix § 14.§ 3, Figure 8). Combining it with Encoder-FT (Encoder-FT+SQS) changes probe AUC by less than 0.013 relative to Encoder-FT alone.

Figure 8. SQS protects against boundary-directed attacks only, not supervised ones. Adversarial AUC at under SQS’s selected hyperparameters, mean over datasets, by attack: M1 (supervised) collapses to 0.000 on every tokenizer; M2-sat/M2-unb (boundary-directed) retain most of their clean AUC; gray diamonds mark each tokenizer’s clean (undefended, unattacked) reconstruction-path AUC ( per dataset).
Figure 5 visualizes the reconstruction and probe tradeoff across all four tokenizers for the three main defenses.

Figure 5. No defense protects both paths at once. Reconstruction-path (blue) and probe-path (purple) AUC under M2-unb, , mean over datasets, for None (N), Pixel-noise (PN), and Decoder-FT (DFT). Green line marks each tokenizer’s clean baseline (value labeled top-left of each panel). Decoder-FT recovers reconstruction but not the probe. Pixel-noise raises both, and only for MedITok and UniTok ( per dataset).
Adaptive robustness. Static evaluation overstates defense strength when the adversary can compute gradients through the defense, a failure mode known as obfuscated gradients [1]. We evaluate this with two adaptive attacks:
BPDA (straight-through gradient estimation through quantization) collapses the reconstruction AUC of Encoder-FT, Decoder-FT, and Encoder-FT+Decoder-FT from 0.858–0.996 in static evaluation to approximately 0.000 on every tokenizer except FSQ, which retains 0.014–0.781 on APTOS and ISIC. The static improvements therefore reflect gradient obfuscation rather than genuine robustness.
Encoder-FT cross-family generalization. Encoder-FT resists an attacker using the same margin objective it was trained against (mean AUC 0.800–0.915), but collapses under BPDA’s decode-and-classify loss and a held-out Carlini-Wagner attack (mean AUC on learned-codebook tokenizers; FSQ retains 0.234–0.264). Its robustness generalizes within the attack family used for training but not across attack families.
Formal certification. SQS provides a certified radius guarantee [6] rather than an empirical result a stronger attacker could overturn. Certification rate alone can nonetheless be misleading: FSQ achieves certification rate on Kermany and APTOS while its accuracy is exactly 0.500, at random chance. Full per-defense numbers, the grid, and certification rates and radii are in Appendix § 14.§ 3.
Reconstruction fidelity. § 4.1–§ 4.3 measure damage as classifier AUC. Measured instead on the reconstructed image (LPIPS/PSNR/SSIM vs. clean; full tables in Appendix § 14.§ 3), the same path-dependence holds where fidelity degrades monotonically with budget, and M2-unb is consistently more damaging than M2-sat at same budget (MedITok LPIPS 0.163 0.472 at ) with continued displacement past the boundary costs reconstruction quality, not just a flipped code. Decoder-FT is the strongest fidelity defense; Encoder-FT helps fidelity but far less than Decoder-FT.
Limitations
Results are means over three datasets with small subsets ( per attack cell, per defense cell), without confidence intervals or significance tests, so small differences between cells should not be over-interpreted; our main conclusions rest on large effects (e.g., reconstruction-path AUC and token-path AUC 0.919 0.239). The generative evaluation has a narrow scope (one vision-language model, LLaVA-Med with MedITok; inference-only; 20 images/dataset), and we red-team the generative model but test no defense on it, so whether the behavior holds for other architectures, and whether our defenses transfer there, is unknown. We also do not compare directly against the embedding-displacement attack of Bhagwatkar et al. [2026] under identical conditions. VQ-16’s margin was computed on unnormalized latents while its quantizer normalizes them, though all reported metrics use the true quantizer. The adaptive suite covers only BPDA and one held-out Carlini-Wagner check. SQS is not combined with Decoder-FT and reconstruction fidelity was measured only for the fine-tuning defenses, not SQS or Pixel-noise.
Discussion and conclusion
Discrete image tokenizers are now upstream of many deployed medical AI systems, from classifiers to generative vision-language models, connecting pixel-space perturbations directly to diagnostic outcomes through a quantization step that has been almost entirely overlooked in the adversarial robustness literature. Our red-teaming shows this step is a genuine attack surface: an imperceptible, label-free perturbation, computed from public tokenizer weights alone, propagates through the tokenizer to make a deployed medical VQA model invent or erase disease.
The central finding is that robustness at this stage is not a single property. The same perturbation causes qualitatively different damage depending on which downstream path it travels, collapsing reconstruction while sparing the token path, or the reverse. We term this path-dependence. It means no single robustness number characterizes a tokenizer, and a defense optimized for one path cannot be assumed to generalize to the other. The mechanism of harm is displacement past the quantization boundary, not the token flip itself, so a near-100% flip rate is uninformative about diagnostic risk. In our comparison, the medical-domain tokenizer pairs the best clean accuracy with the worst token-path fragility, and none of the six defenses we evaluate closes both failure modes; several collapse once the attacker adapts.
For clinical deployment, the implications are concrete. First, a tokenizer’s robustness must be evaluated on the specific downstream path a system actually uses, against an adaptive adversary, and reported as diagnostic outcome rather than token statistics; a tokenizer that looks robust on one path can be destroyed on the other. Second, because the vulnerable component is shared and its weights are public, a single weakness can propagate to models built on it, as we show for LLaVA-Med; whether other generative systems that a clinician might trust to read a scan, or that a patient might query directly, inherit it remains to be tested. Third, the same imperceptible perturbations may also arise from ordinary acquisition, compression, and transmission artifacts, so both failure modes can occur without any adversary in deployed clinical pipelines. As medical AI moves toward multimodal and report-generating systems built on discrete tokenizers, characterizing and defending the quantization step is a prerequisite for safe deployment.
Broader impact
Red-teaming a component of deployed medical AI carries dual-use risk. We mitigate it by attacking only public, already-released tokenizers and by pairing every attack with a defense evaluation, so the net contribution is defensive. The risk we emphasize is not a novel attack but false confidence: defenses that look robust yet collapse under an adaptive adversary, and tokenizers assumed robust on one downstream path but not another. Because the same imperceptible perturbations can also arise from ordinary acquisition, compression, and transmission noise, these failures threaten any system built on the tokenizer, whether a clinician relies on it in the loop or a patient queries it directly, even absent a deliberate adversary.
Acknowledgments and Disclosure of Funding
This work was conducted through the Algoverse AI Research program, which also provided the compute resources. The authors received no external funding for this work.
Hyperparameters and experimental setup
Unless otherwise stated, all experiments in our paper use the shared configuration in Table 4. Attack evaluation is performed on a fixed 256-image subset per dataset. For defense experiments, this subset is split once using a seeded stratified split into disjoint 128-image SEL and REPORT sets. SEL is used for fine-tuning and hyperparameter selection, while all reported defense results are computed only on REPORT.
| Parameter | Value |
| General setup | |
| GPU | 1 × NVIDIA A100-SXM4-80GB |
| Software | PyTorch , torchvision , timm 1.0.8 |
| Image size | 256 × 256 |
| Random seed | 42 |
| Attack evaluation | 256 images / dataset |
| Defense selection / report | 128 / 128 images |
| PGD attacks | |
| budget | |
| Steps / learning rate | 50 / 0.01 |
| Batch size | 4–8 |
| Encoder-FT | |
| Training images | 128 |
| Learning rate / batch size | / 32 |
| Max epochs | 40 |
| Early stopping | patience 2, minimum 3 epochs |
| Improvement threshold | 10% relative |
| Clean-AUC guard | maximum 10% drop |
| Decoder-FT | |
| Training images | 128 |
| Training budget | 8/255 |
| Decoder learning rate | (VQ-16, FSQ); (MedITok, UniTok) |
| Discriminator learning rate | |
| Batch size / max epochs | 8 / 40 |
| Loss weights (adv., perc., recon., robust) | 0.1, 1.0, 1.0, 1.0 |
| SQS | |
| Noise scale | |
| Additional flat-sweep | |
| Vote count | |
| Spatial weight | |
| Agreement threshold (%) | |
| Adaptive multiplier | |
| Logit-ensemble | |
| Adaptive attacks and certification | |
| BPDA steps / learning rate | 50 / 0.01 |
| CW- budget | |
| CW confidence | 0 |
| CW steps / learning rate | 50 / 0.01 |
| Certification draws | 100 |
| Clopper–Pearson | 0.001 |
Table 4. Hyperparameters and experimental setup. Shared across four tokenizers and three datasets unless otherwise noted. Code, checkpoints, extended results, and mathematical formulations are publicly available at https://github.com/akashyall34/tokenizer-adversarial-robustness.
Encoder-FT and Decoder-FT are trained on cached adversarial examples from the attack sweep in § 4.3. Encoder-FT trains one checkpoint per attack budget, whereas Decoder-FT uses a single checkpoint trained at 8/255. Both use only the SEL split and apply early stopping to their training loss; the REPORT split is never used for model or hyperparameter selection. Attack batch size is reduced from 8 to 4 for APTOS and for MedITok/UniTok on ISIC because of memory requirements.
Models and datasets
We evaluate four tokenizers spanning the main quantization strategies (Table 5): LlamaGen VQ-16’s [28] single learned codebook, representative of the VQ-VAE family; FSQ’s [23] codebook-free fixed scalar rounding; and UniTok’s [21] eight parallel cosine-similarity sub-quantizers, shared exactly by its medical-domain counterpart MedITok [20]. UniTok and MedITok share an architecture and differ in pretraining data (general-domain vs. clinical images), giving a matched-architecture comparison of domain-specific pretraining; other training differences may also contribute, so it is not a fully causal test.
Table 5. The four tokenizers evaluated, spanning three quantization strategies. UniTok and MedITok share the same multi-codebook architecture but differ in pretraining data, giving a matched-architecture comparison of domain-specific pretraining.
Our evaluation spans three medical imaging datasets (Table 6), chosen to test whether our findings transfer across imaging modalities, classifier architectures, and diagnostic tasks; in every case the underlying multi-class labels are reduced to one clinically meaningful binary decision. Radiography, fundus photography, and dermoscopy differ in acquisition modality, image statistics, and class structure, so agreement across all three is evidence that a tokenizer vulnerability is a property of discrete quantization itself, not of any single domain. Full dataset details, including collection, grading criteria, and splits, are in Appendix § 12.
Table 6. Three medical imaging datasets spanning different modalities, diagnostic tasks, and classifier architectures. Clean AUC is measured on the unperturbed test subset used throughout all experiments.
Each dataset is scored along both inference paths (reconstruction and probe) on a fixed, class-balanced 256-image subset (seed 42) held constant across every attack. Defense evaluation (§ 4.3) further splits this into seeded 128-image halves, so no defense is scored on the images used to tune it. Attack budgets, probe dimensionalities, and full hyperparameters are in Appendix § 9.
Metrics
We track three quantities per image, averaged over the evaluation set (Table 7). A fourth metric, certified radius, applies only to SQS and is defined where it is used (§ 4.3). § 4.3’s reconstruction-fidelity paragraph additionally reports LPIPS, PSNR, and SSIM between the attacked reconstruction and the clean original. FID is not reported (Appendix § 14.§ 3) because is below the sample size FID needs to be reliable.
| Metric | Measures |
| Token flip rate | Share of tokens reassigned to a different code after the attack |
| Embedding displacement | Distance the pre-quantization representation moves in latent space; keeps growing after a flip, so values are only comparable within one tokenizer |
| Downstream diagnostic AUC | Classifier AUC on attacked vs. clean images, on the same test set; chosen over accuracy for being threshold-free and robust to class imbalance |
Table 7. Three evaluation metrics used throughout. Token flip rate and embedding displacement are measured at the quantizer boundary; downstream AUC is measured at the classifier output along each inference path independently.
Dataset details
Table 8. Dataset metadata. All attack evaluations use a class-balanced subset of 256 images (128 per class). The ISIC split is generated once with a fixed random seed.
Generative downstream: full results
Setup. We attack the MedITok vision tower of a frozen LLaVA-Med with the objectives of § 3.2 unchanged (Adam, 50 steps, lr = , projection), then pass the perturbed image to the full model and read its answer. Nothing is fine-tuned, and the attack never observes the question, the answer, or any gradient from the language decoder. We use 20 images per dataset, balanced across classes, three questions each, at . M1 is not applicable here: it attacks through a classification head, and this path has no probe.
Counting an answer correct. An answer is correct when it agrees with the dataset label: for a diagnostic question its stated verdict must match the ground-truth class, and for a modality or body-region question the modality or anatomy it names must match the dataset’s. We read the verdict the answer declares rather than searching for keywords, so an answer naming a different modality is not counted correct for mentioning the right word in passing.
The attack needs budget, not flips
Table 9 is the central result. At the smallest budget the tokens are already almost entirely flipped, yet most answers survive. As the budget grows the flip rate barely moves while the answers collapse. What does grow with the budget is displacement, and M2-sat makes the same point from the other side: it flips just as many tokens at every budget, displaces about half as far, and leaves the answers alone.
Table 9: Flip rate, displacement and answer accuracy on the modality and body-region questions, pooled over the three datasets ( image-question cells the model answers correctly when clean). Flip rate is saturated from and cannot explain the collapse; displacement tracks it.
| M2-unb | M2-sat | Random | ||||||
| Flip% | Disp. | Correct | Flip% | Disp. | Correct | Flip% | Correct | |
| 2/255 | 98.7 | 50.6 | 59.0% | 99.5 | 24.9 | 96.0% | 28.3 | 99.0% |
| 4/255 | 99.8 | 65.1 | 13.0% | 99.9 | 32.2 | 97.0% | 54.5 | 99.0% |
| 8/255 | 100.0 | 71.3 | 1.0% | 100.0 | 38.6 | 98.0% | 74.6 | 98.0% |
Table 9.
Per-question and per-direction detail
Scope. These results cover MedITok only, because it is the only tokenizer in our study with a released multimodal checkpoint, and are inference-only. The diagnostic questions have few clean-correct images (17 for APTOS, 16 for ISIC), so Table 12 reports counts rather than rates. Greedy decoding is sensitive to small numerical differences in the encoder, so wording varies between runs
| Dataset | Error direction | 4 | 8 | |
| APTOS | Disease erased (false negative) | 4/10 | 6/10 | 3/10 |
| APTOS | Disease invented (false positive) | 6/7 | 7/7 | 7/7 |
| ISIC | Malignant read as benign | 6/6 | 6/6 | 6/6 |
| ISIC | Benign read as malignant | 1/10 | 0/10 | 2/10 |
Table 12. Direction of diagnostic error under M2-unb, on images answered correctly when clean. The attack never sees the label and moves the answer either way; which direction dominates differs by dataset. These are counts, not incidence rates.
Table 10: The same effect on single images. Each answer is verbatim under M2-unb. At the token sequence is already 98% different from the clean one and the answer is still right; it only turns wrong once displacement grows.
| Image | (flip%, disp.) | Answer under M2-unb |
| Chest X-ray<br>Which part of the body? | 2 (98.0, 43.4) | This image belongs to the thoracic region of the body, specifically showing the thoracic aorta and its branches. . . |
| 4 (100.0, 57.9) | This image belongs to the abdominal region of the body. The presence of the liver, spleen. . . | |
| 8 (100.0, 66.7) | This image belongs to the abdominal region, specifically showing the liver and surrounding structures. | |
| Fundus<br>Which part of the body? | 2 (98.0, 46.0) | This image belongs to the eye, specifically showing the retina and optic disc. |
| 4 (100.0, 63.4) | This image belongs to the brain. The brain is a vital organ located within the skull. . . | |
| 8 (100.0, 69.0) | This image belongs to the abdominal region, specifically showing the liver and surrounding structures. | |
| Dermoscopy<br>What modality? | 2 (98.0, 42.3) | The image is a dermoscopic image, which is a specialized imaging technique that uses a dermoscope. . . |
| 4 (100.0, 67.6) | The image is a computed tomography (CT) scan of the abdomen. | |
| 8 (100.0, 78.9) | The image is a histopathological slide, a microscopic examination of stained tissue. |
Table 10.
Table 11: Answer accuracy (%) by dataset and question, images per row.
| Dataset | Question | Clean | M2-unb 2 | M2-unb 4 | M2-unb 8 | M2-sat 2 | M2-sat 4 | M2-sat 8 | Random 2 | Random 8 |
| Kermany | Modality | 100.0 | 75.0 | 5.0 | 0.0 | 100.0 | 100.0 | 100.0 | 100.0 | 100.0 |
| Kermany | Body region | 100.0 | 90.0 | 60.0 | 5.0 | 100.0 | 100.0 | 100.0 | 100.0 | 100.0 |
| Kermany | Pneumonia2 | 50.0 | 50.0 | 50.0 | 30.0 | 55.0 | 50.0 | 47.4 | 50.0 | 50.0 |
| APTOS | Modality | 100.0 | 55.0 | 0.0 | 0.0 | 100.0 | 100.0 | 100.0 | 100.0 | 100.0 |
| APTOS | Body region | 100.0 | 65.0 | 0.0 | 0.0 | 100.0 | 100.0 | 100.0 | 100.0 | 100.0 |
| APTOS | Referable DR | 85.0 | 45.0 | 25.0 | 40.0 | 80.0 | 85.0 | 70.0 | 85.0 | 90.0 |
| ISIC | Modality | 95.0 | 10.0 | 0.0 | 0.0 | 80.0 | 85.0 | 90.0 | 95.0 | 90.0 |
| ISIC | Benign/malignant | 80.0 | 45.0 | 50.0 | 40.0 | 80.0 | 70.0 | 60.0 | 75.0 | 80.0 |
Table 11.
and the smallest breaking for an individual image can shift by one step; the pooled rates are stable, and the quotes in Figure 4 come from the run that produced the displayed images.
Extended results and analysis
Flips versus damage
Figure 6 expands the mechanism summarized by the flip column of Table 2: the bounded and unbounded geometric attacks reach near-identical token flip rates, yet only the unbounded variant, which keeps displacing the representation past the boundary, collapses the probe.

Figure 6. Flips do not imply damage. Bounded (M2-sat) and unbounded (M2-unb) geometric attacks at , mean over datasets. Left: token flip rates are near-identical. Right: adversarial probe AUC diverges sharply; gray diamonds mark each tokenizer’s clean (unattacked) probe AUC. Same flips, opposite diagnostic outcomes.
Cross-tokenizer generalization across modalities
Figure 7 sweeps the M2-unb budget on both paths. MedITok collapses fastest on the token path; all tokenizers resist on the reconstruction path until the largest budget. Table 15–Table 16 give the per-dataset breakdown.

Figure 7. Budget sweep under M2-unb, mean over the three datasets. Left: token (probe) path. Right: reconstruction path. Same grid used throughout this paper; dashed horizontal lines mark each tokenizer’s own clean (unattacked) AUC, same color as its solid adversarial-AUC curve; see Table 15–Table 16 for the per-dataset numbers this figure averages.
| Tokenizer | clean | |||||
| Kermany | ||||||
| LlamaGen VQ-16 | 0.877 | 0.904 | 0.904 | 0.874 | 0.874 | 0.731 |
| MedITok | 0.938 | 0.780 | 0.509 | 0.204 | 0.095 | 0.056 |
| UniTok | 0.921 | 0.912 | 0.880 | 0.790 | 0.587 | 0.485 |
| FSQ | 0.869 | 0.865 | 0.863 | 0.856 | 0.839 | 0.821 |
| APTOS | ||||||
| LlamaGen VQ-16 | 0.951 | 0.946 | 0.926 | 0.879 | 0.822 | 0.734 |
| MedITok | 0.987 | 0.887 | 0.570 | 0.134 | 0.054 | 0.038 |
| UniTok | 0.980 | 0.964 | 0.914 | 0.791 | 0.511 | 0.398 |
| FSQ | 0.954 | 0.938 | 0.891 | 0.730 | 0.547 | 0.491 |
| ISIC | ||||||
| LlamaGen VQ-16 | 0.762 | 0.758 | 0.777 | 0.753 | 0.731 | 0.661 |
| MedITok | 0.834 | 0.814 | 0.725 | 0.378 | 0.228 | 0.198 |
| UniTok | 0.821 | 0.732 | 0.696 | 0.581 | 0.464 | 0.410 |
| FSQ | 0.743 | 0.729 | 0.723 | 0.721 | 0.677 | 0.648 |
Table 15. Token-path robustness (probe AUC) under M2-unb, all datasets, full grid. clean is the unattacked probe AUC. in the pixel convention. MedITok collapses on every dataset. Lower is a stronger attack. per dataset.
| Tokenizer | clean | |||||
| Kermany | ||||||
| LlamaGen VQ-16 | 0.957 | 0.943 | 0.931 | 0.923 | 0.787 | 0.679 |
| MedITok | 0.959 | 0.956 | 0.964 | 0.941 | 0.765 | 0.626 |
| UniTok | 0.934 | 0.939 | 0.930 | 0.925 | 0.873 | 0.845 |
| FSQ | 0.810 | 0.820 | 0.825 | 0.814 | 0.810 | 0.785 |
| APTOS | ||||||
| LlamaGen VQ-16 | 0.997 | 0.992 | 0.989 | 0.976 | 0.943 | 0.926 |
| MedITok | 0.995 | 0.993 | 0.986 | 0.978 | 0.942 | 0.880 |
| UniTok | 0.993 | 0.994 | 0.991 | 0.983 | 0.967 | 0.939 |
| FSQ | 0.932 | 0.919 | 0.929 | 0.915 | 0.905 | 0.883 |
| ISIC | ||||||
| LlamaGen VQ-16 | 0.882 | 0.890 | 0.892 | 0.803 | 0.767 | 0.650 |
| MedITok | 0.910 | 0.902 | 0.878 | 0.850 | 0.707 | 0.607 |
| UniTok | 0.910 | 0.907 | 0.887 | 0.854 | 0.794 | 0.764 |
| FSQ | 0.797 | 0.801 | 0.794 | 0.821 | 0.784 | 0.686 |
Table 16. Reconstruction-path robustness (recon AUC) under M2-unb, all datasets, full grid. The geometric attack barely degrades this path except at the largest budget. in the pixel convention; lower is a stronger attack. per dataset.
Table 13 summarizes the flip-vs-displacement dissociation at : bounded and unbounded attacks reach nearly identical flip rates, yet only M2-unb’s larger embedding displacement collapses the probe. Table 14 reports the full displacement grid per dataset; on every learned-codebook tokenizer M2-unb displaces roughly twice as far as M2-sat at matched flip rates, stable across modalities. FSQ is the exception.
| Tokenizer | Clean AUC | Flip rate (%) M2-sat | Flip rate (%) M2-unb | Emb. displ. M2-sat | Emb. displ. M2-unb | Probe AUC (adv) M2-sat | Probe AUC (adv) M2-unb |
| LlamaGen VQ-16 | 0.863 | 96.73 | 97.99 | 35.88 | 75.31 | 0.864 | 0.836 |
| MedITok | 0.919 | 99.29 | 98.58 | 21.61 | 50.24 | 0.868 | 0.239 |
| UniTok | 0.907 | 99.04 | 99.03 | 11.34 | 22.82 | 0.886 | 0.721 |
| FSQ | 0.855 | 96.50 | 80.62 | 1.66 | 1.82 | 0.764 | 0.769 |
Table 13. Displacement past the boundary, not the token flip, causes the damage. Mean over the three datasets at . The bounded (M2-sat) and unbounded (M2-unb) geometric attacks reach comparable near-saturated flip rates, but M2-unb moves the pre-quantization embedding roughly twice as far (Emb. displ.), and only M2-unb collapses the probe AUC. The flip is matched; the displacement and the harm are not. Displacement is read within a tokenizer only, never across (its scale differs by an order of magnitude). per cell.
| Dataset | Tokenizer | M2-sat | M2-unb | M2-sat | M2-unb | M2-sat | M2-unb | M2-sat | M2-unb | M2-sat | M2-unb |
| Kermany | LlamaGen VQ-16 | 12.21 | 20.84 | 20.33 | 37.08 | 30.35 | 62.47 | 40.62 | 93.83 | 49.96 | 120.39 |
| Kermany | MedITok | 7.28 | 20.38 | 13.67 | 35.98 | 22.11 | 52.03 | 30.39 | 65.21 | 37.21 | 73.01 |
| Kermany | UniTok | 5.30 | 10.03 | 7.41 | 15.47 | 9.56 | 20.51 | 11.48 | 24.81 | 13.61 | 27.82 |
| Kermany | FSQ | 0.30 | 0.31 | 0.57 | 0.61 | 1.12 | 1.23 | 2.08 | 2.32 | 3.12 | 4.07 |
| APTOS | LlamaGen VQ-16 | 16.04 | 26.88 | 25.83 | 50.14 | 37.99 | 80.21 | 47.54 | 105.47 | 56.00 | 122.21 |
| APTOS | MedITok | 7.91 | 15.08 | 15.15 | 28.34 | 23.09 | 45.76 | 30.40 | 60.32 | 37.17 | 68.72 |
| APTOS | UniTok | 7.42 | 15.50 | 10.11 | 21.04 | 12.40 | 24.87 | 14.28 | 27.45 | 16.37 | 29.48 |
| APTOS | FSQ | 0.51 | 0.53 | 1.00 | 1.09 | 2.16 | 2.36 | 4.77 | 4.57 | 7.23 | 7.07 |
| ISIC | LlamaGen VQ-16 | 17.43 | 29.58 | 27.33 | 53.05 | 39.29 | 83.25 | 49.71 | 109.98 | 58.15 | 128.31 |
| ISIC | MedITok | 6.44 | 13.16 | 12.38 | 29.02 | 19.63 | 52.93 | 27.30 | 70.50 | 34.75 | 75.45 |
| ISIC | UniTok | 7.19 | 14.22 | 9.75 | 18.94 | 12.05 | 23.06 | 14.18 | 26.22 | 16.26 | 28.64 |
| ISIC | FSQ | 0.42 | 0.44 | 0.82 | 0.89 | 1.69 | 1.88 | 3.46 | 3.64 | 5.00 | 5.97 |
Table 14. Embedding displacement (pre-quantization), M2-sat vs. M2-unb, all datasets, full grid. The unbounded attack moves the representation consistently farther than the bounded one on every learned-codebook tokenizer, while flip rates are matched (Table 13). FSQ is the exception: bounded and unbounded displace almost equally, consistent with its degraded baseline and lack of a token-path dissociation. Displacement is comparable within a column, not across tokenizers. per dataset.
Full attack and defense sweep data
Figure 8 breaks SQS’s protection down by attack: against M1 SQS’s AUC is 0.00 on every tokenizer, while against boundary-directed attacks (M2-sat/M2-unb) it retains most of its clean AUC. Sweeping SQS’s noise scale and vote count moves mean adversarial AUC by less than 0.01 across the grid on every tokenizer, because that flat mean averages across attacks SQS treats completely differently.
Figure 9 re-plots Table 3’s reconstruction-path numbers as a clean-vs-robust scatter to expose the accuracy/robustness tradeoff directly. Three points (UniTok with Pixel-noise, UniTok with Encoder-FT+Decoder-FT, and VQ-16 with Decoder-FT, starred) Pareto-dominate every other tokenizer/defense combination we tested.

Figure 9. Clean vs. adversarial reconstruction-path AUC (M2-unb, ), mean over datasets, one point per defense, faceted by tokenizer. 1=None, 2=Pixel-noise, 3=SQS, 4=Enc-FT, 5=Enc-FT+SQS, 6=Dec-FT, 7=Enc+Dec-FT. Starred points (orange) are globally Pareto-optimal: UniTok/Pixel-noise, UniTok/Enc+Dec-FT, VQ-16/Dec-FT. per dataset.
Reconstruction fidelity: full per-dataset breakdown
Table 17 and Table 18 are the full per-dataset, full--grid data behind the main text’s reconstruction-fidelity paragraph (§ 4.3; attack and defense comparisons respectively).
| Tokenizer / Dataset | Attack | LPIPS | PSNR | LPIPS | PSNR | LPIPS | PSNR | LPIPS | PSNR | LPIPS | PSNR |
| VQ-16 / Kermany | M2-sat | 0.104 | 25.47 | 0.106 | 25.40 | 0.112 | 25.30 | 0.131 | 25.13 | 0.213 | 24.72 |
| VQ-16 / Kermany | M2-unb | 0.103 | 25.51 | 0.108 | 25.42 | 0.138 | 25.07 | 0.277 | 24.07 | 0.485 | 22.47 |
| VQ-16 / APTOS | M2-sat | 0.072 | 30.39 | 0.077 | 30.25 | 0.091 | 29.95 | 0.119 | 29.62 | 0.200 | 29.14 |
| VQ-16 / APTOS | M2-unb | 0.073 | 30.37 | 0.083 | 30.09 | 0.128 | 29.62 | 0.228 | 28.57 | 0.363 | 27.32 |
| VQ-16 / ISIC | M2-sat | 0.113 | 27.96 | 0.121 | 27.81 | 0.139 | 27.62 | 0.171 | 27.36 | 0.239 | 26.92 |
| VQ-16 / ISIC | M2-unb | 0.116 | 27.92 | 0.133 | 27.58 | 0.192 | 27.13 | 0.318 | 26.11 | 0.473 | 24.86 |
| FSQ / Kermany | M2-sat | 0.236 | 27.53 | 0.242 | 27.39 | 0.245 | 27.29 | 0.243 | 27.31 | 0.256 | 27.11 |
| FSQ / Kermany | M2-unb | 0.233 | 27.60 | 0.234 | 27.58 | 0.234 | 27.58 | 0.250 | 27.34 | 0.321 | 26.28 |
| FSQ / APTOS | M2-sat | 0.160 | 29.61 | 0.173 | 29.25 | 0.179 | 28.86 | 0.179 | 29.04 | 0.209 | 28.87 |
| FSQ / APTOS | M2-unb | 0.157 | 29.63 | 0.159 | 29.62 | 0.159 | 29.61 | 0.196 | 29.31 | 0.298 | 27.98 |
| FSQ / ISIC | M2-sat | 0.201 | 28.60 | 0.209 | 28.43 | 0.210 | 28.30 | 0.209 | 28.29 | 0.234 | 27.99 |
| FSQ / ISIC | M2-unb | 0.199 | 28.68 | 0.199 | 28.71 | 0.198 | 28.73 | 0.238 | 28.30 | 0.360 | 26.78 |
| MedITok / Kermany | M2-sat | 0.037 | 31.10 | 0.039 | 31.07 | 0.043 | 31.02 | 0.066 | 30.57 | 0.158 | 29.62 |
| MedITok / Kermany | M2-unb | 0.037 | 31.25 | 0.044 | 30.71 | 0.083 | 28.67 | 0.216 | 25.30 | 0.423 | 24.08 |
| MedITok / APTOS | M2-sat | 0.028 | 35.27 | 0.030 | 35.20 | 0.037 | 34.90 | 0.062 | 34.18 | 0.148 | 32.57 |
| MedITok / APTOS | M2-unb | 0.028 | 35.42 | 0.034 | 34.93 | 0.072 | 32.00 | 0.210 | 23.28 | 0.479 | 16.26 |
| MedITok / ISIC | M2-sat | 0.053 | 31.96 | 0.056 | 31.80 | 0.065 | 31.60 | 0.094 | 31.19 | 0.184 | 30.23 |
| MedITok / ISIC | M2-unb | 0.053 | 31.96 | 0.065 | 31.49 | 0.133 | 28.42 | 0.330 | 22.40 | 0.514 | 19.62 |
| UniTok / Kermany | M2-sat | 0.044 | 30.32 | 0.046 | 30.14 | 0.051 | 30.00 | 0.074 | 29.73 | 0.154 | 29.12 |
| UniTok / Kermany | M2-unb | 0.045 | 30.27 | 0.054 | 29.63 | 0.088 | 28.43 | 0.183 | 26.88 | 0.347 | 25.28 |
| UniTok / APTOS | M2-sat | 0.036 | 34.52 | 0.038 | 34.36 | 0.045 | 34.18 | 0.066 | 33.87 | 0.137 | 32.84 |
| UniTok / APTOS | M2-unb† | 0.037 | 34.30 | 0.048 | 33.46 | 0.077 | 32.17 | 0.147 | 24.46† | 0.275 | 27.95 |
| UniTok / ISIC | M2-sat | 0.056 | 31.64 | 0.060 | 31.47 | 0.067 | 31.33 | 0.090 | 30.94 | 0.165 | 30.17 |
| UniTok / ISIC | M2-unb | 0.058 | 31.52 | 0.073 | 30.86 | 0.107 | 29.86 | 0.190 | 28.52 | 0.342 | 27.11 |
Table 17. Per-dataset reconstruction fidelity vs. original, M2-sat and M2-unb, full grid. per cell. LPIPS, PSNR.
| Tokenizer | Defense | Kermany LPIPS | PSNR | SSIM | APTOS LPIPS | PSNR | SSIM | ISIC LPIPS | PSNR | SSIM |
| VQ-16 | Clean | 0.103 | 25.60 | 0.675 | 0.070 | 30.35 | 0.842 | 0.109 | 28.07 | 0.725 |
| VQ-16 | None | 0.485 | 22.47 | 0.417 | 0.363 | 27.32 | 0.657 | 0.473 | 24.86 | 0.503 |
| VQ-16 | Encoder-FT | 0.378 | 23.56 | 0.496 | 0.338 | 27.53 | 0.674 | 0.412 | 25.27 | 0.547 |
| VQ-16 | Decoder-FT | 0.207 | 23.47 | 0.539 | 0.171 | 28.69 | 0.794 | 0.307 | 26.08 | 0.607 |
| VQ-16 | +Decoder-FT | 0.185 | 23.69 | 0.569 | 0.169 | 28.09 | 0.788 | 0.273 | 26.05 | 0.626 |
| FSQ | Clean | 0.231 | 27.65 | 0.739 | 0.153 | 29.70 | 0.821 | 0.196 | 28.72 | 0.734 |
| FSQ | None | 0.321 | 26.28 | 0.645 | 0.298 | 27.98 | 0.700 | 0.360 | 26.78 | 0.605 |
| FSQ | Encoder-FT | 0.408 | 24.67 | 0.647 | 0.278 | 23.77 | 0.741 | 0.340 | 24.93 | 0.630 |
| FSQ | Decoder-FT | 0.241 | 26.65 | 0.646 | 0.266 | 26.12 | 0.681 | 0.326 | 24.47 | 0.502 |
| FSQ | +Decoder-FT | 0.302 | 25.45 | 0.646 | 0.280 | 24.16 | 0.710 | 0.332 | 23.26 | 0.526 |
| MedITok | Clean | 0.231 | 31.00 | 0.863 | 0.280 | 35.43 | 0.913 | 0.050 | 32.09 | 0.844 |
| MedITok | None | 0.423 | 24.08 | 0.558 | 0.479 | 16.26 | 0.478 | 0.514 | 19.62 | 0.365 |
| MedITok | Encoder-FT | 0.398 | 26.46 | 0.578 | 0.157‡ | 28.16 | 0.830‡ | 0.472 | 20.50 | 0.407 |
| MedITok | Decoder-FT | 0.169 | 26.32 | 0.710 | 0.147 | 31.13 | 0.850 | 0.272 | 26.61 | 0.685 |
| MedITok | +Decoder-FT | 0.166 | 24.55 | 0.718 | 0.155 | 26.30 | 0.850 | 0.249 | 26.79 | 0.697 |
| UniTok | Clean | 0.042 | 30.48 | 0.832 | 0.033 | 34.63 | 0.891 | 0.053 | 31.78 | 0.817 |
| UniTok | None | 0.347 | 25.28 | 0.599 | 0.275 | 27.95 | 0.722 | 0.342 | 27.11 | 0.617 |
| UniTok | Encoder-FT | 0.233 | 27.60 | 0.700 | 0.201 | 30.51 | 0.792 | 0.263 | 27.95 | 0.657 |
| UniTok | Decoder-FT | 0.127 | 27.39 | 0.727 | 0.122 | 32.44 | 0.864 | 0.179 | 29.25 | 0.751 |
| UniTok | +Decoder-FT | 0.111 | 27.72 | 0.740 | 0.109 | 32.03 | 0.871 | 0.156 | 29.23 | 0.760 |
Table 18. Per-dataset defense-fidelity comparison under M2-unb, . per cell. LPIPS, PSNR, SSIM.
Scope. This reconstruction-fidelity data covers Encoder-FT, Decoder-FT, and Encoder-FT+Decoder-FT only; SQS and Pixel-noise were not run through these fidelity metrics, so their effect on reconstruction quality (as opposed to downstream AUC, Table 3) is not reported. per cell throughout, with the FID reliability flag low () at every cell; only LPIPS/PSNR/SSIM are reported for this reason, not FID.
References
- [1]Anish Athalye, Nicholas Carlini, and David Wagner. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. In International Conference on Machine Learning (ICML), 2018.arxiv.org/abs/1802.00420
- [2]Shruthi Bannur, Stephanie Hyland, Qianchu Liu, Fernando Pérez-García, Maximilian Ilse, Daniel C. Castro, Benedikt Boecking, Harshita Sharma, Kenza Bouzid, Anja Thieme, Anton Schwaighofer, Maria Wetscherek, Matthew P. Lungren, Aditya Nori, Javier Álvarez-Valle, and Ozan Oktay. Learning to exploit temporal structure for biomedical vision-language processing. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2023.arxiv.org/abs/2301.04558
- [3]Rishika Bhagwatkar, Irina Rish, Nicolas Flammarion, and Francesco Croce. On the adversarial robustness of discrete image tokenizers. arXiv preprint arXiv:2602.18252, 2026.arxiv.org/abs/2602.18252
- [4]Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In IEEE Symposium on Security and Privacy, 2017.arxiv.org/abs/1608.04644
- [5]Noel C. F. Codella, David Gutman, M. Emre Celebi, Brian Helba, Michael A. Marchetti, Stephen W. Dusza, Aadi Kalloo, Konstantinos Liopyris, Nabin Mishra, Harald Kittler, and Allan Halpern. Skin lesion analysis toward melanoma detection: A challenge at the 2017 international symposium on biomedical imaging (isbi), hosted by the international skin imaging collaboration (isic). arXiv preprint arXiv:1710.05006, 2017.arxiv.org/abs/1710.05006
- [6]Jeremy M. Cohen, Elan Rosenfeld, and J. Zico Kolter. Certified adversarial robustness via randomized smoothing. In International Conference on Machine Learning (ICML), 2019.arxiv.org/abs/1902.02918
- [7]Marc Combalia, Noel C. F. Codella, Veronica Rotemberg, Brian Helba, Veronica Vilaplana, Ofer Reiter, Cristina Carrera, Alicia Barreiro, Allan C. Halpern, Susana Puig, and Josep Malvehy. BCN20000: Dermoscopic lesions in the wild. arXiv preprint arXiv:1908.02288, 2019.arxiv.org/abs/1908.02288
- [8]Francesco Croce and Matthias Hein. Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks. In International Conference on Machine Learning (ICML), 2020.arxiv.org/abs/2003.01690
- [9]Patrick Esser, Robin Rombach, and Björn Ommer. Taming transformers for high-resolution image synthesis. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.arxiv.org/abs/2012.09841
- [10]Alhussein Fawzi, Seyed-Mohsen Moosavi-Dezfooli, and Pascal Frossard. The robustness of deep networks: A geometrical perspective. IEEE Signal Processing Magazine, 2017.DOI
- [11]Samuel G. Finlayson, John D. Bowers, Joichi Ito, Jonathan L. Zittrain, Andrew L. Beam, and Isaac S. Kohane. Adversarial attacks on medical machine learning. Science, 363(6433):1287–1289, 2019.DOI
- [12]George Gondim-Ribeiro, Pedro Tabacof, and Eduardo Valle. Adversarial attacks on variational autoencoders. arXiv preprint arXiv:1806.04646, 2018.
- [13]Ian J. Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In International Conference on Learning Representations (ICLR), 2015.DOI
- [14]ISIC. ISIC challenge 2019. https://challenge.isic-archive.com/landing/2019, 2019. [Online; accessed 2026-08-29].
- [15]Karthik, Maggie, and Sohier Dane. APTOS 2019 blindness detection. Kaggle, 2019. https://kaggle.com/competitions/aptos2019-blindness-detection.
- [16]Samira Kaviani, Kyungtae Han, and Insoo Sohn. Adversarial attacks and defenses on AI in medical imaging informatics: A survey. Expert Systems with Applications, 198:116815, 2022.DOI
- [18]Daniel S. Kermany, Michael Goldbaum, Wenjia Cai, Carolina C. S. Valentim, Huiying Liang, Sally L. Baxter, Alex McKeown, Ge Yang, Xiaokang Wu, Fangbing Yan, Justin Dong, Made K. Prasadha, Jacqueline Pei, Magdalene Y. L. Ting, Jie Zhu, Christina Li, Sierra Hewett, Jason Dong, Ian Ziyar, Alexander Shi, Runze Zhang, Lianghong Zheng, Rui Hou, William Shi, Xin Fu, Yaou Duan, Viet A. N. Hu, Cindy Wen, Edward D. Zhang, Charlotte L. Zhang, Oulan Li, Xiaobo Wang, Michael A. Singer, Xiaodong Sun, Jie Xu, Ali Tafreshi, M. Anthony Lewis, Huimin Xia, and Kang Zhang. Identifying medical diagnoses and treatable diseases by image-based deep learning. Cell, 172(5):1122–1131.e9, 2018b. doi: 10.1016/j.cell.2018.02.010.DOI
- [19]Jernej Kos, Ian Fischer, and Dawn Song. Adversarial examples for generative models. In IEEE Security & Privacy Workshops, 2018.arxiv.org/abs/1702.06832
- [20]Chenglong Ma, Yuanfeng Ji, Jin Ye, Zilong Li, Chenhui Wang, Junzhi Ning, Wei Li, Lihao Liu, Qiushan Guo, Tianbin Li, Junjun He, and Hongming Shan. Unified medical image tokenizer for autoregressive synthesis and understanding. arXiv preprint arXiv:2505.19225, 2025a.arxiv.org/abs/2505.19225
- [21]Chuofan Ma, Yi Jiang, Junfeng Wu, Jihan Yang, Xin Yu, Zehuan Yuan, Bingyue Peng, and Xiaojun Qi. UniTok: A unified tokenizer for visual generation and understanding. In Advances in Neural Information Processing Systems (NeurIPS), 2025b.arxiv.org/abs/2502.20321
- [22]Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In International Conference on Learning Representations (ICLR), 2018.arxiv.org/abs/1706.06083
- [23]Fabian Mentzer, David Minnen, Eirikur Agustsson, and Michael Tschannen. Finite scalar quantization: VQ-VAE made simple. In International Conference on Learning Representations (ICLR), 2024.arxiv.org/abs/2309.15505
- [24]Yisroel Mirsky, Tom Mahler, Ilan Shelef, and Yuval Elovici. CT-GAN: Malicious tampering of 3d medical imagery using deep learning. In USENIX Security Symposium, 2019.arxiv.org/abs/1901.03597
- [25]Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, and Pascal Frossard. DeepFool: A simple and accurate method to fool deep neural networks. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
- [26]Magdalini Paschali, Sailesh Conjeti, Fernando Navarro, and Nassir Navab. Generalizability vs. robustness: Investigating medical imaging networks using adversarial examples. In Medical Image Computing and Computer-Assisted Intervention (MICCAI), 2018.DOI
- [27]Samuel Räber, Till Aczel, Andreas Plesner, and Roger Wattenhofer. Keep it real: Challenges in attacking compression-based adversarial purification. arXiv preprint arXiv:2508.05489, 2025.arxiv.org/abs/2508.05489
- [28]Peize Sun, Yi Jiang, Shoufa Chen, Shilong Zhang, Bingyue Peng, Ping Luo, and Zehuan Yuan. Autoregressive model beats diffusion: Llama for scalable image generation. arXiv preprint arXiv:2406.06525, 2024.arxiv.org/abs/2406.06525
- [29]Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In International Conference on Learning Representations (ICLR), 2014.arxiv.org/abs/1312.6199
- [30]Philipp Tschandl, Cliff Rosendahl, and Harald Kittler. The HAM10000 dataset, a large collection of multi-source dermatoscopic images of common pigmented skin lesions. Scientific Data, 5:180161, 2018. doi: 10.1038/sdata.2018.161.DOI
- [31]Aaron van den Oord, Oriol Vinyals, and Koray Kavukcuoglu. Neural discrete representation learning. In Advances in Neural Information Processing Systems (NeurIPS), 2017.arxiv.org/abs/1711.00937
- [32]Qihang Yu, Mark Weber, Xueqing Deng, Xiaohui Shen, Daniel Cremers, and Liang-Chieh Chen. An image is worth 32 tokens for reconstruction and generation. In Advances in Neural Information Processing Systems (NeurIPS), 2024.arxiv.org/abs/2406.07550
- [33]Sheng Zhang, Yanbo Xu, Naoto Usuyama, Hanwen Xu, Jaspreet Bagga, Robert Tinn, Sam Preston, Rajesh Rao, Mu Wei, Naveen Valluri, Cliff Wong, Andrea Tupini, Yu Wang, Matt Mazzola, Swadheen Shukla, Lars Liden, Jianfeng Gao, Angela Crabtree, Brian Piening, Carlo Bifulco, Matthew P. Lungren, Tristan Naumann, Sheng Wang, and Hoifung Poon. BiomedCLIP: A multimodal biomedical foundation model pretrained from fifteen million scientific image-text pairs. arXiv preprint arXiv:2303.00915, 2023.arxiv.org/abs/2303.00915