Code Monkey home page Code Monkey logo

graph-mamba's Introduction

Attention mechanisms have been widely used to capture long-range dependencies among nodes in Graph Transformers. Bottlenecked by the quadratic computational cost, attention mechanisms fail to scale in large graphs. Recent improvements in computational efficiency are mainly achieved by attention sparsification with random or heuristic-based graph subsampling, which falls short in data-dependent context reasoning. State space models (SSMs), such as Mamba, have gained prominence for their effectiveness and efficiency in modeling long-range dependencies in sequential data. However, adapting SSMs to non-sequential graph data presents a notable challenge.

In this work, we introduce Graph-Mamba, the first attempt to enhance long-range context modeling in graph networks by integrating a Mamba block with the input-dependent node selection mechanism. Specifically, we formulate graph-centric node prioritization and permutation strategies to enhance context-aware reasoning, leading to a substantial improvement in predictive performance. Extensive experiments on ten benchmark datasets demonstrate that Graph-Mamba outperforms state-of-the-art methods in long-range graph prediction tasks, with a fraction of the computational cost in both FLOPs and GPU memory consumption.

Python environment setup with Conda

conda create --name graph-mamba --file requirements_conda.txt
conda activate graph-mamba
conda clean --all

To troubleshoot Mamba installation, please refer to https://github.com/state-spaces/mamba.

For alternative installation via poetry, refer to poetry_steps.txt.

Running Graph-Mamba

conda activate graph-mamba

# Running Graph-Mamba for Peptides-func dataset
python main.py --cfg configs/Mamba/peptides-func-EX.yaml  wandb.use False

You can also set your wandb settings and use wandb.

Guide on configs files

Most of the configs are shared with GraphGPS and Exphormer code. You can change the following parameters in the config files for different parameters and variants of Graph-Mamba:

gt:
  layer_type: CustomGatedGCN+Mamba_Hybrid_Degree_Noise
  # Refer to graphgps/layer/gps_layer.py for NUM_BUCKETS
  # CustomGatedGCN+Mamba_Hybrid_Degree_Noise_Bucket - For large graph datasets that use the bucketing technique
  # CustomGatedGCN+Mamba_Hybrid_Noise - For permutation-only Graph-Mamba
  # CustomGatedGCN+Mamba - For baseline Mamba without Graph-Mamba adaptations

Preprint and Citation

Our preprint is avaible on arXiv with the following citation:

@article{Graph-Mamba,
Author = {Chloe Wang and Oleksii Tsepa and Jun Ma and Bo Wang},
Title = {Graph-Mamba: Towards Long-Range Graph Sequence Modeling with Selective State Spaces},
Year = {2024},
journal={arXiv preprint arXiv:2402.00789},
}

graph-mamba's People

Contributors

rampasek avatar hamed1375 avatar chloexwang avatar luis-mueller avatar

Stargazers

jist avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.