Skip to content

v0.4.0

Compare
Choose a tag to compare
@BarclayII BarclayII released this 07 Oct 09:45
· 3431 commits to master since this release
5e17ef5

We are thrilled to announce the 0.4 release! This release extends DGL by (i) including support for heterogeneous graphs and (ii) providing a sub-package to efficiently compute embeddings of large knowledge graphs. In addition, it includes numerous performance improvements, contributed models and datasets, and bugfixes.

Support for Heterogeneous Graphs

What is a heterogeneous graph?

Many real world data are about relations between different types of entities. For instance, an E-commerce data may have three types of entities: customers, items, and vendors. Customers and items may have different types of interactions such as clicks or purchases. Customers can also follow each other. Entities and relations may also have their own set of features.

A heterogeneous graph, whose nodes and edges are typed, could match the scenario accurately:

image

Models that work on heterogeneous graphs?

We provide a few models to demonstrate the use cases of heterogeneous graphs and the corresponding DGL APIs.

  • Graph Convolutional Matrix Completion [Code in MXNet]
    • On an EC2 p3.2xlarge instance, we obtained a 5x speedup on MovieLens-100K, and 22x on MovieLens-1M compared against official implementation. We are also able to train on the entire graph without minibatches on MovieLens-10M (the official implementation goes out of memory).
  • R-GCN [Code in PyTorch]
    • The new code can train the model for the AM dataset (>5M edges) using one GPU, while the original implementation consumes 32GB of memory, thus cannot fit on a single GPU and can only run on CPU.
    • The original implementation takes 51.88s to train one epoch on CPU. The new R-GCN based on heterograph takes only 0.1781s for one epoch on V100 GPU (291x faster !!).
  • Heterogeneous Attention Networks [Code in PyTorch]
    • We provide the dgl.transform.metapath_reachable_graph that transform a heterogeneous graph into a new graph, where two nodes are connected if the source node can reach the destination node via the given metapath.
  • Metapath2vec [Code in PyTorch]
    • We implement the metapath sampler in C++, making it twice as fast as the original implementation.

Checkout our heterograph tutorial: Working with Heterogeneous Graphs in DGL

Checkout the full API reference.

DGL-KE : A DGL-based Sub-package for Computing Embeddings of Large Knowledge Graphs

Knowledge graph (KG) embedding is to embed entities and relations of a KG into continuous vector spaces. The embeddings preserve the inherent structure of the KG and can benefit many downstream tasks such as KG completion and relation extraction as well as recommendations.

We release DGL-KE that computes embeddings of large KGs efficiently. The package is adapted from the KnowledgeGraphEmbedding package. We extend KnowledgeGraphEmbedding by leveraging DGL's core to achieve high efficiency and scalability. Using a single NVIDIA V100 GPU, DGL-KE can train TransE on FB15k in 6.85 mins, substantially outperforming existing tools such as GraphVite. For graphs with hundreds of millions of edges (such as the full Freebase graph), it takes a couple of hours on one large EC2 CPU instance such as m5.24xlarge and x1.32xlarge.

Currently, the following models are supported:

  • TransE
  • DistMult
  • ComplEx

More models (RESCAL, RotatE, pRotatE, TransH, TransR, TransD, etc) are under development and will be released in the future.

DGL-KE supports various training methods:

  • CPU training: Graph Embeddings are stored in CPU memory and mini-batches are trained on CPU.

  • GPU training: Graph Embeddings are stored in GPU memory and mini-batches are trained on GPU.

  • Joint CPU & GPU training: Graph Embeddings are stored in CPU memory but mini-batches are trained on GPU. This is designed for training KGE models on large knowledge graphs that cannot fit in GPU.

  • Multiprocessing training on CPUs: Each CPU process train mini-batches independently and use shared memory for communication between processes. This is designed to train KGE models on large knowledge graphs with many CPU cores.

Multi-GPU training and distributed training will be released in the future.

For more information, please refer to this directory

Miscellaneous