Module contents
Lesson 30 of 30Research 110 min

Frontier: topology, algorithmic reasoning, foundation models and symmetry at scale

Explore topological message passing, neural algorithmic reasoning and equivariance at scale through controlled experiments and explicit research hypotheses.

After this lesson you can

  • Construct boundary operators and decompose flows with the Hodge Laplacian.
  • Explain higher-order and sheaf message passing.
  • Compare learned BFS and Bellman-Ford updates under extrapolation.
  • Assess graph foundation models and equivariance under matched budgets.
  • Design falsifiable research comparisons with suitable baselines.

Before you start

Four open questions

A GNN can propagate information along edges, but not every relation is binary; it can imitate an algorithm on small graphs, but that does not prove it learned the rule; and it can respect symmetry, but its cost must be compared with learning symmetry from data. This lesson turns those observations into researchable questions with concrete operators and controls separating hypothesis from proof.

From edges to faces: the Hodge Laplacian

A simplicial complex contains vertices, edges and triangles and, with each simplex, all its faces. Orientation fixes signs, not a required physical direction. Boundary matrix B1\mat{B}_1 sends each oriented edge to destination minus source; B2\mat{B}_2 sends each triangle to the oriented sum of its edges. The boundary of a boundary vanishes: B1B2=0\mat{B}_1\mat{B}_2=\mat{0}, because each vertex appears twice with opposite signs around a triangle.

The edge Hodge Laplacian is L1=B1⊤B1+B2B2⊤\mat{L}_1=\mat{B}_1\T\mat{B}_1+\mat{B}_2\mat{B}_2\T. For flow f\vb{f}, B1f\mat{B}_1\vb{f} measures vertex divergence and B2⊤f\mat{B}_2\T\vb{f} circulation around oriented faces. Since

f⊤L1f=∥B1f∥2+∥B2⊤f∥2,\vb{f}\T\mat{L}_1\vb{f}=\norm{\mat{B}_1\vb{f}}^2+\norm{\mat{B}_2\T\vb{f}}^2,

a harmonic flow lies in both kernels. Finite-dimensional algebra gives the orthogonal decomposition

R∣E∣=im⁡B1⊤  ⊕  im⁡B2  ⊕  ker⁡L1.\R^{|E|}=\operatorname{im}\mat{B}_1\T\;\oplus\;\operatorname{im}\mat{B}_2\;\oplus\;\ker\mat{L}_1.

The two images are orthogonal because B1B2=0\mat{B}_1\mat{B}_2=0; their orthogonal complement is precisely the intersection of the two kernels. The gradient component expresses potential differences; the face component, circulations that are boundaries; the harmonic component represents cycles not explained by those faces. Changing an edge orientation changes its coordinate sign and corresponding column, not the physical flow.

A four-edge cycle without faces has one harmonic dimension. Adding a diagonal and two triangular faces filling the square leaves no hole and the kernel of L1L_1 has dimension zero. Adding a face without all its edges and vertices would not be a valid simplicial complex. See Lim’s algebraic treatment.

The faceless cycle has four flow coordinates and three independent divergence constraints because the graph is connected. One independent circulation around the cycle remains. Adding the diagonal yields five edges and thus two independent cycles in the kernel of B1B_1; the two face boundaries generate exactly those cycles. The diagonal creates a new circulation direction, but both faces explain both directions: correct counting gives zero harmonic dimension. Edge count alone does not determine remaining holes.

The displayed decomposition uses the Euclidean inner product of edge coordinates. If edges have weights or faces represent different areas, a weighted version modifies adjoints and projections. A component orthogonal under one weighting need not be orthogonal under another. For real-data comparison, declare measured flow, units, orientations and weights before interpreting harmonic circulation as an application phenomenon.

InteractiveA hole and a flow
  • positive flow
  • negative flow
12345
Visible component
1.0
1.0
1.0
-1.0
0.0
Gradient norm0.000
Face norm1.155
Harmonic norm1.633
The first face is filled; the second can be filled. Click an edge to increase its flow and use Shift to decrease it, or adjust controls. Readouts are norms of orthogonal Hodge projections; filling both faces removes the harmonic component.

Messages on higher-order relations

Topological message passing can update features on vertices, edges and faces using incidence and upper or lower neighborhoods. Orientation requires oriented-feature transformations compatible with sign changes. A filled triangle is not simply three drawn edges: it adds a higher-order relation. Bodnar et al. analyze simplicial networks and their expressivity under their constructions; it does not follow that every network on every complex automatically surpasses every WL variant.

Cellular sheaves and their diffusion assign vector spaces to nodes and edges and restriction maps to each edge. For edge e=(u,v)e=(u,v), local energy may be ∥Ru→exu−Rv→exv∥2\norm{\mat{R}_{u\to e}\vb{x}_u-\mat{R}_{v\to e}\vb{x}_v}^2. Summed energies define a sheaf Laplacian. Identity restrictions recover a usual notion of agreement; with different maps two different features can be compatible after transport. That flexibility may help under heterophily, but learning restrictions does not guarantee generalization or eliminate oversmoothing by definition. Neural Sheaf Diffusion studies asymptotic behavior and learned variants.

To derive the operator, stack all restriction differences in matrix D\mat{D}. Total energy is ∥Dx∥2=x⊤D⊤Dx\norm{\mat{D}\vb{x}}^2=\vb{x}\T\mat{D}\T\mat{D}\vb{x}, so D⊤D\mat{D}\T\mat{D} is symmetric positive semidefinite. Its kernel vectors simultaneously satisfy edge compatibility conditions. The kernel need not contain only constant signals: that depends on restriction maps and graph structure. This distinguishes “diffuse to agreement” from requiring all original coordinates to be equal.

A higher-order relation is not equivalent to including all its pairwise edges. Three connected stations can form a graph cycle; a filled face additionally declares that cycle the boundary of a triangular interaction in the complex. If data contain only edges, deciding which cycles to fill is a modeling assumption and can change harmonic dimension. Test the result with and without those faces and check the construction criterion does not use the label being predicted.

Has it learned the rule or the distribution?

Neural algorithmic reasoning trains a network to execute algorithm steps. For BFS, reachability after t+1t+1 steps is the Boolean maximum of current state and neighbor states. Bellman-Ford relaxes distances using a minimum over candidates. Maximum or equivalent operations can therefore align aggregation with a propagation rule, while sum changes with neighbor count; this is an inductive hypothesis, not proof an architecture generalizes on every distribution.

Supervising intermediate states provides more information than observing only the final answer, but evaluation must run the network in a loop without replacing predictions with true states. Compare unseen sizes and densities, keep sources and weights outside training where appropriate, measure step and final accuracy, and compare with the exact algorithm. The CLRS benchmark provides tasks and intermediate signals for studying these questions.

In unweighted BFS, after tt updates an exact rule can only have reached nodes at distance at most tt from the source. Thus moving from 16 to 256 nodes requires distinguishing representation or learning limitations from horizon limitations. A network correctly executing 32 steps can fail against the complete component if it contains a longer path. The lab shows both references: BFS compares with the final component, while the weighted variant compares against the algorithm after exactly 32 relaxations.

Trace supervision can improve training signal but also increases available information. To isolate its effect compare equivalent architectures with known budgets and state whether true states are only labels or injected during evaluation. A one-layer final control may help show how hard it is to infer a whole component from an immediate neighborhood; it does not itself show intermediate supervision is the sole cause of the difference.

Foundation models and symmetry at scale

Graph foundation models seek reusable representations across tasks and datasets. A pretrained GNN can share a structural encoder; another route serializes a graph as text for a language model; another converts substructures to tokens. Each representation loses or preserves information differently. An LLM answering small-graph questions can exploit text order, node names or memorized patterns: permute names and edge order, control length and compare with a symbolic algorithm.

Pretraining on many graphs also risks overlap between training and evaluation data. Changing node identifiers alone does not guarantee a repeated structure is new. Depending on task, reserve families, molecules, dates or entire components and define an equivalence notion detecting relevant duplicates. Transductive pretraining that sees test nodes without labels may be valid in some settings, but must be distinguished from generalization to a never-observed graph.

Equivariance at scale is an efficiency comparison, not a universal victory label. In rigid-body interaction experiments, Brehmer et al. find augmentation can close a data-efficiency gap with enough epochs, while equivariant models outperform nonequivariant ones at each compute budget tested in their study. Results depend on model family, task, scale range and compute allocation. A power law fitted to a few points does not justify extrapolating a distant crossover.

Comparing at equal example count answers a different question than comparing at equal cost. One model may need fewer samples but spend more operations per sample; another may exploit random transforms at the cost of more epochs. To evaluate the tradeoff, record parameters, batch size, updates, train and inference time, and operation-count method. If accuracy is measured in one orientation, include rotations and permutations not used for training. An exactly equivariant architecture should respect transformation within numerical precision, but may still predict incorrect energy.

So-called scaling laws often fit error against data, parameters or compute over an observed range. A useful fit requires justifying its form and measuring uncertainty by repetition; if error has an irreducible floor, a power law without a floor term can produce misleading slopes. An extrapolated crossover between nearly parallel curves is especially unstable because it divides by their slope difference. The figure calculates that crossover so its sensitivity can be observed, not to predict a future budget.

Lab: boundary and decomposition

The following implementation uses increasing orientation for each edge and triangle. Flow and matrices use the same order; changing orientation without changing both is a sign error. Least-squares projection uses a pseudoinverse to tolerate the incidence matrix’s constant null space.

[ ]Construir fronteras y descomponer flujosBrowser
import numpy as np

def boundary_matrices(vertices,edges,faces):
    vertices=list(vertices)
    edges=[tuple(sorted(e)) for e in edges]
    faces=[tuple(sorted(f)) for f in faces]
    if len(set(edges)) != len(edges) or len(set(faces)) != len(faces):
        raise ValueError('Simplex repetido')
    vmap={v:i for i,v in enumerate(vertices)}; emap={e:i for i,e in enumerate(edges)}
    B1=np.zeros((len(vertices),len(edges)))
    for j,(a,b) in enumerate(edges): B1[vmap[a],j]=-1; B1[vmap[b],j]=1
    B2=np.zeros((len(edges),len(faces)))
    for j,(a,b,c) in enumerate(faces):
        B2[emap[(b,c)],j]=1; B2[emap[(a,c)],j]=-1; B2[emap[(a,b)],j]=1
    return B1,B2

def hodge(B1,B2,f):
    grad=B1.T @ np.linalg.lstsq(B1.T,f,rcond=None)[0]
    curl=B2 @ np.linalg.lstsq(B2,f,rcond=None)[0] if B2.shape[1] else np.zeros_like(f)
    return grad,curl,f-grad-curl

vertices=[0,1,2,3]
cycle=[(0,1),(1,2),(2,3),(0,3)]
B1,B2=boundary_matrices(vertices,cycle,[])
L=B1.T@[email protected]
print('ciclo: dimensión armónica',len(cycle)-np.linalg.matrix_rank(L))
edges=cycle+[(0,2)]; faces=[(0,1,2),(0,2,3)]
B1,B2=boundary_matrices(vertices,edges,faces)
L=B1.T@[email protected]
print('relleno: frontera² cero',np.allclose(B1@B2,0),'dimensión armónica',len(edges)-np.linalg.matrix_rank(L))
f=np.array([1.,-1.,2.,0.5,-0.5])
g,c,h=hodge(B1,B2,f)
print('reconstrucción',np.allclose(g+c+h,f),'productos cruzados',np.round([g@c,g@h,c@h],12))

Learning a BFS update

Train a logistic neuron shared across nodes to imitate a reachability update. The message is the neighbor scalar state and aggregation is maximum, sum or mean. The label supervises accumulated state after the step. This deliberately small experiment shows what each operation gains and loses; it does not replicate the complete CLRS benchmark.

Compare six intermediate-state supervision steps with a control attempting to predict the final component directly from the initial state in one layer. It receives fewer supervised examples and is not compute-matched, so any difference is illustrative, not an isolated causal estimate of intermediate labels’ value.

[ ]Estados de entrenamiento BFSBrowser
import networkx as nx
from scipy.special import expit

random=np.random.default_rng(19)
def random_graph(n,rng):
    seed=int(rng.integers(2**31-1))
    return nx.fast_gnp_random_graph(n,3/(n-1),seed=seed)

def edge_arrays(graph):
    directed=[(a,b) for u,v in graph.edges for a,b in ((u,v),(v,u))]
    return np.array(directed,dtype=int).reshape(-1,2)

def aggregate(state,edges,kind):
    result=np.zeros(len(state))
    if len(edges):
        if kind=='max': np.maximum.at(result,edges[:,1],state[edges[:,0]])
        else:
            np.add.at(result,edges[:,1],state[edges[:,0]])
            if kind=='mean':
                count=np.bincount(edges[:,1],minlength=len(state))
                result/=np.maximum(count,1)
    return result

def training_examples(kind, intermediate=True):
    X=[];Y=[]
    sample_rng=np.random.default_rng(19)
    for _ in range(160):
        g=random_graph(16,sample_rng); edges=edge_arrays(g)
        state=np.zeros(16);source=int(sample_rng.integers(16));state[source]=1
        if not intermediate:
            final=np.zeros(16);final[list(nx.node_connected_component(g,source))]=1
            agg=aggregate(state,edges,kind)
            X.append(np.column_stack((np.ones(16),state,agg)));Y.append(final)
            continue
        for _ in range(6):
            agg=aggregate(state,edges,kind)
            target=np.maximum(state,aggregate(state,edges,'max'))
            X.append(np.column_stack((np.ones(16),state,agg)));Y.append(target)
            state=target
    return np.concatenate(X),np.concatenate(Y)

models={}
for kind in ('max','sum','mean'):
    for intermediate in (True,False):
        X,y=training_examples(kind,intermediate);w=np.zeros(3)
        for _ in range(600): w-=0.6*(X.T@(expit(X@w)-y)/len(y))
        models[kind,intermediate]=w
        print(kind,'supervisión intermedia',intermediate,'pérdida',round(np.mean(np.logaddexp(0,X@w)-y*(X@w)),5))

The following evaluation uses new seeds, a 32-step horizon and binary feedback of the model’s own predictions. It compares with the exact reachable component; when a shortest path exceeds 32 edges, the complete reference is deliberately more demanding than the model horizon. Mean node accuracy can hide errors in a few nodes; the fraction of completely correct graphs is also reported.

[ ]Generalizar a grafos mayoresBrowser
def rollout_bfs(g,source,w,kind,steps=32):
    edges=edge_arrays(g);state=np.zeros(len(g));state[source]=1
    for _ in range(steps):
        agg=aggregate(state,edges,kind)
        X=np.column_stack((np.ones(len(g)),state,agg))
        state=(expit(X@w)>=0.5).astype(float)
    return state

evaluation=np.random.default_rng(81)
for n in (16,32,64,128,256):
    graphs=[random_graph(n,evaluation) for _ in range(12)]
    source=[int(evaluation.integers(n)) for _ in graphs]
    truth=[]
    for g,s in zip(graphs,source):
        target=np.zeros(n);target[list(nx.node_connected_component(g,s))]=1;truth.append(target)
    print('n',n,end=' ')
    for (kind,intermediate),w in models.items():
        pred=[rollout_bfs(g,s,w,kind) for g,s in zip(graphs,source)]
        node=np.mean([np.mean(p==y) for p,y in zip(pred,truth)])
        full=np.mean([np.all(p==y) for p,y in zip(pred,truth)])
        print(kind,'pasos' if intermediate else 'final',round(node,3),round(full,3),end='; ')
    print()

Only one neuron was fitted and twelve graphs per size sampled from the same random family as training. Generalizing here does not demonstrate correct execution on long paths, dense graphs or adversarial structures. Vary the generator and retain seed separation to test that conclusion.

InteractiveExtrapolation within a graph family
  • Step supervision
  • Direct final control
Aggregation
Graphs per size12
Points are the percentage of completely correct graphs in the preceding run. Change aggregation. The final-supervision control uses fewer examples and a different one-step task, so comparison does not causally isolate intermediate supervision.

Weighted relaxation: Bellman-Ford

The nonnegative-cost update takes the minimum between current distance and dj+wjid_j+w_{ji} for each neighbor. bellman_lab.py generates 160 connected 16-node graphs with weights uniform between 0.1 and 1. The shared layer applies an affine combination of self distance and candidate aggregation; its three parameters are fitted by least squares. In the aligned model the minimum also includes self distance: the exact rule is already an input and regression learns to select it. Sum and mean compress the same candidates differently. Six intermediate states are compared with a control attempting to predict final distance from initial state in one step.

InteractiveWeighted distances outside training
  • Per-step supervision
  • Final distance only
Aggregation
Graphs per size12
Free steps32
Mean absolute errors per node on 12 new graphs of each size after 32 free steps, against 32 exact relaxations. Models trained on 16-node graphs; change aggregation to compare both supervision modes.

Minimum with step supervision reproduces the rule to numerical error of order 10−1310^{-13}; that was expected from the chosen input, not proof a general network discovered Bellman-Ford. At 256 nodes mean error of the minimum final-supervision model is approximately 1.53, as in this run’s sum and mean step-supervised controls. Controls do not match label count or compute; distances saturate at 100 and reference also uses 32 steps, not necessarily convergence. One seed and graph family do not establish universal extrapolation.

Designing a contribution

A testable proposal separates hypothesis from evidence. For example: “on graphs with long cycles and training on small sizes, supervising intermediate distances improves rollout accuracy on larger graphs.” Baselines: exact BFS, GNN with and without intermediate supervision, and a structure-free model receiving the same features. Fix sizes, density, seeds, compute budget and errors before looking at results. Include permutation controls and disconnected cases, and report failures as well as means. A small local experiment can refute the hypothesis; it does not by itself turn the finding into a general law.

A small molecular sweep

The file symmetry_lab.py compares an EGNN that transforms coordinates equivariantly with a transformer given centered coordinates and random rotations during training. They predict the energy of an aspirin molecule using 100, 300 or 1000 examples and two widths. It uses the train/test NPZ files from split 01 of rMD17, PyTorch and NumPy; the author warns that conformations come from a trajectory and are not necessarily independently distributed. It uses 256 examples from the test file and normalizes energies with statistics from the training subset.

python symmetry_lab.py --train rmd17_aspirin_train_01.npz --test rmd17_aspirin_test_01.npz --epochs 100 --seeds 40 41 42 --threads 4

The run in the figure performed 36 CPU training runs: three sizes, two widths, two models and three seeds, each for 100 epochs with batches of 32. Seeds change initialization and batch order, but each size uses the same training subset. The individual results record parameters, updates, MAE, change under rotation and time for each configuration. Among the 256 evaluated examples we found no coordinates exactly duplicated from the 1000 training examples; this does not eliminate dependence among conformations from a trajectory.

Time includes transformer rotations and depends on the machine and other processes; it is not an operation count and does not guarantee equal compute. For example, with 1000 examples and width 32 there were 3200 updates per training run: the EGNN has 16,195 parameters and took 260.7 seconds on average, versus 18,625 parameters and 143.3 seconds for the transformer. These CPU times were measured with four threads and concurrent processes: they describe this run and do not establish a universal speed ranking.

InteractiveA comparison that does not prove a law
  • EGNN
  • Augmented transformer
  • Training mean
Width
Horizontal axis
Transformer MAE on 1000 examples: range across 3 seeds5.136–5.140 kcal/mol
Mean transformer change under rotation, 1000 examples0.029 kcal/mol
EGNN log-log slope−0.006
Transformer log-log slope−0.006
log₁₀ of fitted crossover2.31
MAE in kcal/mol: mean over three seeds with 100 epochs per configuration; bands show minimum and maximum, not confidence intervals. The mean predictor is added to the data axis. The readings fit log-log lines to three points and show the base-10 logarithm of their extrapolated intersection. The alternative axis estimates multiply and add operations in the forward passes, not total cost or matched time.

The compute-axis estimate counts each multiplication and addition in linear layers and attention products for the 21 atoms, multiplied by the 100 passes over the dataset. It omits backpropagation, activations, normalization, rotation generation, memory access and implementation details; it is a partial indicator calculated from the architecture, not a measurement of effective FLOPs or a matched budget. The mean predictor is absent from that axis because it performs no such forward passes.

In this run the errors are close to the mean predictor. With 1000 examples and width 32, mean MAE is 5.13795 kcal/mol for EGNN and 5.13707 for the transformer, versus 5.13758 for the constant predictor; the differences are small relative to the absolute error. Changing size also changes the mean computed on the subset, so part of the trend may reflect that change of reference. Three sizes and seeds are not enough to estimate a scaling law or a reliable crossover: we would need to study convergence, compare real cost and include other molecules and splits. Mean variation under rotation for EGNN ranges from 1.8 to 5.4 × 10⁻⁸ kcal/mol depending on configuration, while the augmented transformer does not impose exact invariance. This observation checks numerical symmetry on these samples, not a predictive advantage.

Exercises

ProofBoundary of a boundary
Prove: Prove that BₖBₖ₊₁ = 0 and deduce the orthogonality of the gradient and face components.
0
The boundary of an oriented simplex alternates signs as each vertex is omitted.

Step 1 of 2. How many times does each codimension-two face appear?

Numeric
What is the dimension of the kernel of L₁ for a four-edge cycle without faces?
Numeric
After adding a diagonal and the two triangular faces filling the cycle, what is the dimension of the kernel of L₁?
Quiz
Which aggregation is directly aligned with Bellman-Ford relaxation?
Quiz
The CLRS benchmark studies networks trained with algorithm traces. If an architecture improves a pathfinding test, what additional experiment helps assess the hypothesis that its intermediate states cause the improvement?
CodeOrientation and cancellation
Implement boundary_matrices(simplices), where simplices is a collection of vertex tuples of lengths 1, 2 or 3, closed under faces and without duplicates. Use increasing orientation and return B1 and B2, with rows and columns in lexicographic order within each dimension.
import numpy as np

def boundary_matrices(simplices):
  pass
Shift+Enter to run
Key idea
The research frontier starts with a hypothesis that a baseline and a reproducible experiment can put to the test.