---
title: 'TMRB-N: Node-Adaptive Temporal Memory Buffer'
url: https://www.emergentmind.com/topics/node-adaptive-temporal-memory-buffer-tmrb-n
type: topic
---

# TMRB-N: Node-Adaptive Temporal Memory Buffer

Node-Adaptive Temporal Memory Buffer, abbreviated **TMRB-N**, is a **lightweight temporal memory module** introduced as part of CoMemNet, a dual-branch continual learning framework for traffic prediction on continuously expanding and evolving traffic networks [2605.05738]. In that setting, TMRB-N is embedded in the backbone and stores, updates, and replays **low-dimensional temporal representations across time periods $\tau$**, focusing only on **key nodes selected adaptively**. Its stated purpose is to consolidate historical temporal priors while adapting to new distributions, thereby addressing **catastrophic forgetting** and **memory explosion**. In related technical formulations, analogous node-conditioned memory buffers also appear in temporal knowledge graph reasoning, temporal network inference, event-stream reordering, and quantum repeater scheduling, although the precise semantics of “buffer,” “memory,” and “node-adaptivity” differ across domains.

## 1. Definition and core function

In CoMemNet, TMRB-N is defined as a **Node-Adaptive Temporal Memory Replay Buffer** whose role is to store, update, and replay compact temporal states rather than raw samples or graph neighborhoods [2605.05738]. Alternative names used for the same mechanism include **“Temporal Memory Replay Buffer”** and **“TMRB-N.”** The module is explicitly described as **node-adaptive** because it selects **Top-K nodes with largest temporal feature change** and updates only those nodes rather than all nodes.

The buffer is designed to address two failure modes that are central to continual spatio-temporal learning. First, it mitigates **catastrophic forgetting** by gating current time features with historical time features $H(\tau-1)$, thereby stabilizing temporal representations and preserving historical patterns. Second, it mitigates **memory explosion** by storing compact temporal embeddings $H_\tau \in \mathbb{R}^D$ and small node lists $V_\tau^k$, rather than raw historical samples or multi-hop graph neighborhoods.

The term “buffer” is therefore not used in the conventional systems sense of a large replay cache. In the CoMemNet formulation, the buffer is a compact temporal state mechanism. A common misconception is to interpret TMRB-N as ordinary experience replay over stored traffic windows. The CoMemNet description states the opposite: replay is realized through **historical temporal priors** and **training-node selection**, not through storage of full historical graph instances.

## 2. Mathematical formalization

TMRB-N operates over time periods $\tau$ and uses daily and weekly temporal embeddings for the currently selected node subset $V_\tau^s$. For the current period, the daily and weekly embeddings are

$$
T_\tau^D \in \mathbb{R}^{N_\tau^s \times D_D}, \qquad
T_\tau^W \in \mathbb{R}^{N_\tau^s \times D_W},
$$

and the concatenated time feature matrix is

$$
T_\tau = (T_\tau^D \parallel T_\tau^W) \in \mathbb{R}^{N_\tau^s \times D}, \qquad D = D_D + D_W.
$$

The buffer stores a global temporal state $H_\tau \in \mathbb{R}^D$ for each period. To compare this global state with node-wise temporal features, $H(\tau-1)$ is expanded across nodes before differencing. The node-wise temporal difference is

$$
\Delta H(\tau-1,\tau)=\left|T_\tau-\operatorname{expand}(H(\tau-1),N_\tau)\right|.
$$

The implementation note is important: in practice, shapes must align with the selected subset size $N_\tau^s$.

Node adaptivity is then implemented by sorting $\Delta H(\tau-1,\tau)$ and selecting the **Top-K nodes** with the largest differences,

$$
V_\tau^k = \operatorname{Top\text{-}K}(\Delta H(\tau-1,\tau), K).
$$

This set $V_\tau^k \subseteq V_\tau^s$ identifies the nodes most sensitive to temporal changes in period $\tau$.

The current-period summary over those key nodes is obtained through a learned linear projection,

$$
H_\tau^a = \frac{1}{K}\sum_{i \in V_\tau^k} T_\tau(i) W,
$$

where $W \in \mathbb{R}^{D \times D}$ is a learned weight matrix. The resulting vector $H_\tau^a \in \mathbb{R}^D$ is a compact summary of the current period’s temporal features at the selected key nodes.

Historical and current temporal features are fused through **GRU-like gates**:

$$
r_t = \sigma\!\left(W_r \cdot (H(\tau-1)\parallel H_\tau^a)\right),
$$

$$
z_t = \sigma\!\left(W_z \cdot (H(\tau-1)\parallel H_\tau^a)\right),
$$

$$
h_t = \tanh\!\left(W_t \cdot \left(H_\tau^a \parallel (H(\tau-1)\cdot r_t)\right)\right),
$$

$$
H_\tau = z_t \cdot h_t + (1-z_t)\cdot H_\tau^a.
$$

The updated temporal state $H_\tau$ is stored in the buffer and used in period $\tau+1$. This design makes the replay state global in dimension yet node-adaptive in how it is updated.

## 3. Integration with CoMemNet’s dual-branch training pipeline

TMRB-N is not a standalone mechanism; it is integrated with CoMemNet’s **Online branch**, **Target branch**, and **Dynamic Contrastive Sampler (DC Sampler)** [2605.05738]. The Target branch extracts historical information using **Wasserstein Distance features**. For node $j$, the Target branch produces $F_\tau(j), F_{(\tau-1)}(j)\in\mathbb{R}^{C_F}$, which are normalized and discretized into histogram-like representations. The practical Wasserstein Distance used in the implementation is

$$
W(\tau-1,\tau)=\sum_{j\in V(\tau-1)}\sum_{i=1}^{n} c_i \left|h_{(\tau-1)i}(j)-h_{\tau i}(j)\right|.
$$

The DC Sampler then selects the training subset through a deterministic **Top-M** rule:

$$
M = N_\tau \cdot \rho,
$$

$$
V_\tau^s = \operatorname{Top\text{-}M}\{W(\tau-1,\tau)\mid j\in V(\tau-1)\}\cup (V_\tau \setminus V(\tau-1)).
$$

TMRB-N is applied only after this sampler has identified the informative nodes. The resulting per-period pipeline is: compute Target-branch features, discretize them, compute node-wise Wasserstein scores, form $V_\tau^s$, construct $T_\tau$ for those nodes, compute $\Delta H(\tau-1,\tau)$, select $V_\tau^k$, aggregate $H_\tau^a$, update $H_\tau$, and then use the Online branch for prediction on $V_\tau^s$.

The training loss is a mean absolute error defined on the selected nodes:

$$
L(\hat{Y}_\tau, Y_\tau, \Theta)=\frac{1}{T_f \cdot N_\tau^s \cdot C}\sum_{t=1}^{T_f}\sum_{n\in V_\tau^s}\sum_{c=1}^{C}\left|\hat{Y}_\tau(t,n,c)-Y_\tau(t,n,c)\right|.
$$

The overall objective is therefore **$L_{\text{MAE}}$ on $V_\tau^s$**. A recurring misunderstanding is that CoMemNet uses an explicit contrastive loss. The specification states that **no explicit contrastive, distillation, or matching losses are used; the “contrastive” component is in the sampler, not the loss**.

Parameter updates follow the dual-branch pattern:

- Online branch SGD:
  $$
  \theta_o \leftarrow \theta_o - \alpha \nabla_{\theta_o} L(\hat{Y}_\tau, Y_\tau, \theta_o)
  $$

- Target branch EMA:
  $$
  \theta_t \leftarrow \beta \cdot \theta_t + (1-\beta)\cdot \theta_o
  $$

At inference time, the Online branch predicts on the **full** node set $V_\tau$ for evaluation under **MAE/RMSE/MAPE**, while $H_\tau$ may still be used as a temporal prior.

## 4. Complexity, storage model, and implementation constraints

The stated computational cost of the DC Sampler is dominated by Target-branch feature extraction and histogram construction, both at $O(N_\tau C_F)$, followed by WD aggregation at $O(N_\tau n)$ and Top-M selection at $O(N_\tau \log M)$ or $O(N_\tau)$ with partial selection [2605.05738]. For TMRB-N itself, the per-update costs are

- $\Delta H$: $O(N_\tau^s \cdot D)$
- Top-K selection: $O(N_\tau^s \log K)$, or $O(N_\tau^s)$ with partial selection
- $H_\tau^a$ aggregation: $O(K \cdot D)$
- gate update: $O(D)$ per vector

The buffer’s memory footprint is correspondingly small. Per period, it stores $H_\tau \in \mathbb{R}^D$ and optionally $V_\tau^k$ of size $K$, giving **$O(D+K)$ memory per period**. If only the most recent $H_\tau$ is retained, the storage is **$O(D)$**. This is contrasted directly with graph replay schemes that store multi-hop neighborhoods and can incur **$O(N \cdot d^L)$ explosion**.

The paper does **not specify capacity $B$ or eviction**. The implementation guidance states that, in practice, a bounded buffer can keep recent $H_\tau$ vectors or overwrite older entries, and a **ring buffer** can be used to cap memory while preserving **$O(D)$ current usage**. This means that TMRB-N is defined more by its update rule than by a fixed archival policy.

The key hyperparameters tied to TMRB-N are explicit. The default **Top-K** is **$K=12$**. The DC Sampler ratio $\rho$ is dataset-specific: **PEMS D3(S) $\rho = 0.05$; PEMS D4(L) $\rho = 0.03$; PEMS D8(M) $\rho = 0.05$**. The Target branch uses **EMA momentum $\beta = 0.99$**. Optimization uses **AdamW, lr=0.01 with decay 0.5, batch size 128, early stopping patience 10**. Practical constraints include shape alignment through $\operatorname{expand}(H(\tau-1),N_\tau^s)$, efficient partial top-k/top-m selection, and consistent construction of daily and weekly time embeddings.

These design choices indicate that TMRB-N is deliberately engineered as a **lightweight replay primitive** rather than a memory-intensive archival subsystem.

## 5. Empirical evidence and comparative rationale

The empirical contribution of TMRB-N in CoMemNet is isolated through ablation experiments on three large-scale traffic datasets [2605.05738]. The reported 12-step mean results are as follows.

| Dataset | w/o TMRB-N | CoMemNet |
|---|---|---|
| PEMSD3(S) | MAE 14.94, RMSE 25.38, MAPE 19.76 | MAE 13.57, RMSE 22.94, MAPE 18.80 |
| PEMSD4(L) | MAE 23.76, RMSE 39.59, MAPE 17.29 | MAE 22.00, RMSE 37.38, MAPE 15.86 |
| PEMSD8(M) | MAE 18.36, RMSE 30.61, MAPE 20.06 | MAE 17.03, RMSE 28.41, MAPE 17.82 |

The reported relative improvements are **$-9.2\%$ MAE, $-9.6\%$ RMSE, $-4.9\%$ MAPE** on PEMSD3(S); **$-7.4\%$ MAE, $-5.6\%$ RMSE, $-8.3\%$ MAPE** on PEMSD4(L); and **$-7.2\%$ MAE, $-7.2\%$ RMSE, $-11.2\%$ MAPE** on PEMSD8(M). Additional component ablations report that **w/o Select**—that is, random key-node choice—degrades performance relative to feature-difference-based selection, and **w/o Update**—removing the gating update—also degrades performance. The sensitivity study in Fig. 5 identifies **$K=12$** as yielding **minimum or near-minimum MAE across all datasets**, with stable performance across $K$.

The larger comparative rationale is also explicit. Relative to **experience replay**, TMRB-N avoids storing raw samples or ego-subgraphs and therefore avoids memory explosion on expanding graphs. Relative to **reservoir sampling**, it is node-adaptive through $\Delta H(\tau-1,\tau)$ rather than task-agnostic. Relative to **rehearsal with distillation**, it avoids auxiliary losses and historical-data matching, because replay is realized through temporal gating with $H(\tau-1)$. Relative to **pattern bank approaches (e.g., PECPM)**, it stores a global temporal prior vector $H_\tau$ and relies on the DC Sampler to focus on volatile nodes.

The same experiments also report that CoMemNet achieves **state-of-the-art performance across all three large-scale real-world datasets**, and that it trains **15–30% of nodes in later years**, which is presented as an efficiency result tied to the sampler-buffer combination. A plausible implication is that TMRB-N’s main contribution is not merely better state retention, but better **selective retention**: the buffer is effective because it is coupled to a mechanism that reduces both the number of updated nodes and the dimensionality of stored history.

## 6. Related formulations and broader interpretations

Outside CoMemNet, closely related memory mechanisms have been connected to TMRB-N in several domains. In **AdaTKG**, a temporal knowledge graph reasoning model, the per-entity memory is presented as exactly such a buffer: each entity $e$ maintains a memory vector updated causally as

$$
M_e^{(t)} = \alpha M_e^{(t-1)} + (1-\alpha)x_e^{(t)}, \qquad M_e^{(0)}=0,
$$

with a single shared scalar $\alpha=\sigma(\rho)$, and the memory is fused with static inductive representations through a learned gate [2605.07121]. The model emphasizes that the memory is **state, not per-entity trainable parameters**, and therefore supports unseen entities. In that mapping, node adaptivity already appears even with shared $\alpha$, because each node’s state evolves according to its own interaction history. The same guide also proposes more explicit node-adaptive variants, such as time-varying context-conditioned $\alpha_e^{(t)}$, while warning that per-node learned $\alpha_e$ breaks strict inductivity.

A different line of work on **temporal networks with node-specific memory** associates node-level persistence with heterogeneous transition probabilities, relaxation times, and structural breaks [2311.16981]. The supplied formulation describes a per-node adaptive buffer whose effective length is tied to inferred relaxation time, for example through

$$
L_i = \left\lceil \alpha \hat{\tau}_i \right\rceil, \qquad
w_\Delta^{(i)} \propto \exp\!\left(-\frac{\Delta}{\hat{\tau}_i}\right).
$$

This suggests a statistical interpretation of TMRB-N in which node-adaptivity is driven by estimated persistence timescales rather than neural feature drift. The same source explicitly notes, however, that the actual paper text was unavailable and that the provided framework was constructed to match the model family; accordingly, this interpretation should be read as a rigorously aligned formulation rather than as a direct quotation of the paper.

In **time-sensitive event processing**, dynamic buffer sizing yields a non-neural but operationally analogous notion of node-adaptive temporal buffering. For multiple distributed sources, a per-node dynamic time-out $T_n$ can be computed from observed transmission times, with the recommended **BSTTDA** rule

$$
\text{bufferTime} = \frac{1}{n}\sum_{i=1}^{n} tt_i + (\max(tt)-\min(tt)) + \text{offset},
$$

and evaluated through **notCompensatedEventsPercentage** and **overfittingBufferTimePercentage** [2009.11741]. Here, node-adaptivity means source-specific reorder windows rather than latent replay states, but the structural analogy is clear: compact temporal statistics are updated online to trade off correctness and memory or latency.

In **quantum repeater architectures**, memory buffer times can also be optimized hierarchically and per node or per link. The provided blueprint grounded in that literature defines node/link-specific buffer choices $\tau^{(i,k)}$ or $n_{\text{out}}^{(i,k)}$ to maximize the rate of distillable entanglement under dephasing and synchronization constraints [1811.01080]. In that setting, the “memory buffer” is literal quantum storage time, not a learned representation, yet the same design principle recurs: **buffer duration should be adapted to local temporal and reliability conditions rather than fixed globally**.

Taken together, these formulations suggest that **TMRB-N** has both a narrow and a broad meaning. In the narrow sense, it is the specific node-adaptive temporal replay module in CoMemNet. In the broader sense, it denotes a family of mechanisms that maintain **node-conditioned temporal state**, update that state causally or periodically, and use adaptive selection or scheduling to preserve useful history without incurring uncontrolled storage growth.

Source: https://www.emergentmind.com/topics/node-adaptive-temporal-memory-buffer-tmrb-n