Heterogeneous and Relational GNNs
Real financial graphs mix different kinds of nodes (companies, funds, people, contracts) connected by different kinds of edges (owns, supplies, sues) — heterogeneous and relational graph networks give each node type and each edge type its own rules instead of forcing everything through one shared aggregation function.
Prerequisites: Message Passing Neural Networks, Graphs as Data: Adjacency and Node Features
A standard graph neural network assumes every node is the same kind of thing and every edge means the same kind of relationship — all nodes are, say, "company," all edges mean "is correlated with." Most real financial graphs are not like that at all: a single graph might have companies, mutual funds, individual executives, and countries as nodes, connected by edges meaning "owns shares in," "employs," "is headquartered in," or "sues." Averaging a fund's neighbors the same way you'd average a company's neighbors makes no sense — a fund's neighbors are holdings, a company's neighbors might be suppliers, competitors, and lawsuits, all mixed together. Heterogeneous and relational GNNs are the fix: give each node type and each edge type its own aggregation rule.
The analogy: a company's mixed mailroom
Imagine a corporate mailroom that receives four completely different kinds of mail — invoices from suppliers, subpoenas from lawyers, dividend checks from investments, and job applications — and imagine one clerk tries to process every piece of mail with the exact same procedure regardless of type. That clerk would either mangle everything (stapling a subpoena the way you'd staple an invoice) or, more realistically, would need a different processing rule per mail type before combining what they learned into one daily summary. A heterogeneous GNN is that smarter mailroom: it sorts incoming "messages" (from neighboring nodes) by what kind of relationship delivered them, applies a relationship-specific rule to each, and only then combines the results into an updated node representation.
The mechanism: one weight matrix per relation type
A relational GNN (the classic version is R-GCN) extends ordinary message passing by giving every edge type its own learnable weight matrix , and aggregates messages separately per relation before summing:
In words: for each relation type (owns, supplies, employs, ...), gather the neighbors connected to specifically through that relation type, transform each of their representations with that relation's own weight matrix , average by a normalizing constant , sum the contributions across all relation types, add a self-loop term that preserves the node's own prior representation, and squash with a nonlinearity . Node type heterogeneity is handled the same way: a node's own feature transformation and its neighbors' transformations can differ by node type, so a "fund" node and a "company" node are never forced through an identical function.
Worked example 1: R-GCN update for one node by hand
Take a company node with two relation types feeding it: "owned by" (one neighbor, fund , current representation ) and "supplied by" (two neighbors, suppliers , with , ). Suppose , , , , and normalizing constants are just the neighbor counts per relation ( for "owned by," for "supplied by"). The pre-activation sum is: owned-by contribution ; supplied-by contribution ; self-loop . Total , then apply a nonlinearity (say ReLU, which leaves a positive value unchanged): . Note the "owned by" relation and "supplied by" relation each got their own weight before being combined — a plain GCN would have mixed fund and supplier signals through one identical weight.
Worked example 2: why one shared weight would fail here
Suppose instead a plain (non-relational) GCN forced a single shared weight (roughly the average of and ) across both relation types, ignoring which edge is which. The update becomes: owned-by ; supplied-by ; self-loop ; total — in this particular toy case the numbers happen to land close, but that is an artifact of the chosen values, not a general property. The real problem shows up during training: with one shared weight, the model has no way to learn that "being owned by a fund" and "being supplied by a vendor" should influence the company's representation in structurally different ways — gradient signal from ownership relationships and supply relationships gets blended into updating the exact same parameters, so the model cannot specialize either relation's effect.
Each relation type in a heterogeneous GNN applies its own transformation matrix to incoming messages, similar to how the matrix above stretches and rotates space differently depending on its entries — a relational GNN just uses a different one of these per edge type instead of one for the whole graph.
Heterogeneous and relational GNNs replace one shared aggregation rule with a separate rule per node type and per edge (relation) type, summing the relation-specific contributions before updating a node — this lets "owns," "supplies," and "sues" each shape a node's representation differently instead of being blended through an identical function.
What this means in practice
Financial knowledge graphs — combining companies, funds, executives, filings, and regulatory actions — are almost always heterogeneous, and R-GCN-style architectures (or heterogeneous attention variants) are the standard tool for tasks like predicting fraud risk from a mixed entity-relationship graph, scoring counterparty risk across ownership and lending relationships simultaneously, or building a single embedding space where "similar company" queries can be answered even though companies are only indirectly connected through funds, people, and filings. The practical cost is more parameters — one weight matrix per relation type instead of one total — which for graphs with many relation types (dozens in a rich knowledge graph) can overfit; basis decomposition or block-diagonal weight sharing across relations is the standard mitigation.
Practice
- Redo worked example 1 with a third relation, "litigated by," contributing one neighbor with and , and recompute .
- Explain in one sentence why forcing all edge types through one shared weight matrix limits what the model can learn, even if it happens to produce similar numbers on one toy example.
- Name two node types and two edge types that would appear in a graph built from 13F institutional holdings filings.
The common confusion is assuming that adding relation-specific weights is "just more parameters for the sake of more parameters," so a well-regularized plain GNN should do just as well given enough data. The issue is structural, not just capacity: a plain GNN has no way to represent "this neighbor influences me because it owns me" differently from "this neighbor influences me because it supplies me" — no amount of extra data fixes a model that cannot even express the distinction the task depends on.
Related concepts
Practice in interviews
Further reading
- Schlichtkrull et al., Modeling Relational Data with Graph Convolutional Networks (2018)
- Wang et al., Heterogeneous Graph Attention Network (2019)