Files
ailed-docs-rp/AGENTS.md
T
chrnx 77fed7d631 docs: two rules earned by Task 10
Eight seeds reported the wrong sign in Task 10 and flipped only at sixteen, so the seed
rule now says eight does not reliably support a direction and asks for a paired standard
error. And a null needs a positive control, or it cannot be told apart from an instrument
that sees nothing.
2026-09-02 14:41:51 -05:00

132 lines
7.7 KiB
Markdown

# AILED — working notes for agents
Read this before touching anything. The authoritative design is
`AILED_General_Specification.md`; this file says what the project is *for* and which
mistakes cost the most here.
## What this project is
AILED is a relational-affective organism: a unit that perceives a **set of entities and
the relations between them** rather than a flat vector, carries **per-entity memory**, and
modulates both with an internal affective state derived from its own error stream.
Three pieces, all defined in the spec:
- **RP (Relational Perceptron)** — message passing over entity pairs. The weights are not
constants; they are generated by a CPPN from the relation itself, so the kernel is a
function of geometry rather than a lookup. Spec §3–§4.
- **GRP (Gated Relational Perceptron)** — the RP plus true per-entity recurrence: a memory
vector `M_i` per entity, a candidate transform, and a gate deciding how much of the past
to keep. Spec §4.
- **ψ = (valence, arousal)** — two axes computed from two-speed EMA baselines of the loss.
Arousal is relative surprise; valence is learning progress. Arousal biases the memory
gate; both feed the CPPN as context. Spec §5.
The paper's claims are **A1, affect-gated adaptation** (arousal opens the gate after an
unannounced regime change) and **A2, affective topology** (the CPPN kernel depends on ψ).
## The framing that matters most
**This is not a performance benchmark.** The question is whether relational structure and
per-entity memory let an organism *come to understand a domain* — its entities, their
relations, and when those relations change. It is not whether some configuration reaches a
lower number.
Three consequences, each of which has already bitten this project once:
1. **The gain is knowledge, not performance.** Experiments here exist to establish what is
missing, not to make a mechanism work. Optimising the GRP is a grave error, not a goal.
The operational test: **is the negative result as informative as the positive one?** An
experiment that only makes sense if it comes out positive is a performance experiment
wearing a diagnostic costume. Write every verdict so both branches carry equal weight,
and describe no outcome as good or bad news.
2. **RP vs GRP is the comparison.** They are two forms of the same unit and the question
between them is what memory buys in *understanding*, not in error. Do **not** introduce
a standard MLP or perceptron baseline — that measures mechanical performance and is not
commensurable with what is being claimed here.
3. **Do not tune a baseline until it catches up.** In Task 7 the memory advantage measured
2.99x at `lr=1e-3` and 1.06x at `lr=1e-2`. The tempting move — raise the learning rate
so the comparison is "fair" — changes the question instead of answering it. What that
ablation actually tells you is about the *domain*: relational particles do not
distinguish state from fast weights on mean error. When a metric cannot tell your
mechanism apart from a cheaper one, change the metric, not the baseline.
## Rules that keep the results honest
These are not style preferences. Each one exists because violating it produced a wrong
result in this project or its predecessor.
- **Measure the ceiling before building the mechanism.** Every mechanism ships with an
oracle — a condition that is *given* the information the mechanism is supposed to infer.
If the oracle does not beat the baseline, the mechanism has no job in that setup and no
amount of tuning will give it one. Four nulls in the previous project came from setups
that left the mechanism nothing to do.
- **A null recorded early beats a claim propped up later.** Report negatives plainly. Do
not soften them, and do not go looking for a configuration that rescues a positive.
- **ψ never carries gradient.** It is built from `loss.item()`. `affect.py` imports no
torch and holds no tensors. If gradient flowed through ψ it would silently become a
learned latent and there would be no oracle for what it means.
- **Oracles are opt-in and free.** Turning an oracle on may only add columns to `attrs`.
The trajectory, regime schedule, switch times and noise draws must stay byte-identical to
the non-oracle run at the same seed. Otherwise a measured difference could come from a
different world rather than from the extra information.
- **`kappa = 0` is a single flag** that disables affect on the gate and changes nothing
else. It is the control A1 is measured against.
- **Affect axes are read by name.** `Organism.forward` is the one sanctioned place a
`(valence, arousal)` tuple is unpacked positionally.
- **A test that cannot fail is worse than no test.** Twice now, a full suite passed against
a deliberately broken implementation. When a test defends a central property, break the
property on purpose and confirm the test fails. Say in your report that you did.
- **Seeds.** Across-seed spread here is comparable to the effects being claimed, and it is
worse than that: in Task 10 eight seeds reported the **wrong sign** (+0.010 favouring one
arm on 5/8, flipping to -0.003 at sixteen). Eight seeds does not reliably support a
direction, let alone a ratio. Report per-seed values, the count of seeds won, and a paired
standard error — and if the effect sits inside one se of zero, say so instead of reading
its sign.
## Layout
```
ia-stuff/ git: ailed-docs-rp — design docs, this file, and .sdd/
├── ailed/ git: ailed-rp — the library, src/ailed/{affect,core}.py
├── experiments/ git: ailed-experiments-rp — the domain and the runs
└── paper/ git: ailed-paper-rp — the manuscript
```
Four sibling repositories under `Ailed-AI`. The three subdirectories are git-ignored by the
root repo, so nothing is nested and each stays independent. Commit inside the repo you
touched. `experiments` installs `ailed` from `../ailed`, so the **directory** names matter
even though the repo names differ.
- `ailed/src/ailed/affect.py` — spec §5. Pure functions over floats, no torch.
- `ailed/src/ailed/core.py` — spec §3–§4. `AffectiveCPPN`, `RelationalPerceptron`,
`GatedRelationalPerceptron`, `Organism`, `detach_memory`.
- `experiments/particles.py` — spec §7. The domain: particles on a torus whose type-by-type
coupling matrix switches without announcement.
- `experiments/regime.py` — spec §8. The eight conditions, the training loop, the metrics.
- `experiments/ceilings.py` — least-squares information ceilings for the domain.
- `experiments/results/*.md` — the audit trail the paper's setup section cites. These are
committed; the `.json` files are not.
## Documents
`AILED_General_Specification.md` is authoritative. The nine older module specs
(`RP_Deep_Dive.md`, `GRP_Deep_Dive.md`, `Psyche_Calculator_Specification.md`, and the rest)
are **superseded** and each carries a banner pointing at the section that replaces it —
they are chess-bound and several contain code with real bugs. Read them for intent, never
for implementation. `AILED_Organism_Specification.md` is the exception: it describes the
chess instance and is still valid as such.
`AILED_Implementation_Plan.md` is the task breakdown. `.sdd/progress.md` is the execution
ledger: what was done, every ruling taken and what it costs if wrong.
## Conventions
- Python ≥3.11, `uv`, PyTorch, pytest. Run tests with `uv run pytest -q` from inside the
repo you changed.
- Autograd only. No hand-written backward passes.
- CPU, small models, short runs. A 2000-step run takes about a second — spend the budget on
more seeds, not longer runs.
- Prior art worth knowing: the chess ψ and the EQ signal chain exist at
`github.com/chrnx-dev/ailed-chess`. Take ideas, not code. This paper is a blank slate.