This Machine Learning concept is the current idea: keep the same invariant visible across Intuition, Math, Code, Interactive Demo.
Machine Learning
Message Passing Neural Networks
Message passing neural networks update node embeddings by sending transformed neighbor features into an aggregate-and-update step.
Concept Structure
Message Passing Neural Networks
Start with the picture, metaphor, or geometric mechanism.
Make the objects explicit and connect them with notation.
Mirror the equations with runnable implementation details.
Manipulate the mechanism and watch the idea respond.
Learner Contract
What this page should let you do.
2 prerequisites listed; refresh them before leaning on the math or code.
Explain the mechanism, trace the main notation, and test one prediction in the live demo.
Read the intuition before the notation; the math should name a mechanism you already felt.
Follow this edge after making one prediction here; the next page should reuse the result, not restart the route.
Claim/source review status
Substantive review recorded
1/1 claims have bounded review metadata; still check caveats and source scope.Metadata-derived; review may be AI-assisted. Not a human certification.01
Intuition
Build the mental picture first so the rest of the page has something to attach to.
A graph neural network has to answer a simple question:
How can a node use the features of its neighbors without forgetting that the input is a graph, not a row in a table?
The usual answer is message passing.
Each node keeps a vector representation. During one layer, every node receives small messages from its neighbors, combines those messages in an order-independent way, and updates its own vector.
The phrase "message" is literal enough to be useful:
- a neighbor has a current representation;
- a learned function turns that representation into a message;
- all incoming messages are aggregated;
- the node combines the aggregate with its previous state.
The important constraint is that a graph has no natural ordering of neighbors. If node has neighbors , the result should not depend on whether the code happened to list them as or . This is why message-passing layers use aggregators such as sum, mean, max, or attention-weighted sums.
This is the first neural version of the adjacency idea. The adjacency matrix said where information can move. Message passing says what information moves, how it is pooled, and how it changes the node representation.
02
Math
Translate the story into symbols, assumptions, and a derivation you can inspect.
Let be a finite graph. Each node has a hidden vector at layer :
The one-hop neighborhood of is
A message-passing layer can be written in three steps.
First, compute a message from each neighbor to node :
Here is a learned message function. The optional edge feature can encode edge type, distance, bond type, or any edge annotation. This page keeps out of the demo so the core mechanism stays visible.
Second, aggregate the incoming messages:
The aggregator must be permutation-invariant. Mean aggregation is one simple choice:
Third, update the node representation:
The update function may be an MLP, a gated recurrent update, a residual block, or a simpler affine map plus nonlinearity.
The key invariant is local and repeated:
After one layer, a node has information from one-hop neighbors. After two layers, it can contain information from nodes two hops away, because its neighbors have already absorbed their own neighbors.
This locality is powerful, but it also creates caveats:
- many layers can blur node representations if aggregation repeatedly averages neighborhoods;
- nodes with different local structure can still become hard to distinguish;
- attention, normalization, residual connections, and edge features change the layer behavior;
- implementation libraries use sparse batching and indexing tricks that are not visible in the small formula.
Those are later pages. This page isolates the mechanism every learner should feel first: send, aggregate, update.
03
Code
Keep the implementation aligned with the notation so the algorithm is legible.
import numpy as np
edges = [(0,1), (0,2), (1,3), (2,3), (2,4), (3,4)]
h = np.array([
[ 1.0, 0.1],
[ 0.9, 0.2],
[ 0.2, 0.8],
[-0.4, 0.9],
[-0.8, 0.7],
])
W_msg = np.array([[0.7, -0.2], [0.1, 0.8]])
W_self = 0.35 * np.eye(2)
b = np.array([0.05, -0.05])
neighbors = {i: [] for i in range(len(h))}
for i, j in edges:
neighbors[i].append(j)
neighbors[j].append(i)
next_h = np.zeros_like(h)
for v in range(len(h)):
messages = np.array([W_msg @ h[u] for u in neighbors[v]])
aggregate = messages.mean(axis=0)
next_h[v] = np.maximum(0, W_self @ h[v] + aggregate + b)
print(v + 1, "aggregate", aggregate.round(2),
"updated", next_h[v].round(2))
The code mirrors the math: build neighbor lists, transform neighbor features into messages, average the incoming messages, then update each node.
04
Interactive Demo
Use direct manipulation to connect the explanation to a moving system.
Predict which node representation changes the most after one mean-aggregation message-passing layer. Then reveal the incoming messages, aggregate vector, update vector, and delta for each candidate node.
Live Concept Demo
Explore Message Passing Neural Networks
The stage is code-native and interactive. Use it to test the explanation against the mechanism.
Manipulate one control and predict the visible change.
Commit to what Message Passing Neural Networks should make visible before reading the result.
After The First Pass
Turn the concept into an inspected object.
Once the invariant is visible in the intuition, math, code, and demo, use these panels to inspect the mechanism visually, check source support, practice the idea, and attach a grounded research question.
Mechanism Storyboard
See the idea move before the page explains it
Message passing neural networks update node embeddings by sending transformed neighbor features into an aggregate-and-update step.
Start with the picture, metaphor, or geometric mechanism.
Before reading further, choose the kind of change Message Passing Neural Networks should make visible.
Visual Inquiry
Make the image answer a mathematical question
Message passing neural networks update node embeddings by sending transformed neighbor features into an aggregate-and-update step.
Which visible object should carry the first intuition?
Pick the cue that should make Message Passing Neural Networks easier to reason about before the page gives the answer.
Source Grounding
Canonical references for the mechanism on this page.
Primary source for the message, aggregate, and update view used in the MPNN framework.
Open sourceCourse source for node neighborhoods, aggregation, and graph neural network layer intuition.
Open sourcePedagogical visual source for graphs with node features and neighborhood information flow.
Open sourceOpen-source implementation reference for propagate, message, aggregate, and update hooks.
Open sourceClaim Review
Message passing neural networks update node embeddings by sending transformed neighbor features into an aggregate-and-update step.
Claims without a substantive review badge still need exact source-support review.
gilmer-2017-mpnn, cs224w-gnn-message-passing, distill-2021-gnn-intro, pyg-messagepassing-2026
Use equations, runnable code, and demos to check whether the source support is operational.
The sources support the finite one-hop layer abstraction, neighbor messages, permutation-invariant aggregation, update functions, and the implementation mapping to message/aggregate/update hooks.
Sources: Neural Message Passing for Quantum Chemistry, Stanford CS224W: Graph Neural Networks, A Gentle Introduction to Graph Neural Networks, PyTorch Geometric: Creating Message Passing NetworksFinite one-layer mean-aggregation witness only; excludes training, sparse batching, edge-feature variants, directed graphs, over-smoothing, and GCN/GraphSAGE/GAT details.A bounded review summary is present; still check caveats and exact reference scope.Checked Gilmer et al. for the MPNN message/update framework, CS224W for neighborhood aggregation and GNN layer intuition, Distill for graph-feature pedagogy, and PyTorch Geometric documentation for the practical message/aggregate/update API pattern. GPT Pro publication critique remains pending because 127.0.0.1:51672 is unavailable.
Reviewer: codex-local-source-review; reviewed 2026-07-02Source support candidates
paper 2017Neural Message Passing for Quantum ChemistryPrimary source for the message, aggregate, and update view used in the MPNN framework.
course-notes 2026Stanford CS224W: Graph Neural NetworksCourse source for node neighborhoods, aggregation, and graph neural network layer intuition.
article 2021A Gentle Introduction to Graph Neural NetworksPedagogical visual source for graphs with node features and neighborhood information flow.
documentation 2026PyTorch Geometric: Creating Message Passing NetworksOpen-source implementation reference for propagate, message, aggregate, and update hooks.
Practice Loop
Try the idea before it explains itself
Message passing neural networks update node embeddings by sending transformed neighbor features into an aggregate-and-update step.
Before touching the demo, predict one visible change that should happen in Message Passing Neural Networks.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
A concrete answer is on the canvas.
The answer names why the claim should hold.
It touches the page context or a neighboring idea.
Research Room
Attach the question to a claim, equation, code, or demo
Pick the concept, equation, source, runnable code, claim, misconception, or demo state before asking for help. The handoff keeps that page item in context.Open the draft below to save one note and next action in this browser.
Message Passing Neural Networks
What is the smallest example that makes Message Passing Neural Networks click without losing the math?
Local action draftNo local draft saved yetExpand only when ready to capture one local next action
This draft stays in this browser, attached to the selected learning item.
- References to inspect: attached references on this page.
- Definition, prerequisite, and contrast concept links
- The equation or runnable code that makes the concept operational
- One demo state that shows the invariant instead of a slogan
- The learner can state the mechanism in their own words
- The learner can name the prerequisite that would repair confusion
- The learner can predict how the mechanism changes under one perturbation
I am working in Continuous Function's research reading room. Object: concept - Message Passing Neural Networks Selected item key: recorded for copy. Context: Machine Learning Page anchor: recorded for copy. Open question: What is the smallest example that makes Message Passing Neural Networks click without losing the math? Evidence to inspect: - References to inspect: attached references on this page. - Definition, prerequisite, and contrast concept links - The equation or runnable code that makes the concept operational - One demo state that shows the invariant instead of a slogan What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action.
concept/concept-notebook/machine-learning/message-passing-neural-networks
concept:machine-learning/message-passing-neural-networks