Multimodal Token Fusion for Vision Transformers
Yikai WangXinghao ChenLele CaoWenbing HuangFuchun SunYunhe Wang
Yikai WangXinghao ChenLele CaoWenbing HuangFuchun SunYunhe Wang
TokenFusion is a multimodal fusion method for vision transformers with input modalities. Each modality is represented as a sequence of spatial or semantically corresponding tokens and is processed through a transformer stream. At every transformer layer, a learned token-importance predictor identifies tokens that contribute little to the modality-specific computation. Important tokens continue through their original transformer stream, whereas uninformative tokens are replaced by features projected from aligned tokens in another modality. The method therefore introduces cross-modal interaction while preserving most of the original single-modal transformer data flow and parameterization. For homogeneous modalities, transformer blocks can be shared; for heterogeneous modalities, separate transformer streams can be connected through learned inter-modal projections.
For modality , let denote its -th input token, and let denote the token in modality that is aligned with it. TokenFusion defines a token projection from modality to modality as
where is the identity map for homogeneous modalities and a shallow multilayer perceptron for heterogeneous modalities. Applying the projection to every token gives
Here is the number of tokens being projected, and the alignment determines for each source token. Unlike alignment-agnostic fusion, which concatenates modality tokens and leaves correspondences to be learned implicitly, this operation explicitly injects known pixel-, patch-, or 3D-coordinate correspondences. The projection can be applied to input features or to intermediate transformer features.
Let be the feature tokens of modality at layer , where is the token count and is the layer's channel dimension. TokenFusion predicts one importance score per token with
where the score vector is broadcast across channels. The score gates the input to multi-head self-attention:
where is layer normalization, is multi-head self-attention, and denotes element-wise multiplication with channel-wise broadcasting. If is the task loss for modality , the training objective is
where is the number of transformer layers and controls the sparsity penalty. Before each transformer layer, a token whose score is below a threshold is replaced by the aligned feature from another modality:
Here is a binary token mask, is the source modality, and has the same token and channel dimensions as . The term encourages low scores for replaceable tokens, while the differentiable gating allows the model to learn which tokens should be retained or fused.
TokenFusion introduces Residual Positional Alignment (RPA) to prevent token substitution from discarding the destination token's positional identity. A transformer positional embedding associated with the destination token remains attached to that token even when its content feature is replaced by a projected feature from another modality. Thus, the substituted representation combines the source modality's content with the destination location's positional embedding. Positional embeddings are shared between modalities in homogeneous fusion and are modality-specific in heterogeneous fusion. During training, positional-embedding back-propagation is stopped after the first layer: gradients are retained for the first-layer positional embeddings, while positional embeddings used at later layers are frozen. This preserves explicit spatial or token-index alignment after fusion.
For aligned homogeneous modalities such as RGB and depth or multiple image representations, TokenFusion uses the same multi-head self-attention and feed-forward parameters across modalities, but separate layer-normalization parameters so that each modality retains its own feature statistics. Patch projections, attention projections, MLPs, and positional embeddings are shared. The projection function is the identity and a pruned token is replaced by the token at the same spatial position in another modality. With two modalities, replacement is bidirectional. With modalities, each modality's token positions are randomly partitioned before training into equal-sized groups, one group for each possible replacement modality; these assignments remain fixed throughout training. If is the fixed mask assigning positions in modality to source modality , the replacement rule is
The fixed allocation ensures that every pruned token has a predetermined alternative modality while the learned scores determine whether replacement occurs.
For structurally different modalities, TokenFusion keeps separate transformer architectures and unshared parameters, then connects them through shallow MLP projections. In the paper's 3D detection application, sampled point-cloud seed tokens are processed by a Group-Free-style transformer, while image patches and object-query tokens are processed by a YOLOS-style transformer. Token pruning is applied to point-cloud seed tokens. A pruned 3D point is projected to its corresponding image patch using camera calibration, and the image-patch feature is transformed to the point-stream embedding dimension before substitution.
For a point with 3D coordinates , camera intrinsic matrix , and camera extrinsic matrix , the homogeneous image projection is
where is the projected pixel coordinate. If is the image-transformer patch size and is the image width, the corresponding image-patch index is
The same geometric correspondence is used to project 3D object labels to the image branch. This design enables simultaneous 3D and 2D detection without requiring the two modalities to have the same token count, embedding dimension, or transformer depth.
TokenFusion was evaluated on Taskonomy using 1,000 training and 500 validation multimodal images sampled from the dataset. Inputs and predictions were resized to pixels. The generator and discriminator were transformers with either 10 layers (tiny) or 20 layers (small), learning rate , shared transformer parameters across input modalities, modality-specific layer normalization, shared positional embeddings, sparsity weight , and threshold . Lower values are better; RGB predictions use FID/KID with the reported values scaled by , while other predictions use MAE/MSE with values scaled by .
The strongest CNN baseline, CEN, obtained scores of , , , , and for Shade+TextureRGB, Depth+NormalRGB, RGB+ShadeNormal, RGB+NormalShade, and RGB+EdgeDepth, respectively. Transformer feature concatenation obtained , , , , and with the tiny backbone, and , , , , and with the small backbone. TokenFusion obtained , , , , and with the tiny backbone, and , , , , and with the small backbone. Thus, for Shade+TextureRGB, the small TokenFusion model reduced FID from the CEN value of to , a reported relative decrease of . Qualitative outputs showed richer colors and details; learned fusion patterns also indicated that texture tokens tended to retain detailed boundaries while borrowing facial information from shade features.
TokenFusion was evaluated for RGB-depth semantic segmentation on NYUDv2 and SUN RGB-D. NYUDv2 used 795 training and 654 test images with 40 classes; SUN RGB-D used 5,285 training and 5,050 test images with 37 classes. The tiny and small models followed the B1 and B2 SegFormer backbones and were initialized from ImageNet-1k pretraining. RGB and depth used shared transformer blocks and positional embeddings with separate layer normalization, , and . Metrics are pixel accuracy, mean accuracy, and mean intersection-over-union, all reported as percentages.
On NYUDv2, RGB-only transformer baselines achieved for the tiny backbone and for the small backbone. Simple RGB-depth token concatenation achieved and , whereas TokenFusion achieved and for the tiny and small backbones, respectively. On SUN RGB-D, the corresponding RGB-only results were and ; concatenation achieved and ; and TokenFusion achieved and . The TokenFusion transformer models therefore exceeded the reported CNN-based state of the art while using relatively light backbones.
TokenFusion jointly learned 3D detection from point clouds and 2D detection from images on SUN RGB-D and ScanNetV2. SUN RGB-D used the standard split and 10 object classes; ScanNetV2 used 1,201 training and 312 test scans with 18 classes, sampling 10 image frames per scene. The 3D branch followed Group-Free and the 2D branch followed YOLOS. Results use [email protected] and [email protected]; values in parentheses are averages across five runs, while unparenthesized values are the best run.
On SUN RGB-D, Group-Free with point clouds alone obtained and , and appending RGB vectors directly to point features reduced performance to and . TokenFusion with the Group-Free configuration and YOLOS-tiny obtained and ; using YOLOS-small obtained and . The best listed CNN result, imVoteNet, obtained [email protected].
On ScanNetV2, Group-Free with obtained and , while direct RGB concatenation obtained and . The larger Group-Free model obtained and , dropping to and with direct RGB concatenation. TokenFusion achieved and with YOLOS-tiny and and with YOLOS-small. The qualitative detections showed that image features helped recover objects with sparse or missing points and disambiguate heavily overlapping point sets.
Ablations were conducted on NYUDv2 RGB-depth segmentation and SUN RGB-D point-cloud/image 3D detection. Without the sparsity penalty, no fusion gave segmentation scores and detection scores. Randomly replacing 10% of tokens gave and , while replacing 30% gave and . Adding the sparsity penalty without token fusion changed the results only slightly to and .
The combination of learned token fusion and RPA produced for segmentation and for detection. A separate RPA ablation with the sparsity penalty showed that no token fusion gave and , RPA without token fusion gave and , learned token fusion without RPA gave and , and the complete method gave and . These results indicate that the sparsity penalty is primarily useful for exposing tokens to fuse, learned replacement is substantially better than random replacement, and RPA is especially important when token fusion is used.
Coverage note — No substantial contributed material was omitted; qualitative visualizations and the paper's implementation details are incorporated into the method and empirical-result knowls rather than treated as separate knowls.
@article{wang2022multimodal,
title = {Multimodal Token Fusion for Vision Transformers},
author = {Wang, Yikai and Chen, Xinghao and Cao, Lele and Huang, Wenbing and Sun, Fuchun and Wang, Yunhe},
year = {2022},
journal = {arXiv},
url = {http://arxiv.org/abs/2204.08721v2},
eprint = {2204.08721}
}This paper is available from its original source. Click below to access the PDF.
Open PDF