S IMPLICIAL A TTENTION N ETWORKS
A BSTRACT
Graph representation learning methods have mostly been limited to the modelling of node-wise interactions.
Recently, there has been an increased interest in understanding how higher-order structures can be utilised to further enhance the learning abilities of graph neural networks (GNNs) in combinatorial spaces.
Simplicial Neural Networks (SNNs) naturally model these interactions by performing message passing on simplicial complexes, higher-dimensional generalisations of graphs.
Nonetheless, the computations performed by most existent SNNs are strictly tied to the combinatorial structure of the complex.
Leveraging the success of attention mechanisms in structured domains, we propose Simplicial Attention
Networks (SAT), a new type of simplicial network that dynamically weighs the interactions between neighbouring simplicies and can readily adapt to novel structures.
Additionally, we propose a signed attention mechanism that makes SAT orientation equivariant, a desirable property for models operating on (co)chain complexes.
We demonstrate that SAT outperforms existent convolutional SNNs and GNNs in two image and trajectory classification tasks.
I NTRODUCTION & RELATED WORK
Graph Neural Networks (GNNs) (Sperduti, 1994; Goller & Kuchler, 1996; Gori et al., 2005; Scarselli et al., 2008; Bruna et al., 2014; Defferrard et al., 2016; Kipf &
Welling, 2017; Gilmer et al., 2017) have become a successful model for statistical problems characterised by an underlying structure.
Nonetheless, the simple combinatorial structure of graphs, relying exclusively on dyadic interactions, has recently driven towards extending these approaches to higher-dimensional generalisations such as simplicial (Ebli et al., 2020;
Bunch et al., 2020; Bodnar et al., 2021b) and cellular complexes (Bodnar et al., 2021a; Hajij et al., 2020)
Simplicial Nerual Networks (SNNs) have recently been successfully applied to various problems such as missing data imputation (Ebli et al., 2020), graph classification (Bunch et al., 2020; Bodnar et al., 2021b), molecular property prediction (Bodnar et al., 2021a), edge prediction Chen et al.
(2021), trajectory classification (Bodnar et al., 2021b) and prediction (Glaze et al., 2021) as well as homology localisation (Keros et al., 2021).
All these approaches can be seen as particular instances of the message passing framework (Bodnar et al., 2021b;a).
Nonetheless, the computations performed by convolutional approaches are tightly coupled to the combinatorial structure of the complex, which could hinder generalisation to unseen simplicial structures.
Therefore, motivated by the recent success of attention-mechanisms in graph representation learning (Veliˇckovi´c et al., 2018) and structured domains more generally (Vaswani et al., 2017), we propose Simplicial Attention Networks (SAT).
Generalising GAT (Veliˇckovi´c et al., 2018), SAT dynamically learns to attend over different neighbouring simplices based on their features.
Additionally, we show how SAT can be made orientation equivariant (Glaze et al., 2021; Bodnar et al., 2021b) via signed attention coefficients, thus making it suitable for oriented simplicial complexes.
In practice, we consider an image classification task based on superpixel graphs and a trajectory classification benchmark involving oriented simplicial complexes. We evaluate SAT in both settings against several GNN and SNN baselines and demonstrate it outperforms them. Code for model and experiments can be found at https://github.com/ggoh29/ Simplicial-neural-network-benchmark .
B ACKGROUND
Simplicial Complexes Simplicial complexes are a class of topological spaces that are made of nicely glued simplices of various dimensions.
Given a set of vertices V , a k-simplex is an unordered subset { v 0 , v 1 , . .
, v k } where v i ∈ V and v i ̸
= v j for all i ̸
= j .
For a k-simplex σ = { v 0 , v 1 , . .
, v k } , we say its faces are all the (k-1)-simplices that are also subsets of σ , while its cofaces are all (k+1)-simplices that have σ as a face.
A simplex can also have an orientation, denoted by [ v 0 , v 1 , . .
, v k ] , where there is a chosen orientation for its vertices.
Two orientations are considered equivalent if they differ by an even permutation, or can be expressed by an even number of transpositions.
The choice of orientation is arbitrary and it is used only for bookkeeping purposes.
Adjacencies Similarly to how we consider two nodes to be adjacent if there exists an edge that connects the two of them together, there is a notion of adjacency for simplicial complexes.
However, adjacency can exist in two forms.
Two k-simplices σ i and σ j are upper adjacent if both are faces of some ( k + 1) -simplex τ .
If the complex is oriented, we further say σ i and σ j are similarly oriented with respect to τ if the orientations of σ i and σ j agree with the ones induced by τ .
If not, they are dissimilarly oriented.
Similarly, two k-simplices σ i and σ j are lower adjacent if both have a common face.
We denote the upper adjacent simplices of σ by N ↑ σ and the down adjacent simplices by N ↓ σ .
For the purposes of this paper, we also assume that σ ∈ N ↑ σ and σ ∈ N ↓ σ .
Given two adjacent d -dim simplices σ, τ , denote by o σ,τ ∈ {± 1 } the relative orientation between them with o σ,σ = 1 for all σ .
If the complex is not oriented, we assume o σ,τ = 1 for all adjacent simplices σ, τ .
Hodge Laplacian Consider a simplicial complex K .
Denote by C k the vector space with coefficients in R having the oriented k -simplices of K as its basis.
Elements of this vector space are called k -chains.
Then we can define a boundary operator ∂ k : C k ( X ) →
C k − 1 ( X ) acting on the basis elements via ∂ k [ v 0 , . .
, v k ] :
= (cid:80) i ( − 1) i [ v 0 , . .
, ˆ v i , . .
, v k ] , where ˆ v i denotes the face obtained by excluding v i .
This can be represented as a matrix B k where the rows are indexed by (k-1)-simplices and the columns are indexed by k-simplices.
Based on the boundary matrix and their transpose, we can define the Hodge Laplacian, a linear operator L k : C k ( X ) →
C k ( X ) , which is a higher order generalisation of the graph Lapacian (Lim, 2019).
In matrix form, the k-th Hodge Laplacian is defined as:
[Equation]
One point to note is that B ⊤ k B k correspond to the lower adjacencies, whereas B k +1 B ⊤ k +1 correspond to the upper adjacencies.
We can refer to them as L downk and L upk respectively.
The existent simplicial convolutional networks rely on this Laplacian (and its normalised versions) to weigh the different adjacencies between simplices.
Instead, we propose using a learned attention matrix that can easily be used both for signals that are k -chains and arbitrary signals on unoriented simplicial complexes.
S IMPLICIAL A TTENTION N ETWORKS
Let K be a simplicial complex.
We will describe our model for an arbitrary dimension of the complex d ≤ dim( K ) .
We compute attention coefficients for the up α ↑ σ,τ and down α ↓ σ,τ adjacencies via the following equations:
[Equation]
where a is a function for computing attention coefficients.
In an oriented simplicial complex, this effectively becomes a form of signed attention.
Note that when working at the node-level, where the relative orientation between nodes is trivial and only upper adjacencies are present, one recovers
GAT Veliˇckovi´c et al.
Denote by H d the features associated to the d -dimensional simplices of K .
SAT layers are described by the following message passing equation weighting the neighbours by the attention coefficients:
[Equation]
Here, ϕ is an update function that aggregates the two incoming messages from the lower and upper adjacencies and updates the representation of σ .
More generally, each of these arguments can effectively be augmented with Z attention heads:
[Equation]
In oriented simplicial complexes, the choice of orientation is arbitrary and we would like the model to be aware of this symmetry.
Mathematically, we would like SAT to be orientation equivariant (Bodnar et al., 2021b; Glaze et al., 2021).
Definition 1 (Bodnar et al.
(2021b)) .
Let K be a simplicial complex described by boundary matrices { B i } .
A function f : C k → C k is orientation equivariant if for any diagonal matrix T with ± 1 on the diagonal, f ( T H k , B k T ,
T B k +1 )
=
T f ( H k , B k , B k +1 ) .
We will now show that under certain constraints on the functions a and ϕ the model is orientation equivariant.
Proposition 2.
If the function a is even in both of its arguments and ϕ is odd in both of its arguments,
SAT is orientation equivariant.
Proof Sketch.
At the message passing level, the equivariance equation is respected if and only if for any simplex σ the local aggregation is invariant to the changes in orientation of the neighbour simplices and if σ changes its orientation, the output features h k +1 σ pick up a minus sign (see Bodnar et al.
(2021b) for details).
Because a is an even function, the product α σ,τ h τ is invariant with respect to changes in the orientation of τ because the change in sign for α σ,τ and h τ cancel each other.
Therefore, the aggregation is invariant with respect to changes in the orientations of the neighbours.
Furthermore, since the function ϕ is odd and α σ,σ ≥ 0 for any orientation of σ , it follows that the local aggregation picks up a minus sign when the orientation of σ is flipped.
R ESULTS 4. S UPERPIXEL GRAPHS
Dataset We use the classification of superpixel graphs as our first benchmark to demonstrate the capabilities of SAT.
A superpixel graph is the graph representation of an image in which pixels are grouped into nodes representing perceptually meaningful regions, such as a region of similar intensity (Achanta et al., 2012).
By representing the image as a graph, it is possible to change the task of image classification to graph classification.
This application of using graph neural networks on superpixel graphs for the task of image classification was first done by Monti et al.
and has since been a popular framework for testing graph neural networks.
Here, we use images from the Modified National Institute of Standards and Technology database (MNIST) (LeCun & Cortes, 2010) containing handwritten digits from 0 to 9.
To construct a superpixel dataset from MNIST, we use the Simple Linear Iterative Clustering (SLIC)
(Achanta et al., 2012) algorithm.
The superpixel nodes are then connected to directly adjacent nodes by means of a region adjacency graph to get the final graph.
The simplicial complex we consider is the two-dimensional clique complex of this graph. Triangles are of particular importance as they tend to encode tightly connected regions constituting a form -order
We follow the work of Long et al.
(2021) in setting up the node features and how the GNN layers are used.
The node features of node cluster j are h
j = [ 1 / n (cid:80) n j i ( a i , b i , g i )] where the a i and b i are the x and y coordinate of pixel i respectively, and g i is the greyscale value of pixel i.
The features for the 1-simplices and 2-simplices will be the concatenation of the node features that make up the simplex in the order given by pixel values.
Architecture Our layers are arranged in the same architecture proposed by Long et al.
(2021) known as a hierarchical GNN architecture.
This was used to avoid the over-smoothing problem (Cai & Wang, 2020; Oono & Suzuki, 2019).
This architecture comprises of three GNN/SNN layers.
The resulting node features from each layer, also known as the residual, are concatenated, resulting in the penultimate feature vector comprising of features vectors from previous layers.
This is then passed through a mean pooling function, before being fed to a multi-layer perceptron with 10 outputs followed by a softmax activation.
Experimental setup For the experiment, we set the superpixel algorithm SLIC to generate approximately 75 nodes.
For all experiments we set a budget of 100 epochs for training, with a batch size of 32 images, using a split of 55k images for training and 5k images for validation.
The model corresponding to the epoch with the best validation performance on the validation set is saved and tested against the MNIST test set of 10k images.
For the optimisation, we use the Adam optimiser, a weight decay of 0 . 0005 , and a learning rate of 0 .
001 for all models tested.
We compare SAT against (GCN) (Kipf & Welling, 2017),
GAT (Veli ˇ ckovi ´ c et al., 2018), SCCONV (Bunch et al., 2020), and SCN (Ebli et al., 2020).
All models were used in a hierarchical
GNN setup explained above with 3 layers each.
We set the number of feature channels for each model such that the total number of parameters across all models was roughly 10k.
All models use a ReLU activation function except SCN which uses Leaky ReLU as in the original paper.
Both GAT and SAT use two attention heads.
Results We repeat the training procedure described above across five seeds and report the mean accuracy and standard deviation.
Additionally, we report the exact number of parameters of each model.
As the table shows, SAT outperforms its GNN counterpart (GAT), as well as other simplicial convolutional networks that have been recently proposed.
[Table]
4. T RAJECTORY C LASSIFICATION
To demonstrate the superior performance of SAT when operating on k -chains as well as to display the benefits of orientation equivariance in this setting, we now consider a trajectory classification task (Schaub et al., 2020; Bodnar et al., 2021b) involving oriented simplicial complexes. Dataset The trajectory classification dataset is a synthetic dataset constructed by sampling 1000 points within a unit square followed by a Delauney triangulation. Two holes within the graph are created by removing certain nodes and the edges connected to these nodes.
Trajectories are generated by randomly sampling a starting point from the top-left corner and an endpoint from the bottom right corner.
Two different types of such trajectories are generated.
One class of trajectories traverses via the top-right corner, while the second class traverses via the bottom-left corner.
We randomly generate 1000 train and 200 test trajectories in this manner.
In order for the test to be challenging for non-orientation invariant models, all trajectories from the training dataset use the same orientation for the edges, while trajectories from the test dataset use random orientations.
Two trajectories from this dataset, belonging to two different classes, can be seen in Figure 3.
Experimental setup All models use the same hyperparameters.
We use 4 layers, with the residual size set to 32 for all layers.
Following the 4 layers, we take the absolute of the output and do a mean-pooling to make it orientation invariant.
We then pass this through two multi-layer perceptron layers before finally taking the softmax of the output.
For all experiments, we set a budget ofepochs for training, with a batch size of 4.
Since there is no validation set, the model corresponding to the epoch with the best performance on the training set is saved and used for testing.
For the optimisation, we once again use the Adam optimiser, a weight decay of 0 . 0005 , and a learning rate of 0 .
001 for all models tested.
Results We repeat the training procedure described above across five seeds and three different activation functions and report the mean accuracy and standard deviation.
Models that use odd activation functions (i.e. the identity of tanh), which makes them orientation equivariant, perform better on the test set.
Furthermore, the orientation equivariant SAT outperforms other orientation equivariant SNNs. [Table]  C ONCLUSION In this paper, we introduced Simplicial Attention Networks (SAT) 1 , a novel SNN that is able to incorporate attention-mechanisms in order to assign different importance weights to neighbouring simplices as well generalise to unseen simplicial structures.
For applications involving orientated simplices, we also illustrated how SAT can be made orientation equivariant via signed attention coefficients.
Empirically, we showed SAT outperforms other GNNs and SNNs at the tasks of classifying superpixel images generated from the MNIST dataset and classifying trajectories represented as 1 -chains on a simplicial complex.