Skip to content
← Back to Projects

Neo4j MPGNN Thesis

Neo4j MPGNN Thesis

Master's thesis on integrating Graph Neural Networks with Neo4j, benchmarking cost-efficient training and inference pipelines for graph-structured data.

#thesis#graph-neural-networks#neo4j#machine-learning#graph-databases#pytorch

During the spring of 2026 we completed our master’s thesis at the Faculty of Engineering, Lund University in collaboration with Neo4j. We worked together with Victor Pekkari, supervised by Xuan-Son Vu (LTH), Brian Shi (Neo4j), and Alfred Clemedtson (Neo4j), with Jacek Malec (LTH) as examiner.

Our thesis explored how graph neural networks (GNNs) can be efficiently integrated with graph databases, with a focus on building cost-efficient machine learning pipelines for graph-structured data.

Message passing in graph neural networks

The Problem

Graph databases are an increasingly popular storage solution for interconnected data, including social networks, citation graphs, and knowledge bases. At the same time, graph neural networks have become one of the leading methods for learning representations on graph-structured data. The challenge is that processing a single node in a GNN can quickly explode to encompass nearly the entire graph, making training and inference expensive both computationally and in terms of memory.

What We Did

We implemented and compared several integration techniques between GNNs and graph databases:

  • Sampling techniques to approximate a node’s neighborhood and put an upper bound on the amount of data that needs to be processed
  • A custom database plugin with tailored functions for sampling and compact data representation, moving computation into the database itself to minimize data transfer
  • In-database inference, where a trained model runs entirely inside the graph database

Key Findings

  1. Our custom sampling methods for Neo4j were statistically indistinguishable from standard implementations in the PyTorch Geometric machine learning library. No loss of accuracy by shifting to a database-backed approach.

  2. Moving from a pure in-memory data source to a RAM/disk hybrid via a graph database allows smaller, cheaper machines to be used for training. The tradeoff is that the pipeline can become slower. Our custom database plugin addressed this by reducing training time significantly through minimized data transfer.

RAM usage comparison between Neo4j-backed and in-memory training pipelines
  1. In-database inference was at least as accurate as PyTorch Geometric, and one of our methods was actually faster than sending data out for computation externally.

Read More

The full thesis is available as open access: Cost-Efficient Graph Database-backed Graph Neural Network Pipelines

A popular scientific summary in Swedish is also available here.