Skip to main content
Back

MBZUAI's BiGain Keeps Diffusion AI Sharp at 1.65x Faster Speed

A training-free token compression framework preserves both generation quality and hidden classification skills in accelerated diffusion models through frequency-aware pruning.

Pro

  • BiGain is a training-free token compression framework that jointly preserves generation and classification in accelerated diffusion models.
  • Two operators: Laplacian-gated token merging protects edges; IE-KVD downsamples keys and values while keeping queries at full resolution.
  • On ImageNet-1K with SD 2.0 at 70% merge ratio, classification accuracy improves by 7.15% and FID by 0.34 vs ToMe.
  • On DiT-XL/2 at aggressive 3x downsampling, BiGain holds 61.58% accuracy where ToDo collapses to 8.46%.
  • Achieves 1.65x wall-clock speedup on RTX 4090; code available at github.com/Greenoso/BiGain.
  • Design rule: preserve balanced frequency spectrum, protecting high-frequency detail for recognition and low/mid bands for generation.

Diffusion models are quietly doing double duty. The same denoiser that paints pixels can also score class likelihoods, giving you a zero-shot classifier for free. But when engineers speed up sampling with token merging or downsampling, they usually only check that the pictures still look good, and never notice that the classifier inside has quietly collapsed. A new paper called BiGain from MBZUAI's VILA Lab and NC State proposes a fix, and the numbers are hard to ignore.

The hidden cost of speeding up diffusion

Acceleration techniques like ToMe (token merging) and ToDo (token downsampling) prune redundant tokens inside attention blocks to cut FLOPs. The catch, according to the authors, is that accelerations that barely hurt generation can dramatically weaken discriminative performance. In their motivating experiment on COCO-2017, aggressive baseline compression actually collapses classification accuracy while FID barely twitches.

Why the asymmetry? Naive merging behaves like a low-pass filter. It smooths flat regions but also blurs the edges, textures, and small high-contrast structures that recognition depends on. Generation can tolerate that because global appearance stays intact. Classification cannot.

Frequency separation as a design rule

BiGain's central idea is what the authors call balanced spectral retention: preserve high-frequency detail (edges, textures) that anchors recognition, while keeping low and mid-frequency content that supports coherent generation. They instantiate this with two training-free, plug-in operators.

Laplacian-Gated Token Merging (L-GTM). Before Q/K/V projections, the hidden feature map is convolved with a 3x3 Laplacian kernel to score every token by local frequency content. In each spatial grid, the lowest-scoring (smoothest) token becomes a merge destination, and the rest form the source set. A bipartite match on cosine similarity then collapses the top-r most similar pairs. High-contrast tokens are simply protected from merging.

Interpolate-Extrapolate KV Downsampling (IE-KVD). For attention, keys and values get downsampled while queries stay at full resolution. The downsampler is a tunable blend between nearest-neighbor and average pooling:

K_tilde[i] = alpha * K[nearest(i)] + (1 - alpha) * mean(K[N_s(i)])
V_tilde[i] = alpha * V[nearest(i)] + (1 - alpha) * mean(V[N_s(i)])
# Q stays full-resolution, attention cost drops from O(N^2 d) to O(N N_tilde d)

Keeping Q intact preserves per-token attention precision, which the paper argues is critical for the Monte Carlo scoring rule used in diffusion classification.

The numbers

The team tested on Stable Diffusion v2.0 (UNet-based latent diffusion with text conditioning) and DiT-XL/2 (Transformer backbone), using official pretrained weights, across ImageNet-1K, ImageNet-100, Oxford-IIIT Pets, and COCO-2017. A few highlights:

  • On ImageNet-1K with SD 2.0 at a 70% merge ratio, BiGain lifts classification accuracy by 7.15% over ToMe while improving FID by 0.34.
  • On Oxford-IIIT Pets at ~10% FLOPs reduction, ToMe drops accuracy by 8.07% and SiTo by 12.19%, while BiGain's Laplacian merging drops only 2.65%.
  • On DiT-XL/2 with ImageNet-100 at 3x downsampling, ToDo collapses to 8.46% accuracy while BiGain holds 61.58%. Generation FID also drops from 190 to 33.
  • Wall-clock speedups are real: on an RTX 4090 with FP16 and batch size 4, BiGain's UNet step time drops from 235 ms to 143 ms, a 1.65x speedup.

What the ablations reveal

The paper systematically compared ten token-scoring heuristics, from global L1/L2 norms to DFT spectral centroids and cosine similarity. The Laplacian filter with L1 aggregation won at every merge ratio. Placement also matters: reducing tokens only in self-attention beat variants that also touched cross-attention or MLP blocks, because compressing cross-attention degrades text-prompt adherence.

A striking ablation shows that retaining only high-frequency or only low-frequency KV tokens both catastrophically hurt classification (26.6% and 45.6% accuracy respectively vs. 72.3% for balanced), reinforcing the balanced-spectrum thesis.

Where this fits, and where it doesn't

BiGain is training-free, deterministic, and does not cache assignments across timesteps, which matters because diffusion classification is a Monte Carlo estimator that needs consistent behavior across (t, epsilon) draws. The official code repository is available on GitHub. The operators drop into either UNet or DiT backbones with no retraining.

Practical fits include medical imaging systems that use one diffusion prior for both diagnosis and counterfactual generation, industrial visual inspection where the same model does defect classification and reconstruction, and remote sensing pipelines that combine cloud-removal synthesis with land-cover classification. If you are running a single diffusion backbone for dual-purpose deployment, this is directly useful.

Limits worth knowing: the authors tried the operators on FLUX.1-dev, a velocity-prediction flow-matching model, and found it barely beat random guessing under the diffusion-classifier protocol, so evaluation is restricted to standard noise-prediction models. The joint use of L-GTM and IE-KVD in different U-Net stages is compatible but not additive, meaning stacking the two operators does not compound gains. The real breakthrough here is not a bigger speedup number, but a design rule: merge where signals are smooth, downsample K and V while preserving Q, and the same compression schedule can serve both generation and recognition.