All publications

Applied AI & Data Scienceby Maximilian Lotz20244 min read

AWS GraphStorm for efficient GNN prototyping

GraphStorm makes graph neural networks controllable through configuration files and CLI flags. How that speeds up prototyping on large graphs, and what to watch out for when using it.

Outlook

Machine learning models have become indispensable in today's business world. From spell checking and fraud detection systems to language models, systems of every type, size and set of requirements are being built. Most of them rely on data whose records are either sequentially related or not related at all. In fields where relationships between different entities need to be represented, however, graphs are often used as the underlying data structure. Examples include social networks, customer interactions, transactions and bank transfers, but also molecules, railway tracks or three-dimensional shapes. To bring these relationships into machine learning, so-called graph neural networks (GNNs) were developed.

This post gives a brief look at how the AWS GraphStorm package makes it possible to try out different GNN architectures quickly and test them against different graph structures.

Graphs

Like the real networks and relationships they describe, graphs are highly complex structures that can be modelled in many different ways. To illustrate this, here is a short explanation of a few graph terms:

  • Nodes correspond to entities in a network, for example IBANs, people, companies, credit cards, or atoms and railway stations.
  • Edges correspond to the relationships between nodes.
  • In weighted graphs, edges are assigned properties such as distances.
  • In directed graphs, the relationship between at least one pair of nodes runs in one direction only.
  • A graph is called heterogeneous when it contains different kinds of nodes. Customers, accounts, goods and companies, for example, can each be represented in one graph and connected whenever they appear together in a transaction. The result is a transaction network in which you can search for fraudsters, but also optimise your logistics.
  • A graph is called homogeneous when it contains only one kind of node.

When you build a graph from an existing dataset, the sheer number of decisions involved (Which nodes exist? Which nodes are connected? When are nodes connected? …) means it is not always obvious which structure is the best and most informative one for your use case. It is often necessary to build several graph structures and test them with different GNN algorithms.

Directed

Undirected

Homogeneous

Heterogeneous

Attributed

ID 1ID 2ID 5ID 3ID 4

Weighted

33212

GraphStorm features

GraphStorm is an open-source Python library, actively developed by AWS, for deploying graph machine learning algorithms quickly. It provides pipelines for flexible training and inference both on a local machine and on large multi-cluster systems such as AWS EC2 instances. Integration with SageMaker is also possible. The GraphStorm tools include Python scripts that transform node and edge data into the required formats and at the same time partition the graph for use across several machines. This makes it possible to work with graphs that have billions of nodes and edges.

GraphStorm offers several graph convolution and attention algorithms that can be selected in a YAML configuration file. Among other things, you can choose the number of layers, optional multi-layer perceptrons before or after the GNN, normalisation and early stopping. Every setting available in the configuration file can also be overridden with CLI flags. If you use only the built-in algorithms, the trained model can also be used for live prediction together with a graph database via AWS NeptuneML.

How does GraphStorm support prototyping?

Implementing the neural network architecture and its training routines usually takes up a lot of development time, because prototyping in particular requires either a lot of effort for configurable code or a lot of effort spent adapting the code. This is especially true when training is to run on several GPUs distributed across different servers. Since GraphStorm already does this work and controls it through the configuration file or CLI flags, the focus can stay on constructing the graph itself, so that the best possible graph architecture can be found quickly.

What should you keep in mind when using GraphStorm?

Because GraphStorm is currently a work in progress, changes that are incompatible with existing code can happen at any time. In addition, new features are added so quickly that the documentation is not always up to date. The neural network architecture is not yet fully flexible either: it is not possible to chain different GNN algorithms one after another, or to choose different layer sizes when using several layers.

Conclusion

The AWS GraphStorm library for Python lets data scientists efficiently test, train and deploy different neural network and graph architectures for inference. Because the architecture is controlled through configuration files or CLI flags, it is even possible to test a wide variety of architectures fully automatically using a hyperparameter search.

Applied AI & Data Science

Working on a similar topic?

Tell us what you are working on. We'll put you in touch with Maximilian Lotz and the team working on this topic.

Send an enquiry

At least 20 characters.

Fields marked with * are required.