Paddle Graph Learning
Project description
Paddle Graph Learning (PGL)
DOC | Quick Start | 中文
Paddle Graph Learning (PGL) is an efficient and flexible graph learning framework based on PaddlePaddle.
We provide python interfaces for storing/reading/querying graph structured data and two fundamental computational interfaces, which are walk based paradigm and message-passing based paradigm as shown in the above framework of PGL, for building cutting-edge graph learning algorithms. Combined with the PaddlePaddle deep learning framework, we are able to support both graph representation learning models and graph neural networks, and thus our framework has a wide range of graph-based applications.
Highlight: Efficient and Flexible Message Passing Paradigm
One of the most important benefits of graph neural networks compared to other models is the ability to use node-to-node connectivity information, but coding the communication between nodes is very cumbersome. At PGL we adopt Message Passing Paradigm similar to DGL to help to build a customize graph neural network easily. Users only need to write send
and recv
functions to easily implement a simple GCN. As shown in the following figure, for the first step the send function is defined on the edges of the graph, and the user can customize the send function to send the message from the source to the target node. For the second step, the recv function is responsible for aggregating messages together from different sources.
As shown in the left of the following figure, to adapt general user-defined message aggregate functions, DGL uses the degree bucketing method to combine nodes with the same degree into a batch and then apply an aggregate function on each batch serially. For our PGL UDF aggregate function, we organize the message as a LodTensor in PaddlePaddle taking the message as variable length sequences. And we utilize the features of LodTensor in Paddle to obtain fast parallel aggregation.
Users only need to call the sequence_ops
functions provided by Paddle to easily implement efficient message aggregation. For examples, using sequence_pool
to sum the neighbor message.
import paddle.fluid as fluid
def recv(msg):
return fluid.layers.sequence_pool(msg, "sum")
Although DGL does some kernel fusion optimization for general sum, max and other aggregate functions with scatter-gather. For complex user-defined functions with degree bucketing algorithm, the serial execution for each degree bucket cannot take full advantage of the performance improvement provided by GPU. However, operations on the PGL LodTensor-based message is performed in parallel, which can fully utilize GPU parallel optimization. In our experiments, PGL can reach up to 13 times the speed of DGL with complex user-defined functions. Even without scatter-gather optimization, PGL still has excellent performance. Of course, we still provide build-in scatter-optimized message aggregation functions.
Performance
We test all the GNN algorithms with Tesla V100-SXM2-16G running for 200 epochs to get average speeds. And we report the accuracy on test dataset without early stoppping.
Dataset | Model | PGL Accuracy | PGL speed (epoch time) | DGL 0.3.0 speed (epoch time) |
---|---|---|---|---|
Cora | GCN | 81.75% | 0.0047s | 0.0045s |
Cora | GAT | 83.5% | 0.0119s | 0.0141s |
Pubmed | GCN | 79.2% | 0.0049s | 0.0051s |
Pubmed | GAT | 77% | 0.0193s | 0.0144s |
Citeseer | GCN | 70.2% | 0.0045 | 0.0046s |
Citeseer | GAT | 68.8% | 0.0124s | 0.0139s |
If we use complex user-defined aggregation like GraphSAGE-LSTM that aggregates neighbor features with LSTM ignoring the order of recieved messages, the optimized message-passing in DGL will be forced to degenerate into degree bucketing scheme. The speed performance will be much slower than the one implemented in PGL. Performances may be various with different scale of the graph, in our experiments, PGL can reach up to 13 times the speed of DGL.
Dataset | PGL speed (epoch time) | DGL 0.3.0 speed (epoch time) | Speed up |
---|---|---|---|
Cora | 0.0186s | 0.1638s | 8.80x |
Pubmed | 0.0388s | 0.5275s | 13.59x |
Citeseer | 0.0150s | 0.1278s | 8.52x |
System requirements
PGL requires:
- paddle >= 1.5
- networkx
- cython
PGL supports both Python 2 & 3
Installation
The current version of PGL is 0.1.0.beta. You can simply install it via pip.
pip install pgl
The Team
PGL is developed and maintained by NLP and Paddle Teams at Baidu
License
PGL uses Apache License 2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for pgl-1.0.0-cp37-cp37m-macosx_10_9_x86_64.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b0af74ed64df3109e1da74f92b88399904a3bf8923ea343d7c8e3003df29b93 |
|
MD5 | 039c40ea0255d71a228f7ca02d7d31fd |
|
BLAKE2b-256 | 0be6185f23980abc17fec1a3291694beed930a874b68a5ebdcefc1f54642d235 |
Hashes for pgl-1.0.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1daa1a78e1ab5dfc3fc995eefd88f0d007c3ef47fe704e6cbcf63d489ee16cf0 |
|
MD5 | 53ebaedb5cef4534daabec81139dc310 |
|
BLAKE2b-256 | 197fb602d6f2af02983ff0bbaa24af5af088f6640487684fa933eaf89a743717 |
Hashes for pgl-1.0.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29dce366fec05711a328bfe76b5a31e7f875146b922b59696404230982ab3289 |
|
MD5 | 4a76891672f5efeb6e8f09baf7c0af9e |
|
BLAKE2b-256 | 5286621015baa32e9dfe2ff1c5b2cc810c4e12f073fd26b29a97edf07560507d |
Hashes for pgl-1.0.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33e0feeaadd852e6d03c1ffbcf512dcd73974bc5734875cbed09b6d8592a265e |
|
MD5 | f6ffcd1bef036477321ee17c632b4fcd |
|
BLAKE2b-256 | ca9ed4a7382eccad202a493d25ca67867f3a6db0a34db25d6eed5d5cf11b8a59 |
Hashes for pgl-1.0.0-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e4649aa8fd40c8d59628769f064672864151ce1030cf938bcd45a08baf91d96 |
|
MD5 | 7548a1f1ec8d63906c590cfa0902b0e1 |
|
BLAKE2b-256 | 3aa147eb75684c4d50ea0c266b01474f2c197172939761fcdf4439c2665770bb |
Hashes for pgl-1.0.0-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d96a0213c9417921903be7364404467065c4ac5d8574f9da224574f6838c9024 |
|
MD5 | f76a64832b081dfef2563d950b272a6d |
|
BLAKE2b-256 | d8b24bf7f8a8ed8a199cf867c71d71b36aae7086186c56335698399d51ebbb82 |
Hashes for pgl-1.0.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eaae598b7d7ac48c1ac5cd2e5e0fb86f594e78b1e8d2ab1e713473855dcbaa57 |
|
MD5 | e826a5ff7777597aba436f37dc899619 |
|
BLAKE2b-256 | 048fc5bcce3be70033be99cc5581c952cbd6e8e1757b64be6ccd5fec28cf1dfa |