{"id":28342590,"url":"https://github.com/zehong-wang/g2pm","last_synced_at":"2026-01-30T19:33:17.722Z","repository":{"id":294782986,"uuid":"988058528","full_name":"Zehong-Wang/G2PM","owner":"Zehong-Wang","description":"Scalable Graph Generative Modeling via Substructure Sequences","archived":false,"fork":false,"pushed_at":"2025-05-28T06:58:58.000Z","size":2833,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-19T18:47:20.692Z","etag":null,"topics":["artificial-intelligence","generative-ai","generative-model","generative-pretraining","graph","graph-learning","graph-neural-networks","graph-representation-learning","graph-transformer","machine-learning","message-passing","pytorch-geometric","self-supervised-learning","substruct","unsupervised-learning"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/2505.16130","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Zehong-Wang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-22T01:58:21.000Z","updated_at":"2025-05-28T07:09:37.000Z","dependencies_parsed_at":"2025-05-22T03:28:16.973Z","dependency_job_id":"ea1d804d-71f7-4dc7-9b60-1e4eff66e697","html_url":"https://github.com/Zehong-Wang/G2PM","commit_stats":null,"previous_names":["zehong-wang/g2pm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Zehong-Wang/G2PM","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zehong-Wang%2FG2PM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zehong-Wang%2FG2PM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zehong-Wang%2FG2PM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zehong-Wang%2FG2PM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zehong-Wang","download_url":"https://codeload.github.com/Zehong-Wang/G2PM/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zehong-Wang%2FG2PM/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28918221,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T19:10:10.838Z","status":"ssl_error","status_checked_at":"2026-01-30T19:06:40.573Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["artificial-intelligence","generative-ai","generative-model","generative-pretraining","graph","graph-learning","graph-neural-networks","graph-representation-learning","graph-transformer","machine-learning","message-passing","pytorch-geometric","self-supervised-learning","substruct","unsupervised-learning"],"created_at":"2025-05-27T05:28:10.778Z","updated_at":"2026-01-30T19:33:17.717Z","avatar_url":"https://github.com/Zehong-Wang.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Generative Graph Pattern Machine (G2PM)\n\n\u003cdiv align='center'\u003e\n\n[![pytorch](https://img.shields.io/badge/PyTorch_2.4+-ee4c2c?logo=pytorch\u0026logoColor=white)](https://pytorch.org/get-started/locally/)\n[![pyg](https://img.shields.io/badge/PyG_2.6+-3C2179?logo=pyg\u0026logoColor=#3C2179)](https://pytorch-geometric.readthedocs.io/en/latest/install/installation.html)\n![license](https://img.shields.io/badge/License-MIT-green.svg?labelColor=gray)\n[![G2PM arxiv](http://img.shields.io/badge/arxiv-2505.16130-yellow.svg)](https://arxiv.org/abs/2505.16130)\n[![GPM](https://img.shields.io/badge/GPM-blue.svg)](https://github.com/zehong-wang/GPM)\n\n\u003cimg src=\"assets/logo.png\" width='300'\u003e\n\u003c/div\u003e\n\n## 📝 Description\n\nThis is the official implementation of our paper [Scalable Graph Generative Modeling via Substructure Sequences](https://arxiv.org/abs/2505.16130), a self-supervised extension of our ICML'25 work [GPM](https://arxiv.org/abs/2501.18739). G2PM addresses the fundamental scalability challenges in Graph Neural Networks (GNNs) by introducing a novel approach that goes beyond traditional message-passing architectures.\n\n### Key Features\n\n\u003cimg src=\"assets/paradigm.png\"\u003e\n\n- 🚀 Breakthrough scalability with continuous performance gains up to 60M parameters\n- 🔄 Novel sequence-based representation replacing traditional message passing\n- 🎯 Versatile performance across node, graph, and transfer learning tasks\n- ⚡ Optimized architecture design for maximum generalization capability\n\n\n### Background \u0026 Motivation\nTraditional message-passing GNNs face several critical limitations:\n- Constrained expressiveness\n- Over-smoothing of node representations\n- Over-squashing of information\n- Limited capacity to model long-range dependencies\n\nThese issues particularly affect scalability, as increasing model size or data volume often fails to improve performance, limiting GNNs' potential as graph foundation models.\n\n\n### Framework Overview\n\n\u003cimg src=\"assets/framework.png\"\u003e\n\nG2PM introduces a generative Transformer pre-training framework that:\n1. Represents graph instances (nodes, edges, or entire graphs) as sequences of substructures\n2. Employs generative pre-training over these sequences\n3. Learns generalizable and transferable representations without relying on traditional message-passing\n\n### Empirical Results\n- Demonstrates exceptional scalability on ogbn-arxiv benchmark\n- Continues performance improvement up to 60M parameters\n- Significantly outperforms previous approaches that plateau at ~3M parameters\n- Shows strong performance across node classification, graph classification, and transfer learning tasks\n\n## 🛠️ Installation\n\n### Prerequisites\n- CUDA-compatible GPU (24GB memory minimum, 48GB recommended)\n- CUDA 12.1\n- Python 3.9+\n\n### Setup\n```bash\n# Create and activate conda environment\nconda env create -f environment.yml\nconda activate GPM\n\n# Install DGL\npip install dgl -f https://data.dgl.ai/wheels/torch-2.4/cu121/repo.html\n\n# Install PyG dependencies\npip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.4.0+cu121.html\n```\n\n## 🚀 Quick Start\nThe code of G2PM is presented in folder `/G2PM`. You can run `pretrain.py` and specify any dataset to run experiments. To ensure reproducability, we provide hyper-parameters in `config/pretrain.yaml`. You can simply use command `--use_params` to set tuned hyper-parameters. \n\n### Basic Usage\n```bash\n# Run with default parameters\npython G2PM/pretrain.py --dataset computers --use_params\n```\n\n### Supported Tasks \u0026 Datasets\n\n1. **Node Classification**\n   - `pubmed`, `photo`, `computers`, `arxiv`, `products`, `wikics`, `flickr`.  \n\n2. **Graph Classification**\n   - `imdb-b`, `reddit-m12k`, `hiv`, `pcba`, `sider`, `clintox`, `muv`. \n\nWe also provide the interfaces of other widely used datasets in [GPM](https://github.com/zehong-wang/GPM). Please check the datasets in `G2PM/data/pyg_data_loader.py` for details. \n\n\n## 🔧 Configuration Options\n\n### Basic Parameters\n- `--use_params`: Use tuned hyperparameters\n- `--dataset`: Target dataset name\n- `--epochs`: Number of training epochs\n- `--batch_size`: Batch size\n- `--lr`: Learning rate\n\n### Pretraining Parameters\n- `--pre_sample_pattern_num`: Number of patterns per instance in total (used for pattern extraction)\n- `--num_patterns`: Number of patterns per instance during training (used for pattern encoding)\n- `--pattern_size`: Pattern size (random walk length)\n- `--mask_token`: Mask token type (`learnable`, `random`, `fixed`, `replace`)\n- `--architecture`: Reconstruction architecture (`mae`, `simmim`)\n\n### Model Architecture\n- `--hidden_dim`: Hidden layer dimension\n- `--num_heads`: Number of attention heads\n- `--num_enc_layers`: Number of Transformer layers in encoder\n- `--num_dec_layers`: Number of Transformer layers in decoder\n- `--dropout`: Dropout rate\n\n### Augmentation\n- `--mix_aug`: Mix the augmentation strategies\n- `--mask_node`: Mask node features\n- `--mask_pattern`: Mask graph patterns\n\nFor complete configuration options, please refer to our code documentation.\n\n## 📂 Repository Structure\n```\n└── G2PM\n    ├── G2PM/             # Main package directory\n    │   ├── data/         # Data loading and preprocessing\n    │   ├── model/        # Model architectures\n    │   ├── task/         # Task implementations\n    │   ├── utils/        # Utility functions\n    │   ├── pretrain.py   # Pretraining script\n    ├── config/           # Configuration files\n    ├── assets/           # Images and assets\n    ├── data/             # Dataset storage\n    ├── patterns/         # Extracted graph patterns\n    └── environment.yml   # Conda environment spec\n```\n\n## 📚 Citation\n\nIf you find this work useful, please cite our paper:\n\n```bibtex\n@article{wang2025scalable,\n  title={Scalable Graph Generative Modeling via Substructure Sequences},\n  author={Wang, Zehong and Zhang, Zheyuan and Ma, Tianyi and Zhang, Chuxu and Ye, Yanfang},\n  journal={arXiv preprint arXiv:2505.16130},\n  year={2025}\n}\n\n@inproceedings{wang2025generative,\n   title={Generative Graph Pattern Machine},\n   author={Zehong Wang and Zheyuan Zhang and Tianyi Ma and Chuxu Zhang and Yanfang Ye},\n   booktitle={The Thirty-ninth Annual Conference on Neural Information Processing Systems},\n   year={2025},\n   url={https://openreview.net/forum?id=tdMWo3jB21}\n}\n```\n\n## 👥 Authors\n\n- [Zehong Wang](https://zehong-wang.github.io/)\n- [Zheyuan Zhang](https://jasonzhangzy1757.github.io/)\n- [Tianyi Ma](https://tianyi-billy-ma.github.io/)\n- [Chuxu Zhang](https://chuxuzhang.github.io/)\n- [Yanfang Ye](http://yes-lab.org/)\n\nFor questions, please contact `zwang43@nd.edu` or open an issue.\n\n## 🙏 Acknowledgements\n\nThis repository builds upon the excellent work from:\n- [GPM](https://github.com/zehong-wang/GPM)\n- [PyG](https://github.com/pyg-team/pytorch_geometric)\n- [OGB](https://github.com/snap-stanford/ogb)\n- [VQ](https://github.com/lucidrains/vector-quantize-pytorch)\n\nWe thank these projects for their valuable contributions to the field.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzehong-wang%2Fg2pm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzehong-wang%2Fg2pm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzehong-wang%2Fg2pm/lists"}