docs: design, plan, and the execution record
The thinking behind the organism, versioned alongside the three code repos rather than living only on one machine. - AILED_General_Specification.md, the authoritative design, and the implementation plan the code was built from - AGENTS.md, the project-wide rules, including the two that were learned the hard way: this is not a performance benchmark, and a null recorded early beats a claim propped up later - the nine superseded module specs, each carrying a banner naming what replaced it - .sdd/, the execution ledger and every task brief and report: each ruling taken, what it would cost if wrong, every correction, and every number verified independently The three code repos are siblings, each its own repository, and are git-ignored here so nothing is nested.
This commit is contained in:
commit
5da4b8efa5
47 files changed
+7498
No files matched your search
@@ -0,0 +1,188 @@
|
||||
# AILED General Specification: Domain-Free Relational-Affective Organism
|
||||
## Design Spec for the Second Paper (supersedes the chess-bound module specs)
|
||||
|
||||
**Status:** Design approved in discussion, 2026-09-01. Not yet implemented.
|
||||
**Scope:** The general formulation of the organism. Chess is one instance and is *not* covered here.
|
||||
**Supersedes:** the per-module specs listed in §10, each of which now carries a pointer to the section that replaces it.
|
||||
|
||||
---
|
||||
|
||||
## 1. What this document fixes
|
||||
|
||||
The module specs define mechanisms. None of them defines the instrument that says whether a mechanism did anything, and every one of them defines $\psi$ as five hand-weighted chess features. This spec fixes six decisions, in the order they were taken:
|
||||
|
||||
| Decision | Choice |
|
||||
| :--- | :--- |
|
||||
| What $\psi$ is | Two axes derived from the organism's own error stream: **valence** and **arousal**. Extensible to $n$ axes. |
|
||||
| What the organism does | Two contracts, same core: **A** predicts a per-entity target; **B** chooses an action under a reward. C (both) is deferred. |
|
||||
| What a relation is | Difference of designated coordinate attributes, all-to-all, with an optional discrete edge type and mask. |
|
||||
| What the RP outputs | One vector per entity (message passing), with readouts on top. |
|
||||
| What the GRP memory is | True per-entity recurrence with a candidate transform. $\psi$ biases the gate additively. |
|
||||
| How it learns | End-to-end gradient, differentiable CPPN. Evolution and Hebbian plasticity are future work with an oracle each. |
|
||||
|
||||
The first paper's claim is **A1: affect-gated adaptation** (arousal opens the memory gate after an unannounced regime change) with **A2: affective topology** (the CPPN kernel depends on $\psi$) as the secondary claim. Both are measured against oracles on one synthetic domain (§7).
|
||||
|
||||
---
|
||||
|
||||
## 2. Domain contract
|
||||
|
||||
A domain is a stream of relational states plus a declaration of what the organism owes back.
|
||||
|
||||
**State stream.** $G_t = \{(\text{id}_i, \mathbf{p}_i)\}_{i \in \mathcal{A}_t}$ where:
|
||||
- $\text{id}_i$ is stable across steps. Chess: the piece, not the square. A message stream: the author. Without a stable id there is no per-entity memory to follow.
|
||||
- $\mathbf{p}_i \in \mathbb{R}^d$ are the entity's attributes.
|
||||
- The domain marks which $k$ attributes are **coordinates** $\mathbf{c}_i \in \mathbb{R}^k$, and supplies a difference function `coord_diff(c_j, c_i)` (identity for flat spaces, wrapped for a torus).
|
||||
- $\mathcal{A}_t$, the live set, may change between steps. $|\mathcal{A}_t| \le N_{\max}$, a domain parameter. Streams window themselves to fit.
|
||||
|
||||
**Optional inputs.** Edge type $e_{ij} \in \{0, \dots, E-1\}$ (default $0$); adjacency mask $\mathbf{A} \in \{0,1\}^{N \times N}$ (default all ones); scalar reward $r_t$ (default absent).
|
||||
|
||||
**Contract A, predictive.** The domain supplies a per-entity target $\mathbf{y}_{i,t}$. Default: $\mathbf{y}_{i,t} = \mathbf{p}_{i,t+1} - \mathbf{p}_{i,t}$. Loss is MSE.
|
||||
|
||||
**Contract B, acting.** The domain supplies a legal action set per step and a reward $r_t$. Loss is the policy objective. Not exercised in this paper; the readout is defined in §4 so nothing here has to change to add it.
|
||||
|
||||
---
|
||||
|
||||
## 3. Relations and the affective CPPN
|
||||
|
||||
**Relation.** For every ordered pair including $j = i$:
|
||||
$$\mathbf{r}_{ij} = \text{coord\_diff}(\mathbf{c}_j, \mathbf{c}_i) \in \mathbb{R}^k$$
|
||||
Chess is the exact instance with $\mathbf{c} = (\text{file}, \text{rank})$. A molecule: $xyz$. A message stream: $(\text{time}, \text{author})$, so $\mathbf{r}_{ij} = (\Delta t, \text{same author or not})$.
|
||||
|
||||
**Affective CPPN.** A differentiable kernel from relation and affect to a per-channel weight:
|
||||
$$\mathbf{z}_{ij} = [\mathbf{r}_{ij} \parallel \text{onehot}(e_{ij}) \parallel \boldsymbol{\psi}_t]$$
|
||||
$$\mathbf{m}_{ij} = \mathbf{W}_2 \sin(\mathbf{W}_1 \mathbf{z}_{ij} + \mathbf{b}_1) \in \mathbb{R}^D$$
|
||||
|
||||
Two things this fixes relative to `CPPN_Affective_Specification.md` and `RP_Deep_Dive.md`:
|
||||
- The output is a **vector**, one weight per feature channel. The demo code collapsed it to a scalar, which made feature channels indistinguishable.
|
||||
- $\psi$ is an **input**, so the kernel's shape depends on affect. The demo multiplied all weights by $1 + \psi/100$, which is a gain and cannot change *which* relation matters. Connectivity $= f(\psi)$ is delivered by this input, not by evolving the CPPN.
|
||||
|
||||
The kernel is translation-invariant by construction because it only sees differences. This is the inductive bias `AILED_Theoretical_Foundations.md` §3.1 claims.
|
||||
|
||||
---
|
||||
|
||||
## 4. The Relational Perceptron and the Gated Relational Perceptron
|
||||
|
||||
**RP, one layer, one vector per entity.**
|
||||
$$\mathbf{h}_i = \tanh\left( \frac{1}{|\mathcal{N}_i|} \sum_{j \in \mathcal{N}_i} \mathbf{m}_{ij} \odot (\mathbf{W}_{\text{feat}} \mathbf{p}_j) + \mathbf{b} \right) \in \mathbb{R}^D$$
|
||||
where $\mathcal{N}_i = \{ j : \mathbf{A}_{ij} = 1 \}$. Mean aggregation keeps scale independent of $N$. The scalar-per-graph output of the old demo is this with a pooling readout; nothing is lost.
|
||||
|
||||
**GRP, per-entity state.** `GRP_Deep_Dive.md` takes $\mathbf{M}_{t-1}$ from outside and never stores $\mathbf{z}_t$, so it has no recurrence. It also has no candidate transform: $\mathbf{z} = (1-\mathbf{g})\mathbf{x} + \mathbf{g}\mathbf{M}$ can only average past inputs, and a regime is not visible in one $G_t$, only in the difference between steps. The memory has to compute, not just retain.
|
||||
$$\mathbf{g}_i = \sigma\left( \mathbf{W}_g [\mathbf{h}_i \parallel \mathbf{M}_i] + \mathbf{b}_g - \kappa \, a_t \right) \qquad \kappa \ge 0$$
|
||||
$$\tilde{\mathbf{M}}_i = \tanh\left( \mathbf{W}_c [\mathbf{h}_i \parallel \mathbf{M}_i] + \mathbf{b}_c \right)$$
|
||||
$$\mathbf{M}_i \leftarrow (1 - \mathbf{g}_i) \odot \tilde{\mathbf{M}}_i + \mathbf{g}_i \odot \mathbf{M}_i$$
|
||||
|
||||
$\mathbf{g} \to 1$ keeps, $\mathbf{g} \to 0$ overwrites. High arousal $a_t$ pushes toward overwriting. The bias is additive on the pre-activation so affect can move the gate in both directions; the old code multiplied the gate by a factor in $[0,1]$ and could only ever lower it. $\kappa = 0$ is the "gate without affect" ablation and must be a single flag.
|
||||
|
||||
**Entity lifecycle.** New id: $\mathbf{M}_i = \mathbf{0}$. Id that leaves $\mathcal{A}_t$: state discarded. Reversible demotion instead of discard is future work (§9), marked, not designed.
|
||||
|
||||
**Readouts.**
|
||||
- Contract A: $\hat{\mathbf{y}}_i = \mathbf{W}_{\text{out}} \mathbf{M}_i$ (residual on $\mathbf{p}_i$ is the domain's default target).
|
||||
- Contract B: per-entity logits $\mathbf{W}_{\text{act}} \mathbf{M}_i$, or per-pair $\mathbf{W}_{\text{act}} [\mathbf{M}_i \parallel \mathbf{M}_j]$, mean-pooled when the action is global. Then the EQ signal chain from `ailed-chess` (`eq_curve.py`, `move_selector.py`) with its anchors interpolated on **valence** and softmax temperature driven by **arousal**.
|
||||
|
||||
---
|
||||
|
||||
## 5. Affect
|
||||
|
||||
$\boldsymbol{\psi}_t = (v_t, a_t)$, valence $v \in [-1, 1]$ and arousal $a \in [0, 1]$. Natural units, not $\pm 100$. Consumers read axes **by name**; adding an axis is adding a row.
|
||||
|
||||
$\psi$ is computed under `detach`. It is a modulator, not a learned latent. If gradient flowed through it, the "learned scalar head" option rejected in design would return by the back door, and there would be no oracle for what it means.
|
||||
|
||||
Two error baselines at two speeds, the standard novelty detector, with $L_t$ the step loss:
|
||||
$$\bar{L}^{f} \leftarrow (1 - \rho_f)\bar{L}^{f} + \rho_f L_t \qquad \bar{L}^{s} \leftarrow (1 - \rho_s)\bar{L}^{s} + \rho_s L_t \qquad \rho_s < \rho_f$$
|
||||
$$a^{\star} = \tanh\left( \frac{\max(0, L_t - \bar{L}^{s})}{\bar{L}^{s} + \epsilon} \right) \qquad \text{relative surprise}$$
|
||||
$$v^{\star} = \tanh\left( \frac{\bar{L}^{s} - \bar{L}^{f}}{\bar{L}^{s} + \epsilon} + \frac{r_t}{s_r} \right) \qquad \text{learning progress, plus reward when present}$$
|
||||
$$a \leftarrow a + (a^{\star} - a)\rho_a \qquad v \leftarrow v + (v^{\star} - v)\rho_v$$
|
||||
|
||||
Both baselines initialise to the first observed loss, so step one is not a surprise. In a stable regime $a \approx 0$; an error jump spikes it and it decays on its own. Positive valence means "I am getting better at this". Between episodes $\boldsymbol{\psi} \leftarrow (1 - \delta)\boldsymbol{\psi}$, the daily decay of `ailed-chess`. The update is a pure function: $\psi$ in, $\psi$ out.
|
||||
|
||||
**Why two axes.** The chess $\psi$ measures *level* of advantage; surprise measures *error against expectation*. The module specs use one $\psi$ for two jobs that need these separately: the gate ("trust memory or present?") needs surprise, the fear factor $\alpha$ ("survive or attack?") needs valence. One scalar cannot express "winning, but the opponent just did something strange", where the gate should open and $\alpha$ should stay low.
|
||||
|
||||
**What the chess repo taught.** Target-blend with $\tanh$ on the target, statelessness, and decay toward neutral survive. Sacrifice dampening and check penalty do not survive as code, but they are the argument for surprise: a sacrifice is a loss the model *expected*, so its prediction error is zero and the dampening comes free. Phase factors and resilience were three multipliers on one reactivity; here reactivity is fixed and the two-speed baselines do the adaptive part.
|
||||
|
||||
---
|
||||
|
||||
## 6. What $\psi$ modulates
|
||||
|
||||
Each peripheral module of the organism reduces to one modulation target.
|
||||
|
||||
| Module spec | General form | Axis | This paper |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| Memory gate | $-\kappa a$ bias on the GRP gate (§4) | arousal | **built** |
|
||||
| Affective CPPN | $\psi$ as kernel input (§3) | both | **built** |
|
||||
| Instinct / Reflexes, policy side | EQ chain on logits, anchors on $v$, temperature on $a$ | both | contract B only, defined |
|
||||
| Metabolism | $\lambda(v) \, \|\mathbf{h}\|^2$ added to the loss, $\lambda$ larger at low valence | valence | defined, not built |
|
||||
| Reflexes S1/S2, compute side | second RP pass when $a > \theta$ | arousal | defined, not built |
|
||||
|
||||
The last two ship with their equation and a pending oracle (§8) and no code. They get built when an experiment shows they are missing.
|
||||
|
||||
---
|
||||
|
||||
## 7. Domain: relational particles with regimes
|
||||
|
||||
The smallest domain in which every part of the organism has a job: the CPPN learns the interaction law as a kernel over $\mathbf{r}$, the memory retains which regime is running, arousal detects that it changed.
|
||||
|
||||
- $N$ particles on a torus $[0,1)^2$. Coordinates $\mathbf{c}_i = (x, y)$, $k = 2$, wrapped difference. Attributes $\mathbf{p}_i = \text{onehot}(\text{type})$, three types, $d = 3$. The coordinates are deliberately *not* repeated inside $\mathbf{p}_i$: the target depends only on relations, so the whole model stays translation-invariant and the domain does not hand the RP a nuisance input to learn to ignore.
|
||||
- Dynamics: $\Delta \mathbf{x}_i = dt \sum_{j \ne i} K[\text{type}_i, \text{type}_j] \, \mathbf{r}_{ij} \exp(-\|\mathbf{r}_{ij}\|^2 / \sigma^2) + \boldsymbol{\eta}$, with $\boldsymbol{\eta}$ Gaussian noise.
|
||||
- A regime is $K \in \{-1, 0, 1\}^{3 \times 3}$. A pool of four regimes; the active one switches without announcement every $T$ steps, $T$ uniform in a range.
|
||||
- Contract A target: $\Delta \mathbf{x}_i(t+1)$. Loss: MSE. The noise variance is the error floor.
|
||||
|
||||
**Oracles.** Opt-in, and the non-oracle path must be byte-identical to the path before the oracle existed, asserted in the self-check.
|
||||
- *Change flag*: one bit appended to $\mathbf{p}_i$ on the switch step. Ceiling for arousal.
|
||||
- *Regime id*: onehot of $K$ appended to $\mathbf{p}_i$. Ceiling for memory. Must drive error to the noise floor; if it does not, the oracle is not being read.
|
||||
- *Control that cannot show an effect*: change flag on the memory-free model. If it moves a number, something else is leaking.
|
||||
|
||||
---
|
||||
|
||||
## 8. Experiments
|
||||
|
||||
**A1, affect-gated adaptation.** Five conditions, same seeds, same particles:
|
||||
|
||||
| # | Condition | What it isolates |
|
||||
| :--- | :--- | :--- |
|
||||
| 1 | RP only, no memory | the observation alone |
|
||||
| 2 | GRP, $\kappa = 0$ | learned gate without affect |
|
||||
| 3 | GRP, $\kappa > 0$ | affect-biased gate |
|
||||
| 4 | GRP, $\kappa = 0$, change flag as input | arousal ceiling: the flag replaces affect |
|
||||
| 5 | GRP, $\kappa = 0$, regime id as input | memory ceiling: nothing left to infer |
|
||||
|
||||
Metrics: error curve in the $W$ steps after each switch (recovery), and steady-state error away from switches. **A1 holds** if condition 3 beats 2 on recovery and approaches 4. If 4 does not beat 2, the setup gave arousal no job and nothing about the mechanism has been tested.
|
||||
|
||||
**A2, affective topology.** On the best condition of A1: CPPN with $\psi$ input vs CPPN without vs CPPN with regime id as input. In code the CPPN takes a generic `context` vector; $\psi$ is its default, zeros is the ablation, and the regime onehot is the oracle. The gate always reads arousal from $\psi$ regardless of `context`. Measures what fraction of the ceiling a two-number affect recovers. The expected effect is smaller than A1's and the paper says so.
|
||||
|
||||
**Protocol rules**, carried over from what went wrong before: measure the ceiling with an oracle before building anything to chase it; every claim is a delta between conditions with identical seeds; a control that cannot show an effect and does is the first thing to investigate.
|
||||
|
||||
---
|
||||
|
||||
## 9. Out of scope, explicitly
|
||||
|
||||
Chess adapter. Contract B experiments. HyperNEAT or any evolution. Hebbian or any online plasticity. Implemented metabolism or S2 compute. Entity budget, demotion, and birth/death policy. Multi-layer RP. More than two affect axes. Each of these is future work and each gets an oracle before it gets a mechanism.
|
||||
|
||||
---
|
||||
|
||||
## 10. Relationship to the module specs
|
||||
|
||||
| Document | Status after this spec |
|
||||
| :--- | :--- |
|
||||
| `RP_Deep_Dive.md` | replaced by §3, §4. Demo code has three silent bugs noted in §3 and §4. |
|
||||
| `GRP_Deep_Dive.md` | replaced by §4. No recurrence and no candidate in the original. |
|
||||
| `CPPN_Affective_Specification.md` | replaced by §3. Vector output, $\psi$ as input. |
|
||||
| `Psyche_Calculator_Specification.md` | replaced by §5. Chess-feature $\psi$ becomes an optional domain adapter feeding valence. |
|
||||
| `Memory_Specification.md` | absorbed into §4. The external EMA is gone; memory lives in the GRP state. |
|
||||
| `Metabolism_Specification.md` | reduced to one row of §6. Not built. |
|
||||
| `Reflexes_and_Instinct_Specification.md` | reduced to two rows of §6. Policy side lives in the `ailed-chess` EQ chain. |
|
||||
| `AILED_Organism_Specification.md` | chess instance of this spec. Unchanged. |
|
||||
| `AILED_Theoretical_Foundations.md` | claims §2.3 (Hebbian) and §4.1 (evolved topology) are future work per §9. |
|
||||
| `AILED_Master_Roadmap.md` | Phase 2 now precedes Phase 1's chess PoC. |
|
||||
|
||||
---
|
||||
|
||||
## 11. Code shape
|
||||
|
||||
PyTorch with autograd; no hand-written backward. Four files, each with a runnable self-check:
|
||||
|
||||
| File | Contents |
|
||||
| :--- | :--- |
|
||||
| `core.py` | `AffectiveCPPN`, `RelationalPerceptron`, `GatedRelationalPerceptron`, `Organism` (contract A readout) |
|
||||
| `affect.py` | the pure $\psi$ update of §5 |
|
||||
| `domains/particles.py` | simulator of §7 with the three oracles behind flags |
|
||||
| `experiments/regime.py` | the five conditions of §8, seeded, one results table |
|
||||
Reference in new issue
Block a user