NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

MambaTree: Tree Topology is All You Need in State Space Model

Yicheng Xiao, Lin Song, Shaoli Huang, Jiangshan Wang, Siyu Song, Yixiao Ge, Xiu Li, Ying ShanNeurIPS 2024

Introduction

State Space Models (SSMs), particularly the Mamba architecture, have recently emerged as a formidable rival to Transformers. They offer a highly desirable "best of both worlds" scenario: the long-range dependency modeling capabilities of Transformers combined with the linear scaling and computational efficiency of Recurrent Neural Networks (RNNs).

However, MambaTree identifies a critical bottleneck in current SSM applications: they are fundamentally constrained by the geometric limitations of 1D sequences. To break these "1D sequence" shackles, MambaTree dynamically builds a tree topology based on input features, propagating information along a Minimum Spanning Tree (MST) instead of a fixed raster scan. This allows it to capture complex spatial and semantic relationships with linear complexity, significantly outperforming existing Mamba-based models in both vision and language tasks.

The Problem: Spatial Discontinuity in 1D Scans

Because SSMs are inherently designed for 1D sequences, applying them to 2D images or complex textual structures requires "scanning" strategies. Researchers typically use raster or cross-scanning to flatten an image into a 1D string of pixels.

This creates a major problem: spatial discontinuity. Pixels that are immediate neighbors in 2D space often end up far apart in the flattened 1D sequence. This breaks the natural flow of information, making it exceedingly difficult for the model to understand complex geometric structures and local contexts.

Comparison of traditional scanning strategies versus MambaTree's tree topology scan.

As shown above, while previous visual and textual SSMs rely on rigid, predefined paths (like raster or continuous scans), MambaTree adapts its path to the actual content, forming a tree that respects the natural boundaries of objects or semantic groupings in text.

Methodology: The MambaTree Framework

The authors introduce a framework that replaces these fixed scanning patterns with an input-aware tree topology.

  1. Dynamic Tree Generation: For a given input (whether image pixels or text tokens), the model first builds a graph where edge weights represent the "dissimilarity" between adjacent features. It then utilizes the Contractive Boruvka algorithm to prune this graph into a Minimum Spanning Tree (MST). This tree naturally groups semantically and spatially related features together.
  2. Tree Scanning Algorithm (TSA): Instead of moving left-to-right across a flattened sequence, the model propagates features along the branches of this dynamically generated tree.
  3. Linear Complexity via Dynamic Programming: Naively traversing a tree for every possible root would result in quadratic computational complexity ($O(L^2)$). To solve this, the authors propose a dynamic programming (DP) algorithm that achieves the exact same result in just two passes (leaf-to-root and root-to-leaf). This maintains the $O(L)$ linear complexity that makes Mamba attractive in the first place.
Architecture of the Tree State Space Model and the Tree Scanning Algorithm.

To ensure multimodal versatility, the paper introduces two distinct variants:

  • MambaTreeV (Vision): Uses a hierarchical backbone for processing images.
  • MambaTreeL (Language): Uses LoRA fine-tuning to enhance pre-trained Large Language Models.

Key Insights and Results

The model was rigorously tested across several standard benchmarks, including ImageNet-1K for classification, MSCOCO 2017 for object detection, ADE20K for semantic segmentation, and seven distinct language understanding benchmarks.

Content-Aware Paths and Receptive Fields

Unlike previous models that use the same "snake" scan for every image, MambaTree's propagation path changes based on the image content. By minimizing dissimilarity, the MST ensures that information flows through the most "reliable" connections first, acting as a learned structural prior. Consequently, MambaTree’s receptive field is much more organic and object-focused than the rigid, grid-like receptive fields of raster-scanning models.

Performance Breakthroughs

  • Vision Superiority: MambaTreeV-T achieved 83.4% Top-1 accuracy on ImageNet-1K, outperforming ViM-S by 2.9% and VMamba-T by 0.9% with similar computational costs.
  • Segmentation Gains: The model showed massive improvements in semantic segmentation on ADE20K, beating ViM-S by +3.6 mIoU (single-scale). This suggests the tree topology is particularly adept at preserving fine-grained structural details.
  • Language Boosting: When applied to a 130M Mamba language model, MambaTreeL provided a +1.1% average accuracy boost across multiple NLP tasks with minimal training overhead.
  • Inference Speed: Efficiency remains a priority. With custom optimized CUDA kernels, MambaTreeV-T reached 392 img/s* on an Nvidia V100, making it faster and more memory-efficient than many of its competitors.

Limitations and Future Work

While highly effective, MambaTree has a few limitations. First, tree-based operations are generally less "native" to current GPU architectures than standard convolutions or sequence operations. Although the authors provided a custom CUDA kernel, further hardware-level optimization could unlock even more speed. Second, while the propagation itself is linear, the initial construction of the MST adds a small amount of overhead that might become significant for extremely large-scale graphs.

Future directions include exploring more complex graph topologies beyond simple trees and investigating how this structural prior behaves when scaled up to massive foundation models.

Summary updated

BibTeX
@inproceedings{xiao2024mambatree,
  author = {Yicheng Xiao and Lin Song and Shaoli Huang and Jiangshan Wang and Siyu Song and Yixiao Ge and Xiu Li and Ying Shan},
  title = {{MambaTree: Tree Topology is All You Need in State Space Model}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=W8rFsaKr4m},
}
Figure