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.
90 lines
5.7 KiB
Markdown
90 lines
5.7 KiB
Markdown
# Task 5 report: relational particles domain
|
|
|
|
## Fix round 1 (2026-09-02)
|
|
|
|
Team-lead flagged: `step()` wraps coords with `% 1.0` but returns the raw `delta` as
|
|
`Observation.target`, which only equals the wrapped coordinate difference while
|
|
`|delta| < 0.5`. Measured margin was fine for the default config (max 0.0591 over
|
|
8 seeds x 1500 steps) but a config with larger `n`/`dt`/`sigma` (e.g. `n=64, dt=0.2,
|
|
sigma=0.5`) blew past it (max 1.6612) — reachable by an ordinary config change.
|
|
|
|
Ruling from the team lead: assert, don't wrap — a step that moves a particle more
|
|
than half the torus is a physically meaningless simulation, not a target-encoding
|
|
bug, and should fail loudly.
|
|
|
|
Changes in `experiments/particles.py`:
|
|
- `step()`: added `assert delta.abs().max() < 0.5, "per-step displacement exceeds half the torus"` right after `delta` is computed, with a comment explaining the bound and why it's not silently wrapped.
|
|
- `Observation.target` comment corrected — it's the raw per-step displacement, equal to the wrapped coordinate delta only because the assert enforces the bound.
|
|
|
|
Changes in `experiments/tests/test_particles.py`:
|
|
- Added `test_target_matches_wrapped_coordinate_update`: rolls `ParticleConfig(seed=11)` for 300 steps and asserts, at every step, that the previous observation's `target` equals `d - torch.floor(d + 0.5)` where `d = cur.coords - prev.coords` — pins the invariant the assert protects.
|
|
|
|
No signature, default, dynamics, or RNG stream changes — oracle byte-identity and determinism tests still pass unchanged.
|
|
|
|
Test output:
|
|
|
|
```
|
|
$ uv run pytest -q
|
|
........... [100%]
|
|
11 passed in 0.43s
|
|
```
|
|
|
|
Commit: `7cdb4bc5bd2d5badb3104e98719cce14d9e2f665` — "fix: guard target/coords wrap invariant with an explicit assert (spec §7)"
|
|
|
|
No concerns.
|
|
|
|
|
|
## What was written
|
|
|
|
- `experiments/particles.py` — `wrapped_diff`, `ParticleConfig`, `Observation`, `ParticleWorld` (`.step()`, `.attr_dim`), implemented verbatim from the brief (Step 3).
|
|
- `experiments/tests/test_particles.py` — the 9 tests from the brief (Step 1), copied verbatim.
|
|
|
|
Implementation matches the brief's Step 3 code exactly; no deviations were needed. I read through the dynamics before committing to check the three properties called out as critical:
|
|
|
|
- **Oracle freedom**: every `np.random.Generator` / `torch.Generator` draw in `__init__` and `step()` (regime bank generation, particle types, initial coords, initial regime, switch-interval draws, regime-choice draws, per-step noise) is unconditional on `cfg.oracle`. The `oracle` value is read only inside `attr_dim` and `_attrs`, which only append columns — never consume randomness or touch `coords`/`regime`/`until`. `test_oracles_do_not_change_the_world` (200-step rollout, seed=1, both oracle modes) confirms this holds.
|
|
- **Determinism**: `ParticleWorld` owns a fresh `np.random.default_rng(cfg.seed)` and `torch.Generator().manual_seed(cfg.seed)` per instance; no global `torch.manual_seed`/`np.random.seed` calls anywhere. `test_same_seed_same_trajectory` confirms two independently constructed worlds with the same seed produce bit-identical `coords`/`target` over 50 steps.
|
|
- **Translation invariance**: `_attrs` only ever concatenates the type one-hot plus (optionally) the change-flag or regime one-hot; `coords` is returned separately on `Observation` and never folded into `attrs`. The model only sees position via `wrapped_diff(obs.coords)` per Task 6's contract.
|
|
|
|
## Test output
|
|
|
|
```
|
|
$ cd experiments && uv run pytest tests/test_particles.py -v
|
|
============================= test session starts ==============================
|
|
platform darwin -- Python 3.12.13, pytest-9.1.1, pluggy-1.6.0 -- .../experiments/.venv/bin/python
|
|
rootdir: /Users/chrnx/workspace/chrnx-dev/ia-stuff/experiments
|
|
configfile: pyproject.toml
|
|
collecting ... collected 9 items
|
|
|
|
tests/test_particles.py::test_wrapped_diff_range_and_antisymmetry PASSED [ 11%]
|
|
tests/test_particles.py::test_same_seed_same_trajectory PASSED [ 22%]
|
|
tests/test_particles.py::test_oracles_do_not_change_the_world PASSED [ 33%]
|
|
tests/test_particles.py::test_attr_width_per_oracle PASSED [ 44%]
|
|
tests/test_particles.py::test_change_flag_only_on_switch_steps PASSED [ 55%]
|
|
tests/test_particles.py::test_regime_onehot_matches_regime PASSED [ 66%]
|
|
tests/test_particles.py::test_switches_happen_within_bounds_and_change_regime PASSED [ 77%]
|
|
tests/test_particles.py::test_target_is_next_delta PASSED [ 88%]
|
|
tests/test_particles.py::test_zero_regime_and_no_noise_is_static PASSED [100%]
|
|
|
|
============================== 9 passed in 0.42s ===============================
|
|
```
|
|
|
|
Full suite (including the pre-existing `tests/test_smoke.py`):
|
|
|
|
```
|
|
$ uv run pytest -q
|
|
.......... [100%]
|
|
10 passed in 1.54s
|
|
```
|
|
|
|
No failures at any point — did not need the `until`-bookkeeping fallback the brief mentioned for `test_switches_happen_within_bounds_and_change_regime`.
|
|
|
|
## Commit
|
|
|
|
`ce04abefa163946b741ad1de0e1795d03fcb44c1` — "feat: relational particles world with regime switches and opt-in oracles (spec §7)"
|
|
|
|
Used this session's attribution trailer (Claude Sonnet 5 / session_01NsYGmXP6NAparrarnZJaE1) rather than the brief's Step 5 trailer, per instructions that the controller normalizes trailers at task close.
|
|
|
|
## Notes on the brief
|
|
|
|
Nothing struck me as wrong or ambiguous — the Step 3 code, the test file, and the Task 6 consumption contract (`ParticleConfig(seed=..., oracle=...)`, `world.attr_dim`, `world.step()`, `obs.attrs/coords/ids/target/switched/regime`, `wrapped_diff(obs.coords)`) all matched exactly with no gaps to fill in. No changes were made to the brief's reference implementation.
|