In the world of computer vision, Vision Transformers (ViTs) have become the gold standard. However, they still rely on a surprisingly primitive first step: chopping an image into a rigid grid of square patches. While computationally convenient, this "one-size-fits-all" approach ignores the actual content of the image, often splitting a single object across multiple tokens or mixing foreground and background into one.
A new paper introduces Differentiable Hierarchical Visual Tokenization ($\partial$HT). This method moves beyond the grid, allowing models to "see" in semantically meaningful, irregularly shaped regions that adapt to the image content—all while remaining fully end-to-end learnable.
TL;DR
$\partial$HT replaces the rigid square patches of Vision Transformers with adaptive, content-aware "superpixel" tokens. By using a differentiable hierarchical merging process and information criteria for model selection, it achieves superior performance in segmentation and classification while remaining backward-compatible with existing pretrained ViT backbones.
What Problem Does This Paper Address?
Standard ViTs treat images like a checkerboard, typically using $16 \times 16$ pixel patches. This creates a "semantic incongruity": while natural language tokenizers group characters into meaningful subwords, vision tokenizers fragment objects without regard for their boundaries.
Previous attempts to fix this using "superpixels" (grouping pixels by similarity) were often non-differentiable, meaning the tokenizer couldn't be trained alongside the rest of the model. Others were "plug-and-play" but lacked the ability to adapt the number of tokens to the complexity of the scene. $\partial$HT solves this by making the entire grouping process differentiable and using statistical principles to pick the optimal level of detail for every image.
Methods
The $\partial$HT pipeline consists of four main stages:
- Feature Projection: A lightweight CNN embeds each pixel into a $d$-dimensional feature space, establishing a similarity metric.
- Hierarchical Vertex Merging: Starting at the pixel level, the algorithm iteratively merges the most similar adjacent regions. This builds a "hierarchy" (a tree) of possible image partitions, from thousands of tiny regions down to a single region representing the whole image.
- Optimal Selection: Instead of using a fixed threshold, the authors treat tokenization as a model selection problem. They use Information Criteria (specifically AICC) to prune the hierarchy. This balances "model fit" (how well the tokens represent the image) against "complexity" (the number of tokens), automatically choosing more tokens for busy scenes and fewer for simple ones.
- Differentiable Extraction: To make this work with standard ViTs, the authors use a "mean-injection trick." This allows gradients to flow from the transformer backbone back into the tokenizer, even though the grouping step is technically discrete.
Crucially, the authors introduce a retrofitting strategy. By pretraining the tokenizer to reconstruct images, they can swap out the patch-grid of a pre-existing ViT for $\partial$HT tokens without retraining the entire massive backbone from scratch.
Key Insights and Results
The researchers evaluated $\partial$HT across a wide range of standard benchmarks, including ImageNet-1k for classification, and ADE20k & COCO-Stuff for dense semantic segmentation.
- Semantic Alignment Matters: Because $\partial$HT tokens follow object boundaries, the model naturally gains better interpretability and accuracy in "dense" tasks like segmentation. On ADE20k, $\partial$HT reached an mIoU of 53.2, a significant jump over Swin-B (52.4) and standard ViT-based methods.
- Classification: On ImageNet-1k, $\partial$HT-ViT-B16 achieved 83.2% accuracy, outperforming the standard patch-based ViT-B16 (82.6%).
- Information Theory for Vision: Using Information Criteria to decide token granularity removes the need for manual hyperparameter tuning for token counts, letting the image content decide.
- Zero-Shot Performance: In salient object detection, $\partial$HT outperformed existing adaptive tokenizers like SPiT and SuiT across all tested datasets (ECSSD, DUTS, & DUT-OMRON).
- Out-of-the-box Vectorization: Because the tokens are precise geometric regions, the model can perform "raster-to-vector" conversion as a side effect, outperforming some models specifically designed for that task.
Limitations and Future Work
While $\partial$HT represents a significant step forward, it currently faces a few limitations. It is slower than simple patch-based tokenization due to the hierarchical merging process. Additionally, at very low resolutions (like $32 \times 32$ pixel images), the grid-based approach remains hard to beat due to a lack of pixel-level granularity.
Future directions include moving from simple mean-aggregation to using Graph Neural Networks (GNNs) to extract richer features from irregular superpixel regions, and applying this method to video, where "spatiotemporal superpixels" could drastically reduce redundancy across frames.
Summary updated