Neural Spacetimes for DAG Representation Learning

## Abstract

Abstract We propose a class of trainable deep learning-based geometries called Neural Spacetimes (NSTs), which can universally represent nodes in weighted directed acyclic graphs (DAGs) as events in a spacetime manifold. While most works in the literature focus on undirected graph representation learning or causality embedding separately, our differentiable geometry can encode both graph edge weights in its spatial dimensions and causality in the form of edge directionality in its temporal dimensions. We use a product manifold that combines a quasi-metric (for space) and a partial order (for time). NSTs are implemented as three neural networks trained in an end-to-end manner: an embedding network, which learns to optimize the location of nodes as events in the spacetime manifold, and two other networks that optimize the space and time geometries in parallel, which we call a neural (quasi-)metric and a neural partial order, respectively. The latter two networks leverage recent ideas at the intersection of fractal geometry and deep learning to shape the geometry of the representation space in a data-driven fashion, unlike other works in the literature that use fixed spacetime manifolds such as Minkowski space or De Sitter space to embed DAGs. Our main theoretical guarantee is a universal embedding theorem, showing that any k 𝑘 k italic_k -point DAG can be embedded into an NST with 1 + 𝒪 ⁢ ( log ⁡ ( k ) ) 1 𝒪 𝑘 1+\mathcal{O}(\log(k)) 1 + caligraphic_O ( roman_log ( italic_k ) ) distortion while exactly preserving its causal structure. The total number of parameters defining the NST is sub-cubic in k 𝑘 k italic_k and linear in the width of the DAG. If the DAG has a planar Hasse diagram, this is improved to 𝒪 ( log ( k ) ) + 2 ) \mathcal{O}(\log(k))+2) caligraphic_O ( roman_log ( italic_k ) ) + 2 ) spatial and 2 temporal dimensions. We validate our framework computationally with synthetic weighted DAGs and real-world network embeddings; in both cases, the NSTs achieve lower embedding distortions than their counterparts using fixed spacetime geometries.

## 1 Introduction

Graphs are a ubiquitous mathematical abstraction used in practically every branch of science from the analysis of social networks (Robins et al., ) to economic stability (Hurd et al., ) and genomics (Marbach et al., ).
The breadth of social and physical phenomena encoded by large graphs has motivated the machine learning community to seek efficient representations (or embeddings) of graphs in continuous spaces.
Since the structure of graphs typically has properties very different from those of standard Euclidean spaces (e.g., trees exhibit exponential volume growth), a significant effort has been made to identify non-Euclidean geometries which can faithfully capture the structure of general graphs.
Examples include hyperbolic embeddings of trees and tree-like graphs (Ganea et al., ; Sonthalia & Gilbert, ; Shimizu et al., ; Kratsios et al., , ), spherical and toroidal embeddings of graphs with cycles (Schoenberg, ; Guella et al., ; Giovanni et al., ),
embeddings of graphs with several of these characteristics into product Riemannian geometries (Borde et al., , ; Giovanni et al., ), alternative combinations of constant curvature Riemannian manifolds (Lu et al., ) and manifolds with locally controllable Ricci curvature (Giovanni et al., ).

Figure: Figure 1: A Neural Spacetime (NST) is a learnable triplet $\mathcal{S}=(\mathcal{E},\mathcal{D},\mathcal{T})$, where $\mathcal{E}:\mathbb{R}^{N}\rightarrow\mathbb{R}^{D+T}$ is a (feature) encoder network, $\mathcal{D}:\mathbb{R}^{D+T}\times\mathbb{R}^{D+T}\to[0,\infty)$ is a learnable quasi-metric on $\mathbb{R}^{D}$ and $\mathcal{T}:\mathbb{R}^{D+T}\to\mathbb{R}^{T}$ is a learnable partial order on $\mathbb{R}^{T}$. Given an input Directed Acyclic Graph (DAG), $\mathcal{E}$ optimizes the location of the nodes $u,v,w$ as events in the space-time manifold $\hat{u},\hat{v},\hat{w}$, while concurrently $\mathcal{D}$ and $\mathcal{T}$ learn the geometry of space and time themselves. The objective is to find a geometry that can faithfully represent, with minimal distortion, the metric geometry of the input DAG in space as well as its causal connectivity in time.
Refer to caption: x1.png

Despite these successes, it was shown in Borde & Kratsios (, Proposition 2) that no complete Riemannian geometry can contain an isometric copy of even very simple graph structures, highlighting the inherent limitation of such spaces in representation learning. In the same paper, the authors developed a trainable deep learning-based fractal geometry, which is flexible enough to exactly (isometrically) represent any undirected graph. In particular, the architecture avoided the need to manually identify the appropriate closed-form metric to embed different graphs and allowed for the optimization of a parametric metric via gradient descent instead (see Appendix A.3). Although distance information (e.g. shortest path graph geodesic distance) alone is enough to recover undirected edges, standard metric learning does not easily encode direction; thus far, the majority of works has focused on representation learning of undirected graphs.
However, the description of many real-world systems requires directed graphs, for example, gene regulatory networks (Marbach et al., ), flow networks (Deleu et al., ), stochastic processes (Backhoff-Veraguas et al., ), or graph metanetworks (Lim et al., ) to name a few.

The Directed Graph Embedding Problem.
Directed graphs (or digraphs) play a significant role in causal reasoning, where they are used to study the relationship between a cause and its effect in a complex system. These problems make use of representation spaces with causal structures, modeling the directional edges of a discrete graph as causal connections in a continuous representation space (Zheng et al., ). However, most approaches in causal representation learning primarily focus on capturing directional information while neglecting distance information. Recent works (Law & Lucas, ; Sim et al., ) have suggested that Lorentzian spacetimes from general relativity are suitable representation spaces for directed graphs, as these geometries possess an arrow of time that provides them with causal structure (see Appendix A.5) while also being capable of encoding distance.
In particular, some Lorentzian spacetimes called *globally hyperbolic* (Geroch, ) have the important property that any pair of causally related points may be joined by a causal geodesic segment of maximal length (Beem et al., ).
It is important to note that these geometries do not allow for time loops, where points can have a non-trivial causal relationship with themselves in time. This means they cannot model general digraphs, only DAGs, which are also the focus of our work.
Globally hyperbolic Lorentzian spacetimes can be decomposed into a Lorentzian product $\mathbb{R}\times\mathcal{M}$, where $\mathcal{M}$ is a Riemannian manifold describing the spatial structure of the spacetime and $\mathbb{R}$ is a real time dimension that characterizes causality  (Beem et al., , Theorem 3.66 and 3.67).
A point or event $(t,p)$ in the globally hyperbolic manifold is said to causally precede another event $(s,q)$ only if they are ordered $t\leq s$, where $t$ and $s$ represent time and $p$ and $q$ denote space coordinates, respectively.
Unfortunately, simply using a single time dimension to define partial orders cannot encode most DAGs (see proof in Proposition 3), e.g. any directed tree with two or more leaves. Therefore, one must turn to richer causal structures (for instance with multiple time dimensions) to model greater directional complexity.

The Neural Spacetime Model.
We propose a trainable geometry with enough temporal and spatial dimensions to encode a broad class of weighted DAGs. In particular, the neural spacetime (NST) model utilizes a MultiLayer Perceptron (MLP) encoder that maps graph node features to an intermediate Euclidean latent space, which is then fragmented into space and time and processed in parallel by a neural metric network (inspired by the neural snowflake model from Borde & Kratsios ()) and a neural (partial) order. These embed nodes jointly as causally connected events in the continuous representation while respecting the one-hop distance (given by the DAG weights) and directionality of the original discrete graph structure, see Figure 1. The spatial component of our model, which considers $D$ spatial dimensions, leverages large-scale and asymptotic embedding approaches relevant in coarse and hyperbolic geometry (Nowak, ; Eskenazis et al., ), as well as the small-scale embedding-based approach of Borde & Kratsios () inspired by fractal-type metric embeddings. These are often used to encode undirected graphs equipped with their (global) geodesic undirected distance (Bourgain, ; Matoušek, ; Gupta, ; Krauthgamer et al., ; Neiman, ; Elkin & Neiman, ; Andoni et al., ; Filtser, ; Kratsios et al., ; Abraham et al., ), which implies that their local distance information can also be embedded (Abraham et al., ; Charikar et al., ). Note that the opposite is not true: optimizing for the local geometry does not guarantee a faithful representation of the global geometry (Ostrovska & Ostrovskii, ).
On the other hand, the temporal component of our trainable geometry parameterizes an order structure $\lesssim^{\mathcal{T}}$ on multiple $T$ time dimensions. Thus, causality in our representation space simply means that a point $x\in\mathbb{R}^{D+T}$ precedes another $y\in\mathbb{R}^{D+T}$ in the sense that $x\lesssim^{\mathcal{T}}y$ (which only considers order in time $T$, see Section 3). When $T=1$, our geometry corresponds to using a Cauchy time function of the globally hyperbolic Lorentzian spacetimes to define a partial order (see Beem et al. (, Page 65) or Burtscher & Garcia-Heveling ()).

Contributions. Our contributions are as follows:

- •
We propose a computationally tractable parametric construction of spacetimes (with multiple time dimensions) based on neural networks, ensuring that only valid geometries are learnable; hence, the term neural spacetimes (NSTs). Our approach decouples the representation into a product manifold, which models (quasi-)metrics and (partial) orders independently. It enables learning, via gradient descent, an isocausal embedding of DAGs (Section 3.1). We provide techniques to build, optimize, and stabilize artificial neural networks with fractalesque activation functions, upon which neural spacetimes are constructed (Section 3.3 and Appendix C).
- •
Our main theoretical result, Theorem 1, provides a global embeddability guarantee showing that any (finite) poset can be embedded into a neural spacetime with a sufficient number of temporal and spatial dimensions, where the number of temporal dimensions equals the complexity (the so-called width of the poset) and the number of spatial dimensions depends on the desired embedding accuracy with respect to the shortest path distance on the underlying undirected graph. The embeddings are causal in time and asymptotically isometric in space. Furthermore, the neural spacetime model only requires $\mathcal{O}(k^{2})$ parameters to globally embed a weighted DAG with $k$ nodes. Secondly, Proposition 3 characterizes which posets can be embedded using at most two temporal dimensions. In particular, this shows that globally hyperbolic Lorentzian spacetimes are too rigid to capture the structure of many posets as they can only encode those with Hasse diagrams inducing a planar graph (see Example 2). Lastly, Theorem 2 shows that a broad class of posets can be embedded into a NST with at most two temporal dimensions. Here, the embeddings are causal in time and exactly isometric in space.
- •
We experimentally validate our model on synthetic metric DAG embedding datasets, as well as real-world directed graphs such as the WebKB (Rozemberczki et al., ) and Dream5 (Marbach et al., ) datasets, which involve web hyperlink connections and gene expression networks, respectively. We compare neural spacetimes against other manifolds proposed in the spacetime representation learning literature and demonstrate the superior embedding capabilities of the proposed geometry.

In summary, in this work, we propose a parametric representation of spacetime geometries with embeddability guarantees for weighted DAGs, which can be practically implemented and optimized in a data-driven manner via gradient descent without requiring a priori a closed-form representation of the geometry.

## 2 Preliminaries: Directed Graphs, Posets, and Quasi-Metrics

We now introduce the relevant notions of causal and spatial structure required to formulate our main results and our model. This section concludes by discussing the concept of spacetime embeddings, which represent DAGs in a continuous space encoding both their causal and spatial structure.

### 2.1 Causal Structure

Directed Graphs. Consider a weighted directed graph, $G_{D}=(E_{D},V,W_{D})$, where $E_{D}$ represents a set of directed edges, $V$ a set of vertices, and $W_{D}$ the strength of the connections, respectively.
We say that two vertices $u,v\in V$ are causally connected, denoted by $u\preccurlyeq v$, if there exists a sequence of directed edges, a path $\big{(}(\nu_{n},\nu_{n+1})\big{)}_{n=1}^{N-1}$ in $V$ with $\nu_{1}=u$ and $\nu_{N}=v$. Notice that causal connectivity is a transitive relation; that is, if $u\preccurlyeq v$ and $v\preccurlyeq w$, then $u\preccurlyeq w$, for each $u,v,w\in V$. The neighborhood $\mathcal{N}(u)$ of a node $u\in V$ is the set of nodes sharing an edge with $u$; i.e. $\mathcal{N}(u)\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\{v\in V:\,(u,v)
\in E_{D}\mbox{ or }(v,u)\in E_{D}\}$. Every weighted directed graph $G_{D}=(E_{D},V,W_{D})$ is naturally a graph upon forgetting edge directions, meaning that it induces a weighted undirected graph $G=(E,V,W)$ where $E\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\{\{u,v\}\in V:\,(u,v)\in E_{D
}\mbox{ or }(v,u)\in E_{D}\}$ and where $W$ is the symmetrization of $W_{D}$, $W(u,v)\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\max\{W_{D}(u,v),W_{D}(v,
u)\}$.

###### Remark 1 (Feature Vectors and Nodes) .

In practice, e.g. in Graph Neural Network (GNN) (Scarselli et al., ) use-cases, one equips the nodes in the graph $G=(E_{D},V,W_{D})$ with a set of feature vectors $\{x_{v}\}_{v\in V}$ in $\mathbb{R}^{N}$. We thus henceforth identify the set of nodes $V$ in any graph with a set of feature vectors in $\mathbb{R}^{N}$, for some positive integer $N$, via the identification $V\in v\leftrightarrow x_{v}\in\mathbb{R}^{N}$.

Figure: Figure 2: The red arrows illustrate the Hasse diagram (DAG) with directed edge set $\{(A,B),(B,C),(B,D),(D,E)\}$. Its corresponding poset is depicted using green arrows on the same vertex set $\{A,B,C,D,E\}$. Our partial order is not a total order as there is no red or green arrow between $C$ and $E$. Red arrows encode key DAG structure and green arrows encode all their possible compositions.
Refer to caption: x2.png

Posets.
A broad class of logical relations can be encoded as directed graphs. We consider the class of partially ordered sets (posets): the pair or tuple $(V,\lesssim)$. In particular, a key characteristic of a poset is that for any two elements $u$ and $v$ in the set the following properties are satisfied: reflexivity, $\forall u\in V,u\preccurlyeq u$; antisymmetry, $u\preccurlyeq v\land v\preccurlyeq u\implies u=v$; and transitivity, $\forall u,v,w\in V,u\preccurlyeq v\land v\preccurlyeq w\implies u\preccurlyeq w$. Every poset can induce a directed graph structure on the vertex set $V$.

###### Example 1 (From DAGs to Posets) .

Given the DAG $G_{D}=(E_{D},V,W_{D})$, then we define the relation $\preccurlyeq$ on vertices $u,v\in V$ such that $u\preccurlyeq v$ if either $u=v$ or there exists a directed path from $u$ to $v$ in the graph. This relation establishes $(V,\lesssim)$ as a poset.

The antisymmetry condition is not satisfied by all digraphs, but only by certain types of digraphs such as DAGs, since it is incompatible with directed cycles of length greater than 1 (loops other than self-loops). Conversely, posets induce directed graphs. This identification is encoded through the Hasse diagram of a poset, see Example 2, which is a natural way to forget all composite relations in the poset by identifying the key basic skeleton relations encoding all its structure. The poset can then be recovered from its Hasse diagram by adding all compositions of edges and self-loops, see Figure 2.

###### Example 2 (From Posets to DAGS: Hasse Diagrams) .

The Hasse diagram of a poset $(V,\lesssim)$ is a directed graph $G_{D}=(E_{D},V)$ with $V\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}E_{D}$ and, for each $u,v\in V$, $(u,v)\in E_{D}$ iff 1) $x_{u}\leq x_{v}$, 2) $u\neq v$ and 3) there is no $w\in V\setminus\{u,v\}$ with $x_{u}\leq x_{w}\leq x_{v}$ (so $x_{u}\leq x_{v}$ is a “minimal relation”).

Our theoretical results in Section 3.2 concentrate on embedding guarantees for posets induced by DAGs, which are of interest in causal inference (Textor et al., ; Oates et al., ), causal optimal transport on DAGs (Eckstein & Cheridito, ), which is particularly important in sequential decisions making (Acciaio et al., ; Backhoff-Veraguas et al., ; Xu et al., ; Eckstein & Pammer, ; Kršek & Pammer, ; Gunasingam & Wong, ) and in robust finance (Bartl et al., ; Acciaio et al., )), in applied category theory (Fong & Spivak, ) since any thin category is a poset (Chandler, ), and in biology applications such as gene regulatory networks (Marbach et al., ).

###### Remark 1 (Feature Vectors and Nodes) .

###### Example 1 (From DAGs to Posets) .

###### Example 2 (From Posets to DAGS: Hasse Diagrams) .

### 2.2 Spatial Structure

Quasi-Metric Spaces. Although Riemannian manifolds have been employed to formalize non-Euclidean distances between points, their additional structural characteristics, such as smoothness and infinitesimal angles, present considerable constraints. This complexity often makes it challenging to express the distance function for arbitrary Riemannian manifolds in closed-form. On the other hand, quasi-metric spaces isolate the pertinent properties of Riemannian distance functions without requiring any of their additional structures for graph embedding. A quasi-metric space is defined as a set $X$ equipped with a distance function $d:X\times X\rightarrow[0,\infty)$ satisfying the following conditions for every $x_{u},x_{v},x_{w}\in X$: i) $d(x_{u},x_{v})=0$ if and only if $x_{u}=x_{v}$, ii) $d(x_{u},x_{v})=d(x_{v},x_{u})$, iii) $d(x_{u},x_{v})\leq C\big{(}d(x_{u},x_{w})+d(x_{w},x_{v})\big{)}$, for some constant $C\geq 1$. Property (iii) is called the $C$-relaxed triangle inequality. When $C=1$, $(X,d)$ is termed a metric space, and the $C$-relaxed triangle inequality becomes the standard triangle inequality. Quasi-metrics arise naturally when considering local embeddings since the triangle inequality is only required to hold locally, allowing for small neighbourhoods of distinct points in a point metric space to be embedded independently from one another. Furthermore, these geometries share many of the important properties of metric spaces, e.g. the Arzela-Ascoli theorem holds (Xia, ). Moreover, if property (i) is dropped, such that several points may be indistinguishable by their distance information, then we say that $d$ is a pseudo-quasi-metric (Kim, ; Kũnzi, ).
This naturally occurs when additional time dimensions are used to encode causality, but distance is ignored.

###### Example 3 .

Every weighted graph $G=(E,V,W)$ induces a metric space $(V,d_{G})$; e.g. using the shortest path (graph geodesic) distance $d_{G}$, defined for each $u,v\in V$ by

$$ $d_{G}(u,v)\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\inf\Biggl{\{}\sum_{n =1}^{N-1}\,W(\nu_{n},\nu_{n+1}):\exists\,(\nu_{1}=u,\nu_{2}),\dots,(\nu_{N-1}, \nu_{N}=v)\in E\Biggr{\}}.$ (1) $$

One could define the $\inf$ of the empty set to be $\max_{v,u\in V}\,W(u,v)+1$ (instead of $\infty$, which is unsuitable for learning and embedding). However, following the spacetime representation literature, we are only interested in learning the distance between causally connected nodes (Section 3.3). We emphasize that only simple weighted digraphs are considered here, meaning that we do not allow for self-loops, and each ordered pair of nodes has at most one edge between them. As later discussed in Section 3.2 and Section 3.3, NSTs can model causal connectivity in one direction (but no undirected edges), as well as lack of causal connectivity between events (anti-chains).

###### Example 3 .

### 2.3 Spacetime Embeddings

We will work in a class of objects with the causal structure of DAGs/posets and the distance structure of weighted undirected graphs.
We formalize this class of causal metric spaces as follows.

###### Definition 1 (Causal (Quasi-)Metric Space) .

A triple $(\mathcal{X},d,\lesssim)$ such that $(\mathcal{X},d)$ is a (quasi-)metric space and $(\mathcal{X},\lesssim)$ is a poset, is called a causal (quasi-)metric space.

Having defined a meaningful class of causal metric spaces, we now formalize what it means to approximately create a copy of a causal metric space into another. The goal is to begin with a complicated discrete structure, such as a DAG, and embed it into a well-behaved continuous structure.

###### Definition 2 (Spacetime Embedding) .

Let $(\mathcal{X},d,\lesssim^{x})$ and $(\mathcal{Y},\rho,\lesssim^{y})$ be causal (quasi-)metric spaces. A map $f:\mathcal{X}\to\mathcal{Y}$ is a spacetime embedding if there are constants $D\geq 1$ and $c>0$ such that for each $x_{1},x_{2}\in\mathcal{X}$

(i) Causal Embedding: $x_{1}\lesssim^{x}x_{2}\Leftrightarrow f(x_{1})\lesssim^{y}f(x_{2})$

(ii) Metric Embedding:
$c\,\rho(x_{1},x_{2})\leq d(x_{1},x_{2})\leq D\,c\rho(x_{1},x_{2}).$
The constant $D$ is called the distortion, and $c$ is the scale of the spacetime embedding. If $D=c=1$, then $f$ is called isocausal.

Our description of spacetime embeddings is illustrated in Figure 3. We encode causality using the notion of an order embedding from order theory (Davey & Priestley, ), also used in general relativity (Kronheimer & Penrose, ; Sorkin, ; Reid, ; Henson, ; Benincasa & Dowker, ), jointly with the notion of a metric embedding core to theoretical computation science (Gupta & Hambrusch, ; Gupta, ; Gupta et al., ) and representation learning (Sonthalia & Gilbert, ).

Figure: (a) Spatial Embedding: the objective is to replicate the distance between nodes, counted in a minimal number of hops, with the Euclidean distance on $\mathbb{R}^{2}$. In the neural spacetime, however, the distance will be non-Euclidean.
Refer to caption: x3.png

###### Definition 1 (Causal (Quasi-)Metric Space) .

###### Definition 2 (Spacetime Embedding) .

## 3 Neural Spacetimes

##### Problem Formulation.

Following the discussion in Section 2, our goal is to learn a spacetime manifold representation where nodes in a DAG can be embedded as events. This should be done while capturing edge directionality in the form of causal structure (which includes modelling lack of connectivity as anti-chains), as well as the edge weights in the original discrete structure: these are represented as temporal ordering and spatial distance in the continuous embedding space.

### 3.1 The Neural Spacetime Architecture

Let $N\in\mathbb{N}_{+}$ be the dimensionality of the feature vectors $x_{u},x_{v}\in\mathbb{R}^{N}$ associated with nodes $u,v\in V$, where $V$ represents the set of nodes of the DAG $G_{D}=(E_{D},V,W_{D})$. Fix a space dimension $D\in\mathbb{N}_{+}$ and a time dimension $T\in\mathbb{N}_{+}$.
A neural spacetime (NST) is a learnable triplet $\mathcal{S}=(\mathcal{E},\mathcal{D},\mathcal{T})$,
where $\mathcal{E}:\mathbb{R}^{N}\rightarrow\mathbb{R}^{D+T}$ is an encoder network, e.g. an MLP, $\mathcal{D}:\mathbb{R}^{D+T}\times\mathbb{R}^{D+T}\to[0,\infty)$ is a learnable quasi-metric on $\mathbb{R}^{D}$ and $\mathcal{T}:\mathbb{R}^{D+T}\to\mathbb{R}^{T}$ is a learnable partial order on $\mathbb{R}^{T}$.
We implement $\mathcal{D}$ and $\mathcal{T}$ as two neural networks that process the spatial and temporal dimensions of encoded feature vectors $\hat{x}_{u},\hat{x}_{v}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\mathcal
{E}(x_{u}),\mathcal{E}(x_{v})\in\mathbb{R}^{D+T}$ in parallel.

The encoder network, $\mathcal{E}:\mathbb{R}^{N}\rightarrow\mathbb{R}^{D+T}$, maps the original node feature vectors of the input graph to the dimensions of space and time used by the NST representation. We employ this mapping as an intermediate Euclidean space upon which to learn the quasi-metric and partial order. The model learns to allocate relevant information to each dimension through gradient descent, rather than attempting to manually specify which of the original node feature dimensions should correspond to space and time.

To define $\mathcal{D}$, which will be implemented using a variation of the original neural snowflake (see equation 10 from Appendix A.3), we consider the following activation function, $\sigma_{s,l}(x)$. The activation depends on two trainable parameters $s,l>0$. In the spirit of the fractalesque structure of neural snowflakes, $s$ controls whether small-scale distances should be expanded or contracted relative to the distance on $\mathbb{R}^{D}$. Similarly, $l$ controls the large-scale distances of points and dictates whether those should be expanded or contracted. See Appendix C.1 for an extended discussion.

###### Definition 3 (Neural (Quasi-)Metric Activation) .

For any $s,l>0$, we define the neural (quasi-)metric activation to be the map $\sigma_{s,l}:\mathbb{R}\to\mathbb{R}$ given for each $x\in\mathbb{R}$ by

$$ $\sigma_{s,l}(x)\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\begin{cases} \operatorname{sgn}(x)\,|x|^{s}&\mbox{ if }|x|<1\\ \operatorname{sgn}(x)\,|x|^{l}&\mbox{ if }|x|\geq 1\end{cases}$ (2) $$

where the sign function $\operatorname{sgn}$ returns $1$ for $x~{}\geq~{}0$ and $-1$ for $x<0$.

If $s=l$ then $\sigma_{s,l}(x)=\operatorname{sgn}(x)\,|x|^{s}$ and one recovers the key component of the snowflake activation function of Borde & Kratsios () used in the majority of the proofs of its metric embedding guarantees.
Note that $s$ and $l$ are not required to be coupled in any way.

A neural (quasi-)metric is a map $\mathcal{D}:\mathbb{R}^{D+T}\times\mathbb{R}^{D+T}\to[0,\infty)$ with iterative representation:

$$ $\displaystyle\mathcal{D}(\hat{x}_{u},\hat{x}_{v})$ $\displaystyle\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\mathsf{W}_{J} \sigma_{s_{J},l_{J}}\bullet(u_{J-1});\,u_{j}\stackrel{{\scriptstyle\mbox{\tiny def .}}}{{=}}\mathsf{W}_{j}\sigma_{s_{j},l_{j}}\bullet(u_{j-1})\mbox{ for }j=1, \dots,J-1,$ (3) $\displaystyle u_{0}$ $\displaystyle\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}|\sigma_{s_{0},l_{ 0}}\bullet(\hat{x}_{u})_{1:D}-\sigma_{s_{0},l_{0}}\bullet(\hat{x}_{v})_{1:D}|,$ $$

for each $\hat{x}_{u},\hat{x}_{v}\in\mathbb{R}^{D+T}$, where the depth parameter $J\in\mathbb{N}_{+}$, where the $s_{0},l_{0},\dots,s_{J},l_{J}>0$, and $\bullet$ denotes component-wise composition, weight matrices $\mathsf{W}_{j}\in I^{+}_{D}$ (an invertible positive matrix, see Appendix A.2) for $j<J$ and $\mathsf{W}_{J}\in(0,\infty)^{1\times d}$ all of which have positive entries, and where the absolute value $|\cdot|$ is also applied component-wise. Note that $(\cdot)_{1:D}$ extracts the first $D$ dimensions of the input feature vector.

Moreover, we seek an ordering $\lesssim$ on $\mathbb{R}^{D+T}$ so that $u\preccurlyeq v$ in the poset if and only if their respective embeddings $\hat{x}_{u}$ and $\hat{x}_{v}$ are ordered in the feature space via $\lesssim$. Our class of trainable orders are parameterized with the following type of neural networks, which we call neural partial orders.
Consider a map $\mathcal{T}:\mathbb{R}^{D+T}\to\mathbb{R}^{T}$ admitting the iterative representation

$$ $\mathcal{T}(\hat{x}_{u})\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}z_{ \tilde{J}},~{}~{}~{}~{}~{}~{}~{}~{}~{}\forall j\in\{1,\dots,\tilde{J}\},z_{j} \stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\mathsf{V}_{j}\sigma_{\tilde{s} _{j},\tilde{s}_{j}}\circ\textrm{LR}\bullet(z_{j-1})+b_{j},~{}~{}~{}~{}~{}~{}~{ }~{}~{}z_{0}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}(\hat{x}_{u})_{D+1: D+T},$ (4) $$

where LR stands for LeakyReLU and $\circ$ for function composition, with the depth parameter $\tilde{J}\in\mathbb{N}_{+}$, weight matrices $\mathsf{V}_{j}\in I^{+}_{T}$, and bias terms $b_{1},\dots,b_{\tilde{J}}\in\mathbb{R}^{T}$. Also, note that $\mathcal{T}(\hat{x}_{u})\in\mathbb{R}^{T}$, whereas when applying the subscript $\mathcal{T}(\hat{x}_{u})_{t}\in\mathbb{R}$, the operation returns the entry of the coordinate embedding at dimension $t$. At each layer of $\mathcal{T}$ we use the (single trainable parameter, $s=l$ in equation 2) activation $\tilde{s},\dots,\tilde{s}_{\tilde{J}}>0$. Moreover, we would like to highlight that $\mathcal{D}$ takes both $\hat{x}_{u},\hat{x}_{v}\in\mathbb{R}^{D+T}$ as input to compute distances, whereas $\mathcal{T}$ processes inputs independently. Hence, given any such $\mathcal{T}$ we define the partial order $\lesssim^{\mathcal{T}}$ on $\mathbb{R}^{D+T}$ given, for each $\hat{x}_{u},\hat{x}_{v}\in\mathbb{R}^{D+T}$, by

$$ $\hat{x}_{u}\lesssim^{\mathcal{T}}\hat{x}_{v}\Longleftrightarrow\mathcal{T}( \hat{x}_{u})_{t}\leq\mathcal{T}(\hat{x}_{v})_{t},\forall t=D+1,\dots,D+T.$ (5) $$

The next proposition shows that $\lesssim^{\mathcal{T}}$ always defines a partial order on the time dimensions of $\mathbb{R}^{D+T}$, for any $\mathcal{T}$. This is formalized by noting that, for any $D\in\mathbb{N}_{+}$, the quotient space $\mathbb{R}^{D+T}/\sim$ under the equivalence relation $x\sim\tilde{x}\Leftrightarrow x_{1:D}=\tilde{x}_{1:D}$ is isomorphic (as a vector space) to $\mathbb{R}^{T}$. Thus, there is no loss in generality in assuming that $D=0$.

###### Proposition 1 (Neural Spacetimes Always Implement Partial Orders) .

If $T\in\mathbb{N}_{+}$, $D=0$, and $\mathcal{T}:\mathbb{R}^{D+T}\to\mathbb{R}^{T}$ admits a representation as equation 4, then $\lesssim^{\mathcal{T}}$
is a partial order on $\mathbb{R}^{D+T}$.

###### Proof.

See page $21$.
∎

Just as the neural snowflakes of Borde & Kratsios (), neural (quasi-)metrics implements a quasi-metric on the spatial dimension $\mathbb{R}^{D}$ in $\mathbb{R}^{D+T}$ (ignoring the time dimensions used only to encode causality). A key difference between the two is that our formulation allows for the weighting or discovery of the importance of each spatial dimension, as well as the rescaling of each spatial dimension individually. Thus, our model in equation 3 enables greater flexibility as it departs further from the somewhat Euclidean structure of Borde & Kratsios (), which is based on warping a precomputed Euclidean distance.

###### Remark 2 (Comparing Neural Snowflakes to Neural (Quasi-)metrics in NSTs.) .

Neural (quasi-)metrics generalize the non-Euclidean metrics studied in Gozlan (, Proposition 1.2) and implemented as part of the neural snowflake model in Borde & Kratsios ().

This can be of interest in learning theory since it was shown in Gozlan () that these types of distances exhibit favourable concentration of measure properties when measured in $1$-Wasserstein distance from optimal transport. The connection to learning occurs due to the technique of Amit et al. (); Hou et al. (); Benitez et al. (); Kratsios et al. () whereby one may obtain uniform generalization bounds for Hölder learners through concentration of measure results.

###### Proposition 2 (A Neural (Quasi-)Metric is a quasi-metric on the spatial dimensions) .

Any $\mathcal{D}$ with representation in equation 3 is a quasi-metric on $\mathbb{R}^{D}$.
If each $\mathsf{W}_{j}$ is orthogonal (^1^11Since any $\mathsf{W}_{j}$ must have only non-negative entries, then if $\mathsf{W}_{j}$ is additionally orthogonal, it must be a permutation matrix.) and $0<s_{j},t_{j}\leq 1$ then $\mathcal{D}$ is a metric on $\mathbb{R}^{D}$.
Furthermore, if $T\in\mathbb{N}_{+}$, then $\mathcal{D}$ is a pseudo-quasi-metric on $\mathbb{R}^{D+T}$.

###### Proof.

See page $21$.
∎

###### Definition 3 (Neural (Quasi-)Metric Activation) .

###### Proposition 1 (Neural Spacetimes Always Implement Partial Orders) .

###### Proof.

###### Remark 2 (Comparing Neural Snowflakes to Neural (Quasi-)metrics in NSTs.) .

###### Proposition 2 (A Neural (Quasi-)Metric is a quasi-metric on the spatial dimensions) .

###### Proof.

### 3.2 Embedding Guarantees

We now present our main theoretical result which is the (global) embedding guarantees for NSTs.

###### Definition 4 (Width) .

Let $(P,\lesssim)$ be a poset. A subset $S\subseteq P$ is called an anti-chain if for each $u,v\in S$ neither $u\preccurlyeq v$ nor $v\preccurlyeq u$. The width of $(P,\lesssim)$ is the maximal size (cardinality) of any anti-chain in $P$.

Note that to model anti-chains with our framework, more than one time dimension is needed. This allows our model to represent lack of causal connectivity between nodes that do not share a directed path between them in the graph. The result below uses the notion of doubling constant and metric space dimension from fractal geometry, see Appendix A.1.

###### Theorem 1 (Universal Spacetime Embeddings) .

Fix $W,N\in\mathbb{N}_{+}$, $K>0$, and let $(P,d,\lesssim)$ be a finite causal metric space with doubling constant $K$, width $W$, and $P\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\{x_{v}\}_{v\in V}\subseteq
\mathbb{R}^{N}$.
There exists a $D\in\mathcal{O}(\log(K))$, an MLP $\mathcal{E}:\mathbb{R}^{N}\to\mathbb{R}^{D+W}$, $\mathcal{T}:\mathbb{R}^{D+W}\to\mathbb{R}^{W}$ with representation equation 4, and $\mathcal{D}:\mathbb{R}^{D+W}\times\mathbb{R}^{D+W}\to[0,\infty)$ with representation equation 3 such that for each $x_{u},x_{v}\in P$

(i) Order Embedding: $x_{u}\preccurlyeq x_{v}$ if and only if $\mathcal{E}(x_{u})\lesssim^{\mathcal{T}}\mathcal{E}(x_{v})$,

(ii) Metric Embedding:
$d(x_{u},x_{v})\leq\mathcal{D}\big{(}\mathcal{E}(x_{u}),\mathcal{E}(x_{v})\big{
)}\leq\mathcal{O}\big{(}\log(K)^{5}\big{)}\,d(x_{u},x_{v}).$

Moreover, setting $D=k$, (ii) can be improved to an isocausal embedding, i.e. $d(x_{u},x_{v})=\mathcal{D}\big{(}\mathcal{E}(x_{u}),\mathcal{E}(x_{v})\big{)}$.
In either case, the number of non-zero parameters determining the neural spacetime triplet $\mathcal{S}=(\mathcal{E},\mathcal{D},\mathcal{T})$ is
$\tilde{\mathcal{O}}\big{(}D+W+k^{5/2}D^{4}N\big{)}.$

###### Proof.

See page $25$.
∎

Theorem 1 guarantees that one never needs more than $W$ time dimensions(^2^22$W$ here is used for time dimensions and not edge weigths.) and $\#P$ space dimensions to have a (perfect) isocausal spacetime embedding. However, note that $W+\mathcal{O}(\log(\#P))$ spacetime dimensions are guaranteed to provide an embedding with a very small distortion, which is likely good enough for most practical problems. Theorem 1 is extremal, in the sense that it holds for all causal metric spaces. One may, therefore, ask:
How much can the result be improved for causal metric spaces with favourable properties?

In analogy with the Minkowski spacetime representations in Law & Lucas (), which can accommodate directed line graphs, we now investigate when few (at most two) time dimensions are enough to guarantee a causal embedding for a poset. Using Baker et al. (), we first characterized posets which admit a spacetime embedding with two time dimensions via their Hasse diagrams.

###### Proposition 3 (When two time dimensions are not enough) .

If the Hasse diagram of a poset $(P,\lesssim)$ is not a planar graph, then there is no spacetime embedding $\mathcal{E}:P\to\mathbb{R}^{D+W}$, $\mathcal{D}:\mathbb{R}^{D+W}\times\mathbb{R}^{D+W}\to[0,\infty)$, $\mathcal{T}:\mathbb{R}^{D+W}\to\mathbb{R}^{W}$ with $W=1,2$.

###### Proof.

See page $26$.
∎

We now improve both the temporal and spatial guarantees of the spacetime embedding in Theorem 1 for the posets characterized by the preceding proposition. To leverage the planar structure of the Hasse diagrams of these posets and thus enhance the spatial component of our spacetime embeddings, we instead equip any such poset $(P,\lesssim)$ with the metric $d_{\operatorname{H}}$, defined as the graph geodesic distance on the undirected Hasse diagram of $(P,\lesssim)$.

###### Theorem 2 (Low-Distortion Spacetime Embeddings in Time Dimensions) .

Fix $k,N\in\mathbb{N}_{+}$, and let $(P,\lesssim,d_{\operatorname{H}})$ is $k$-point poset whose Hasse diagram for $(P,\lesssim)$ is planar, $P\subset\mathbb{R}^{N}$.
There is a ReLU MLP $\mathcal{E}:\mathbb{R}^{N}\to\mathbb{R}^{\mathcal{O}(\log(k))+2}$, $\mathcal{D}:\mathbb{R}^{\mathcal{O}(\log(k))+2}\times\mathbb{R}^{\mathcal{O}(
\log(k))+2}\to[0,\infty)$ with representation equation 3, and $\mathcal{T}:\mathbb{R}^{\mathcal{O}(\log(k))+2}\to\mathbb{R}^{2}$ as in equation 4 satisfying:
for each $x_{u},x_{v}\in P$

(i) Causal Embedding: $x_{u}\preccurlyeq x_{v}$ if and only if $\mathcal{E}(x_{u})\lesssim^{\mathcal{T}}\mathcal{E}(x_{v})$,

(ii) Low-Distortion Metric Embedding: $d_{\operatorname{H}}(x_{u},x_{v})\leq\mathcal{D}\big{(}\mathcal{E}(x_{u}),
\mathcal{E}(x_{v})\big{)}\leq\mathcal{O}(\log(k)^{2})\,d_{\operatorname{H}}(x_
{u},x_{v}).$

The total number of parameters in $\mathcal{S}$ is $\mathcal{O}\big{(}k^{5/2}D^{4}N\,\log(N)\,\,\log\big{(}k^{2}\,\operatorname{
diam}(P,d_{\operatorname{H}})\big{)}\big{)}.$

###### Proof.

See page $26$.
∎

Our training procedure (Section 3.3) focuses on embedding the local structure of directed graphs and is supported by our theoretical guarantees that NSTs are expressive enough to encode the global structure of weighted DAGs. By focusing on local embeddings, our neural spacetime model can be trained to embed very large directed graphs, since local distance information is readily available, but global distance information is generally expensive to compute. Interestingly,

###### Remark 3 (Local vs. Global NST Embeddings.) .

The global and local embeddability of directional information is equivalent in our case due to the transitivity properties of DAGs and our representation spaces.

Lastly, for completeness we also provide a discussion comparing neural spacetimes to hyperbolic representation in Appendix A.6.

###### Definition 4 (Width) .

###### Theorem 1 (Universal Spacetime Embeddings) .

###### Proof.

###### Proposition 3 (When two time dimensions are not enough) .

###### Proof.

###### Theorem 2 (Low-Distortion Spacetime Embeddings in Time Dimensions) .

###### Proof.

###### Remark 3 (Local vs. Global NST Embeddings.) .

### 3.3 Computational Implementation

In this section, we provide a discussion on how to bridge the theoretical embedding guarantees presented earlier into a computationally tractable model that can be optimized via gradient descent. Further details are provided in Appendix C.

Representing graph edge directionality as a partial order in the embedding manifold. Given a weighted directed graph $G_{D}=(E_{D},V,W_{D})$, let $x_{u},x_{v}\in\mathbb{R}^{N}$ be the feature vectors associated with the nodes $u,v\in V$, which we want to embed as events in our spacetime: $\mathcal{S}$ takes as input these features and maps them to an embedding in the manifold. The edge set $E_{D}$ induces a binary non-symmetric adjacency matrix $\mathbf{A}$. In our case, $G_{D}$ is not any digraph but a DAG, hence if $A_{uv}=1\Rightarrow A_{vu}=0$. Both entries can only be equal when they are 0, $A_{uv}=A_{vu}=0$. In the latter case, the nodes may either be causally disconnected, or causally connected but not neighbours. If the input graph does not satisfy these properties our spacetime embedding parametrized by the NST will not be able to faithfully embed the input graph in terms of its edge directionality.

Representing graph edge weights as distances in the embedding manifold. Likewise, $W_{D}$ induces a distance matrix $\mathbf{D}$ with entries $D_{uv}$ being the causal distance between events $u,v$. Although theoretically this could be computed as the shortest path graph geodesic distance for two causality connected and distant $u$ and $v$ (similar to equation 1 but for weighted directed graphs, see Appendix D.1), in practice we only optimize for the one-hop neighbourhood. In particular, if $u=v\Rightarrow D_{uv}=0$, if $u\preccurlyeq v\land v\in\mathcal{N}(u)\land u\neq v\Rightarrow D_{uv}>0$. The distance $D_{uv}$ is ignored otherwise, that is, we do not model the distance between nodes in the original graph that are causally connected but outside the one-hop neighbourhood of each other nor do we model the distance between events that are not causality connected (anti-chains). This is in line with the literature on graph construction via Lorentzian pre-length spaces (Law & Lucas, ). In the case of NSTs, it is achieved using the connectivity $A_{uv}$ as a mask in the loss function.

Local geometry optimization and global geometry implications. Note that although we optimize for the one-hop neighbourhood of each node only, transivity of the causal connectivity of nodes across hops will be satisfied by definition of the partial order (Remark 3). Additionally, although the partial order between anti-chains is not directly optimized, as the number of time dimensions increases, it is increasingly probable that $\lesssim^{\mathcal{T}}$ will not be satisfied for nodes not causally connected, as desired. Conversely, there is no guarantee that when directly evaluating the distance between causally connected nodes using $\mathcal{D}$ we will obtain the graph geodesic distance between nodes. In summary, if $x_{u},x_{v},x_{w}\in\mathbb{R}^{N}$ are feature vectors for nodes $u,v,w\in V$, and $\hat{x}_{u},\hat{x}_{v},\hat{x}_{w}\in\mathbb{R}^{D+T}$ are their $\mathcal{E}$ encodings in the intermediate Euclidean space used by the NST, if $x\lesssim^{\mathcal{T}}y\land y\lesssim^{\mathcal{T}}z\Rightarrow x\lesssim^{
\mathcal{T}}z$. On the other hand, in general $\mathcal{D}(x,y)+\mathcal{D}(y,z)=D_{uv}+D_{vw}$, and provided that this particular path corresponds to the graph geodesic $D_{uv}+D_{vw}=d_{G}(u,w)$, but $\mathcal{D}(x,y)+\mathcal{D}(y,z)\neq\mathcal{D}(x,z)$. The latter inequality is acceptable and not required to faithfully encode the graph edge weights.

Training and Loss Function. Let us use the matrix $\mathbf{X}\in\mathbb{R}^{M\times N}$ to denote the collection of feature vectors for $M=|\mathcal{V}|$ nodes associated with the DAG, $G_{D}$. The neural spacetime parameters are optimized with respect to the following loss:

$$ $\mathcal{L}_{G_{D}}(\mathbf{X},\mathbf{A},\mathbf{D})\stackrel{{\scriptstyle \mbox{\tiny def.}}}{{=}}\sum_{u=u_{1}}^{u_{M}}\sum_{v=v_{1}}^{v_{M}}\mathcal{L }_{uv}\left(\mathcal{S}(x_{u},x_{v}),(A_{uv},D_{uv})\right),$ (6) $$

where $x_{u}$ extracts the row feature vector for $u$ from matrix $\mathbf{X}$. The goal is to learn appropriate embeddings so that nodes connected by directed edges are represented as causally connected events in the time dimensions of the manifold, and respect the distance $D_{uv}$ induced by the graph weights in the space dimensions. To do so, we can further divide the loss function into a (causal) distance loss, $\mathcal{L}^{D}_{uv}$, and a causality loss, $\mathcal{L}^{C}_{uv}$. We remind the reader of the definition $\hat{x}_{u},\hat{x}_{v}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\mathcal
{E}(x_{u}),\mathcal{E}(x_{v})\in\mathbb{R}^{D+T}$. Hence the loss can be partitioned into:

$$ $\mathcal{L}_{uv}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\mathcal{L}^{D} _{uv}\left(\mathcal{D}(\hat{x}_{u},\hat{x}_{v}),(A_{uv},D_{uv})\right)+ \mathcal{L}^{C}_{uv}\left(\mathcal{T}(\hat{x}_{u}),\mathcal{T}(\hat{x}_{v}),A_ {uv}\right).$ (7) $$

Next, we dissect each of the losses. The distance loss for a pair of nodes or events is a standard mean squared error (MSE) loss between the predicted and ground truth distance, with masking given by the adjacency matrix:

$$ $\smash{\mathcal{L}^{D}_{uv}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}A_{ uv}\textrm{MSE}\left(\mathcal{D}(\hat{x}_{u},\hat{x}_{v}),D_{uv}\right).}$ (8) $$

On the other hand, the causality loss (with respect to the one-hop neighbourhood) is

$$ $\mathcal{L}^{C}_{uv}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\,A_{uv} \mathcal{L}^{*}_{C}\Big{(}\sum_{t=1}^{T}\,\operatorname{SteepSigmoid}(\mathcal {T}(\hat{x}_{u})_{t}-\mathcal{T}(\hat{x}_{v})_{t})\Big{)},$ (9) $$

where $\mathcal{L}^{*}_{C}$ is a function that takes as input the expression above and $\operatorname{SteepSigmoid}(x)=\frac{1}{1+e^{-10x}}$ (we omit some details here for simplicity, see Appendix C.3 for a lengthier explanation). The loss for two causally connected events $u\preccurlyeq v$ in the first neighbourhood of each other ($A_{uv}=1$) is minimized when $\hat{x}_{u}\lesssim^{\mathcal{T}}\hat{x}_{v}$ is satisfied (equation 5). If the time coordinates of $\hat{x}_{v}$ associated with the event $v$ are elementwise greater than all the time coordinates of $\hat{x}_{u}$ for $u$ then all $\operatorname{SteepSigmoid}$ activation functions will return $\approx 0$.

## 4 Experimental Validation

In this section, we provide an overview of our experimental procedure and results.

Synthetic Weighted DAG Embedding. We generate DAGs (see Appendix D.2) embedded in the 2D plane with associated local distances between nodes given by several metrics. We measure the embedding capabilities of NSTs compared to closed-form spacetime geometries such as the Minkowski and De Sitter spaces in Law & Lucas (). Note that although we do not optimize the geometries in the case of the baselines, we do use a neural network encoder to map points to events in the manifolds. We quantify both the average and maximum metric distortion (the ratio between true and predicted distances) following Kratsios et al. (), as well as the accuracy of the time embedding. As we can see in Table 1, we are always able to embed edge directionality (0 for no edges embedded correctly, 1 for all edges embedded correctly). In terms of metric distortion, we can see that as the embedding dimension increases, both average and maximum distortion decrease. NSTs are particularly good at retraining low distortions in low-dimensional embedding spaces.

Real-World Network Embedding. Next, we test our approach on real-world networks. In Table 2, we present results for the Cornell, Texas, and Wisconsin (WebKB) datasets (Rozemberczki et al., ), which are based on web pages represented as nodes and directed hyperlinks between them. In this case, all nodes have bag-of-word features, which are used as input to the neural spacetime encoder. The neural partial order encodes the hyperlink directionality between websites, and the neural (quasi-)metric learns the connectivity strength as the cosine similarity between connected web page features. We achieve very low distortions, showcasing the embedding capabilities of our network. Note that, from a metric learning perspective, real-world datasets are generally less challenging than the metrics presented in Table 1, which were chosen to be particularly unconventional on purpose. In terms of the time embedding, we manage to mostly encode directionality; however, these datasets are not pure DAGs, so it is not possible to embed them perfectly. We also work with real-world gene regulatory network datasets (Marbach et al., ) in line with previous spacetime representation learning literature (Law & Lucas, ; Sim et al., ). We achieve both good spatial and causal embeddings. For further details refer to Appendix D.3.

Experimental details and hyperparameters for all setups can be found in Appendix D. Additionally, we present tree (spatial only) embedding experiments comparing neural snowflakes to neural (quasi-)metrics in NSTs, as well as hyperbolic neural networks (HNNs), in Appendix D.1.

## 5 Conclusion

This work has introduced the concept of neural spacetimes (NSTs), a computational framework utilizing neural networks to construct spacetime geometries with multiple time dimensions for DAG representation learning. We decouple our representation into a product manifold of space, equipped with a quasi-metric, and time, which captures causality via a partial order. We propose techniques to build, optimize, and stabilize artificial neural networks with fractalesque activation functions, ensuring the learnability of valid geometries. Our main theoretical contributions include a global embeddability guarantee for posets into neural spacetimes, with embeddings being causal in time and asymptotically isometric in space. We demonstrate the efficacy of our approach through experiments on synthetic metric DAG embedding datasets and real-world directed graphs, showcasing its superiority over existing spacetime representation learning methods with fixed closed-form geometries.

**Table 1: DAG embedding results. Embedding dimension $D=T=2,4,10$.**
|  | Neural Spacetime |  |  |  |
| --- | --- | --- | --- | --- |
| Metric | Embedding Dim | Distortion (average $\pm$ stand dev) | Max Distortion | Directionality |
| $\|\mathbf{x}-\mathbf{y}\|^{0.5}\log(1+\|\mathbf{x}-\mathbf{y}\|)^{0.5}$ | 2 | 1.13 $\pm$ 0.37 | 5.82 | 1.0 |
| 4 | 1.02 $\pm$ 0.06 | 1.34 | 1.0 |  |
| 10 | 1.00 $\pm$ 0.02 | 1.28 | 1.0 |  |
| $\|\mathbf{x}-\mathbf{y}\|^{0.1}\log(1+\|\mathbf{x}-\mathbf{y}\|)^{0.9}$ | 2 | 1.16 $\pm$ 0.45 | 6.21 | 1.0 |
| 4 | 1.02 $\pm$ 0.07 | 1.75 | 1.0 |  |
| 10 | 1.00 $\pm$ 0.04 | 1.47 | 1.0 |  |
| $1-\frac{1}{(1+\|\mathbf{x}-\mathbf{y}\|^{0.5})}$ | 2 | 1.53 $\pm$ 1.25 | 14.20 | 1.0 |
| 4 | 1.10 $\pm$ 0.38 | 5.81 | 1.0 |  |
| 10 | 1.01 $\pm$ 0.06 | 1.63 | 1.0 |  |
| $1-\exp{\frac{-(\|\mathbf{x}-\mathbf{y}\|-1)}{\log(\|\mathbf{x}-\mathbf{y}\|)}}$ | 2 | 1.51 $\pm$ 1.18 | 13.55 | 1.0 |
| 4 | 1.11 $\pm$ 0.41 | 8.92 | 1.0 |  |
| 10 | 1.01 $\pm$ 0.05 | 1.31 | 1.0 |  |
| $1-\frac{1}{1+\|\mathbf{x}-\mathbf{y}\|^{0.2}+\|\mathbf{x}-\mathbf{y}\|^{0.5}}$ | 2 | 1.60 $\pm$ 1.42 | 17.07 | 1.0 |
| 4 | 1.13 $\pm$ 0.45 | 4.44 | 1.0 |  |
| 10 | 1.00 $\pm$ 0.05 | 1.44 | 1.0 |  |
|  | Minkowski |  |  |  |
| Metric | Embedding Dim | Distortion (average $\pm$ stand dev) | Max Distortion | Directionality |
| $\|\mathbf{x}-\mathbf{y}\|^{0.5}\log(1+\|\mathbf{x}-\mathbf{y}\|)^{0.5}$ | 2 | 2.86 $\pm$ 5.22 | 72.66 | 0.99 |
| 4 | 1.70 $\pm$ 2.77 | 71.09 | 0.99 |  |
| 10 | 1.21 $\pm$ 1.33 | 35.58 | 0.99 |  |
| $\|\mathbf{x}-\mathbf{y}\|^{0.1}\log(1+\|\mathbf{x}-\mathbf{y}\|)^{0.9}$ | 2 | 6.77 $\pm$ 133.68 | 1669.83 | 0.99 |
| 4 | 1.70 $\pm$ 5.21 | 77.03 | 0.99 |  |
| 10 | 1.19 $\pm$ 1.09 | 25.18 | 0.99 |  |
| $1-\frac{1}{(1+\|\mathbf{x}-\mathbf{y}\|^{0.5})}$ | 2 | 21.89 $\pm$ 759.05 | 18753.57 | 0.99 |
| 4 | 2.87 $\pm$ 20.17 | 643.71 | 0.99 |  |
| 10 | 1.17 $\pm$ 1.26 | 37.42 | 0.99 |  |
| $1-\exp{\frac{-(\|\mathbf{x}-\mathbf{y}\|-1)}{\log(\|\mathbf{x}-\mathbf{y}\|)}}$ | 2 | 11.37 $\pm$ 114.98 | 1876.54 | 0.98 |
| 4 | 2.49 $\pm$ 8.72 | 198.04 | 0.98 |  |
| 10 | 1.18 $\pm$ 2.49 | 82.67 | 0.99 |  |
| $1-\frac{1}{1+\|\mathbf{x}-\mathbf{y}\|^{0.2}+\|\mathbf{x}-\mathbf{y}\|^{0.5}}$ | 2 | 20.65 $\pm$ 292.90 | 5471.07 | 0.96 |
| 4 | 2.83 $\pm$ 9.54 | 153.91 | 0.98 |  |
| 10 | 1.13 $\pm$ 0.91 | 28.45 | 0.99 |  |
|  | De Sitter |  |  |  |
| Metric | Embedding Dim | Distortion (average $\pm$ stand dev) | Max Distortion | Directionality |
| $\|\mathbf{x}-\mathbf{y}\|^{0.5}\log(1+\|\mathbf{x}-\mathbf{y}\|)^{0.5}$ | 2 | $\infty$ $\pm$ | $\infty$ | 0.99 |
| 4 | -4.33 $\pm$ 816.47 | 10235.71 | 0.99 |  |
| 10 | 288.17 $\pm$ 9794.97 | 324027.5 | 0.99 |  |
| $\|\mathbf{x}-\mathbf{y}\|^{0.1}\log(1+\|\mathbf{x}-\mathbf{y}\|)^{0.9}$ | 2 | 9.40 $\pm$ 2226.84 | 63968.21 | 0.99 |
| 4 | 174.69 $\pm$ 3637.32 | 115851.88 | 0.99 |  |
| 10 | -10.66 $\pm$ 739.71 | 8997.62 | 0.99 |  |
| $1-\frac{1}{(1+\|\mathbf{x}-\mathbf{y}\|^{0.5})}$ | 2 | -63.56 $\pm$ 4438.15 | 43424.54 | 0.94 |
| 4 | $\infty$ $\pm$ | $\infty$ | 0.94 |  |
| 10 | -333.23 $\pm$ 8701.18 | 130111.80 | 0.94 |  |
| $1-\exp{\frac{-(\|\mathbf{x}-\mathbf{y}\|-1)}{\log(\|\mathbf{x}-\mathbf{y}\|)}}$ | 2 | -183.71 $\pm$ 9600.71 | 39648.66 | 0.94 |
| 4 | 83.04 $\pm$ 4313.82 | 97524.21 | 0.94 |  |
| 10 | 418.26 $\pm$ 6599.80 | 150543.73 | 0.94 |  |
| $1-\frac{1}{1+\|\mathbf{x}-\mathbf{y}\|^{0.2}+\|\mathbf{x}-\mathbf{y}\|^{0.5}}$ | 2 | -542.39 $\pm$ 22058.97 | 114491.45 | 0.94 |
| 4 | $\infty$ $\pm$ | $\infty$ | 0.94 |  |
| 10 | $\infty$ $\pm$ | $\infty$ | 0.94 |  |

**Table 2: Embedding results for real-world web page hyperlink graph datasets and gene regulatory networks.**
|  | Neural Spacetime |  |  |  |
| --- | --- | --- | --- | --- |
| Metric | Embedding Dim | Distortion (avg. $\pm$ sdev.) | Max Distortion | Directionality |
| Cornell | 2 | 1.00 $\pm$ 0.07 | 1.31 | 0.93 |
| 4 | 1.00 $\pm$ 0.04 | 1.08 | 0.94 |  |
| 10 | 1.00 $\pm$ 0.04 | 1.08 | 0.94 |  |
| Texas | 2 | 1.01 $\pm$ 0.10 | 2.27 | 0.89 |
| 4 | 1.00 $\pm$ 0.01 | 1.05 | 0.90 |  |
| 10 | 1.00 $\pm$ 0.00 | 1.00 | 0.90 |  |
| Wisconsin | 2 | 1.00 $\pm$ 0.10 | 1.67 | 0.89 |
| 4 | 1.00 $\pm$ 0.04 | 1.16 | 0.89 |  |
| 10 | 1.00 $\pm$ 0.04 | 1.20 | 0.89 |  |
| In silico | 2 | 1.06 $\pm$ 0.47 | 18.54 | 1.00 |
| 4 | 1.00 $\pm$ 0.09 | 1.73 | 1.00 |  |
| 10 | 1.00 $\pm$ 0.05 | 1.32 | 1.00 |  |
| Escherichia coli | 2 | 1.02 $\pm$ 0.45 | 15.37 | 1.00 |
| 4 | 1.00 $\pm$ 0.06 | 2.62 | 1.00 |  |
| 10 | 1.00 $\pm$ 0.05 | 1.17 | 1.00 |  |
| Saccharomyces cerevisiae | 2 | 1.05 $\pm$ 0.34 | 10.18 | 1.00 |
| 4 | 1.00 $\pm$0.07 | 1.63 | 1.00 |  |
| 10 | 1.00$\pm$ 0.05 | 1.57 | 1.00 |  |
|  | Minkowski |  |  |  |
| Metric | Embedding Dim | Distortion (avg. $\pm$ sdev.) | Max Distortion | Directionality |
| Cornell | 2 | 1.07 $\pm$ 0.70 | 9.43 | 0.94 |
| 4 | 1.00 $\pm$ 0.00 | 1.01 | 0.94 |  |
| 10 | 1.00 $\pm$ 0.00 | 1.00 | 0.94 |  |
| Texas | 2 | 1.12 $\pm$ 1.73 | 31.27 | 0.90 |
| 4 | 1.00 $\pm$ 0.00 | 1.00 | 0.90 |  |
| 10 | 1.01 $\pm$ 0.01 | 1.05 | 0.90 |  |
| Wisconsin | 2 | 5.07 $\pm$ 65.99 | 1410.03 | 0.90 |
| 4 | 1.00 $\pm$ 0.04 | 1.19 | 0.90 |  |
| 10 | 1.13 $\pm$ 0.69 | 16.28 | 0.90 |  |
| In silico | 2 | 105.42 $\pm$ 4671.85 | 209248.72 | 0.94 |
| 4 | 0.25 $\pm$ 54.57 | 1315.76 | 0.95 |  |
| 10 | 1.00 $\pm$ 0.05 | 3.69 | 0.99 |  |
| Escherichia coli | 2 | -4.25 $\pm$ 149.61 | 438.34 | 0.97 |
| 4 | 1.00 $\pm$ 0.01 | 1.08 | 0.98 |  |
| 10 | 1.00 $\pm$ 0.01 | 1.01 | 0.99 |  |
| Saccharomyces cerevisiae | 2 | -2.38 $\pm$ 173.57 | 151.43 | 0.91 |
| 4 | 1.04 $\pm$ 2.25 | 63.17 | 0.98 |  |
| 10 | 1.01 $\pm$ 0.02 | 1.39 | 0.99 |  |
|  | De Sitter |  |  |  |
| Metric | Embedding Dim | Distortion (avg. $\pm$ sdev.) | Max Distortion | Directionality |
| Cornell | 2 | -55.83 $\pm$ 890.45 | 3950.88 | 0.92 |
| 4 | -20.60 $\pm$ 249.49 | 403.46 | 0.94 |  |
| 10 | 0.80 $\pm$ 126.26 | 1543.07 | 0.93 |  |
| Texas | 2 | -0.29 $\pm$ 84.42 | 818.10 | 0.90 |
| 4 | 42.03 $\pm$ 795.51 | 13939.25 | 0.90 |  |
| 10 | 2.60 $\pm$ 70.33 | 1107.60 | 0.90 |  |
| Wisconsin | 2 | 2.06 $\pm$ 63.46 | 1291.31 | 0.89 |
| 4 | -0.78 $\pm$ 27.91 | 114.24 | 0.90 |  |
| 10 | 0.04 $\pm$ 215.94 | 2862.19 | 0.89 |  |
| In silico | 2 | -63.59 $\pm$ 1866.69 | 56626.97 | 0.92 |
| 4 | -468.81 $\pm$ 33021.14 | 65289.22 | 0.92 |  |
| 10 | -129.13 $\pm$ 9623.30 | 261531.59 | 0.93 |  |
| Escherichia coli | 2 | 34.65 $\pm$ 2637.50 | 119047.23 | 0.91 |
| 4 | -2.00 $\pm$ 3294.81 | 130509.59 | 0.91 |  |
| 10 | -8.26 $\pm$ 94.57 | 652.96 | 0.91 |  |
| Saccharomyces cerevisiae | 2 | 55.36 $\pm$ 3960.09 | 160278.39 | 0.90 |
| 4 | -28.60 $\pm$ 1175.67 | 63086.54 | 0.90 |  |
| 10 | -121.17 $\pm$ 7550.16 | 84724.25 | 0.91 |  |

##### Acknowledgements

AK acknowledges financial support from an NSERC Discovery Grant No. RGPIN-2023-04482 and No. DGECR-2023-00230. AK also acknowledges that resources used in preparing this research were provided, in part, by the Province of Ontario, the Government of Canada through CIFAR, and companies sponsoring the Vector Institute(^3^33[https://vectorinstitute.ai/partnerships/current-partners/](https://vectorinstitute.ai/partnerships/current-partners/)).

## Appendix A Additional Background

In this section, we discuss relevant background on the dimension of a metric space and invertible matrices, which are used as part of our proofs in Appendix B. We also review the original neural snowflake model, pseudo-Riemannian manifolds, Lorentzian manifolds, and spacetimes in physics. Additionally, we provide an extended discussion on past literature in spacetime representation learning in the context of machine learning, and compare neural spacetimes to hyperbolic spaces.

### A.1 Dimension and Size of a Metric Spaces

The doubling constant in fractal geometry quantifies the complexity of a metric space by indicating how many smaller balls are needed to cover a larger ball. It is related to the Assouad dimension and other fractal dimensions. A small doubling constant suggests a low fractal dimension, while a large constant indicates a higher fractal dimension. This constant helps analyze self-similarity in fractals by providing a scale-invariant description of the space.

Our quantitative results use the following fractal notion of dimension/size of a metric space.

###### Definition 5 (Doubling Constant) .

The doubling constant $K\geq 1$ of a metric space $(X,d)$ is the smallest integer $k\geq 1$ for which the following holds: for every center $x\in X$ and each radius $r>0$, every (open) ball $B(x,r)\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\{u\in X:d(x,u)<r\}$ can be covered by at most $k$ (open) balls of radius $r/2$; i.e., there exist $x_{1},\dots,x_{k}\in X$ such that $B(x,r)\subseteq\bigcup_{i=1}^{k}B(x_{i},r/2)$.

By this definition, $K$ is the smallest possible value of $k$ that satisfies the covering condition for all $x\in X$ and all $r>0$. Note that every finite metric space, such as every weighted graph with the shortest path/geodesic distance, has a finite doubling constant. For example, if $X$ is finite and has at least two points, then $K\geq 2$.

The size of a metric space can also be quantified by its diameter and its separation. These respectively quantify the maximal and minimal distances between points therein.

###### Definition 6 (Diameter) .

Let $(X,d)$ be a metric space. The diameter of $(X,d)$ is defined to be $\operatorname{diam}(X,d)\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}
\operatorname{sup}_{x,\tilde{x}\in X}\,d(x,\tilde{x})$.

###### Definition 7 (Separation) .

Let $(X,d)$ be a metric space. If $X$ has at-least two points, then its separation is defined to be $\operatorname{sep}(X,d)\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}
\operatorname{inf}_{x,\tilde{x}\in X,\,x\neq\tilde{x}}\,d(x,\tilde{x})$, otherwise $\operatorname{sep}(X,d)\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}1$.

###### Definition 5 (Doubling Constant) .

###### Definition 6 (Diameter) .

###### Definition 7 (Separation) .

### A.2 Invertible Positive Matrices

We employ square matrices that are both invertible and have positive entries for constructing our neural quasi-metric. These matrices guarantee that our snowflake produces trainable quasi-metrics, allowing the implemented distance function to distinguish between points (i.e., identify when two vectors are equal).

###### Definition 8 (Invertible Positive Matrices $I^{+}_{D}$ ) .

Let $D\in\mathbb{N}_{+}$. A $D\times D$ matrix $\mathsf{W}$ is invertible and positive if it can be represented as

$$ $\mathsf{W}=\lambda\,I_{D}+|\tilde{\mathsf{W}}|,$ $$

where $\lambda>0$, $\tilde{\mathsf{W}}$ is an arbitrary $D\times D$ matrix, and $|\cdot|$ denotes entrywise absolute value applied to the matrix $\tilde{\mathsf{W}}$. The set of all such $D\times D$ invertible positive matrices $W$ is denoted by $I^{+}_{D}$.

In Appendix B, we demonstrate that all matrices in $I^{+}_{D}$ are invertible and preserve $[0,\infty)^{D}$ under matrix multiplication.

###### Definition 8 (Invertible Positive Matrices I D + subscript superscript 𝐼 𝐷 I^{+}_{D} italic_I start_POSTSUPERSCRIPT + end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_D end_POSTSUBSCRIPT ) .

### A.3 Neural Snowflakes

Neural spacetimes build on the neural snowflake model for weighted undirected graph embedding. Here, we describe the original construction in Borde & Kratsios ().

Neural Snowflakes. Neural snowflakes leverage quasi-metric spaces and implement a learnable adaptive geometry $\|\hat{x}_{u}-\hat{x}_{v}\|_{f}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}
f(\|\hat{x}_{u}-\hat{x}_{v}\|),$ where $\hat{x}_{u},\hat{x}_{v}\in\mathbb{R}^{D}$. In particular, it is a map $f:[0,\infty)\rightarrow[0,\infty)$, with iterative representation

$$ $\displaystyle f(t)$ $\displaystyle=u_{J}^{1+|p|}$ (10) $\displaystyle u_{j}$ $\displaystyle=\mathsf{B}_{j}\,\psi_{a_{j},b_{j}}(\mathsf{A}_{j}u_{j-1})\, \mathsf{C}_{j}$ $\displaystyle\qquad\mbox{ for }j=1,\dots,J$ $\displaystyle u_{0}$ $\displaystyle=u$ $$

where for $j=1,\dots,J$, $\mathsf{A}_{j}$ is a $\tilde{d}_{j}\times d_{j-1}$ matrix, $\mathsf{B}_{j}$ is a $d_{j}\times\tilde{d}_{j}$-matrix, and $\mathsf{C}_{j}$ is a $3\times 1$ matrix all of which have non-negative weights and at least one non-zero weight. Furthermore, for $j=1,\dots,J$, $0<a_{j}\leq 1$, $0\leq b_{j}\leq 1$, $d_{1},\dots,d_{J}\in\mathbb{N}_{+}$, and $d_{0}=1=d_{J}$. Also, $p\in\mathbb{R}$. Note that $p$ controls the relaxation of the triangle inequality ($C=2^{p}$) and that for $p\neq 0$, the neural snowflake is a quasi-metric. The input to the neural snowflake, denoted as $u$, represents the Euclidean distance between $\hat{x}_{u}$ and $\hat{x}_{v}$. This value serves as an intermediate representation within the neural snowflake, which is subsequently warped. In principle, $u$ need not be the Euclidean distance. In the original neural snowflake implementation, $\psi_{a,b}:\mathbb{R}\rightarrow[0,\infty)$ is a tensorized trainable activation function which sends any vector $u\in\mathbb{R}^{K}$, for some $K\in\mathbb{N}_{+}$, to the $K\times 3$ matrix $\psi_{a,b}(u)$ whose $k^{th}$ row is

$$ $\psi_{a,b}(u)_{k}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\big{(}1-e^{-| u_{k}|},|u_{k}|^{a},\log(1+|u_{k}|)^{b}\big{)},$ (11) $$

with $0<a$ and $0\leq b\leq 1$ being trainable. Such a construction provides universal graph embedding guarantees for weighted undirected graphs (Borde & Kratsios, ). In this work, we will generalize this learnable adaptive geometry formulation to directed graphs borrowing ideas from spacetimes and pseudo-Riemannian manifolds.

### A.4 Pseudo-Riemannian Manifolds and Lorentzian Spacetimes

Next, we discuss pseudo-Riemannian manifolds and spacetimes, from which we draw inspiration for our neural spacetime construction (Section 3). Our framework generalizes neural snowflakes and their weighted undirected graph embedding properties to also incorporate causal connectivity and graph directionality. In other words, they implement an isocausal trainable embedding.

Pseudo-Riemannian manifolds are a generalization of Riemannian manifolds where the metric tensor $g$ is not constrained to be positive definite. A $d$-dimensional pseudo-Riemannian manifold is a smooth manifold $M$ equipped with a pseudo-Riemannian metric $g$. Formally, a pseudo-Riemannian metric tensor is a smooth, symmetric, non-degenerate bilinear form (called a *scalar product*) defined on the tangent bundle $TM$ (disjoint union of all tangent spaces). The metric tensor a each point $p\in M$ is denoted by $g_{p}$. The metric assigns to each tangent space $T_{p}M$ a signature $(\pm,\pm,\dots,\pm)$. In particular, the tangent space $T_{p}M$ admits an orthonormal basis $\{\mathbf{e}_{1},\mathbf{e}_{2},\dots,\mathbf{e}_{d}\}$ that satisfies $\forall i\in\{1,\dots,d\},~{}g_{p}(\mathbf{e}_{i},\mathbf{e}_{i})=\pm 1$.
If $g_{p}(\mathbf{e}_{i},\mathbf{e}_{i})=1$ for all $i$, then $M$ is a Riemannian manifold, its metric tensor is positive definite, and its metric signature is $(+,+,\dots,+)$.

Lorentzian manifolds are a subset of pseudo-Riemannian manifolds with a specific metric signature, typically denoted as $(-,+,+,\dots,+)$ or $(+,-,-,\dots,-)$. In our case, we define distances between causally connected events to be positive, and hence adopt the second sign convention.
With this convention, a nonzero tangent vector $\mathbf{v}$ of a Lorentzian manifold is called causal if it satisfies $g_{p}(\mathbf{v},\mathbf{v})\geq 0$, and it is called chronological if $g_{p}(\mathbf{v},\mathbf{v})>0$.

Spacetimes. The definition of a *spacetime* in general relativity varies depending on the author. Spacetimes are a subset of Lorentzian manifolds often defined so that they are equipped with a *causal structure* (Law & Lucas, ). Some spacetimes are called globally hyperbolic (Geroch, ). Global hyperbolicity ensures that the spacetime possesses a well-defined causal structure, meaning there are no closed timelike curves (CTCs) and every inextendible causal curve intersects every Cauchy surface (a spacelike hypersurface that slices through the entire manifold exactly once). This property allows for the deterministic evolution of physical fields and particles forward in time. In mathematical terms, if there exists a smooth vector field $\mathcal{V}$ on $M$ such that $g_{p}(\mathcal{V}(p),\mathcal{V}(p))>0$ for all $p\in M$, then the Lorentzian manifold is called a *spacetime* and it contains a *causal structure*. 4-dimensional spacetimes with signature $(-,+,+,+)$ or $(+,-,-,-)$ are used to model the physical world in general relativity. Spacetimes can exhibit various geometries, from flat Minkowski spacetime (used in special relativity) to curved spacetimes that account for gravitational effects predicted by Einstein’s field equations. In summary, a spacetime often refers to a Lorentzian manifold that additionally satisfies certain physical and causal conditions.
We refer the reader to Beem et al. () for details.

Relation to Neural Spacetimes. Neural Spacetimes are an adaptive geometry aiming to learn, in a differentiable manner, a suitable embedding in which nodes in a DAG can be represented as causally connected events. Although Neural Spacetimes (Section 3) draw inspiration from the concepts above—separating space and time into different dimensions and capturing causal connectivity between events—strictly speaking, Neural Spacetimes utilize higher time dimensions ($T>1$) than classical spacetimes used to model the physical world. Moreover, they also incorporate a quasi-metric to model distance in the space dimensions, which relaxes the smoothness and other requirements inherent to pseudo-Riemannian metrics.

### A.5 Related Work on Spacetime Representation Learning

Related work in the machine learning literature that considers pseudo-Riemannian manifolds with multiple time dimensions includes *ultrahyperbolic representations* (Law & Stam, ; Law, ). Ultrahyperbolic geometry is a generalization of the hyperbolic and elliptic geometries to pseudo-Riemannian manifolds. However, the works in Law & Stam (); Law () mostly focus on the optimization of such representations, they only consider undirected graphs and do not consider partial ordering.

Spacetime representation learning (Law & Lucas, ) considers Lorentzian spacetimes (i.e. with one time dimension) to represent directed graphs. Following the formalism in Appendix A.4 with a metric signature $(+,-,\dots,-)$, and noting $\overrightarrow{x_{u}x_{v}}$, the logarithmic map of $x_{v}$ at $x_{u}$, they consider that there exists an edge from $u$ to $v$ iff $g_{x_{u}}(\overrightarrow{x_{u}x_{v}},t)>0$ and $0<g_{x_{u}}(\overrightarrow{x_{u}x_{v}},\overrightarrow{x_{u}x_{v}})<\varepsilon$ where $t$ is an arbitrary tangent vector that defines the future direction and $\varepsilon>0$ is a hyperparameter that defines the maximal length of the geodesic from $x_{u}$ to $x_{v}$ to draw a directed edge.
The hyperparameter $\varepsilon$ allows them to avoid connecting $u$ to all the descendants of $v$.
Their work is limited to the optimization of embeddings (i.e. not neural networks).
We draw inspiration from Law & Lucas () but consider multiple time dimensions in a framework that is easy to optimize for neural networks. Our local geometry optimization framework also allows us to ignore the hyperparameter $\varepsilon$, which is necessary when there is only one time dimension. In our case causality is controlled by the multi-dimensional neural partial order $\lesssim^{\mathcal{T}}$ instead.

Also, note that all the previous works discussed above require selecting an appropriate manifold to model the embedding space a priori. Our work, on the other hand, not only optimizes the location of points in space but also the manifold itself. In other words, our framework models a trainable geometry.

### A.6 Hyperbolic Spaces as Compared to Neural Spacetime Embeddings

Hyperbolic geometry has been shown to be relevant for describing undirected graphs without cycles, which are called trees. Indeed, in Sarkar (), it was shown that these trees can be algorithmically embedded into hyperbolic space with low distortion. Additionally, Ganea et al. () constructed a class of hyperbolic neural networks (HNNs) which can exploit trees represented in these spaces, and Kratsios et al. () demonstrated that finite trees can indeed be embedded with arbitrarily low distortion. However, in Borde et al. (), it was shown that an isometric embedding is not possible, except at ”infinity” in the hyperbolic boundary of such a space Dyubina & Polterovich () (which lies outside the manifold itself). The issue arises because hyperbolic space is a Riemannian manifold, and thus, it is incompatible with the branches in the tree itself.

This is not the case for the fractal geometry implemented by the neural spacetime and neural snowflake of Borde & Kratsios (). Indeed, in (Maehara, , Theorem 3.6), it was shown that any finite tree can be isometrically embedded in Euclidean space $\mathbb{R}^{d}$, for $d$ large enough, but with the ”snowflaked” Euclidean distance between any two points $x,y\in\mathbb{R}^{d}$ given by $\|x-y\|^{\alpha}$ where $\alpha=1/2$. Since neural spacetime and neural snowflake can implement such fractal geometries, they are better suited to the geometry of trees.

In this paper, we propose a framework to represent DAGs that do not contain directed cycles. However, the underlying undirected graph of a DAG can contain cycles. This is for example the case for the DAG containing four nodes $\{\nu_{i}\}_{i=1}^{4}$ that satisfy only the following partial orders: $\nu_{1}\preccurlyeq\nu_{2}\preccurlyeq\nu_{4}$ and $\nu_{1}\preccurlyeq\nu_{3}\preccurlyeq\nu_{4}$, without causality relation between $\nu_{2}$ and $\nu_{3}$.
The underlying undirected graph is an undirected cycle $\nu_{1},\nu_{2},\nu_{4},\nu_{3},\nu_{1}$, which is not appropriate for hyperbolic geometry.

## Appendix B Proofs

### B.1 Properties of Neural Spacetimes

###### Proof of Proposition 1 .

Fix $T\in\mathbb{N}_{+}$ and set $D=0$.
Fix a $\mathcal{T}:\mathbb{R}^{D+T}\to\mathbb{R}^{T}$ with representation equation 4.
We verify that the relation $\lesssim^{\mathcal{T}}$ is a partial order on $\mathbb{R}^{D+T}$.
It is trivially symmetric since $T(x)_{t}=T(x)_{t}$ for each $t=1,\dots,T$ and every $x\in\mathbb{R}^{D+T}$; thus, $x\lesssim^{\mathcal{T}}x$ for each $x\in\mathbb{R}^{D+T}$.

Since each matrix $V_{j}\in I_{T}^{+}$ then, as shown in equation 12, it is injective. Since the leaky ReLU function is injective, and so is its componentwise composition, as well as affine translations/shifts, then $\mathcal{T}$ is injective.
Thus, for each $y,x\in\mathbb{R}^{D+T}$ if $\mathcal{T}(x_{t})_{t}=\mathcal{T}(y_{t})_{t}$ for each $t=1,\dots,T$ then $\mathcal{T}(x)=\mathcal{T}(y)$; by injectivity of $\mathcal{T}$(^4^44Since $D=0$.) we conclude that $x=y$.

The transitivity follows directly from the componentwise $\leq$ (i.e. the product order on $\mathbb{R}^{T}$).
∎

###### Proof of Proposition 2 .

Comment: The main challenge in this proof is showing that $\mathcal{D}$ separates points in $\mathbb{R}^{D}$; that is, for any $x,y\in\mathbb{R}^{D}$ we have $\mathcal{D}(x,y)=0$ if and only if $x=y$. Note that in the main text $\mathcal{D}$ takes as input the spatial coordinates of the Euclidean embeddings $\hat{x}_{u},\hat{x}_{v}\in\mathbb{R}^{D+T}$ instead, but we avoid this notation here for simplicity.

Symmetry of $\mathcal{D}$:
The map $\mathcal{D}$ is symmetric since

$$ $\big{(}|\sigma_{s_{0},l_{0}}(x)-\sigma_{s_{0},l_{0}}(y)|\big{)}_{i=1}^{d}=\big {(}|\sigma_{s_{0},l_{0}}(y)-\sigma_{s_{0},l_{0}}(x)|\big{)}_{i=1}^{d};$ $$

meaning that the map $u\mapsto u_{0}$ is symmetric. Consequentially, $\mathcal{D}$ is symmetric.

Non-Negativity of $\mathcal{D}$:
Since each of the matrices $\mathsf{W}_{1},\dots,\mathsf{W}_{J}$ have non-negative entries then they map $[0,\infty)^{D}$ to itself. To see this note that for any $d,D\in\mathbb{N}_{+}$ if $u\in[0,\infty)^{D}$, $\mathsf{W}\in\mathbb{R}^{d\times D}$, and $(\mathsf{W})_{i,k}\geq 0$ for each $i=1\dots,D$ and $k=1,\dots,d$ then: for $i=1,\dots,D$ we have that

$$ $(\mathsf{W}u)_{i}=\sum_{j=1}^{D}\,\mathsf{W}_{i,j}u_{j}\geq 0.$ $$

Thus, $\mathcal{D}(x,y)\geq 0$ for each $x,y\in\mathbb{R}^{D}$.

Case I : $\mathcal{D}$ Separates Points if $T=0$:
Suppose that $T=0$; otherwise we will show that $\mathcal{D}$ does not separate points.

It is sufficient to show the result for $J=1$, with the general case following directly by recursion.
Consider the map $\mathcal{D}:\mathbb{R}^{D+T}\times\mathbb{R}^{D+T}\to[0,\infty)$ with iterative representation given in equation 3; i.e. for each $x,y\in\mathbb{R}^{D+T}\cong\mathbb{R}^{D}$

$$ $\displaystyle\mathcal{D}(x,y)$ $\displaystyle\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\mathsf{W}_{J} \sigma_{s_{J+1},l_{J+1}}(u_{J})$ $\displaystyle u_{j}$ $\displaystyle\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\mathsf{W}_{j} \sigma_{s_{j},l_{j}}\bullet(u_{j-1})\qquad\qquad\mbox{ for }j=1,\dots,{J-1}$ $\displaystyle u_{0}$ $\displaystyle\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}|\sigma_{s_{0},l_{ 0}}(x)-\sigma_{s_{0},l_{0}}(y)|$ $$

where, we recall equation 2, which states that for each $s,l>0$ and $x\in\mathbb{R}$ (the activation function is applied pointwise)

$$ $\sigma_{s,l}(x)\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\begin{cases} \operatorname{sgn}(x)\,|x|^{s}&\mbox{ if }|x|<1\\ \operatorname{sgn}(x)\,|x|^{l}&\mbox{ if }|x|\geq 1\end{cases}.$ $$

Since $\mathsf{W}_{1}=\lambda I_{D}+|\tilde{\mathsf{W}}|$
and some matrix $\tilde{\mathsf{W}}\in\mathbb{R}^{D\times D}$; then, the entries of $\mathsf{W}$ are non-negative and for $i,j=1,\dots,D$ we have that

$$ $(\mathsf{W}_{1})_{i,i}=\lambda+\sum_{j=1}^{D}\,|\tilde{\mathsf{W}}_{i,j}|>\sum _{j=1}^{D}\,|\tilde{\mathsf{W}}_{i,j}|\geq\sum_{j=1;\,j\neq i}^{D}\,|\tilde{ \mathsf{W}}_{i,j}|\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}R_{i},$ (12) $$

where, we emphasize that the strictness of the first inequality is due to the positivity of $\lambda$.
Thus, the Gershgorin circle theorem, see Gershgorin (), implies that the eigenvalues of $\mathsf{W}_{1}$ belong to the set $\Lambda_{1}\subseteq\mathbb{C}$ defined by

$$ $\Lambda_{1}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\bigcup_{i=1}^{D}\, \overline{\operatorname{B}}_{2}\big{(}(\mathsf{W}_{1})_{i,i},R_{i}\big{)}$ $$

where, for $u\in\mathbb{C}$ and $r\geq 0$ we define $\overline{\operatorname{B}}_{2}\big{(}u,r\big{)}\stackrel{{\scriptstyle\mbox{
\tiny def.}}}{{=}}\{z\ \in\mathbb{C}:\,\|u-z\|\leq r\}$. Since the computation in equation 12 showed that $R_{i}<(\mathsf{W}_{1})_{i,i}$ for each $i=1,\dots,D$ then $0\not\in\Lambda_{1}$. Thus, $\mathsf{W}_{1}$ is invertible.

Consequentially, $\mathbb{R}^{D}\ni u\mapsto\mathsf{W}_{1}u\in\mathbb{R}^{D}$ is injective.

For any specification of $s,l>0$ the (componentwise) map $\sigma_{s,l}\bullet:\mathbb{R}^{D}\ni u\to(\sigma_{s,l}(u_{i}))_{i=1}^{D}\in
\mathbb{R}^{D}$ is injective as it is componentwise monotone increasing.
In the notation of equation 3:
Since $u_{0}=0$ if and only if $x=y$ then the map

$$ $\mathbb{R}^{D}\times\mathbb{R}^{D}\ni(x,y)\mapsto\mathsf{W}_{1}\mapsto u_{1} \in\mathbb{R}^{D}$ $$

is equal to the zero vector if and only if $x=y$. Since $\mathsf{W}_{2}\in[0,\infty)^{d}$ then $\mathcal{D}(x,y)\geq 0$; thus, $\mathcal{D}(x,y)=0$ if and only if $x=y$. We have just shown that $\mathcal{D}$ is point-separating (i.e. $\mathcal{D}(x,y)=0$ if and only if $x=y$) and in the process have seen that $\mathcal{D}$ is positive (i.e. $\mathcal{D}(x,y)\geq 0$).
That is, $\mathcal{D}$ separates points in $\mathbb{R}^{D}$.

Case II: Pseudo-Metric for Positive Time Dimensions if $T>0$:
If instead $T\in\mathbb{N}_{+}$, then let $\mathbf{0}_{T}$ denote the zero vector in $\mathbb{R}^{T}$, and $x,y\in\mathbb{R}^{D}$ with $x\neq y$. Then, $\mathcal{D}\big{(}(\mathbf{0}_{T},x),(\mathbf{0}_{T},y)\big{)}=0$. Thus, $\mathcal{D}$ does not separate points whenever $T>0$. Note that from a computational perspective, we account for this using masking during training, see Section 3.3 and Appendix C.

Relaxed Triangle Inequality:
It remains to show that a relaxed triangle inequality holds. Again, we consider the case when $T=0$, with the general case following identically up to a more cumbersome notation.
Let $x,y\in\mathbb{R}^{D}$, using the notation of equation 3, for $j=0,\dots,J$ define the constant

$$ $\beta_{j}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\min\{(\max\{s_{j},t_{ j}\}-1),0\}.$ $$

Note that, $\beta_{j}=0$ whenever both $s_{j}$ and $t_{j}\leq 1$ and it equals to $(\max\{s_{j},t_{j}\}-1)$ otherwise. Further, note that if $s_{j}=t_{j}>1$, then $\beta_{j}=s_{j}-1$.

By definition of the operator norm of each matrix $\mathsf{W}_{j}$ we have that: for $j=1,\dots,J$

$$ $\|u_{j}\|\leq\|\mathsf{W}_{j}\|_{op}\,\|\sigma_{s_{j},l_{j}}(u_{j-1})\|.$ (13) $$

By (Xia, , Example 2.2): for each $j=1,\dots,J$ we have that

$$ $\|\sigma_{s_{j},l_{j}}(u_{j-1})\|\leq 2^{\beta_{j}}\,\|u_{j-1}\|.$ (14) $$

Upon combining the bounds in equation 13 and equation 14 for each $j=1,\dots,J$ we arrive at

$$ $\mathcal{D}(x,y)\leq\prod_{j=1}^{J}\,\Big{(}\|\mathsf{W}_{j}\|_{op}\,2^{\beta_ {j}}\Big{)}\|u_{0}\|=2^{\sum_{j=1}^{J}\,\beta_{j}}\Biggr{(}\prod_{j=1}^{J}\,\| \mathsf{W}_{j}\|_{op}\,\Biggl{)}\,\|u_{0}\|.$ (15) $$

Again using (Xia, , Example 2.2) we have that

$$ $\displaystyle\|u_{0}\|=$ $\displaystyle\Biggl{(}\sum_{i=1}^{d}\,|\sigma_{s_{0},l_{0}}(x_{i})-\sigma_{s_{ 0},l_{0}}(y_{i})|^{2}\Biggr{)}^{1/2}$ (16) $\displaystyle\leq$ $\displaystyle\Biggl{(}\sum_{i=1}^{d}\,\big{(}2^{\beta_{0}}|x_{i}-y_{i}|\big{)} ^{2}\Biggr{)}^{1/2}$ $\displaystyle=$ $\displaystyle 2^{\beta_{0}}\,\Biggl{(}\sum_{i=1}^{d}\,|x_{i}-y_{i}|^{2}\Biggr{ )}^{1/2}$ $\displaystyle=$ $\displaystyle 2^{\beta_{0}}\,\|x-y\|.$ $$

Upon combining the estimates in equation 15 with those in equation 16 we find that

$$ $\displaystyle\mathcal{D}(x,y)\leq$ $\displaystyle 2^{\sum_{j=1}^{J}\,\beta_{j}}\Biggr{(}\prod_{j=1}^{J}\,\|\mathsf {W}_{j}\|_{op}\,\Biggl{)}\,\|u_{0}\|$ $\displaystyle\leq$ $\displaystyle 2^{\sum_{j=1}^{J}\,\beta_{j}}\Biggr{(}\prod_{j=1}^{J}\,\|\mathsf {W}_{j}\|_{op}\,\Biggl{)}\,2^{\beta_{0}}\,\|x-y\|$ (17) $\displaystyle=$ $\displaystyle 2^{\sum_{j=0}^{J}\,\beta_{j}}\Biggr{(}\prod_{j=1}^{J}\,\|\mathsf {W}_{j}\|_{op}\,\Biggl{)}\,\|x-y\|.$ (18) $$

Finally, notice that if for each $j=1,\dots,J$ the matrix $\mathsf{W}_{j}$ is orthogonal and $0<s_{j},t_{j}\leq 1$ then equation 18 becomes $1\,\|x-y\|$; in which case $\mathcal{D}$ is a metric.
This concludes the proof.
∎

###### Proof of Proposition 1 .

###### Proof of Proposition 2 .

### B.2 Embedding Results

We will routinely use the following ordering.

###### Definition 9 (Product Order) .

Let $T\in\mathbb{N}_{+}$. The product, or coordinate, order $\lesssim^{\times}$ on $\mathbb{R}^{T}$ is defined for each $x,y\in\mathbb{R}^{T}$ by

$$ $x\lesssim^{\times}y\Leftrightarrow x_{t}\leq y_{t}\mbox{ for all }t=1,\dots,T.$ $$

Equivalently, $x\lesssim^{\times}y$ if $1=\prod_{t=1}^{T}\,I_{x_{t}\leq y_{t}}$.

A key step in our main results is the ability of neural spacetimes to encode the product order in time and snowflake metrics in space. This is quantified by the following helper lemma.

###### Lemma 1 (An Implementation Lemma for Neural Spacetimes) .

Let $\alpha>0$, $1\leq p<\infty$, and $T,D\in\mathbb{N}_{+}$. Then, there exist maps $\mathcal{T}:\mathbb{R}^{D+T}\to\mathbb{R}^{T}$ and $\mathcal{D}:\mathbb{R}^{D+T}\times\mathbb{R}^{D+T}\to[0,\infty)$, with respective representations equation 3 and equation 4, such that for all $x,y\in\mathbb{R}^{D+T}$

- (i)
Implementation of Product Ordering:
$(x)_{D+1:D+T}\lesssim^{\times}(y)_{D+1:D+T}\Leftrightarrow\mathcal{T}(x)_{t}
\leq\mathcal{T}(y)_{t}\,\,\mbox{ for }\,t=D+1,\dots,D+T$
- (ii)
Implementation of Snowflake of the $\ell^{p}$ metric:
$\mathcal{D}(x,y)=\|(x)_{0:D}-(y)_{0:D}\|_{p}^{\alpha}$

Furthermore, the parametric complexity of $\mathcal{T}$ and $\mathcal{D}$ are given by:

- (a)
Depth: $\operatorname{Depth}(\mathcal{T})=1$ and $\operatorname{Depth}(\mathcal{D})=2$
- (b)
Width: $\operatorname{Width}(\mathcal{T})=T$ and $\operatorname{Width}(\mathcal{D})=D$
- (c)
No. Non-zero Parameters: $\operatorname{No.Param}(\mathcal{T})=T+2$ and $\operatorname{No.Par}(\mathcal{D})=3(2+D)$.

Note that in the main text, we use $\lesssim^{\mathcal{T}}$ to indicate more explicitly that the order $\lesssim^{\times}$ is implemented according to the neural partial order $\mathcal{T}$.

###### Proof of Lemma 1 .

In what follows we use, for any $i\in\mathbb{N}_{+}$, let $I_{i}$ denotes the $i\times i$ identity matrix, let $\mathbf{0}_{i}$ denote the zero vector in $\mathbb{R}^{i}$, and we use $1_{\mathbb{R}^{i}}$ to denote the identity map on $\mathbb{R}^{i}$.

Step 1 - Implementation of the Product Order

Observe that the product ordering (Definition 9) and the ordering equation 5 coincide if $\mathcal{T}(x)=(x)_{D+1:D+T}$ for all $x\in\mathbb{R}^{D+T}$.
Consider the map $\mathcal{T}:\mathbb{R}^{D+T}\to\mathbb{R}^{T}$ defined for any $x\in\mathbb{R}^{D+T}$ by

$$ $\displaystyle\mathcal{T}(x)$ $\displaystyle\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}I_{T}\sigma_{1,1} \bullet(x)_{D+1:D+T}+\mathbf{0}_{T}$ (19) $$

is of the form of equation 4 and by construction $\mathcal{T}(x)=x_{D+1:D+T}$ for all $x\in\mathbb{R}^{D+T}$.
By construction, $\mathcal{T}$ has: depth $1$, width $T$, and $T+2$ non-zero parameters (the identity matrix diagonal entries plus $s$ and $l$).

Step 2 - Implementation of the $\alpha$-Snowflake of the $\ell^{p}$-Quasi-Metric

Fix $J=2$, set $s_{0}=l_{0}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}1$,
$s_{1}=l_{1}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}p$, $\mathsf{W}_{1}=I_{D}$, and
$s_{2}=l_{2}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}1/(p\alpha)$, $\mathbf{1}_{D}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\mathsf{W}_{2}\in
\mathbb{R}^{1\times D}$ with $(\mathsf{W}_{2})_{i}=1$ for each $i=1,\dots,D$.
Therefore,

$$ $\displaystyle u_{0}$ $\displaystyle\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\big{(}|\sigma_{1, 1}(x_{i})-\sigma_{1,1}(y_{i})|\big{)}_{i=1}^{d}=\big{(}|x_{i}-y_{i}|\big{)}_{i =1}^{d}$ (20) $\displaystyle\therefore\,\,u_{1}$ $\displaystyle\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}I_{D}\sigma_{p,p} \bullet(u_{0})=\big{(}|x_{i}-y_{i}|^{p}\big{)}_{i=1}^{d}$ $\displaystyle\therefore\,\,u_{2}$ $\displaystyle\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\sigma_{\alpha/p, \alpha/p}\big{(}\mathbf{1}_{D}u_{1}\big{)}=\biggl{(}\sum_{i=1}^{D}\,|x_{i}-y_{ i}|^{p}\bigg{)}^{\frac{\alpha}{p}}=\|(x)_{1:D}-(y)_{1:D}\|_{p}^{\alpha}.$ $$

Consequentially, the map $\mathcal{D}(x,y)\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}u_{2}$, with $u_{2}$ defined by equation 20, is of the form of equation 3 and satisfies: for each $x,y\in\mathbb{R}^{D+T}$

$$ $\mathcal{D}(x,y)=\|(x)_{1:D}-(y)_{1:D}\|_{p}^{\alpha}.$ $$

Observe that $\mathcal{D}$ has depth $2$, width $d$, and $2\cdot 3+D+D=2(3+D)$ (non-zero) trainable parameters.
∎

The following is a more technical version of Theorem 1, which we prove here as it implies the version found in the main text of our manuscript. Note that so far we have used $x,y\in\mathbb{R}^{D+T}$ for our proofs and derivations. Next, we use $x_{u},x_{v}\in\mathbb{R}^{N}$ to denote the original node features of two given nodes $u$ and $v$. Recall the identification $V\in v\leftrightarrow x_{v}\in\mathbb{R}^{N}$ from Section 2.1. $x,y$ used thus far would correspond to the encoded node features $\mathcal{E}(x_{u}),\mathcal{E}(x_{v})$.

###### Theorem 3 (Universal Spacetime Embeddings) .

Fix $W,N,k\in\mathbb{N}_{+}$, $K>0$, and let $(P,\lesssim,d)$ be a $k$-point causal metric space with doubling constant $K$, width $W$, and feature encoding $P\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\{x_{v}\}_{v\in V}\subseteq
\mathbb{R}^{N}$.
There exists a $D\in\mathcal{O}(\log(K))$, $T\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}W$, an MLP $\mathcal{E}:\mathbb{R}^{N}\to\mathbb{R}^{D+T}$, $\mathcal{T}:\mathbb{R}^{D+T}\to\mathbb{R}^{T}$ with representation equation 4, and $\mathcal{D}:\mathbb{R}^{D+T}\times\mathbb{R}^{D+T}\to[0,\infty)$ with representation equation 3 such that: for each $x_{u},x_{v}\in P$

- (i)
Order Embedding: $x_{u}\preccurlyeq x_{v}$ if and only if $\mathcal{E}(x_{u})\lesssim^{\mathcal{T}}\mathcal{E}(x_{v})$,
- (ii)
Metric Embedding:
$d(x_{u},x_{v})\leq\mathcal{D}\big{(}\mathcal{E}(x_{u}),\mathcal{E}(x_{v})\big{
)}\leq\mathcal{O}\big{(}\log(K)^{5}\big{)}\,d(x_{u},x_{v}),$

Furthermore, there is some $D\leq k$ such that (ii) can be improved to

$$ $d(x_{u},x_{v})=\mathcal{D}\big{(}\mathcal{E}(x_{u}),\mathcal{E}(x_{v})\big{)}$ $$

In either case, we have the following parametric complexity estimates:

- (i)
Geometric Complexity:
Together, $\mathcal{D}$ and $\mathcal{T}$ are defined by a total of
$D+T+8$
non-zero parameters,
- (ii)
Encoding Complexity: $\mathcal{E}$ depends on
$\mathcal{O}\biggr{(}k^{5/2}D^{4}N\,\log(N)\,\,\log\biggr{(}\frac{k^{2}\,
\operatorname{diam}(P,d)}{\operatorname{sep}(P,d)}\biggl{)}\biggl{)}$
non-zero parameters.

Consequentially, together, $\mathcal{D}$, $\mathcal{T}$, and $\mathcal{E}$ depend at-most on a total of

$$ $\mathcal{O}\biggr{(}D+T+k^{5/2}D^{4}N\,\log(N)\,\,\log\biggr{(}\frac{k^{2}\, \operatorname{diam}(P,d)}{\operatorname{sep}(P,d)}\biggl{)}\biggl{)}$ $$

non-zero parameters.

###### Proof of Theorem 1 .

Let $\alpha\in(1/2,1)$ and $\delta\in(0,1]$, both of which will be fixed retroactively.

Step 1 - Causal Embedding:
By (Dilworth, , Theorem 1.1), $(P,\precsim)$ has width $W$ only if there exists an order embedding $\tilde{\mathcal{E}}^{\star}:P\to(\{0,1\}^{W},\lesssim^{\times})$.
Since the inclusion $\iota$ of $(\{0,1\}^{W},\lesssim^{\times})$ into
$(\mathbb{R}^{W},\lesssim^{\times})$ trivially defines an order embedding, then $\mathcal{E}^{(1)}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\iota\circ
\tilde{\mathcal{E}}:(P,\precsim)\to(\mathbb{R}^{W},\lesssim^{\times})$ is an order embedding.

Step 2 (Case I) - Metric Embedding - Low-Distortion Case:
By Naor and Neiman’s Assouad embedding theorem, as formulated in (Naor & Neiman, , Theorem 1.2), there exists an absolute constant $c>0$ such that for each $1/2<\alpha<1$ and $0<\delta\leq 1$, there exists a bi-Lipschitz embedding $\mathcal{E}^{(2)}(P,d^{1-\alpha})\to(\mathbb{R}^{D},\|\cdot\|_{2})$ satisfying: for each $x_{u},x_{v}\in P$

$$ $d^{1-\alpha}(x_{u},x_{v})\leq\|\mathcal{E}^{(2)}(x_{u})-\mathcal{E}^{(2)}(x_{v })\|_{2}\leq c\Big{(}\frac{\log(K)}{1-\alpha}\Big{)}^{1+\delta}\,d^{1-\alpha}( x_{u},x_{v})$ (21) $$

where(^5^55Note that $\varepsilon\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}1-\alpha$ in the notation of Naor & Neiman ().)
$D\in\mathcal{O}(\log(K)/\delta)$.
Equivalently, for each $x_{u},x_{v}\in P$

$$ $d(x_{u},x_{v})\leq\|\mathcal{E}^{(2)}(x_{u})-\mathcal{E}^{(2)}(x_{v})\|_{2}^{1 /(1-\alpha)}\leq c^{1/(1-\alpha)}\,\Big{(}\frac{\log(K)}{1-\alpha}\Big{)}^{ \frac{1+\delta}{1-\alpha}}\,d(x_{u},x_{v}).$ (22) $$

Step 2 (Case II) - Metric Embedding - Isometric Case:

Since $(P,d)$ is such that $P$ is finite, i.e. $k=\#P<\infty$ then, (^6^66The isometric embeddability into a Euclidean snowflake characterizes finite metric spaces; see (Le Donne et al., , Corollary 2.2).) implies that setting $\alpha\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\gamma(k-1)/2\stackrel{{
\scriptstyle\mbox{\tiny def.}}}{{=}}\log_{2}(1+1/(k-1))/2\in(0,1]$ (with the case where $\alpha=1$ only being achieved when $P$ is a singleton) there exists some $\tilde{D}\in\mathbb{N}_{+}$ and $\tilde{\mathcal{E}}^{(2)}:P\to\mathbb{R}^{\tilde{D}}$ such that: for each $x_{u},x_{v}\in P$

$$ $d(x_{u},x_{v})^{\alpha}=\|\tilde{\mathcal{E}}^{(2)}(x_{u})-\tilde{\mathcal{E}} ^{(2)}(x_{v})\|_{2}.$ (23) $$

Since $D\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\operatorname{dim}\big{(}
\operatorname{span}\{\tilde{\mathcal{E}}(x_{u})\}_{x_{u}\in P}\big{)}\leq\#P=k$ and since all $D$ dimensional linear of $\mathbb{R}^{\tilde{D}}$ subspaces are isometrically isomorphic to the $D$-dimensional Euclidean space; then there exists some linear surjection $T:\mathbb{R}^{\tilde{D}}\to\mathbb{R}^{D}$ which restricts to a bijective isomorphism from $\operatorname{span}\{\tilde{\mathcal{E}}(x_{u})\}_{x_{u}\in P}$ to $\mathbb{R}^{D}$ (both equipped with Euclidean metrics). Then, the composite map $\mathcal{E}^{(2)}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}T\circ\tilde{
\mathcal{E}}^{(2)}:(P,d^{\alpha})\to(\mathbb{R}^{D},\|\cdot\|)$ is an isometric embedding.
Consequentially: for each $x_{u},x_{v}\in P$ we have that

$$ $d(x_{u},x_{v})=\|\mathcal{E}^{(2)}(x_{u})-\mathcal{E}^{(2)}(x_{v})\|_{2}^{1/\alpha}$ (24) $$

and we emphasize that $D\leq k$.

Step 3 - Interpolation:
Define the “spacetime embedding” $\mathcal{E}:P\to\mathbb{R}^{D+W}$ by: for each $x_{u}\in P$

$$ $\mathcal{E}(x_{u})\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\big{(} \mathcal{E}^{(1)}(x_{u}),\mathcal{E}^{(2)}(x_{u})\big{)}.$ (25) $$

We memorize/interpolate $\mathcal{E}$ using (Kratsios et al., , Lemma 20); thus, there exists a ReLU MLP $\hat{\mathcal{E}}:\mathbb{R}^{N}\to\mathbb{R}^{D+W}$ satisfying: for each $x_{u}\in P$ we have that

$$ $\hat{\mathcal{E}}(x_{u})=\mathcal{E}(x_{u}).$ (26) $$

Furthermore, (Kratsios et al., , Lemma 20) guarantees that number of trainable parameters defining $\mathcal{E}$ is

$$ $\displaystyle\mathcal{O}\Big{(}k^{5/2}D^{4}N\,\log(N)\,\,\log\big{(}k^{2}\, \operatorname{aspect}(P,d)\big{)}\Big{)},$ $$

where similarly to Krauthgamer et al. () the aspect ratio of the finite metric space $(P,d)$ is defined by

$$ $\operatorname{aspect}(P,d)\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\frac {\max_{x_{u},x_{v}\in P}\,d(x_{u},x_{v})}{\min_{x_{u},x_{v}\in P\,;\,x_{u}\neq x _{v}}\,d(x_{u},x_{v})}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\frac{ \operatorname{diam}(P,d)}{\operatorname{sep}(P,d)}.$ $$

Thus, the number of non-zero parameters determining $\mathcal{E}$ is at-most

$$ $\mathcal{O}\biggr{(}k^{5/2}D^{4}N\,\log(N)\,\,\log\biggr{(}\frac{k^{2}\, \operatorname{diam}(P,d)}{\operatorname{sep}(P,d)}\biggl{)}\biggl{)}.$ $$

Furthermore, by equation 22 (in case I) and by definition of $\mathcal{E}$, we have that: for each $x_{u},x_{v}\in P$

$$ $\displaystyle d(x_{u},x_{v})$ $\displaystyle\leq\|\pi\circ\mathcal{E}(x_{u})-\pi\circ\mathcal{E}(x_{v})\|_{2} ^{1/(1-\alpha)}\leq c^{1/(1-\alpha)}\,\Big{(}\frac{\log(K)}{1-\alpha}\Big{)}^{ \frac{1+\delta}{1-\alpha}}\,d(x_{u},x_{v})$ (27) $\displaystyle x_{u}\lesssim x_{v}$ $\displaystyle\Leftrightarrow\mathcal{E}(x_{u})\lesssim^{\mathcal{T}}\mathcal{E }(x_{v}).$ (28) $$

Retroactively set $\delta\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}1/4\in(0,1]$ and $\alpha\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}3/4\in(1/2,1)$. Then, equation 27
and equation 28 become

$$ $\displaystyle d(x_{u},x_{v})$ $\displaystyle\leq\|\pi\circ\mathcal{E}(x_{u})-\pi\circ\mathcal{E}(x_{v})\|_{2} ^{1/(1-\alpha)}\leq\big{(}1024\,c^{4}\,\log(K)^{5}\big{)}\,d(x_{u},x_{v})$ (29) $\displaystyle x_{u}\lesssim x_{v}$ $\displaystyle\Leftrightarrow\mathcal{E}(x_{u})\lesssim^{\mathcal{T}}\mathcal{E }(x_{v}).$ (30) $$

In case II, instead,  equation 24 implies that: for each $u,v\in V$

$$ $\displaystyle d(x_{u},x_{v})$ $\displaystyle=\|\pi\circ\mathcal{E}(x_{u})-\pi\circ\mathcal{E}(x_{v})\|_{2}^{1 /\alpha}$ (31) $\displaystyle x_{u}\lesssim x_{v}$ $\displaystyle\Leftrightarrow\mathcal{E}(x_{u})\lesssim^{\mathcal{T}}\mathcal{E }(x_{v}).$ (32) $$

Step $4$ - Encoding Product Order in time and snowflake in space as $(\mathcal{T},\mathcal{D})$

In either case, since $\mathbb{R}^{D+W}$ is equipped with the product order on its last $W$ (temporal) dimensions and the $1/(1-\alpha)$ (resp. $1/\alpha$)-snowflake of the Euclidean $(\ell^{2})$ metric on its first $D$ (spatial) dimension, then the conditions for Lemma 1 are met. Applying Lemma 1 concludes the proof.
∎

###### Proof of Proposition 3 .

Set $W\in\{1,2\}$ and $D\in\mathbb{N}_{+}$.
By definition, of the order on $\mathbb{R}^{D+W}$, given in Lemma 1 (i), a spacetime embedding $\mathcal{E}:P\to\mathbb{R}^{D+W}$ exists if and only if $p\circ\mathcal{E}:P\to\mathbb{R}^{W}$ is an order embedding into $(\mathbb{R}^{W},\lesssim^{\times})$ where $\lesssim^{\times}$ is the product order and $p:\mathbb{R}^{D+W}\ni(x_{i})_{i=1}^{D+W}\to(x_{i})_{i=1}^{W}\in\mathbb{R}^{W}$ is the canonical projection. By (Baker et al., , Theorem 6.1) an order embedding of $(P,\precsim)$ into $(\mathbb{R}^{2},\lesssim^{\times})$ exists if and only if $(P,\precsim)$ has a planar Hasse diagram.
∎

###### Proof of Theorem 2 .

Step 1 - Time Embedding
Since the Hasse diagram of $(P,\lesssim)$ has been assumed to be planar, then (Baker et al., , Theorem 6.1) implies that there exists an other embedding

$$ $\mathcal{E}^{(1)}:(P,\lesssim)\to(\mathbb{R}^{2},\lesssim^{\times}).$ $$

Step 2 - Spatial Embedding
Since we have assumed that the Hasse diagram of $(P,\lesssim)$ is planar, then we may instead use (Rao, , Theorem 9) to deduce that there exists a $D\in\mathbb{N}_{+}$ and an injective map $\mathcal{E}^{(2)}:P\to\mathbb{R}^{D}$ such that: for each $x_{u},x_{v}\in P$

$$ $\frac{1}{c\,\sqrt{\log(k)}}d_{\operatorname{H}}(x_{u},x_{v})\leq\|\mathcal{E}^ {(2)}(x_{v})-\mathcal{E}^{(2)}(x_{u})\|_{2}\leq d_{\operatorname{H}}(x_{u},x_{ v}),$ (33) $$

where $c>0$ is an absolute constant. Resealing $\mathcal{E}^{(2)}$ by a factor of $c\sqrt{\log(k)}$, and multiplying across equation 33 by $c\sqrt{\log(k)}$, we find that: for each $x_{u},x_{v}\in P$

$$ $d_{\operatorname{H}}(x_{u},x_{v})\leq\|\mathcal{E}^{(2)}(x_{v})-\mathcal{E}^{( 2)}(x_{u})\|_{2}\leq c\,\sqrt{\log(k)}\,d_{\operatorname{H}}(x_{u},x_{v}).$ (34) $$

Furthermore, by remark at the beginning of (Rao, , Section 4) by the Johnson-Lindenstrauss lemma, as formulated in (Dubhashi & Panconesi, , Theorem 2.1), one may take $k\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\#P$ an incur an additional factor of $\tilde{c}\sqrt{\log(k)}$, for an absolute constant $\tilde{c}>0$, in the distortion in equation 34; that is
find that: for each $u,v\in P$

$$ $d_{\operatorname{H}}(x_{u},x_{v})\leq\|\mathcal{E}^{(2)}(x_{v})-\mathcal{E}^{( 2)}(x_{u})\|_{2}\leq C\,\log(k)\,d_{\operatorname{H}}(x_{u},x_{v}),$ (35) $$

where $C\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}c\tilde{c}>0$. Set $p\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}1$ and recall that $\|\cdot\|_{2}\leq\|\cdot\|_{1}\leq\tilde{C}\sqrt{\log(k)}\|\cdot\|_{2}$ on $\mathbb{R}^{\tilde{C}\log(k)}$, for any $\tilde{C}>0$. Thus, equation 35 implies that: for each $x_{u},x_{v}\in P$ we have

$$ $d_{\operatorname{H}}(x_{u},x_{v})\leq\|\mathcal{E}^{(2)}(x_{v})-\mathcal{E}^{( 2)}(x_{u})\|_{1}^{p}\leq C^{\prime}\log(k)^{2}\,d_{\operatorname{H}}(x_{u},x_{ v}),$ (36) $$

where $C^{\prime}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}C\tilde{C}>0$ and $p\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}1$.

Step 3 - Interpolation Embedding
Pick some $x^{\star}\in\mathbb{R}^{2+d}\setminus[\cup_{i=1}^{2}\,\mathcal{E}^{(i)}(P)].$
Since $P\subset\mathbb{R}^{N}$ then consider the map $\mathcal{E}:\mathbb{R}^{N}\to\mathbb{R}^{2+d}$ defined for each $x\in\mathbb{R}^{N}$ by

$$ $\displaystyle\mathcal{E}(x)\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}} \begin{cases}\big{(}\mathcal{E}^{(1)}(x),\mathcal{E}^{(2)}(x)\big{)}&\,\mbox{ if }x\in P\\ x^{\star}&\mbox{ if }x\not\in P.\end{cases}$ $$

We memorize/interpolate $\mathcal{E}$ using (Kratsios et al., , Lemma 20) over the finite set $P$. Whence, there exists a ReLU MLP $\hat{\mathcal{E}}:\mathbb{R}^{N}\to\mathbb{R}^{D+W}$ satisfying: for each $x_{u}\in P$

$$ $\hat{\mathcal{E}}(x_{u})=\mathcal{E}(x_{u}).$ (37) $$

Again, as in the proof of Theorem 1, (Kratsios et al., , Lemma 20) guarantees that number of trainable parameters defining $\mathcal{E}$ is

$$ $\displaystyle\mathcal{O}\Big{(}k^{5/2}D^{4}N\,\log(N)\,\,\log\big{(}k^{2}\, \operatorname{aspect}(P,d_{\operatorname{H}})\big{)}\Big{)},$ $$

where, in this case, aspect ratio of the finite metric space $(P,d_{\operatorname{H}})$ is defined by

$$ $\operatorname{aspect}(P,d_{\operatorname{H}})\stackrel{{\scriptstyle\mbox{ \tiny def.}}}{{=}}\frac{\max_{x_{u},x_{v}\in P}\,d_{\operatorname{H}}(x_{u},x_ {v})}{\min_{x_{u},x_{v}\in P\,;\,x_{u}\neq x_{v}}\,d_{\operatorname{H}}(x_{u}, x_{v})}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\frac{\operatorname{diam }(P,d_{\operatorname{H}})}{\operatorname{sep}(P,1)}=\operatorname{diam}(P,d_{ \operatorname{H}}),$ $$

where we used the fact that the minimal edge weights between adjacent distance nodes are equal to $1$ in an unweighted graph.
Consequentially, the number of non-zero parameters determining $\mathcal{E}$ is

$$ $\mathcal{O}\Big{(}k^{5/2}D^{4}N\,\log(N)\,\,\log\big{(}k^{2}\,\operatorname{ diam}(P,d_{\operatorname{H}})\big{)}\Big{)}.$ $$

Step $4$ - Encoding Product Order in time and snowflake in space as $(\mathcal{T},\mathcal{D})$

Since $\mathbb{R}^{2+D}$ is equipped with the product order on its last two (time) dimensions and the $p\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}1/\alpha$-snowflake of the Euclidean $(\ell^{2})$ metric on its first $D$ (space) dimension, then the conditions for Lemma 1 are met.
Applying Lemma 1 concludes the proof.
∎

###### Definition 9 (Product Order) .

###### Lemma 1 (An Implementation Lemma for Neural Spacetimes) .

###### Proof of Lemma 1 .

###### Theorem 3 (Universal Spacetime Embeddings) .

###### Proof of Theorem 1 .

###### Proof of Proposition 3 .

###### Proof of Theorem 2 .

## Appendix C Computational Implementation of Neural Spacetimes

In this appendix, we provide an extended discussion and additional details regarding the computational implementation of neural spacetimes. First, we explain what makes an activation function fractalesque, followed by an analysis of the behavior of our proposed activation function for neural (quasi-)metrics and neural partial orders. Moreover, we provide an algorithmic description of the entire pipeline, extend the discussion on causality loss enforcement and time embeddings, and propose optimization strategies at both the local and global geometry levels. Additionally, we explore potential classical algorithms for computing the optimal embedding dimensions, weight initialization strategies for the networks, and the algorithmic differences between neural snowflakes and neural (quasi-)metrics.

### C.1 What makes an Activation Function Fractalesque?

The terminology snowflake arises as follows. Consider the activation function $\sigma:\mathbb{R}\to\mathbb{R}$ given by $\sigma(x)=|x|^{\alpha}$ and set $\alpha=\log(4)/\log(3)$. Then, $d_{\alpha}(x,y)\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\sigma(|x-y|)$ defines a metric on $\mathbb{R}$ and the metric space $(\mathbb{R},d_{\alpha})$ is isometric to the (von) Koch snowflake fractal (Figure 4)
$\mathcal{X}\subset\mathbb{R}^{2}$ endowed with the distance obtained by restriction of the Euclidean distance on $\mathbb{R}^{2}$ to $\mathcal{X}$.
Here, $\alpha$ is chosen such that $(\mathcal{X},d_{\alpha})$ has positive and finite $\alpha$-Hausdorff measure.

Figure: (a)
Refer to caption: x6.png

Indeed, for any general $\alpha\in(0,1)$ one can show that $d_{\alpha}$ defines a metric on $\mathbb{R}$ with the property that any line segment has infinite length, see Semmes (). Thus, intuitively, the snowflake space $(\mathbb{R},d_{\alpha}$ contains infinitely more space to place points in while also maintaining a similar geometry to the Euclidean line; see e.g. (Acciaio et al., , Lemma 7.1). See Tyson & Wu () for an intrinsic characterization of metric spaces which arise as snowflakes of a subset of a (possibly multidimensional) Euclidean space.

More generally, consider a continuous activation function $\sigma:\mathbb{R}\to\mathbb{R}$
.
Since $\sigma$ is continuous and $[0,1]$ is compact then $\sigma$ admits a modulus of continuity $\omega:[0,\infty)\to\mathbb{R}$ on $[0,1]$; i.e. for each $x,y\in\mathbb{R}$

$$ $|\sigma(x)-\sigma(y)|\leq\omega(|x-y|).$ (38) $$

We think of $\sigma$ as being fractalesque if it is sub-Hölder and non-Lipschitz near 0 0. That is, there is an $\alpha\in(0,1)$ (note that $\alpha<1$) and some $L>0$, such that the right-hand side of equation 38 can be bounded above as

$$ $|\sigma(x)-\sigma(y)|\leq\omega(|x-y|)\leq L\,|x-y|^{\alpha}.$ (39) $$

Thus, if the upper-bound in equation 39 holds for an activation function $\sigma$, e.g. our snowflake activation function defined in equation 11, then the Euclidean distance between points in the image of the componentwise application of $\sigma$ are comparable to those of the snowflaked space $(\mathbb{R}^{d},\|\cdot\|^{\alpha})$; making it fractalesque.

#### C.1.1 The activation function in equation 2

In this work, we leverage fractalesque activation functions, which exhibit different training dynamics from typical activation functions used in artificial neural networks. We aim to visualize this type of activations and to gain an intuitive understanding of their nature.

Neural spacetimes leverage the following equation:

$$ $\sigma_{s,l}(x)\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\begin{cases} \operatorname{sgn}(x)\,|x|^{s}&\mbox{ if }|x|<1\\ \operatorname{sgn}(x)\,|x|^{l}&\mbox{ if }|x|\geq 1,\end{cases}$ $$

where the sign function $\operatorname{sgn}$ returns $1$ for $x~{}\geq~{}0$ and $-1$ for $x<0$. Both neural (quasi-)metrics and neural partial orders in neural spacetimes implement variations of this expression.

We visualize the activation using different values for $s$ and $l$ in Figure 5(a). As we can see from the plot, the function is antisymmetric about the y-axis, monotonically increasing, and behaves differently depending on the magnitude of the input. The network can learn to optimize $s$ and $l$ alongside linear projection weights, which can route inputs to different regions of the function, to model different scales independently.

Figure: (a) Neural (quasi-)metric activation function used for spatial embeddings (equation 2).
Refer to caption: x9.png

In Figure 5(b) we plot a finite difference approximation of its derivative. The derivative rapidly increases for absolute values of the input near 0 for exponents $s<1$, meaning it has a very high second derivative around these values. This can indirectly destabilize training. Moreover, the absolute value of the derivative itself is also large. This can easily make training unstable as well, especially if we compose this function with itself over multiple layers; when computing backpropagation using the chain rule, the gradients can easily explode.

In the case of the neural partial order, we implement a variation of the activation which is not able to distinguish between small and large scales since $s=l$. Although this would be theoretically enough, and corresponds to the activation in Figure 5(c), we empirically found it to be slow at training. Instead, we compose the fractalesque activation with a LeakyReLU (refer back to equation 4), which we find aids optimization and accelerates learning. As we can see in Figure 5(d), this results in a clear difference in the behavior of the function on the negative and positive axes of the input. By changing the exponential coefficient, which is learned by gradient descent, the network can substantially alter the behavior of the activation. As before, for exponential coefficients smaller than 1, this activation can lead to instabilities for small input values. For $s=1$ we recover LeakyReLU.

Based on these observation we restrict all activations to learn $s$ and $l$ coefficients greater than 1 only. These allows us to use fractalesque activations while restristing the functions to behave more similarly to activations used in the literature such as ReLU, LeakyReLU or SiLU functions.

### C.2 Algorithmic Description

We complement the mathematical descriptions of neural spacetimes in Section 3.1 with the following algorithm summaries. As discussed in the main text, let $N\in\mathbb{N}_{+}$ be the dimensionality of the feature vectors $x_{u},x_{v}\in\mathbb{R}^{N}$ associated with nodes $u,v\in V$, where $V$ represents the set of nodes of the digraph $G_{D}=(E_{D},V,W_{D})$. Fix a space dimension $D\in\mathbb{N}_{+}$ and a time dimension $T\in\mathbb{N}_{+}$. A neural spacetime is a learnable triplet $\mathcal{S}=(\mathcal{E},\mathcal{D},\mathcal{T})$, where:

- •
$\mathcal{E}:\mathbb{R}^{N}\rightarrow\mathbb{R}^{D+T}$ is an encoder network (MLP),
- •
$\mathcal{D}:\mathbb{R}^{D+T}\times\mathbb{R}^{D+T}\to[0,\infty)$ is a learnable quasi-metric on $\mathbb{R}^{D}$, and
- •
$\mathcal{T}:\mathbb{R}^{D+T}\to\mathbb{R}^{T}$ is a learnable partial order on $\mathbb{R}^{T}$.

In particular, we implement $\mathcal{D}$ and $\mathcal{T}$ as two distinct artificial neural networks inspired by neural snowflakes, which process the space and time dimensions of encoded feature vectors $\hat{x}_{u},\hat{x}_{v}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\mathcal
{E}(x_{u}),\mathcal{E}(x_{v})\in\mathbb{R}^{D+T}$ in parallel.

Figure: Algorithm 1 Neural (quasi-)metric, $\mathcal{D}$

Figure: Algorithm 2 Neural Partial Order, $\mathcal{T}$

Figure: Algorithm 3 Neural Spacetime, $\mathcal{S}=(\mathcal{E},\mathcal{D},\mathcal{T})$ (Forward Pass)

### C.3 Causality Loss and Time Embedding

In Section 3.3 we introduced the procedure used to optimize our neural spacetime model. The metric embedding in space is relatively simple an analogous to previous works (Borde & Kratsios, ; Kratsios et al., ). In this appendix we expand on the computational approach used for embedding causality and optimizing the time embedding.

The causality loss is given in the main text by:

$$ $\mathcal{L}^{C}_{uv}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\,A_{uv} \mathcal{L}^{*}_{C}\Big{(}\sum_{t=1}^{T}\,\operatorname{SteepSigmoid}(\mathcal {T}(\hat{x}_{u})_{t}-\mathcal{T}(\hat{x}_{v})_{t})\Big{)},$ $$

with $\operatorname{SteepSigmoid}(x)=\frac{1}{1+e^{-10x}}$ (the value 10 was found experimentally, making the function too steep can lead to training instabilities), and where $\mathcal{L}^{*}_{C}$ slightly modifies the expression (equation 40):

$$ $\sum_{t=1}^{T}\,\operatorname{SteepSigmoid}(\mathcal{T}(\hat{x}_{u})_{t}- \mathcal{T}(\hat{x}_{v})_{t}).$ $$

For the sake of understanding, let us focus on the equation above first.

$$ $\operatorname{SteepSigmoid}(x)\to 0\quad\text{as}\quad x\to-\infty.$ $$

In particular, $\operatorname{SteepSigmoid}(x)$ tends to 0 faster than $\operatorname{Sigmoid}(x)$ as $x\to-\infty$ (see Figure 6). In asymptotic notation:

$$ $\lim_{x\to-\infty}\frac{\operatorname{SteepSigmoid}(x)}{\operatorname{Sigmoid} (x)}=0.$ $$

Importantly, $\operatorname{SteepSigmoid}\left(\mathcal{T}(\hat{x}_{u})_{t}-\mathcal{T}(\hat
{x}_{v})_{t}\right)\approx 0\forall\left(\mathcal{T}(\hat{x}_{u})_{t}-\mathcal
{T}(\hat{x}_{v})_{t}\right)<0$ even if $\left|\mathcal{T}(\hat{x}_{u})_{t}-\mathcal{T}(\hat{x}_{v})_{t}\right|$ is small. As discussed in Section 3.3, the loss for two causally connected events $u\preccurlyeq v$ in the first neighborhood of each other ($A_{uv}=1$) is minimized when $\hat{x}_{u}\lesssim^{\mathcal{T}}\hat{x}_{v}$ is satisfied (equation 5).

In our mathematical formulation, the exact magnitude of the negative difference is not important. At first glance, a more straightforward way of imposing this condition is to use $\operatorname{ReLU}$ activation functions instead. However, these are discontinuous and lead to unstable training, which we verified experimentally. Hence, we want a continuous function that is easy to optimize and reaches zero quickly as the partial order is satisfied. Remember that we are optimizing the distance loss for the spatial component of the spacetime embedding and the time embedding using the causality loss simultaneously. If the causality loss does not reach zero quickly enough, we will be wasting computation trying to make the difference between partial embeddings more negative for no reason and, as a consequence, failing to further optimize the metric distortion of the embedding when we have already satisfied causality.

Finally, to ensure that the causality loss provides good gradients while being zero as soon as the partial order is satisfied we use the following expression, which we converged to empirically and that satisfies all our requirements:

$$ $\mathcal{L}^{C}_{uv}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\,A_{uv} \Big{(}\sum_{t=1}^{T}\,\operatorname{SteepSigmoid}(\mathcal{T}(\hat{x}_{u})_{t }-\mathcal{T}(\hat{x}_{v})_{t})\Big{)}\times(1-\operatorname{TotalCorrect}),$ (40) $$

where the second term is not differentiable but makes the loss zero when all the directed edges have been correctly embedded. To compute this we can indeed use the $\operatorname{ReLU}$ function:

$$ $\operatorname{TotalCorrect}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\, \frac{\sum_{u=u_{1}}^{u_{M}}\sum_{v=v_{1}}^{v_{M}}A_{uv}\cdot\mathbb{I}\left( \sum_{t=1}^{T}\operatorname{ReLU}(\mathcal{T}(\hat{x}_{u})_{t}-\mathcal{T}( \hat{x}_{v})_{t})=0\right)}{|E_{D}|},$ $$

where the expression in the enumerator counts how many times the function evaluates to zero for connected nodes.

Figure: Figure 6: Comparison between (standard) Sigmoid and SteepSigmoid function.
Refer to caption: x13.png

### C.4 How to Theoretically Enforce the Global Causal Geometry

In Section 3.3, we discuss that for practical purposes, we only focus on encoding local geometry, which in turn optimizes the causal geometry of the neural spacetime implicitly for causally connected events due to transitivity. For anti-chains, the no causality condition will be satisfied with high probability, especially as the number of time dimensions increases. For completeness, here we provide a loss function to enforce the global causal geometry of DAGs if the causal connectivity in the input geometry was easily computable. Note that for large graphs, this becomes very computationally expensive since we need to verify that for anti-chains, there is no path between those two given nodes.

$$ $\mathcal{L}^{C}_{uv}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}\, \underbrace{A^{\prime}_{uv}\Big{(}\sum_{t=1}^{T}\,\operatorname{ReLU}(\mathcal {T}(\hat{x}_{u})_{t}-\mathcal{T}(\hat{x}_{v})_{t})\Big{)}}_{\text{Check: Causality}}+\underbrace{B_{uv}\big{(}\min_{t}\big{(}\operatorname{ReLU}( \varepsilon+\mathcal{T}(\hat{x}_{v})_{t}-\mathcal{T}(\hat{x}_{u})_{t})\big{)} \big{)}}_{\text{Check: No Causality}},$ (41) $$

where $\mathbf{B}\stackrel{{\scriptstyle\mbox{\tiny def.}}}{{=}}(I_{(u\cancel{
\preccurlyeq}v\land v\cancel{\preccurlyeq}u)})_{uv}$ with entries $B_{uv}$ for two events $u$ and $v$, which can be deduced from $\mathbf{A}^{\prime}$, and where $\varepsilon>0$ is a margin. $A^{\prime}_{uv}$ in this case is not the adjacency matrix, but a mask which is $1$ for causally connected nodes or events. Note that here unlike in the main text we are not restricting causality to the first hop. Also, $\mathbf{B}$ is symmetric: $B_{uv}=B_{vu}$.

The loss above enforces causal connectivity and lack of causal connectivity. Both $\hat{x}_{u}\cancel{\lesssim}^{\mathcal{T}}\hat{x}_{v}$ and $\hat{x}_{v}\cancel{\lesssim}^{\mathcal{T}}\hat{x}_{u}$ must be satisfied by our representation for anti-chains. $T>1$ is required, otherwise it is not possible to avoid causality in at least one direction. In the simplest case, when $T=2$ and $t\in\{t_{1},t_{2}\}$ the following must be satisfied if we associate $\hat{x}_{u}$ with $u$ and $\hat{x}_{v}$ with $v$: $\mathcal{T}(\hat{x}_{v})_{t_{1}}>\mathcal{T}(\hat{x}_{u})_{t_{1}}$ and $\mathcal{T}(\hat{x}_{u})_{t_{2}}>\mathcal{T}(\hat{x}_{v})_{t_{2}}$, or $\mathcal{T}(\hat{x}_{v})_{t_{2}}>\mathcal{T}(\hat{x}_{u})_{t_{2}}$ and $\mathcal{T}(\hat{x}_{u})_{t_{1}}>\mathcal{T}(\hat{x}_{v})_{t_{1}}$. To satisfy the no causality condition when $T>2$, as long as one of the time dimensions breaks $\lesssim^{\mathcal{T}}$ in equation 5 it suffices. $\varepsilon$ would be included in this hypothetical optimization objective to avoid the collapse of the encoder network to a single embedding. Lastly, we would like to highlight that this causality loss should be optimized alongside a distance loss based on the graph geodesic distance instead of the local distance. Although this is a theoretical exercise, in practice it may be best to substitute $\operatorname{ReLU}$ with $\operatorname{SteepSigmoid}$ for optimization purposes as in Section C.3.

### C.5 Potential Classical Algorithms to Compute Space and Time Dimensions

Theorem 1 shows that the number of time dimensions should be at least equal to the width of the poset being embedded by the neural spacetime. In theory, the width of a poset could be computed in polynomial time Felsner et al. (). Furthermore, for posets with a width of less than $4$, there are algorithms with a runtime of $\mathcal{O}(n\,\log(n))$ (sub-quadratic time) that can detect if the poset has a width of at most $4$. Nevertheless this theoretical results become impractical for large graphs. Similarly, Theorem 1 shows that the required number of spatial dimensions needed to obtain a faithful low-distortion metric embedding of the graph underlying a poset is determined by its doubling constant and it is known that an exact computation of this doubling dimension is generally NP-hard Gottlieb & Krauthgamer (). Alternatives algorithms to obtain accurate upper bounds (up to an absolute constant factor) are also discussed in the literature Har-Peled & Mendel (), but these are in general impractical for large DAGs.

### C.6 Weight Initialization and Handling the Absence of Normalization

Weight initialization is important to avoid initial network predictions from shrinking or exploding. Networks with fractalesque activations are particularly susceptible to this problem, as they use activations with exponential coefficients. This is not such a prevalent issue if we use the well-established ReLU activation or its variants (ELU, LeakyReLU, etc.), since this activations only zero out part of the axis and leave the rest of the transformation linear.

In the original neural snowflake model (equation 10), the matrices $A$, $B$, and $C$ are initialized with weights sampled from a uniform distribution spanning from 0 to 1, which are then normalized according to the dimensions of each matrix. Specifically, for matrix $A$, the weights are drawn from a distribution ranging between 0 and $1/(d_{A1}d_{A2})$, where $d_{A1}$ represents the number of rows and $d_{A2}$ represents the number of columns of matrix $A$. We follow the same approach to initialize $W$ in equation 3. While better initialization alternatives may be possible, it was noted previously in (Borde & Kratsios, ) that drawing the weights from a normal Gaussian or using Xavier initialization can lead to instabilities and exploding numbers in the forward pass. We also observe that this initialization technique is important to avoid the metric prediction becoming either too small or too large when making the network deeper since we cannot naively apply normalization layers inside our parametric representation of the metric. Additionally, we find that neural (quasi-)metrics are better than the original neural snowflakes in maintaining the same order of magnitude in its distance prediction as the number of layers is increased.

### C.7 Neural Snowflakes vs Neural (Quasi-)Metrics

Next, we discuss similarities and differences between the original neural snowflake and neural (quasi-)metrics. We first provide an algorithmic description of neural snowflakes, which can be used to compare against that presented in Appendix C.2 for the neural (quasi-)metric model.

Figure: Algorithm 4 Neural Snowflake

Embedding Experiments. In terms of experiments, generally, we find that neural (quasi-)metrics have a smoother optimization landscape. They tend to converge faster for a low number of epochs, and in the case of snowflakes, we experimentally observed sudden drops in MSE loss, similar to those reported in Appendix I of (Borde & Kratsios, ). As shown in Section D.1, the neural (quasi-)metric construction performs better at tree embedding. What we observed is that if trained for a sufficient duration, snowflakes will eventually find a good local minimum. On the other hand, our new model seems more reliable in terms of optimization and achieves better performance for lower epochs.

Optimizing exponents. In Equation 11, $a$ and $b$ are in principle presented as learnable components via gradient descent. However, in practice, exponents can be unstable to optimize via backprop (Borde & Kratsios, ). The original neural snowflake fixes $a=b=1$, to avoid optimization issues. Nevertheless note that $p$, which controls the quasi-metric in Equation 10 is indeed optimized. Optimizing exponents closer to the final computations of the network is in general more stable. We hypothesize that this could be due to the fact that there are less chain-rule multiplications, reducing the likelihood of gradient explosion. We observe similar behaviour for neural (quasi-)metrics, note that our activation function relies on learning the exponents (equation 2). In general we find that we can learn the exponents for all layers in this configuration. But we also experimented with trying to approximate fractal metrics and observed that under some extreme cases it may be better to only optimize the exponents of the last layer for stability.

## Appendix D Experimental Details

In this appendix we expand on the experimental procedure used to obtain the results presented in the main text in Section 4.

### D.1 Undirected Tree Embedding

Overview of Results for Preliminary Undirected Embeddings. Before proceeding to DAGs, following Kratsios et al. (), we first test the spatial component of the NST model, on embedding trees and compare it to Euclidean embeddings implemented by an MLP and to hyperbolic embeddings via HNNs Ganea et al. (). We use the same training procedure as in Kratsios et al. () and perform experiments for both binary and ternary trees. In the case of the snowflake geometry, inputs are mapped using an MLP, and the metric induced by the tree structure is learned by a neural (quasi-)metric with 4 layers operating on the embedding space dimensionality. We measure distortion as the ratio between true and predicted distances. Consistent with the theoretical results in (Gupta, ), we find that in general, the difference in average distortion between metric spaces is not as pronounced as the maximum distortion since most metric spaces are ”treelike” on average. Indeed, we find that our proposed model better restricts the maximum distortion and that it is able to achieve an average distortion of 1.00 even with an embedding space of dimension 2 only. For completeness we also test the neural snowflake model in the same task, which although it is able to minimize the MSE loss, the (max) distortion is very high. Additional discussion comparing neural snowflakes and neural (quasi-)metrics can be found in Appendix C.7.

**Table 3: Tree Embedding distortion leveraging Euclidean, Hyperbolic, Neural Snowflake and Neural (Quasi-)metric spaces.**
| Tree Type | Embedding dim | Geometry | Avg Distortion | St dev Distortion | Max Distortion | MSE |
| --- | --- | --- | --- | --- | --- | --- |
| Binary | 2 | Euclidean | 1.66 | 3.53 | 1224.17 | 26.27 |
| Hyperbolic | 1.04 | 1.61 | 402.52 | 12.76 |  |  |
| Neural (Quasi-)Metric | 1.00 | 0.23 | 3.09 | 10.09 |  |  |
| Snowflake | 1.01 | 3.01 | 2261.35 | 9.47 |  |  |
| 4 | Euclidean | 1.15 | 0.68 | 159.74 | 10.19 |  |
| Hyperbolic | 1.00 | 0.17 | 11.03 | 4.14 |  |  |
| Neural (Quasi-)Metric | 1.00 | 0.19 | 3.87 | 4.88 |  |  |
| Snowflake | 1.00 | 0.65 | 539.71 | 5.92 |  |  |
| Ternary | 2 | Euclidean | 1.69 | 3.17 | 602.96 | 11.55 |
| Hyperbolic | 1.09 | 1.23 | 135.81 | 5.55 |  |  |
| Neural (Quasi-)Metric | 1.00 | 0.20 | 6.33 | 3.34 |  |  |
| Snowflake | 1.01 | 4.78 | 4017.99 | 3.64 |  |  |
| 4 | Euclidean | 1.17 | 0.82 | 185.73 | 4.82 |  |
| Hyperbolic | 1.00 | 0.15 | 16.56 | 1.37 |  |  |
| Neural (Quasi-)Metric | 1.00 | 0.16 | 4.19 | 1.72 |  |  |
| Snowflake | 1.00 | 0.47 | 237.88 | 2.15 |  |  |

Experimental Procedure for Undirected Tree Embeddings. Neural spacetimes provide guarantees in terms of global and local embeddings. In general, from a computational perspective, local embedding is more tractable. However, in these particular preliminary experiments for metric embedding, similar to (Kratsios et al., ), we embed the full undirected tree geometry. The distance between any two nodes $u,v\in V$ simplifies to the usual shortest path distance on an unweighted graph

$$ $d_{\mathcal{T}}(u,v)=\inf\big{\{}i\,:\,\exists\,\{v,v_{1}\},\dots\{v_{i-1},u\} \in\mathcal{E}\big{\}}.$ (42) $$

Using the expression above, we compute the tree induced graph geodesic between nodes. We work with both binary and ternary trees with all edge weights being equal to 1. To find all-pairs shortest path lengths we use Floyd’s algorithm (Floyd, ). Note that Floyd’s algorithm has a running time complexity of $\mathcal{O}(|V|^{3})$ and running space of $\mathcal{O}(|V|^{2})$. This makes it not scalable for large graphs.

The networks receive the $x_{u}$ and $y_{u}$ coordinates of the graph nodes in $\mathbb{R}^{2}$ and are tasked with mapping them to a new embedding space which must preserve the distance. An algorithm is employed to generate input coordinates, mimicking a force-directed layout of the tree. In this simulation, edges act as springs, drawing nodes closer, while nodes behave as objects with repelling forces, similar to anti-gravity effects. This process continues iteratively until the positions reach equilibrium. The algorithm can be replicated using the NetworkX library and the spring layout for the graph.

The networks need to find an appropriate way to gauge the distance. We adjust the network parameters by computing the Mean Squared Error (MSE) loss, which compares the actual distance between nodes given by the tree topology, $d_{\text{true}}$, to the distance predicted by the network mappings, $d_{\text{pred}}$:

$$ $\text{Loss}=\text{MSE}(d_{\text{true}},d_{\text{pred}}).$ $$

For the Multi-Layer Perceptron (MLP) baseline, the predicted distance is calculated as:

$$ $d_{\text{pred}}=\|\text{MLP}(x_{u},y_{u})-\text{MLP}(x_{v},y_{v})\|_{2},$ $$

where $(x_{u},y_{u})$ and $(x_{v},y_{v})$ represent the coordinates in $\mathbb{R}^{2}$ of a synthetically generated tree. On the other hand, for the HNN, we utilize the hyperbolic distance between embeddings with fixed curvature of -1:

$$ $d_{\text{pred}}=d_{-1}(\text{HNN}(x_{u},y_{u}),\text{HNN}(x_{v},y_{v})).$ $$

In the case of HNNs, we employ the hyperboloid model, incorporating an exponential map at the pole to map the representations to hyperbolic space, as detailed in Borde et al. (). Notably, we do not even need any hyperbolic biases to discern the performance disparity between MLP and HNN models (Kratsios et al., ).

Note that in the previous two baselines, the geometry of the space is effectively fixed, and we only optimize the location of the node embeddings in the manifold. In the case of neural snowflakes, the metric is also parametric and optimized via gradient descent. This means that we change both the location of events in the manifold and the geometry of the manifold itself during optimization. Following (Borde & Kratsios, ), the neural (quasi-)metric model also leverages the encoder $\mathcal{E}$ which is implemented as an MLP (same as in the Euclidean baseline). The predicted distance is

$$ $d_{\text{pred}}=d_{NQM}(\text{MLP}(x_{u},y_{u}),\text{MLP}(x_{v},y_{v})),$ $$

where $d_{NQM}$ is parametrized by a neural (quasi-)metric network. Importantly, feature vectors are passed independently to the metric learning network (unlike in (Borde & Kratsios, ) where an intermediate Euclidean distance representation is fed instead).

In terms of hyperparameters, we generate trees with 1000 nodes and embed them into features of dimensionality 2 and 4 in different experiments. We employ a batch size of 10,000 to learn the distances, train for 10 epochs with a learning rate of $3\times 10^{-3}$ and AdamW optimizer, and apply a max gradient norm of 1. All encoders have a total of 10 hidden layers with 100 neurons and a final projection layer to the embedding dimension. The neural (quasi-)metric has a total of 4 layers, with a hidden layer dimension equal to the event embedding dimensions, that is, either 2 or 4, and the last layer projects the representation to a scalar, i.e., the predicted distance. We use the same configuration for the snowflakes.

### D.2 Metric DAG Embedding

In this appendix, we provide additional details on the synthetic weighted DAG embedding experiments described in Section 4, focusing on local embedding. Similar to the previous setup, the networks receive the $x_{u}$ and $y_{u}$ coordinates of the graph nodes in $\mathbb{R}^{2}$ and are tasked with mapping these coordinates to a new embedding space that preserves both the distance and directionality of the generated DAG. We train the embedding following Section 3.3. As discussed in the main text, we optimize the spacetime embedding by running gradient descent based on both a distance and a causality loss. The procedure used to train the neural (quasi-)metric in terms of the spatial embedding is identical to that described in Appendix D.1.

We use the Graphviz dot layout algorithm to generate the input coordinates, positioning the nodes from top to bottom according to the directionality of the DAG. This process can be replicated using the NetworkX library. Additionally, the coordinates are normalized to lie between 0 and 1. The DAG is constructed from a random graph where each node has a 0.9 probability of being connected to other nodes, defining the directionality and connectivity of the DAG (see Figure 7). The metric distance is then calculated based on the spatial coordinates of the nodes after they have been embedded in the plane. The specific distance functions used in the experiments are listed in Table 1 and are based on (Borde & Kratsios, ).

In terms of hyperparameters, we generate DAGs with 50 nodes and embed them into spacetimes of $D=T=2,4,10$. The 50 nodes induce $50^{2}$ possible distances. We do not apply mini-batching; we optimize all of them at the same time. We train for 5,000 epochs with a learning rate of $10^{-4}$ using the AdamW optimizer, and apply a max gradient norm of 1. The initial encoders have a total of 10 hidden layers with 100 neurons each and a final projection layer to the embedding dimension $D+T$. The neural (quasi-)metric and the neural partial order have a total of 4 layers, each with a hidden layer dimension of 10.

Figure: Figure 7: Example DAG with 10 nodes and using the first metric in Table 1.
Refer to caption: x14.png

### D.3 Real-World Network Embedding

WebKB datasets. In these datasets (Rozemberczki et al., ), nodes represent web pages, while edges denote hyperlinks between them. Each node’s features are given by the bag-of-words representation of its web page. We summarize the datasets in Table 4.

**Table 4: Statistics of WebKB datasets**
| Name | #nodes | #edges |
| --- | --- | --- |
| Cornell | 183 | 298 |
| Texas | 183 | 325 |
| Wisconsin | 251 | 515 |

As discussed in the main text in Section 4, these datasets are not pure DAGs. As a preprocessing step, we remove self-loops. However, we do not remove cycles, nor do we further process edge directionality. This explains why in Table 1, it is not possible to get a perfect embedding in time. The local metric between nodes is computed as the cosine similarity between the node feature embeddings (since the datasets do not have edge weights). Note that here we do not embed graphs in the plane; we already have bag-of-words features that can be passed to the encoder, unlike in the synthetic DAG experiments. In terms of training, the procedure is the same as in Appendix D.2 and using a learning rate of $10^{-4}$.

**Table 5: Statistics of Dream5 datasets**
| Name | #nodes | #edges |
| --- | --- | --- |
| In silico | 1,565 | 4,012 |
| Escherichia coli | 1,081 | 2,066 |
| Saccharomyces cerevisiae | 1,994 | 3,940 |

Dream5 datasets. The Dream5 datasets (Marbach et al., ) were originally introduced as part of the Network Inference Challenge, where participants were provided with four microarray compendia and tasked with deducing the structure of the underlying transcriptional (gene) regulatory networks. Each compendium encompasses numerous microarray experiments, spanning various genetic, drug, and environmental alterations (or simulations thereof, in the case of the in-silico network). In this work, instead of focusing on network structure prediction, we test our neural spacetime algorithm in the context of graph embedding, following the spacetime representation literature (Law & Lucas, ; Sim et al., ). We embed the graph topology in $\mathbb{R}^{2}$ using Graphviz dot layout and compute the strength between the connections based on the cosine similarity, since the original networks do not have weights. In Table 5 we record the number of nodes and edges for each dataset. Note that these are not pure DAGs either (but it is possible to embed over $99\%$ of the directed edges correctly, see Table 2). As before, for training, we follow Appendix D.2 and a learning rate of $10^{-4}$.

## Peer Reviews

confidence: 4
contribution: 2
initial_rating: 5
presentation: 3
questions: 1. How do NSTs perform in real-world learning tasks evaluated by well-established metrics (e.g., accuracy, NMI, and F1, ROC-AUC)?
2. How do NSTs perform when compared with conventional GNNs in real-world learning tasks?
3. Do NSTs still perform robustly in massive graphs?
4. How do NSTs perform when compared with GNNs tackling heterophily?
soundness: 2
strengths: 1. The problem tackled in this paper, i.e., representation learning in DAGs, is challenging and significant in the graph machine learning community.
2. Theoretical guarantees of the proposed approach are provided in the manuscript.
summary: This paper presents Neural SpaceTimes (NSTs), a class of trainable geometries that can encode nodes of weighted Directed Acyclic Graphs (DAGs) into a spacetime manifold. NSTs are designed to capture both spatial and causal (temporal) information by using a product manifold combining spatial quasi-metrics with temporal partial orders to represent graph weights and directionality. Besides, theoretical analysis of the universal embedding theorem shows that NSTs can learn low-distortion embeddings for any DAG. Some experiments are also conducted to validate the effectiveness of NSTs.
weaknesses: Despite the merits of the paper, I have the following concerns.
1. Most results presented in this paper pertain to distortion and directionality, which demonstrate that NSTs perform robustly when evaluated by these two measures. However, there are no concrete results showing the performance of NSTs in real-world learning tasks, e.g., (semi-supervised/unsupervised) node classification, link prediction, and graph classification in synthetic DAGs, real-world DAGs (e.g., web page hyperlink graphs and citation graphs), and spatiotemporal graphs (e.g., encrypted transaction graphs). Authors are suggested to conduct some previously mentioned learning tasks and investigate how NSTs perform.
2. Some test datasets used in the experiments are always considered by those graph neural networks tackling graph heterophily (e.g., CPGNN). Compared with these graph neural networks tackling graph heterophily, how do NSTs perform in real-world tasks?
3. Most test datasets considered in this paper are also used to test conventional graph neural networks, e.g., GCN, GAT, GraphSAGE, and Graph Transformer. The authors should compare NSTs with conventional graph neural networks in real-world learning tasks (as mentioned in point 1).
4. The test datasets used in this paper are relatively small. How do NSTs perform in larger datasets? The authors can consider using datasets from OGBN, and other large datasets.

---

confidence: 4
contribution: 4
initial_rating: 5
presentation: 3
questions: 1) In the latent space embedding, is there any guarantee that $\mathcal{E}$ maps feature vectors in such a way that the resulting embedding can be partitioned into spatial and temporal components? E.g., you embed features from $\mathbb{R}^N$ into $\mathbb{R}^{D+T}$ and later separate the embedding by slicing the results ($1:D$ and $D+1:D+T$) for use in the recursions of $\mathcal{D}$ and $\mathcal{T}$. Therefore, my question is, how do you guarantee that spatial information ends up only in the first $D$ dimensions, and temporal in the last $T$ dimensions?
soundness: 4
strengths: The paper offers originality within its domain by constructing a novel architecture capable of embedding a DAG into a pseudo-Riemannian manifold which has several spatial and temporal components. In particular, adding the capability of embedding a given DAG into more than one temporal component is a novel contribution and allows the network to represent and preserve more complex causal structure from the DAG. Furthermore, the authors modify the neural snowflake model for use as a learnable quasi-metric.

The quality of the paper is also very good given that the authors cited several relevant related works and gave ample justification in the form of mathematical proof for their many propositions and theorems, thus adding to the already existing clarity of the paper.

I believe this paper makes a significant contribution to the field by adding the ability to represent discrete structures in a continuous fashion with very little approximation error, thus presenting a new and powerful tool to various application domains.
summary: The paper sets forth a new neural network architecture capable of learning the embedding of a DAG into a pseudo-Riemannian manifold, which encodes both the spatial and temporal distance between nodes of the DAG in a continuous way. Some conditions (along with proof) are given which guarantee that the embedding is faithful.

The network itself is composed of three separate networks, namely, an initial latent space embedding $\mathcal{E}: \mathbb{R}^N \rightarrow \mathbb{R}^{D+T}$, a modified neural snowflake $\mathcal{D}: \mathbb{R}^{D+T} \times \mathbb{R}^{D+T} \rightarrow [0, \infty)$ which is the quasi-metric on the manifold, and a partial order $\mathcal{T}: \mathbb{R}^{D+T} \rightarrow \mathbb{R}^T$ which encodes the causal relationships in the DAG. These latter two networks are trained parallel to each other and are optimized with respect to an aggregated loss function $\mathcal{L} = \mathcal{L}^{\mathcal{D}} + \mathcal{L}^{\mathcal{T}}$.

Empirical results are given over several datasets, some synthetic with a complex pseudo-metric and others real-world webpage hyperlink DAGs. The results are favorable of the new architecture compared to those of Minkowski and De Sitter space embeddings, showing that the new architecture shows little distortion in the learned quasi-metric and almost always preserves the causal relationships among nodes in the DAGs.
weaknesses: The paper would benefit from further experimentation, e.g., showcasing the results of the network to various distributions of DAGs and being explicit about any potential weaknesses. It would be nice to know where this architecture breaks down or how. robust it is to perturbations in the assumptions.

The language in lines 420-422 becomes imprecise and can lead to confusion. I would suggest sticking to a single convention here when using variables in a description. Similarly when the switch is made from using $T$ to using $W$, it's not clear why this is done and can lead to confusion.

Also, there seems to be a type on line 215 that would make a significant difference. The elements $x_1, x_2 \in \mathcal{X}$ cannot be compared using the metric from $\mathcal{Y}$. I assume you meant to say $\rho(f(x_1), f(x_2))$ not $\rho(x_1, x_2)$.

---

confidence: 3
contribution: 3
initial_rating: 8
presentation: 3
questions: 1. How does the framework scale to very large graphs? The current larges experiment uses ~200 k nodes, but many real-world networks could be larger.
2. The local vs. global geometry optimization tradeoff warrants deeper analysis -- could hierarchical or multi-scale approaches help bridge this gap while maintaining computational tractability? 
3. While the paper shows NST can encode both local distances and causality, how well does it preserve higher-order DAG properties like path lengths between distant nodes or branching structures? This could be particularly relevant for applications like computational workflow graphs or neural architecture search where these properties are important.
4. For DAGs with hierarchical structure (like computational graphs or dependency trees), how does the learned geometry reflect this hierarchy? Additional analysis of how NSTs capture hierarchical relationships would strengthen the practical applications.
soundness: 4
strengths: * The paper is well-organized with clear problem statement , goal (Section 1), and the proposed solution (Section 3).
* The theoretical framework in Section 3 decouples spatial and temporal components while maintaining their interaction through the embedding network. 
* The theoretical development in Section 3.1 establishes embedding guarantees through Theorem 1, showing NSTs can universally embed k-point DAGs.
* The experimental validation in Section 4 demonstrates clear improvements over baselines, particularly for low-dimensional embeddings where NSTs maintain average distortion near 1.0 while other methods show much higher distortion.
* The practical applicability is well explained through the analysis of real-world networks in Table 2.
summary: The paper proposes Neural SpaceTimes (NSTs), a framework for embedding directed acyclic graphs (DGAs) in continuous geometries which can encode both edge weights and directionality. Unlike previous methods that use fixed spacetime manifolds, NSTs learn the geometry itself through three neural networks -- an embedding network for mapping nodes to coordinates, a neural quasi-metric network for encoding distances in space dimensions, and a neural partial order network for encoding causality in time dimensions. The authors provide theoretical guarantees showing that NSTs can universally embed any k-point DAG with low distortion while preserving its causal structure. Experiments on both synthetic and real-world directed graphs demonstrate that NSTs achieve lower embedding distortions compared to baseline methods using fixed geometries like Minkowski or de Sitter spaces.
weaknesses: * In Section 3.1, while the paper proves existence of neural sapcetime embeddings with low distortion, it provides limited practical guidence on selecting the number of temporal dimension. This could be important for complex DAGs where the minimal sufficient dimension is not immediately clear.
* The optimization approach in Section 3.2 focuses on preserving local structure during training. While the authors provide theoretical guarantees about global structure preservation, the empirical validation concentrates mainly on local metrics.

---

confidence: 3
contribution: 3
initial_rating: 6
presentation: 3
questions: N/A
soundness: 3
strengths: 1. The method seems well-motivated to me. In particular, the decomposition makes sense as a space for DAG-like data, and the paper proposes a nice way of doing so with neural networks.
2. The empirical results seem promising, as the method seems to be able near perfectly embed many common DAG graph datasets.
summary: This paper proposes a framework of quasimetric embeddings using spacetime as the embedding manifold.
weaknesses: While the paper seems to be mostly complete to me, several concerning aspects about the experiments did not sit right with me.

1. The empirical results have some concerning aspects about them. In particular, the Minkowski embedding is able to largely get to near the same final distortion on both the real world graph datasets. Since the proposed method uses neural networks as well as node features (at least for the real-world data) while the previous methods do not (as is my understanding from skimming the Law and Lucas paper), this suggests that the difference provided by the proposed method is not very large with respect to the required additional effort or that the test tasks are too simple.
2. While the distortion is near perfect, the downstream effects of using these embeddings is never studied. In particular, some GNN-type experiments would be greatly appreciated.

---

confidence: 2
contribution: 3
initial_rating: 6
presentation: 2
questions: Q1. In line 215 about the metric embedding, what is $\rho(x_1,x_2)$? Since $\rho$ is defined on $\mathcal{Y}$, how can $\rho$ compute on $\mathcal{X}$?
soundness: 3
strengths: S1. NSTs' combination of quasi-metric spaces for spatial information and partial orders for causal information presents an elegant and flexible solution to representing DAGs.

S2. The authors provide a robust theoretical foundation. 

S3. The experimental results on synthetic and real-world DAG datasets indicate the NST’s capability to achieve lower embedding distortions.
summary: The authors introduce a novel architecture, Neural SpaceTimes (NSTs), which represents nodes in Directed Acyclic Graphs (DAGs) as events in a trainable spacetime manifold. This framework innovatively unifies spatial distances and causal directionality into a single representation space, designed to improve upon fixed spacetime geometries typically used in graph embedding. The authors implement this system through three neural networks: an embedding network, a neural quasi-metric, and a neural partial order network.
weaknesses: W1. Could authors provide more explanations about the experimental results? How is NST compared to closed-form spacetimes such as the Minkowski? Why the NST is better than the closed-from spacetimes? Besides, comparison with more baselines can be more convincing. 

W2. It would be good to see a time complexity analysis for the proposed NST.

Meta-review: This paper introduces Neural SpaceTimes (NSTs), a novel framework for embedding directed acyclic graphs (DAGs) into continuous geometries that capture both edge weights and directionality. Unlike prior methods relying on fixed spacetime manifolds, NSTs dynamically learn the geometry through three neural networks: an embedding network that maps nodes to coordinates, a neural quasi-metric network for encoding spatial distances, and a neural partial order network for capturing causality in temporal dimensions.  

The authors provide theoretical guarantees, demonstrating that NSTs can universally embed any \(k\)-point DAG with low distortion while preserving its causal structure. In Section 3.1, Theorem 1 rigorously establishes these embedding guarantees, showcasing the robustness of the framework.  

This work represents a significant advancement by enabling the representation of discrete structures in a continuous space with minimal approximation error, offering a versatile and powerful tool for a wide range of application domains.

Decision: Accept (Poster)