---
title: 'Brainstacks: Layered Brain-Inspired Architectures'
url: https://www.emergentmind.com/topics/brainstacks
type: topic
---

# Brainstacks: Layered Brain-Inspired Architectures

“Brainstack” and “Brainstacks” are labels used in several brain-inspired computing literatures for stack-structured or layered organizations of representation, plasticity, and control, but they do not denote a single standardized architecture. In “Planning with Biological Neurons and Synapses,” a Brainstack is a stack data structure implemented as a chain of assemblies in the Assembly Calculus [2112.08186]. In “Thermodynamic-RAM Technology Stack,” “Brainstacks” names the eight-layer neuromorphic technology stack spanning memristor device physics through server-level software [1406.5633]. In “Brainstacks: Cross-Domain Cognitive Capabilities via Frozen MoE-LoRA Stacks for Continual LLM Learning,” the term refers to frozen domain-specific adapter stacks composed additively on a shared frozen base model [2604.01152]. In “ZenBrain: A Neuroscience-Inspired 7-Layer Memory Architecture for Autonomous AI Systems,” it denotes a seven-layer memory hierarchy governed by neuroscience-inspired algorithms and Predictive Memory Architecture components [2604.23878].

## 1. Terminological scope and recurring structure

The literature assigns “Brainstack” to distinct technical objects: a symbolic data structure realized in spiking assemblies, a hardware-software abstraction stack for neuromorphic processors, a continual-learning adapter stack for LLMs, and a layered memory architecture for autonomous agents. The commonality is structural rather than ontological: each usage organizes computation into vertically composed levels or states with controlled transitions, selective routing, and explicit plasticity–stability management.

| Context | Meaning of “Brainstack(s)” | Source |
|---|---|---|
| Assembly Calculus | A stack implemented as a chain of assemblies in five brain areas | [2112.08186] |
| Thermodynamic-RAM | The eight layers of a neuromorphic technology stack | [1406.5633] |
| Continual LLM learning | Frozen domain-specific MoE-LoRA stacks on a frozen base | [2604.01152] |
| ZenBrain | A seven-layer memory hierarchy for autonomous AI systems | [2604.23878] |

A useful distinction is between **literal stacks** and **abstraction stacks**. The Assembly Calculus Brainstack is a literal push/pop data structure. Thermodynamic-RAM uses the term for a bottom-up implementation hierarchy. The 2026 Brainstacks architecture uses additive frozen stacks of adapters, while ZenBrain uses stacked memory stores with consolidation, decay, and reconsolidation. This suggests that the term functions as a family resemblance label for brain-inspired layering rather than as a canonical formalism.

## 2. Brainstack as a neural stack in the Assembly Calculus

In the Assembly Calculus model, each brain area \(A\) consists of \(n\) excitatory neurons with random connectivity \(P(x\to y \mid x,y\in A)=p\), and at most \(k\) neurons may fire at any time step. An assembly is a set of size \(k\) that, once formed, re-fires together when cued. Synaptic weights are initialized to \(1\) and follow Hebbian plasticity:
$$
w_{x\to y}\leftarrow (1+\beta)\,w_{x\to y}
$$
when neuron \(x\) fires at time \(t\) and neuron \(y\) fires at time \(t+1\) [2112.08186].

A stack of blocks \(b_1,b_2,\dots,b_s\) is encoded using five areas: **Blocks**, **Head**, and three node areas \(\{0\},\{1\},\{2\}\). Blocks contains a fixed pre-wired assembly \(\mathit{Asm}(b)\) for each block \(b\). Parsing the stack projects each block from Blocks into the node areas in cyclic order, after which the node area projects into Head. The resulting representation is a chain of linked assemblies in which each node-area assembly is strongly connected both to its predecessor and to the block assembly representing the corresponding block. The bottom-to-top block order is therefore recapitulated as a sequence of linked assemblies.

Push and pop are realized through sequences of disinhibition and projection. For **pop**, Head is linked to node \(i\), Head\(\to\)node\(_i\) and node\(_i\)\(\to\)node\(_{i-1\bmod 3}\) are disinhibited, and \(\texttt{strongProject}\) is invoked. At the next time step, node\(_{i-1}\) fires, cued both by node\(_i\) and by residual chain connections; a subsequent projection from node\(_{i-1}\) to Head makes Head adopt the assembly one level down the stack. The top link is not erased, but it becomes unused. For **push**, Blocks\(\to\)node\(_i\) is disinhibited, the new block assembly is projected into node\(_i\), then node\(_i\)\(\to\)Head is projected so that Head fires the new block assembly; a cleanup strong projection across all five areas restores the chain order.

The synaptic substrate is \(G_{n,p}\) both within areas and across fibers. If \(W_{AB}\in\{0,1\}^{n\times n}\) is the adjacency matrix from area \(A\) to area \(B\), then projection forms a dense subgraph between the active source and target assemblies, with the submatrix \(W_{AB}[\mathit{Asm}_A,\mathit{Asm}_B]\) containing nearly all ones up to a small fraction \(\varepsilon\). After \(\ell\) projection rounds,
$$
w_{x\to y}\approx (1+\beta)^\ell
$$
for \(x\in \mathit{Asm}_A\) and \(y\in \mathit{Asm}_B\), so future firing of \(\mathit{Asm}_A\) recruits \(\mathit{Asm}_B\) with probability \(1-O(\varepsilon)\).

The central empirical limitation is chain reliability. Classical Assembly Calculus conditions require
$$
k\ll n,\qquad p\gg \frac{\log n}{k},\qquad \beta p k \gg 1.
$$
With \(n=10^6\), \(k=50\), \(p=0.1\), and \(\beta=0.1\), simple projections used in parsing, push, and pop are “essentially fool-proof” with \(1-\varepsilon\approx 0.99\). However, chaining \(s\) consecutive projections degrades substantially: beyond \(s\approx 20\) blocks, the probability of fully recovering the chain drops below \(50\%\), even though \(n/k=2\times 10^4\) disjoint assemblies could coexist. The experiments also show an optimal window of \(k\) around \(30\!-\!40\) for maximizing chain length. In this usage, Brainstack is therefore a biologically plausible data structure whose main bottleneck is reliable long-chain recovery rather than single-operation correctness.

## 3. Brainstacks as the Thermodynamic-RAM technology stack

In Thermodynamic-RAM, “Brainstacks” refers to eight layers of abstraction needed to implement a neuromorphic processor based on AHaH Computing and integrate it into digital systems [1406.5633]. The stack runs bottom-up from device physics to application-facing infrastructure:

- **Memristor device physics**: a memristor is modeled as probabilistic two-state “metastable switches” in parallel with a Schottky-diode term, with total current
  $$
  I(V,t)=\phi\cdot I_m(V,t)+(1-\phi)\cdot I_s(V),
  $$
  where \(I_s(V)=I_0(e^{\alpha V}-1)\).
- **Synapse implementation**: a synapse is a differential pair of memristors \((M_a,M_b)\) sharing a common node, with a two-phase “2-1” read/write cycle and qualitative update rule
  $$
  \Delta G_a\propto -F\cdot I_a\cdot \Delta t,\qquad
  \Delta G_b\propto -F\cdot I_b\cdot \Delta t.
  $$
- **AHaH node behavior**: an AHaH node aggregates \(n\) synapses onto a common electrode \(y\), with read-phase analog dot product
  $$
  y=V\cdot \frac{\sum_{i\in active} G_{a,i}-\sum_{i\in active} G_{b,i}}{\sum G_{total}},
  $$
  and unsupervised write feedback \(F=-V\cdot \mathrm{sign}(y)\).
- **kT-RAM core architecture**: a modified RAM array in which each cell stores a synapse rather than a bit, and an H-tree interconnect ties selected memristors to global lines \(A\), \(B\), and \(y\).
- **AHaH instruction set semantics**: 12 forward/reverse instructions, including FF, FH, FL, FU, FA, FZ and RF, RH, RL, RU, RA, RZ.
- **Sparse spike encoding scheme**: each time step activates exactly \(k\) out of \(M\) channels, with input
  $$
  y=w\cdot x=\sum_{i\in S} w_i,
  $$
  reducing synapse activations to \(O(k)\) rather than \(O(M)\).
- **kT-RAM emulator**: a cycle-accurate software model with the same API as future hardware.
- **SENSE server integration**: a daemon linking spike encoders, buffers, virtual AHaH nodes, and application logic.

The stack’s main systems claim is collapse of the memory–compute barrier. Every access both reads and updates the model. On the device side, the target thresholds for synaptic updates are below \(0.2\,\mathrm{V}\), with \(R_{on}\approx 10\,\mathrm{k}\Omega\) or greater, short pulse operation in the ps–ns regime, femto–picojoule updates, and retention ranging from seconds to weeks depending on application. At the node level, analog read+write occurs every cycle, giving “minimal per-sample energy at \(\sim\)pJ level.” At the core level, kT-RAM targets semiconductor-speed read–write cycles in the GHz range with sub-pJ per synapse access.

Architecturally, the system avoids naive crossbar sneak paths through per-cell switches and explicit addressing, and it uses temporal partitioning so that multiple virtual AHaH nodes share the same H-tree by time-multiplexing disjoint sets of synapse addresses. The cost is controller complexity, multiplexing overhead, and sensitivity to device noise, parasitic capacitances, and ADC/DAC resolution. The emulator demonstrates a linear classifier on MNIST with \(92.1\%\) accuracy, while SENSE server integration is reported to keep host CPU utilization at \(\sim<10\%\) cycles because core adaptation is off-loaded.

In this usage, Brainstacks is not a data structure but a complete implementation hierarchy: materials, circuits, nodes, cores, ISA, encoding, emulation, and deployment.

## 4. Brainstacks as frozen MoE-LoRA stacks for continual LLM learning

The 2026 Brainstacks architecture defines a modular continual-learning system in which a pre-trained transformer base model is frozen throughout training and inference, while domain expertise is packaged into sequentially trained, permanently frozen adapter stacks [2604.01152]. The base is TinyLlama-1.1B or Gemma 3 12B IT in 4-bit NF4 quantized form, implemented as `bnb.nn.Linear4bit`. Each domain-specific stack inserts MoE-LoRA delta modules into all seven transformer projections—\(q\), \(k\), \(v\), \(o\) in attention and gate, up, down in the FFN—at every layer. Inference is additive:
$$
y = W_{\mathrm{frozen}}x + \sum_{j\in \mathrm{FrozenStacks}} \Delta_j(x) + \Delta_{\mathrm{active}}(x).
$$
Only the active stack receives gradients; frozen stacks are read-only and are offloaded to CPU half-precision to minimize GPU footprint.

Each LoRA expert uses low-rank factors \(A_i\in\mathbb{R}^{d_{in}\times r}\) and \(B_i\in\mathbb{R}^{r\times d_{out}}\) with rank \(r=16\). \(B_i\) is initialized to zero so that \(\Delta_i\) begins at the identity, and rsLoRA uses \(\alpha=r=16\) and scale \(s=\alpha/\sqrt{r}=4.0\), giving
$$
\Delta_i(x)= s\cdot B_i(A_i x).
$$
Routing is Shazeer-style noisy top-2 with \(N=4\) experts and \(K=2\) selected per token:
$$
\ell_{\mathrm{router}}=W_r x,\qquad
\sigma_{\mathrm{noise}}=\mathrm{softplus}(W_n x),\qquad
\ell_{\mathrm{noisy}}=\ell_{\mathrm{router}}+\sigma_{\mathrm{noise}}\odot \epsilon,
$$
followed by top-2 masking and softmax. The auxiliary load-balance loss is
$$
\mathcal{L}_{aux}=N\sum_{e=1}^N P(e)f(e),\qquad \lambda_{aux}=0.01.
$$

The training procedure has two nested loops. The **inner loop** performs residual boosting: add a new trainable MoE-LoRA stack, train it on domain data, freeze it, and stop if validation-loss improvement is below \(\delta_{min}=0.002\). The paper uses up to \(2\!-\!3\) rounds per domain and a BestStackCallback that restores the best checkpoint if validation loss spikes above \(0.1\) or plateaus for 4 evaluations. The **outer loop** orders domains by curriculum: Chat, Code, Math, Medical, Reasoning. Before each domain after the first, a null-space projector is computed from all frozen stacks using randomized SVD on \(n_{samples}=400\) validation examples with \(K=64\):
$$
D=U\Sigma V^\top,\qquad P=VV^\top,\qquad
\Delta_{\mathrm{proj}}=\Delta-\Delta P=\Delta(I-P).
$$
This constrains new stacks to operate in the orthogonal complement of prior domains and is stated to enforce zero forgetting by construction.

After supervised fine-tuning, the system trains an outcome-based sigmoid meta-router of approximately \(2\)M parameters. The router consumes a weighted sum of hidden states, \(0.45\times\) mid-layer plus \(0.55\times\) last-layer, with all domain stacks disabled. It applies linear token projection to dimension \(512\), learned global query attention, cross-attention to per-domain query vectors, and a fusion MLP with GELU and dropout, ending in independent sigmoids rather than a softmax. The chat stack has a minimum weight of \(0.20\), and stack-loading threshold is \(0.12\). Outcome targets are discovered greedily by loss reduction of at least \(0.01\), with a soft-boost target \(t_{reasoning}=0.5\) for any reasoning improvement and a final target \(t=0.8\,t_{discovered}+0.2\,t_{label}\). Training lasts 8 epochs with cosine learning-rate schedule and checkpoint selection by
$$
0.50\cdot \mathrm{single\_top1\_accuracy}
+0.35\cdot \mathrm{mixed\_set\_match}
-0.15\cdot \mathrm{validation\_bce}.
$$

Empirically, parameter-matched MoE-LoRA converges faster per step than single LoRA: on Alpaca with TinyLlama-1.1B, single LoRA (\(r=64\), \(50.5\)M parameters) reaches validation loss \(0.874\) in 400 steps and 9.5 minutes, while MoE-LoRA (\(4\times r=16\), \(53.6\)M parameters) reaches \(0.872\) in 400 steps and 20.2 minutes, but attains single LoRA’s final loss in \(\sim160\) steps, i.e. \(2.5\times\) faster convergence per step. Residual boosting improves the chat domain from a single-LoRA plateau of \(0.8741\) to a final \(0.8531\), a \(2.4\%\) relative improvement. In 4-domain continual learning on TinyLlama, the reported final losses are Chat \(0.853\), Code \(0.493\), Medical \(0.663\), and Math \(0.696\), with 9 stacks total.

The paper’s most specific claim concerns interference and recovery. Ungated accumulation damages composition quality: after all domains, chat validation loss rises to \(1.778\) from \(0.853\) “purely by magnitude accumulation, not weight drift,” and ungated 10-stack generation collapses into over-thinking math chains on every prompt. Null-space training reduces interference, with chat loss after math equal to \(1.778\) with null-space versus \(1.839\) without it, \(\Delta=-0.061\). When the meta-router gates each domain in isolation, each domain’s loss returns exactly to its training-time value. On 33 medical prompts, an oracle uses only the medical stack in \(3\%\) of cases and chat+math stacks in \(97\%\) of cases despite zero medical data in those stacks, leading the paper to argue that the learned stacks encode transferable cognitive primitives such as instruction-following clarity, numerical reasoning, procedural logic, and chain-of-thought structure. A boundary RL experiment also exposes fragility: per-domain GRPO on code causes catastrophic spikes to \(\sim 28\) million loss, corrupting that stack and all downstream stacks, which motivates completing SFT stacking before any RL.

## 5. Brainstack as ZenBrain’s layered memory architecture

ZenBrain uses “Brainstack” to denote a seven-layer memory architecture for autonomous AI systems [2604.23878]. The layers are **Working**, **Short-Term**, **Episodic**, **Semantic**, **Procedural**, **Core**, and **Cross-Context** memory. Working Memory holds up to \(\sim 7\) items at millisecond–second latency; Short-Term retains the current session’s context over minutes–hours; Episodic stores timestamped events; Semantic abstracts facts and relationships into a knowledge graph; Procedural stores skills and routines; Core pins identity and preference facts that never decay; Cross-Context performs privacy-aware entity resolution and selective transfer between isolated domains. A MemoryCoordinator orchestrates five operations across these layers: store, recall, consolidate, decay, and review.

The architecture is governed by nine foundational neuroscience algorithms. The Two-Factor Synaptic Model attaches to each knowledge-graph edge a weight \(w_{ij}\) and variance \(\sigma^2_{ij}\), with importance \(I_{ij}=1/\sigma^2_{ij}\), and updates them by
$$
w_{ij}\leftarrow w_{ij}+\eta\,t_{ij}a_{ij},\qquad
\sigma^2_{ij}\leftarrow \sigma^2_{ij}(1-\beta\,n(k)),\qquad
n(k)=\frac{1}{1+0.1\,k}.
$$
This yields an EWC-style penalty \(\tfrac{\lambda}{2}\sum I_{ij}\Delta w_{ij}^2\) that protects mature edges. Other foundational mechanisms include the Ebbinghaus forgetting curve \(R(t)=\exp(-t/S)\), vmPFC-coupled FSRS for review scheduling under context shift, a Simulation-Selection sleep loop that scores replay candidates by
$$
\mathrm{TAG}(e)=0.4\,|\delta_{TD}|+0.35\,R_e+0.25\,N_e,
$$
Bayesian confidence propagation, emotional arousal tagging, similarity clustering, context-retrieval that fuses BM25 and dense embeddings with per-layer boosts, and visualization indexing.

ZenBrain further adds six Predictive Memory Architecture components. The NeuromodulatorEngine maintains DA, NE, 5HT, and ACh with tonic baselines, phasic bursts, DA–5HT opposition of \(-0.3\), and decay factor \(0.95\). ReconsolidationEngine makes retrieved memories labile and gates update modes by effective prediction error. TripleCopyMemory stores each event in three copies with divergent decay:
$$
S_f(t)=S_0e^{-t/\tau_f},\ \tau_f=4\mathrm{h};\qquad
S_m(t)=0.8S_0e^{-t/\tau_m},\ \tau_m=14\mathrm{d};\qquad
S_d(t)=S_0\ln\!\left(1+\frac{t}{\tau_d}\right),\ \tau_d=7\mathrm{d},
$$
with composite strength \(S(t)=\max\{S_f,S_m,S_d\}\). PriorityMap computes
$$
P=w_s s+w_e|v|+w_r r+w_g g,
$$
and imposes an amygdala fast-path \( |v|>0.6 \Rightarrow P\ge 0.5\). StabilityProtector uses lock score \(L\) and rigidity \(\rho\) to gate overwrites, permitting updates only if
$$
\mathrm{PE}\ge 0.5+0.3\,L\,\rho.
$$
MetacognitiveMonitor tracks confirmation, recency, and retrieval biases and opens 10-minute novelty windows after high-PE events above \(0.7\).

The empirical case for this Brainstack is explicitly comparative. Layered routing improves LoCoMo by \(+20.7\%\) F1 over a flat single-layer baseline with \(p<0.005\), including \(+41\%\) temporal F1, and improves MemoryArena by \(+19.5\%\) F1 with \(p=0.015\), including \(+53.5\%\) on dependency-chain questions. Simulation-Selection sleep yields a \(37\%\) stability improvement with \(p<0.005\) while reducing storage by \(47.4\%\). TripleCopyMemory retains \(S(30\,\mathrm d)=0.912\), and PriorityMap achieves \(\mathrm{NDCG}@10=0.997\) versus chronological \(0.680\). The 15-algorithm ablation shows a cooperative survival network: under challenging conditions, seven algorithms become individually critical, including vmPFC-FSRS removal \(\Delta Q=-93.1\%\), TripleCopy \(\Delta Q=-54.2\%\), Dual-Process CoT \(\Delta Q=-38.5\%\), Two-Factor \(\Delta Q=-34.4\%\), IB Budget \(\Delta Q=-25.5\%\), Sleep \(\Delta Q=-91.1\%\), and Neuromodulator \(\Delta Q=-34.8\%\); under extreme stress, nine become critical, including StabilityProtector \(\Delta Q=-5.8\%\) and Reconsolidation \(\Delta Q=-3.4\%\). Removing all six PMA components collapses retention to floor by day 30, whereas the full system retains \(31.1\%\), a \(31.1\times\) advantage with \(p=0.005\).

At benchmark scale, ZenBrain also reports the highest mean rank on all 12 system-judge cells of LongMemEval-500, with three-judge mean \(J=0.545\) versus letta \(=0.485\), a-mem \(=0.414\), and mem0 \(=0.394\); all 9 pair-wise contrasts clear Bonferroni. Under the binary judge, it reaches \(91.3\%\) of oracle accuracy at \(1/106\)th the per-query token budget. In this usage, Brainstack names a memory hierarchy whose defining operations are consolidation, forgetting, reconsolidation, and bias-aware control rather than parameter-efficient adaptation or neuromorphic device composition.

## 6. Comparative interpretation, non-equivalence, and research significance

Across these works, the term identifies four different stack formalisms: a push/pop structure over assemblies, a full neuromorphic technology stack, a family of additive frozen adapter stacks for continual LLM tuning, and a seven-layer memory hierarchy for autonomous agents [2112.08186] [1406.5633] [2604.01152] [2604.23878]. The label is therefore descriptive rather than taxonomic.

Three recurring design motifs nevertheless appear. First, all four systems make **selective routing** central: disinhibition of fibers and strong projection in Assembly Calculus, explicit A/B/y addressing plus sparse spike activation in kT-RAM, outcome-based sigmoid gating in the LLM architecture, and MemoryCoordinator plus per-layer retrieval boosts in ZenBrain. Second, each system confronts a **plasticity–stability trade-off**: chain-recovery failures beyond \(s\approx 20\) in the Assembly Calculus Brainstack, weight perturbation on every read in kT-RAM, catastrophic ungated stack accumulation and RL-induced corruption in continual LLM Brainstacks, and overwrite protection versus reconsolidation in ZenBrain. Third, each uses some mechanism to make composition productive rather than destructive: Hebbian strengthening of assembly chains, AHaH self-regulation with anti-Hebbian/Hebbian cycles, null-space projection with routed stack loading, or sleep, PriorityMap, and StabilityProtector.

The non-equivalences are as important as the commonalities. “Zero forgetting” in the continual LLM work is qualified by routing conditions and by the distinction between weight drift and interference from ungated magnitude accumulation. The Assembly Calculus Brainstack is not an LLM adapter stack and does not aim at domain composition. Thermodynamic-RAM Brainstacks are implementation layers, not cognitive modules. ZenBrain’s Brainstack is a memory architecture whose empirical gains come from multi-layer routing, replay, and reconsolidation rather than from freezing additive parameter deltas. A plausible implication is that “Brainstack” has become a productive descriptor for systems that separate transient and persistent structure across levels, but the research content lies in the specific mechanisms—assemblies, memristors, MoE-LoRA routers, or layered memory stores—not in the label alone.

Source: https://www.emergentmind.com/topics/brainstacks