Yicheng Xiao1,*, Lin Song2,3,📧,*, Shaoli Huang3, Jiangshan Wang1, Siyu Song4, Yixiao Ge2,3, Xiu Li1,📧 and Ying Shan2,3
* Equal contribution 📧 Corresponding author
1 Tsinghua University 2 ARC Lab, Tencent PCG 3 Tencent AI Lab 4 South China Normal University
The state space models, employing recursively propagated features, demonstrate strong representation capabilities comparable to Transformer models and superior efficiency. However, constrained by the inherent geometric constraints of sequences, it still falls short in modeling long-range dependencies. To address this issue, we propose the GrootVL network, which first dynamically generates a tree topology based on spatial relationships and input features. Then, feature propagation is performed based on this graph, thereby breaking the original sequence constraints to achieve stronger representation capabilities. Additionally, we introduce a linear complexity dynamic programming algorithm to enhance long-range interactions without increasing computational cost. GrootVL is a versatile multimodal framework that can be applied to both visual and textual tasks. Extensive experiments demonstrate that our method significantly outperforms existing structured state space models on image classification, object detection and segmentation. Besides, by fine-tuning large language models, our approach achieves consistent improvements in multiple textual tasks at minor training cost.
We first revisit the selective state space model and design an input-aware topology scanning algorithm for state space modeling. With this superior algorithm, we develop a tree SSM and propose a novel framework called GrootVL, which consists of two sub-networks: GrootV for visual tasks and GrootL for fine-tuning a pre-trained language model.
We utilize a dynamic programming procedure to accelerate the inference and training processes which results in linear complexity
conda create -n grootv python=3.9
conda activate grootv
# Install pytorch
pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117
# Install other packages
pip install -r GrootV/grootv_requirements.txt
# Install Vision_Tree_Scanning
cd GrootV/third-party/TreeScan
pip install -v -e .
conda create -n grootl python=3.9
conda activate grootl
# Install pytorch
pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2
# Install other packages
pip install -r GrootL/grootl_requirements.txt
# Install Language_Tree_Scanning
cd GrootL/third-party/TreeScanLan
pip install -v -e .
# Install language model evluation tools
cd GrootL/3rdparty/lm-evaluation-harness
pip install -v -e .
ImageNet-1k Image Classification
COCO Object Detection and Instance Segmentation
ADE20K Semantic Segmentation
Language Understanding
ImageNet-1k Image Classification
bash GrootV/scripts/bash_cls_train.sh
You need to modify the relevant path to your own.
Language Understanding
cd GrootL
bash eval.sh
You need to modify the relevant path to your own.
If you find this work useful for your research, please cite:
@article{xiao2024grootvl,
title={GrootVL: Tree Topology is All You Need in State Space Model},
author={Xiao, Yicheng and Song, Lin and Huang, Shaoli and Wang, Jiangshan and Song, Siyu and Ge, Yixiao and Li, Xiu and Shan, Ying},
journal={arXiv preprint arXiv:2406.02395},
year={2024}
}
Code in this repository is built upon several public repositories. Thanks for the wonderful work InternImage and VMamba ! !
Our codes are under MIT license.