{"id":18478851,"url":"https://github.com/facebookresearch/forwardgnn","last_synced_at":"2025-04-19T09:54:06.186Z","repository":{"id":234301939,"uuid":"772188769","full_name":"facebookresearch/forwardgnn","owner":"facebookresearch","description":"This repository provides code for the paper \"Forward Learning of Graph Neural Networks\" (ICLR 2024).","archived":false,"fork":false,"pushed_at":"2024-04-18T17:43:51.000Z","size":435,"stargazers_count":17,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T07:05:40.766Z","etag":null,"topics":["forward-learning","graph-learning","graph-neural-networks","link-prediction","node-classification"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/facebookresearch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-03-14T17:46:40.000Z","updated_at":"2025-03-17T05:48:00.000Z","dependencies_parsed_at":"2024-04-18T19:54:14.425Z","dependency_job_id":"a3aac764-2e18-4796-bf9c-f6e9a9b10871","html_url":"https://github.com/facebookresearch/forwardgnn","commit_stats":null,"previous_names":["facebookresearch/forwardgnn"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookresearch%2Fforwardgnn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookresearch%2Fforwardgnn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookresearch%2Fforwardgnn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebookresearch%2Fforwardgnn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/facebookresearch","download_url":"https://codeload.github.com/facebookresearch/forwardgnn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249668764,"owners_count":21308531,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["forward-learning","graph-learning","graph-neural-networks","link-prediction","node-classification"],"created_at":"2024-11-06T12:12:16.300Z","updated_at":"2025-04-19T09:54:06.170Z","avatar_url":"https://github.com/facebookresearch.png","language":"Python","readme":"# Forward Learning of Graph Neural Networks\nThis repository provides the code of the ForwardGNN framework presented in the paper [\"Forward Learning of Graph Neural Networks\"](https://arxiv.org/pdf/2403.11004.pdf), \nNamyong Park, Xing Wang, Antoine Simoulin, Shuai Yang, Grey Yang, Ryan Rossi, Puja Trivedi, Nesreen Ahmed, \nThe Twelfth International Conference on Learning Representations (ICLR) 2024.\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"./img/overview.png\" width=\"800\"\u003e\n\u003c/div\u003e\n\n***Learning graph neural networks (GNNs) with (a) backpropagation and (b)-(d) the proposed forward learning approaches of the ForwardGNN framework**:\n(a) Backpropagation involves one forward pass, followed by one backward pass through the network. \n(b) The forward-forward approach involves two forward passes on positive and negative inputs. \n(c) The single-forward approach learns via just one forward pass. \n(d) The single-forward approach is extended to incorporate top-down signals.*\n\n## Installation\nRunning [install_packages.sh](install/install_packages.sh) sets up the conda environment named `ForwardLearningGNN` and installs required packages.\n\n## Datasets\nDatasets used in the paper will be downloaded in the [`data`](./data/) folder when the code runs for the first time.\n\n## Data Splits\nNode and edge splits to be used for node classification and link prediction, respectively, \nwill be generated in the [`datasplits`](./datasplits/) folder when the code runs for the first time.\nTo use the node and edge splits used for the experiments in the paper,\ndownload them from \n[this repository](https://github.com/NamyongPark/forwardgnn-datasplits), and \nplace them in the [`datasplits`](./datasplits/) folder.\n\n## How to Run\nScripts in [`exp/nodeclass/`](./exp/nodeclass/) and [`exp/linkpred/`](./exp/linkpred/) can be used \nto train GNNs using the proposed forward learning algorithms of ForwardGNN or backpropagation \nfor node classification and link prediction, respectively.\n\n## Directory Structure\n* [`src/`](./src/): source code root directory\n  * [`src/train_forward.py`](./src/train_forward.py): script to train GNNs using the forward learning algorithms\n  * [`src/forward_learning`](./src/forward_learning): root package for the forward learning algorithms\n    * [`src/forward_learning/nodeclass`](./src/forward_learning/nodeclass): package for variants of forward learning algorithms for node classification\n    * [`src/forward_learning/linkpred`](./src/forward_learning/linkpred): package for variants of forward learning algorithms for link prediction\n  * [`src/train_backprop.py`](./src/train_backprop.py): script to train GNNs using backpropagation\n  * [`src/gnn`](./src/gnn): package with adapted GNN operators\n  * [`src/datasets`](./src/datasets): package with scripts to preprocess and load data and data splits\n  * [`src/utils`](./src/utils): package for various utility classes and functions, e.g., performance evaluation, early stopping, and logging.\n* [`exp/`](./exp/): directory with scripts to train GNNs using the proposed forward learning algorithms and backpropagation\n* [`data/`](./data/): directory to store graph data files\n* [`datasplits/`](./datasplits/): directory to store graph data splits\n\n## Citation\nIf you use code in this repository in your own work, please cite our paper.\n```bibtex\n@inproceedings{park2024forwardgnn,\n  title={Forward Learning of Graph Neural Networks},\n  author={Namyong Park and Xing Wang and Antoine Simoulin and Shuai Yang and Grey Yang and Ryan Rossi and Puja Trivedi and Nesreen Ahmed},\n  booktitle={ICLR},\n  year={2024},\n}\n```\n\n## License\nThe majority of the ForwardGNN project is licensed under CC-BY-NC, \nhowever portions of the project are available under separate license terms.\nThe GCN and GraphSAGE operators in the [gnn](./src/gnn) folder adapted the PyG's implementation, \nwhich is licensed under the MIT license.\nThe forward learning algorithms in the [nodeclass](./src/forward_learning/nodeclass) and [linkpred](./src/forward_learning/linkpred) folders \nbuild upon the Nebuly's implementation of the forward-forward algorithm, \nwhich is licensed under the Apache-2.0 license.\n\n## Contributing\nSee the [CONTRIBUTING](CONTRIBUTING.md) file for how to contribute to the project.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebookresearch%2Fforwardgnn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffacebookresearch%2Fforwardgnn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebookresearch%2Fforwardgnn/lists"}