Persistent Relational Memory
Implementation & benchmark of arXiv:2609.02991 — TRACE: Spatiotemporal Contact Memory Graph Network Simulator for Granular Dynamics
Source paper: TRACE: Spatiotemporal Contact Memory Graph Network Simulator for Granular Dynamics arXiv:2609.02991 ⓘ · analyzed Sep 4, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Give every possible pairwise relation its own recurrent latent state, stored in a dictionary keyed by stable node identities, instead of discarding the state whenever the edge is absent from the current graph. At each timestep, active edges retrieve their old state, update it with the current pair features and neighborhood messages, and write it back after message passing. This should improve predictions in dynamic graphs with intermittent interactions and reduce the burden on node states to remember which specific neighbor caused an earlier event.
Formulas
Mathematical statement
The paper constructs the active graph at time t as $\mathcal{G}^{t}=(\mathcal{V},\mathcal{E}^{t})$, with nodes representing particles and $\mathcal{E}^{t}=\{(i,j):\|\mathbf{x}_{i}^{t}-\mathbf{x}_{j}^{t}\|_{2}<\alpha(r_i+r_j),\ i<j\}$. Here $\mathbf{x}_i^t$ is the feature or position of node i at time t, $r_i$ is its radius or entity scale, and $\alpha$ is a skin factor controlling when an edge becomes active. The transferable operation is not the granular radius criterion itself, but the separation between a changing active edge set and a persistent state indexed by the stable pair key $(i,j)$. For each active edge, let $m_{ij}^t$ be its stored memory, $e_{ij}^t$ its current pair feature, and $a_{ij}^t$ its aggregated attention/message input. Use a gated recurrent update $m_{ij}^{t+1}=\operatorname{GRU}(m_{ij}^{t},[e_{ij}^{t};a_{ij}^{t}])$. A concrete GRU expansion is $z=\sigma(W_z u+U_zm+b_z)$, $q=\sigma(W_q u+U_qm+b_q)$, $\tilde m=\tanh(W_m u+U_m(q\odot m)+b_m)$, and $m^+= (1-z)\odot m+z\odot\tilde m$, where $u=[e_{ij}^{t};a_{ij}^{t}]$, $\sigma$ is the sigmoid, and all W,U,b are learned parameters. The dictionary preserves $m_{ij}$ across inactive periods; a new pair receives $m_{ij}=0$ or a learned initialization.
Implementation notes
(1) Integration point: modify a temporal GNN or graph-transformer layer that currently recomputes edge embeddings from the active adjacency at every timestep. Assume each node has a stable integer ID and each timestep provides node features x[t] and a candidate-edge generator. Build the active edge set using the paper's rule when geometric positions and radii exist; otherwise use a task-specific threshold, k-nearest-neighbor graph, or observed event list. Maintain a GPU hash map memory[(min(i,j),max(i,j))] containing a vector of dimension d_mem and optionally a last_seen timestep.
(2) Pseudocode:
memory = empty_map()
for t in range(T):
E = {(i,j): distance(x[i],x[j]) < alpha*(r[i]+r[j])}
for (i,j) in E:
m = memory.get((i,j), learned_zero)
e = edge_encoder(x[i], x[j], edge_attributes[i,j])
a = edge_attention(e, neighboring_active_edges(i,j), node_states)
u = concat(e, a)
z = sigmoid(Wz@u + Uz@m + bz)
q = sigmoid(Wq@u + Uq@m + bq)
candidate = tanh(Wm@u + Um@(q*m) + bm)
m_new = (1-z)*m + z*candidate
memory[(i,j)] = m_new
edge_embedding[i,j] = concat(e, m_new)
node_states = graph_message_passing(node_states, edge_embedding, E)
prediction[t] = decoder(node_states, edge_embedding)
Use detached memory between training chunks only if memory growth causes backpropagation-through-time to exceed the budget; otherwise backpropagate for 8-32 steps. Retain inactive memories for a fixed horizon H, or evict them with an LRU policy after H steps. The attention formula above can be replaced with ordinary local edge aggregation for the first MVP.
(3) Computed from the paper's mathematics: dynamic edge construction, stable pair-key lookup, and the gated recurrence. Estimated empirically: the memory dimension d_mem, retention horizon H, attention neighborhood, and whether inactive memories should decay. Add an optional decay $m\leftarrow\rho^{\Delta t}m$ on retrieval, with learned or tuned $\rho\in(0,1]$, to prevent stale information.
(4) First cheap experiment: use a synthetic 2D multi-agent interaction dataset with 32 particles whose pair interactions switch on when distance is below a threshold, and train a 2-layer message-passing network to predict positions 10-50 steps ahead. Compare (a) no temporal memory, (b) node GRU memory, and (c) persistent edge GRU memory with identical hidden size and FLOPs. Report one-step MSE, 50-step rollout MSE, error immediately after a previously seen edge reappears, and memory/latency overhead. The hypothesis is specifically lower reactivation error and more stable long rollouts for (c), not necessarily lower one-step error. A successful signal is at least 20% lower long-horizon MSE at equal parameter count, with less than 30% inference overhead.
Verification
Stage 1 · Toy mechanism gate: Passed ✓
Stage 2 · Mechanism transferred to benchmark: Confirmed ✓
Stage 2 · Practical benchmark result: Significant win ✓
Methodology: 8 paired seeds, permutation test (p<0.05) against a learning-rate-tuned baseline. How verification works
Stage 1 — Mechanism check agent confidence 8/10
Built a reproducible persistent edge-GRU MVP and verified its core math: inactive states are retained exactly, and the gated interpolation keeps each updated coordinate within the old-state/candidate bound. On the synthetic intermittent-pair task, persistent edge memory reduced reactivation MSE from 1.004 to 0.000194 and all-timestep MSE from 0.977 to 0.160, clearly demonstrating the claimed history-recall effect. However, this unoptimized recurrent implementation was about 23.5x slower and used 273 versus 65 parameters, so the accuracy win does not currently satisfy the proposed low-overhead expectation.
- Agent confidence
- 8/10
- Baseline
- Reactivation MSE 1.00384; all-timestep MSE 0.97747; 65 parameters; 0.650 ms per batch of 128
- Idea
- Reactivation MSE 0.0001935; all-timestep MSE 0.15959; 273 parameters; 15.256 ms per batch of 128; 0.000193x baseline reactivation error; 23.48x latency
Limitations: This is a small synthetic one-pair-per-sequence recall task, not a full multi-particle dynamic GNN or physical rollout. It does not test node-GRU memory, attention aggregation, eviction/decay, equal-parameter/FLOP comparisons, or generalization across graph structures; the edge dictionary is represented by independent batch slots rather than a production GPU hash map.
How to run: python3 experiment.py
Stage 2 — Benchmark vs. tuned baseline (arXiv:2609.02991)
Beats the tuned baseline by 98.4% (p=0.0081, wins 8 / 8 paired seeds; metric: lower is better).
- Benchmark
- Relational_dynamics
- Model
- pair_temporal_mlp
- Paired seeds
- 8
- Baseline mean
- 0.9346
- Idea mean
- 0.0149
- Effect (Δ)
- -0.9197 (−98.4%; negative = idea better)
- Wins
- 8 / 8 paired seeds
- p-value
- 0.0081 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±7.7%
- Mechanism
- Confirmed ✓
- Practical effect
- Helps
- Baseline tuning
- swept over 3 configs
The custom track is synthetic and uses six fixed pair slots rather than a scalable GPU hash map over variable-size graphs. It does not test eviction/decay, attention aggregation, larger particle counts, multi-step physical rollout, latency, or equal-parameter/FLOP normalization.
How to run: python3 stage2_bench.py
Verdict computed by deterministic test code from paired-seed statistics — not by the language model.
Stage 2 — Benchmark latest Worked ✓
Agent confidence: 9/10
Implemented Persistent Relational Memory as a persistent per-pair GRU state on a structurally matched custom relational-dynamics track. The full 8-seed paired benchmark significantly favored the idea: test MSE decreased from 0.934598 to 0.014909, paired delta was -0.919690, and the permutation p-value was 0.0081. The trained-model reactivation probe confirmed the predicted mechanism, reducing masked-reactivation MSE from 0.934598 to 0.395199.
- Baseline
- Best lr=0.003; full 8-seed test MSE 0.934598 ± 0.080551.
- Idea
- Best lr=0.01; full 8-seed test MSE 0.014909 ± 0.002908; all 8 paired seeds improved; delta=-0.919690, p=0.0081.
- Mechanism signature
- Baseline reactivation MSE 0.934598; idea reactivation MSE 0.395199; idea/baseline ratio 0.422854; confirmed=true.
Benchmark result
Beats the tuned baseline by 98.4% (p=0.0081, wins 8 / 8 paired seeds; metric: lower is better).
- Benchmark
- Relational_dynamics
- Model
- pair_temporal_mlp
- Paired seeds
- 8
- Baseline mean
- 0.9346
- Idea mean
- 0.0149
- Effect (Δ)
- -0.9197 (−98.4%; negative = idea better)
- Wins
- 8 / 8 paired seeds
- p-value
- 0.0081 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±7.7%
- Mechanism
- Confirmed ✓
- Practical effect
- Helps
- Baseline tuning
- swept over 3 configs
The custom track is synthetic and uses six fixed pair slots rather than a scalable GPU hash map over variable-size graphs. It does not test eviction/decay, attention aggregation, larger particle counts, multi-step physical rollout, latency, or equal-parameter/FLOP normalization.
How to run: python3 stage2_bench.py
Artifacts
- bench_report.json 3.6 KB View Raw
- experiment.py 4.8 KB View Raw
- relational_dynamics_track.py 1.1 KB View Raw
- report.md 1.5 KB View
- report_bench_2026-09-04T153459.md 4.1 KB View
- result.json 0.7 KB View Raw
- stage2_bench.py 4.6 KB View Raw