Asynchronous Algorithmic Alignment with Cocycles

Andrew Joseph Dudzik, Tamara von Glehn, Razvan Pascanu, Petar Veličković

Abstract

Neural Algorithmic Reasoning (NAR) aims to train Graph Neural Networks (GNNs) to execute classical algorithms. However, standard GNNs are inherently synchronous, requiring every node to send messages at every layer. This paradigm is a poor fit for dynamic programming algorithms where only a handful of nodes have meaningful updates at each step. This mismatch forces GNNs to learn complex identity functions to maintain state during idle steps. We propose a mathematical framework using cocycles and monoid actions to explicitly separate node state updates from message function invocations. Our analysis yields synchronous GNN layers that are provably invariant under various forms of asynchrony. Evaluation on the CLRS-30 benchmark demonstrates that our approach significantly improves out-of-distribution generalization on complex algorithmic tasks.

Introduction

Standard Graph Neural Networks (GNNs) operate globally and synchronously: in every layer, every node aggregates information from all its neighbors simultaneously. While effective for many graph tasks, this is inefficient for algorithms like Dijkstra’s or Depth-First Search (DFS). In these cases, forcing a GNN to be synchronous means many nodes must learn to "wait" by performing identity operations, which is a difficult learning problem.

The evolution of node states and message queues in an asynchronous setting, illustrating how individual nodes process incoming instructions.

We shift from a global view to a node-centric view, focusing on how individual nodes process incoming messages and generate outgoing arguments. By formalizing these interactions using abstract algebra, we can build GNNs where the final output is identical regardless of whether messages are processed in one large batch or multiple asynchronous chunks.

Methodology

Our framework treats messages and node states as elements of a monoid (a set with an associative binary operation and an identity element), allowing us to model "instruction queues."

The 1-Cocycle Condition

The core contribution is the identification of the 1-cocycle condition. Mathematically, this ensures that the arguments produced by a node receiving two messages together are the same as the combination of arguments produced by receiving them sequentially. This property makes the network's logic robust to the timing and order of message delivery.

Levels of Invariance

We define three levels of asynchrony-robustness for GNN layers:

  1. L1 (Order Invariance): Invariant to message receiving order, typically achieved using commutative aggregators like sum.
  2. L2 (State Update Invariance): Invariant to repeated state updates, using idempotent operations like max.
  3. L3 (Message Function Invariance): Invariant to repeated message function calls, requiring message functions to be monoid multimorphisms.
The computational flow of a GNN layer designed for asynchronous alignment, showing the path from senders to receivers via edge-based message functions.

Results and Discussion

We evaluated our approach on the CLRS-30 benchmark, focusing on out-of-distribution (OOD) generalization to graphs much larger than those seen during training.

Performance and Generalization

The experiments showed a clear trend: higher levels of asynchrony invariance lead to better performance. L3 Models, which utilize log-semiring bilinear layers (a smooth approximation of tropical geometry), achieved the best overall results. These models excelled in purely sequential algorithms like DFS and topological sorting, where standard GNNs often struggle.

Theoretical Alignment

Our framework provides a theoretical "gold standard" for why certain architectures succeed. We rigorously prove that the Bellman-Ford algorithm satisfies our cocycle conditions. Furthermore, we show that our theory naturally re-derives PathGNNs, proving they are effective precisely because they align with the requirements for asynchrony invariance.

Conclusion

By aligning GNN architectures with the node-centric logic of classical algorithms through cocycles, we significantly improve their reasoning and generalization capabilities. While our current implementation focuses on making synchronous layers invariant to asynchrony, this work provides the blueprint for future GNNs running on truly asynchronous or distributed hardware.

Summary updated

BibTeX
@inproceedings{dudzik2023asynchronous,
  author = {Andrew Joseph Dudzik and Tamara von Glehn and Razvan Pascanu and Petar Veličković},
  title = {{Asynchronous Algorithmic Alignment with Cocycles}},
  booktitle = {LoG},
  year = {2023},
  url = {https://openreview.net/forum?id=ba4bbZ4KoF},
}
Figure