@reicek/neataptic-ts 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -143
- package/docs/README.md +58 -143
- package/docs/assets/ascii-maze.bundle.js +1 -1
- package/docs/assets/ascii-maze.bundle.js.map +1 -1
- package/docs/examples/asciiMaze/index.html +2 -2
- package/docs/index.html +58 -141
- package/package.json +1 -1
- package/plans/HyperMorphoNEAT.md +525 -751
- package/plans/Memory_Optimization.md +195 -112
- package/plans/ONNX_EXPORT_PLAN.md +7 -9
- package/test/examples/asciiMaze/index.html +2 -2
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
# Memory Optimization Plan (Multi-Layer Strategy for Very Large Networks)
|
|
2
2
|
|
|
3
|
-
Goal: Enable construction, evolution, and training of networks scaling toward **10^6+ (stretch 10^7)** connections on commodity JS/TS runtimes across **Node** and
|
|
4
|
-
|
|
5
|
-
---
|
|
3
|
+
Goal: Enable construction, evolution, and training of networks scaling toward **10^6+ (stretch 10^7)** connections on commodity JS/TS runtimes across **Node** and *_Browser_.
|
|
6
4
|
|
|
7
5
|
## Guiding Principles
|
|
8
|
-
|
|
9
6
|
1. Pay-for-use: No overhead unless feature enabled (flags + lazy allocation).
|
|
10
7
|
2. Reuse & Pool: Prefer object pooling / typed array slabs over many small objects (already partially implemented for `Connection`).
|
|
11
8
|
3. Structural Sparsity First: Keep graphs sparse; optimize dense fast-paths only when needed.
|
|
@@ -14,10 +11,11 @@ Goal: Enable construction, evolution, and training of networks scaling toward **
|
|
|
14
11
|
6. Environment Awareness: Node path may adopt heavier instrumentation & persistent caches; Browser path emphasizes chunking, responsiveness, and quota safety.
|
|
15
12
|
7. Hyper Alignment: Memory layers anticipate Hyper MorphoNEAT phases (indirect generation, morphogenesis churn, phenotype/adjacency caches).
|
|
16
13
|
8. Transparent API: All environment-specific memory optimizations (Node vs Browser, slabs, pooling, precision) remain behind a stable public memory/network API; callers never branch on environment—feature flags + `memoryStats()` abstraction handle differences.
|
|
14
|
+
9. Performance Trade-off Management: Acknowledge that initial memory optimizations (like instrumentation and slab packing) may introduce temporary performance overhead. The plan must track these trade-offs and ensure that subsequent optimizations (e.g., caching, sparsity) deliver a net performance gain at scale.
|
|
17
15
|
|
|
18
|
-
> Build Baseline Update (
|
|
16
|
+
> Build Baseline Update (Q3 2025): TypeScript/webpack target pinned to **ES2023** (previously floating `ESNext`) to ensure reproducible emitted output and educational clarity. Modern features beyond ES2023 may still appear behind feature flags with graceful degradation or transpilation guidance.
|
|
19
17
|
|
|
20
|
-
> Dist-Only Benchmark Pivot (
|
|
18
|
+
> Dist-Only Benchmark Pivot (Q3 2025): The benchmarking infrastructure no longer performs src vs dist variant comparisons. Only the built `dist` bundle metrics are recorded. Historical entries with dual-mode deltas persist in the rolling history until aged out (≤10 snapshots). This reduces noise and maintenance; future re-introduction of a second variant will only occur if a materially different optimized production build (treeshaken/minified) diverges behaviorally or structurally from the reference `dist` artifact.
|
|
21
19
|
|
|
22
20
|
---
|
|
23
21
|
|
|
@@ -39,12 +37,14 @@ Implications: Browser emphasizes **cooperative scheduling, micro-chunk allocatio
|
|
|
39
37
|
|
|
40
38
|
## Target Metrics (Refine After Baseline Measurement)
|
|
41
39
|
|
|
42
|
-
| Metric | Baseline (
|
|
43
|
-
| --------------------------------------------- |
|
|
44
|
-
| Avg bytes / active connection |
|
|
45
|
-
| Peak heap growth per 100k added connections | measure
|
|
46
|
-
| GC pause impact (allocation-heavy evolutions) | measure
|
|
47
|
-
| Phenotype rebuild allocation churn | measure
|
|
40
|
+
| Metric | Baseline (Post-Phase 0) | Target Phase | Goal |
|
|
41
|
+
| --------------------------------------------- | ------------------------ | ------------ | --------------------------------- |
|
|
42
|
+
| Avg bytes / active connection | ~64-69 | 4 | -25% vs baseline (via sparsity) |
|
|
43
|
+
| Peak heap growth per 100k added connections | TBD (measure in Phase 4) | 5 | < 12 MB |
|
|
44
|
+
| GC pause impact (allocation-heavy evolutions) | TBD (measure in Phase 6) | 6 | -30% vs baseline |
|
|
45
|
+
| Phenotype rebuild allocation churn | TBD (measure in Phase 7) | 7 | amortized O(1) per edge via reuse |
|
|
46
|
+
|
|
47
|
+
Note on Bytes/Connection: The baseline of ~64 bytes/connection reflects the overhead of individual JavaScript objects. The slab packing in Phase 3 was designed to change the _memory layout_ to enable future gains but did not reduce the _data payload_ itself, hence the flat metric. The targeted 25% reduction is contingent on **Phase 4 (Sparsity)**, where connections are selectively pruned, directly reducing the average memory cost across the network.
|
|
48
48
|
|
|
49
49
|
### Additional Hyper-Specific Metrics (Introduced Once Hyper Phases Land)
|
|
50
50
|
|
|
@@ -91,6 +91,7 @@ Each phase notes: (C) Common, (N) Node-specific, (B) Browser-specific, (H) Hyper
|
|
|
91
91
|
Purpose: Establish reproducible dist‑only performance & memory baseline plus variance framework to support later optimizations.
|
|
92
92
|
|
|
93
93
|
Key Deliverables:
|
|
94
|
+
|
|
94
95
|
- Dist-only benchmark artifact (JSON): baseline, variantRaw (dist raw), aggregated, variance, history (≤10), meta, fieldAudit, warnings.
|
|
95
96
|
- Deterministic seeding, warm‑up discard, adaptive forward iteration counts, IQR (1.5) outlier filtering.
|
|
96
97
|
- Field audit (enumerable keys) tracking structural slimming impact.
|
|
@@ -101,7 +102,7 @@ Key Deliverables:
|
|
|
101
102
|
Representative Final Baseline (pre-pooling/slab) (dist snapshot – earlier Phase 0 run):
|
|
102
103
|
|
|
103
104
|
| Size | buildMsMean | fwdAvgMsMean | bytesPerConnMean |
|
|
104
|
-
|
|
105
|
+
| ---- | ----------- | ------------ | ---------------- |
|
|
105
106
|
| 1k | ~2 | ~0.4 | 69 |
|
|
106
107
|
| 10k | ~8–12 | ~3–4 | 65 |
|
|
107
108
|
| 50k | ~40–46 | ~4–7 | 65 |
|
|
@@ -109,11 +110,13 @@ Representative Final Baseline (pre-pooling/slab) (dist snapshot – earlier Phas
|
|
|
109
110
|
| 200k | ~149–170 | ~19–26 | 64 |
|
|
110
111
|
|
|
111
112
|
Outcomes:
|
|
113
|
+
|
|
112
114
|
- Plateau bytes/conn ≈64–69 (object overhead dominates; validates need for pooling/slab path).
|
|
113
115
|
- Variance still > target at larger scales → auto escalation deferred to Phase 2.
|
|
114
116
|
- Artifact schema stable; foundation ready for pooling, slab packing and future gating.
|
|
115
117
|
|
|
116
118
|
Carry-Over to Phase 2:
|
|
119
|
+
|
|
117
120
|
- Variance auto escalation (adaptive repeats).
|
|
118
121
|
- Browser parity memory test (defer until CV stabilized).
|
|
119
122
|
- Optional production optimized build (only if a materially different bundle path is introduced).
|
|
@@ -123,11 +126,13 @@ Carry-Over to Phase 2:
|
|
|
123
126
|
Purpose: Reduce per-object overhead & lock in structural introspection before deeper memory model changes.
|
|
124
127
|
|
|
125
128
|
Slimming Actions:
|
|
129
|
+
|
|
126
130
|
- Connection virtualization: neutral gain & gater removed from enumerable set.
|
|
127
131
|
- Bitfield `_flags` (enabled, dropConnect mask, hasGater) reduced Connection enumerable keys to 9 (target maintained).
|
|
128
132
|
- Canonical layout documented (guards hidden class stability & future WASM alignment).
|
|
129
133
|
|
|
130
134
|
Instrumentation Enhancements:
|
|
135
|
+
|
|
131
136
|
- Regression annotation (informational timing deltas).
|
|
132
137
|
- History retention policy (≤10 snapshots) with provenance (dist bundle bytes + sha256 prefix).
|
|
133
138
|
- Variance tracking (CV%) persisted; gating logic deferred until stability.
|
|
@@ -135,19 +140,21 @@ Instrumentation Enhancements:
|
|
|
135
140
|
Final Phase 1 Metrics (dist snapshot):
|
|
136
141
|
| Size | buildMsMean | fwdAvgMsMean | bytesPerConnMean | Samples |
|
|
137
142
|
|------|-------------|--------------|------------------|---------|
|
|
138
|
-
| 1k
|
|
139
|
-
| 10k
|
|
140
|
-
| 50k
|
|
141
|
-
| 100k | 62.89
|
|
142
|
-
| 200k | 149.08
|
|
143
|
+
| 1k | 1.99 | 0.37 | 69 | 1 |
|
|
144
|
+
| 10k | 7.95 | 3.64 | 65 | 1 |
|
|
145
|
+
| 50k | 45.40 | 3.91 | 65 | 1 |
|
|
146
|
+
| 100k | 62.89 | 9.71 | 64 | 7 |
|
|
147
|
+
| 200k | 149.08 | 19.66 | 64 | 7 |
|
|
143
148
|
|
|
144
149
|
Achievements:
|
|
150
|
+
|
|
145
151
|
- Connection enumerable keys ≤9 (goal met).
|
|
146
152
|
- Deterministic reproducibility baseline in place.
|
|
147
153
|
- NodePool skeleton prepared (no network integration yet at end of Phase 1).
|
|
148
154
|
- Bytes/connection stable (pre-slab reference).
|
|
149
155
|
|
|
150
156
|
Deferred / Hand-off to Phase 2:
|
|
157
|
+
|
|
151
158
|
- Variance stabilization (<7% CV at 100k & 200k).
|
|
152
159
|
- Further slimming (node error SoA) scheduled for Phase 3 (slab introduction).
|
|
153
160
|
- Enforcement gate (fail on Connection key regression) postponed until post-pooling variance stabilization.
|
|
@@ -155,6 +162,7 @@ Deferred / Hand-off to Phase 2:
|
|
|
155
162
|
### Phase 2 – Node Pooling & Governance (Finalized – COMPLETE)
|
|
156
163
|
|
|
157
164
|
Completion Summary:
|
|
165
|
+
|
|
158
166
|
- Pool integration (construction, addNodeBetween, remove()) behind enableNodePooling flag.
|
|
159
167
|
- Release on remove with defensive swallow.
|
|
160
168
|
- memoryStats() exposes pools.nodePool.
|
|
@@ -167,19 +175,21 @@ Completion Summary:
|
|
|
167
175
|
Final Stress Metrics (representative run):
|
|
168
176
|
| recycledRatio | highWaterMarkTailΔ | Thresholds | Status |
|
|
169
177
|
|---------------|--------------------|------------|--------|
|
|
170
|
-
| ~0.66
|
|
178
|
+
| ~0.66 | 0 | ≥0.5 / ≤2 | PASS |
|
|
171
179
|
|
|
172
180
|
Notes:
|
|
181
|
+
|
|
173
182
|
- Active variance stabilization provides statistically reliable baseline ahead of Phase 3 slab packing comparisons.
|
|
174
183
|
- Next tasks shift entirely to slab packing + bytes/conn reductions without needing to revisit repeat governance.
|
|
175
184
|
|
|
176
185
|
Proceeding Next: Phase 3 – slab packing prototype with stable pooling + variance foundations.
|
|
177
186
|
|
|
178
187
|
Achievements (Quantitative Metrics):
|
|
188
|
+
|
|
179
189
|
- Large-size variance escalation engaged both monitored sizes to cap (max repeats=9) due to CV above 7% target; escalation trail recorded (3 events per size: 2 escalate + 1 stop each).
|
|
180
190
|
- Post‑escalation variance (cap reached – still above target, informing Phase 3 optimization focus):
|
|
181
|
-
|
|
182
|
-
|
|
191
|
+
- 100k: build CV 9.53%, forward CV 21.13% (samples=9).
|
|
192
|
+
- 200k: build CV 11.79%, forward CV 23.11% (samples=9).
|
|
183
193
|
- Build throughput (dist, escalated means): 100k buildMsMean ≈82.54ms; 200k ≈172.39ms.
|
|
184
194
|
- Forward average latency (dist, escalated means): 100k fwdAvgMsMean ≈15.98ms; 200k ≈24.07ms.
|
|
185
195
|
- Bytes per connection plateau preserved at 64 (reference pre‑slab target baseline maintained; no regression introduced by pooling/escalation harness adjustments).
|
|
@@ -188,6 +198,7 @@ Achievements (Quantitative Metrics):
|
|
|
188
198
|
- Determinism parity tests pass with pooling enabled (forward outputs identical to non‑pooled path under seeded RNG).
|
|
189
199
|
|
|
190
200
|
Interpretation & Next Focus:
|
|
201
|
+
|
|
191
202
|
- Elevated forward CV ( >20%) at large sizes suggests remaining noise sources (allocation jitter, warm-cache effects) that slab packing + reduced object churn should attenuate.
|
|
192
203
|
- Maintaining bytes/conn plateau while adding governance instrumentation validates pay‑for‑use principle (no incidental bloat).
|
|
193
204
|
- Pool reuse efficiency metrics will become meaningful once Phase 3 introduces slab-backed connection packing and more aggressive mutation/prune cycles; present zeroed stats serve as baseline.
|
|
@@ -197,11 +208,13 @@ Interpretation & Next Focus:
|
|
|
197
208
|
Scope Files: `src/architecture/network.slab.ts`, `src/architecture/network.ts`
|
|
198
209
|
|
|
199
210
|
Objectives:
|
|
211
|
+
|
|
200
212
|
- Pack connection data into Structure‑of‑Arrays slabs (weights, flags, optional gains, optional plasticity) with geometric growth & pooling.
|
|
201
213
|
- Preserve forward correctness (parity) and enable a fast CSR activation path with pay‑for‑use optional slabs.
|
|
202
214
|
- Instrument memory (fragmentation, pooled reuse, alloc stats) without inflating bytes/connection when features unused.
|
|
203
215
|
|
|
204
216
|
Implemented Features (consolidated):
|
|
217
|
+
|
|
205
218
|
1. Geometric capacity growth (Node 1.75×, Browser 1.25×) with slab reuse and fragmentation accounting.
|
|
206
219
|
2. Bit‑packed connection flags (enabled, dropConnect mask, gater, plastic) in a `Uint8Array` slab.
|
|
207
220
|
3. Optional gain slab (`_connGain`) allocated only on first non‑neutral gain; released when all revert to 1.
|
|
@@ -221,24 +234,25 @@ Deferred (post‑Phase 3): chunked copy yield refinements (browser large slabs),
|
|
|
221
234
|
Source: `test/benchmarks/benchmark.results.json` (latest history entry vs earliest recorded baseline in same file).
|
|
222
235
|
|
|
223
236
|
| Size | Baseline Build ms (mean) | Phase 3 Build ms (mean) | Δ Build % | Baseline Fwd Avg ms | Phase 3 Fwd Avg ms | Δ Fwd % | Bytes/Conn Baseline | Bytes/Conn Phase 3 | Δ Bytes/Conn |
|
|
224
|
-
|
|
225
|
-
| 1k | 2.0415 | 1.9435 |
|
|
226
|
-
| 10k | 7.0529 | 9.8183 |
|
|
227
|
-
| 50k | 46.2062 | 48.6405 |
|
|
228
|
-
| 100k | 60.1772 | 77.2990 |
|
|
229
|
-
| 200k | 153.4771 | 189.3520 |
|
|
237
|
+
| ---- | ------------------------ | ----------------------- | --------: | ------------------- | ------------------ | ------: | ------------------- | ------------------ | -----------: |
|
|
238
|
+
| 1k | 2.0415 | 1.9435 | -4.8% | 0.4045 | 0.6797 | +68%\* | 69 | 69 | 0 |
|
|
239
|
+
| 10k | 7.0529 | 9.8183 | +39.3% | 3.9449 | 4.5383 | +15.0% | 65 | 65 | 0 |
|
|
240
|
+
| 50k | 46.2062 | 48.6405 | +5.3% | 6.2795 | 7.4799 | +19.1% | 65 | 65 | 0 |
|
|
241
|
+
| 100k | 60.1772 | 77.2990 | +28.4% | 9.2725 | 13.6824 | +47.6% | 64 | 64 | 0 |
|
|
242
|
+
| 200k | 153.4771 | 189.3520 | +23.4% | 22.2546 | 29.4639 | +32.4% | 64 | 64 | 0 |
|
|
230
243
|
|
|
231
|
-
|
|
244
|
+
The 1k forward pass time shows a significant increase (+68%). While this may be related to test overhead on very small networks or initial cache warm-up effects, the magnitude warrants further investigation in Phase 6 (Allocation Churn Reduction) to rule out any underlying inefficiencies in the slab implementation at small scales. The primary Phase 3 memory objective—stabilizing bytes/connection while adding features—was met.
|
|
232
245
|
|
|
233
246
|
Variance (CV%) snapshot (from `variance` section):
|
|
234
247
|
| Size | Build CV% | Fwd CV% | Target CV% |
|
|
235
248
|
|------|-----------|---------|------------|
|
|
236
|
-
| 100k | 4.7
|
|
237
|
-
| 200k | 11.34
|
|
249
|
+
| 100k | 4.7 | 11.41 | 7 (build met, forward above) |
|
|
250
|
+
| 200k | 11.34 | 13.13 | 7 (above) |
|
|
238
251
|
|
|
239
252
|
Notes:
|
|
253
|
+
|
|
240
254
|
- Phase 3 prioritized memory layout & feature packing (plasticity bit + optional slabs, gain omission) over variance suppression; forward CV remains elevated at high scales—scheduled for attention in Phase 6 (allocation churn) & Phase 7 (caching reuse) where rebuild frequency drops.
|
|
241
|
-
- Bytes/connection held constant (no regression) despite added optional slabs; gain omission and plasticity pay‑for‑use prevented per-connection inflation.
|
|
255
|
+
- Bytes/connection held constant (no regression) despite added optional slabs; gain omission and plasticity pay‑for‑use prevented per-connection inflation. This confirms the pay-for-use principle is working but highlights that progress on the bytes/connection reduction metric is dependent on Phase 4 (Sparsity).
|
|
242
256
|
- Field audit counts: Connection enumerable keys = 9 (stable), Node = 15 (stable) per benchmark `fieldAudit` confirmation.
|
|
243
257
|
|
|
244
258
|
Results Notes & Next Step: For quantitative deltas see table above; variance & invariant consolidation detailed in Phase 3 Conclusion below. Proceed to Hyper MorphoNEAT work with stable slab foundation.
|
|
@@ -248,6 +262,7 @@ Results Notes & Next Step: For quantitative deltas see table above; variance & i
|
|
|
248
262
|
All planned Phase 3 memory layout features are implemented, documented, and validated by tests; the slab system now provides a pay‑for‑use foundation for forthcoming Hyper MorphoNEAT caching & morphogenesis work.
|
|
249
263
|
|
|
250
264
|
Delivered Enhancements (Recap):
|
|
265
|
+
|
|
251
266
|
1. Optional slabs (gain, plasticity) allocated lazily, released when neutral / absent.
|
|
252
267
|
2. Bit‑packed connection flags with added plastic bit.
|
|
253
268
|
3. Geometric capacity growth with pooling + fragmentation tracking.
|
|
@@ -257,28 +272,32 @@ Delivered Enhancements (Recap):
|
|
|
257
272
|
7. Plasticity packing (bit + optional slab) and gain omission optimization (ensures zero overhead when unused).
|
|
258
273
|
|
|
259
274
|
Verified Invariants (Backed by Tests):
|
|
275
|
+
|
|
260
276
|
1. Parity: Fast vs legacy activation (baseline, with gating guard fallback, with non‑neutral gains).
|
|
261
|
-
2. Optional gain slab: allocated on first non‑neutral gain; released when all revert to 1
|
|
262
|
-
3. Optional plasticity slab: allocated only when any connection plastic; released when none plastic
|
|
263
|
-
4. Slab version increments on structural rebuilds (sync & async)
|
|
277
|
+
2. Optional gain slab: allocated on first non‑neutral gain; released when all revert to 1.
|
|
278
|
+
3. Optional plasticity slab: allocated only when any connection plastic; released when none plastic.
|
|
279
|
+
4. Slab version increments on structural rebuilds (sync & async).
|
|
264
280
|
5. Fragmentation metrics: trend test plus bounds test guarantee 0 ≤ fragmentationPct ≤ 100 across churn.
|
|
265
281
|
6. Pooling reuse: repeated rebuilds without growth show non‑decreasing pooled allocation counter.
|
|
266
282
|
7. Gating guard correctness: fast path defers when gating present to avoid incorrect math.
|
|
267
283
|
8. Bytes/connection: stable plateau (≈64–69) despite added optional features (no unconditional inflation).
|
|
268
|
-
9. Gain parity: fast path multiplies weight
|
|
284
|
+
9. Gain parity: fast path multiplies weight\*gain if gain slab present.
|
|
285
|
+
|
|
286
|
+
New / Final Validation Concepts Tested in Phase 3:
|
|
269
287
|
|
|
270
|
-
|
|
271
|
-
-
|
|
272
|
-
-
|
|
273
|
-
-
|
|
274
|
-
- `network.slab.gain.release-on-reset.test.ts`
|
|
288
|
+
- Fast path gain multiplication parity.
|
|
289
|
+
- Slab fragmentation bounds (0-100%).
|
|
290
|
+
- Allocation statistics and reuse tracking.
|
|
291
|
+
- Release of optional gain slab upon reset.
|
|
275
292
|
|
|
276
293
|
Risk & Deferred Items:
|
|
294
|
+
|
|
277
295
|
- Forward pass variance (> target at large sizes) deferred to Phase 6/7 (allocation churn + caching reuse).
|
|
278
296
|
- Adjacency → phenotype direct mapping postponed to caching phase to avoid premature duplication work.
|
|
279
297
|
- Potential future packing of plasticity side parameters (rates/traces) once learning rules land.
|
|
280
298
|
|
|
281
299
|
Exit Criteria (Met):
|
|
300
|
+
|
|
282
301
|
- Pay‑for‑use: Optional slabs only when demanded; released afterward.
|
|
283
302
|
- Fast path correctness across gain & plastic scenarios verified.
|
|
284
303
|
- Fragmentation metric correctness (bounded & trend tested).
|
|
@@ -287,7 +306,62 @@ Exit Criteria (Met):
|
|
|
287
306
|
|
|
288
307
|
Ready for Next Phase: Hyper MorphoNEAT work can proceed atop a stable, instrumented slab foundation with confidence in memory invariants and optional feature overhead discipline.
|
|
289
308
|
|
|
290
|
-
### Phase
|
|
309
|
+
### Phase 3.5 – Centralized Memory Management & Browser Validation
|
|
310
|
+
|
|
311
|
+
**Status: Active**
|
|
312
|
+
|
|
313
|
+
This phase addresses a critical architectural gap by implementing a `Centralized Memory Manager` as the single source of truth for all memory-related operations. It also establishes a formal browser benchmark harness to validate environment-specific features.
|
|
314
|
+
|
|
315
|
+
#### Part 1: Centralized Memory Manager
|
|
316
|
+
|
|
317
|
+
To ensure consistent behavior, feature gating, and pay‑for‑use semantics, this module will be the canonical contract between the runtime, benchmarking harness, and platform-specific adaptations.
|
|
318
|
+
|
|
319
|
+
**Scope Files:** `src/memory/config.ts`, `src/memory/manager.ts`, `test/memory/manager.test.ts`
|
|
320
|
+
|
|
321
|
+
**Responsibilities & Design:**
|
|
322
|
+
|
|
323
|
+
- **Centralize Flags and Defaults:**
|
|
324
|
+
- Global feature flags (`enableSlabs`, `enablePooling`, `precisionMode`, `browserAsyncRebuild`).
|
|
325
|
+
- Typed-array growth factors and alignment preferences (`nodeFactor`, `browserFactor`, `baseCapacity`).
|
|
326
|
+
- Pool defaults (`maxRetainedPerKey`, `initialReserve`).
|
|
327
|
+
- **Provide Pay-for-Use Primitives:**
|
|
328
|
+
- Lazy allocation helpers for optional slabs (e.g., gain, plasticity).
|
|
329
|
+
- Typed-array allocator wrappers that consult pooling and growth configurations.
|
|
330
|
+
- A registration API for pools to enable centralized instrumentation and controlled teardown.
|
|
331
|
+
- **Expose a Stable `MemoryManager` API:**
|
|
332
|
+
- `getConfig()`: Snapshot of current flags & growth factors.
|
|
333
|
+
- `setFlag(name, value)`: Controlled mutation with validation.
|
|
334
|
+
- `allocateTypedArray(type, length)`: Pooled/aligned allocation.
|
|
335
|
+
- `releaseTypedArray(obj)`: Releases back to the appropriate pool.
|
|
336
|
+
- `registerPool(name, poolDescriptor)`: Instrumentation handle.
|
|
337
|
+
- `memoryStats()`: Populated from manager internals.
|
|
338
|
+
- `init()/teardown()`: Controlled lifecycle for tests.
|
|
339
|
+
- **Environment Awareness & Gating:**
|
|
340
|
+
- Automatic platform defaults (Node vs. Browser) chosen at initialization.
|
|
341
|
+
- Feature flags default to `false`; enabling must be explicit.
|
|
342
|
+
|
|
343
|
+
**Key Deliverables:**
|
|
344
|
+
|
|
345
|
+
1. **`src/memory/config.ts`**: Will export `const` values for all flags and numeric defaults with detailed JSDoc.
|
|
346
|
+
2. **`src/memory/manager.ts`**: Will export a `class MemoryManager` and a `defaultMemoryManager` singleton instance.
|
|
347
|
+
3. **Refactoring**: Existing code in `network.ts` and `network.slab.ts` will be updated to use the `defaultMemoryManager`.
|
|
348
|
+
4. **Unit Tests**: Tests will be added to assert `getConfig()`/`setFlag()` behavior and verify that `allocate`/`release` operations respect the pay-for-use principle when flags are toggled.
|
|
349
|
+
|
|
350
|
+
#### Part 2: Browser Benchmark Harness
|
|
351
|
+
|
|
352
|
+
**Scope Files:** `bench-browser/harness.ts`
|
|
353
|
+
|
|
354
|
+
**Key Deliverables:**
|
|
355
|
+
|
|
356
|
+
1. A dedicated test harness in `bench-browser/` to capture the same core metrics as the Node.js benchmarks (build time, forward pass time, memory usage via `performance.memory`).
|
|
357
|
+
2. Specific tests to validate browser-only features, such as measuring UI thread blocking during `asyncBuilds` to confirm cooperative scheduling is effective.
|
|
358
|
+
3. The plan will be updated to document the browser harness setup and results.
|
|
359
|
+
|
|
360
|
+
**Status:** Under development. Initial results will be added here once the harness is operational.
|
|
361
|
+
|
|
362
|
+
### Phase 4 – Sparse Growth & Prune Budgets
|
|
363
|
+
|
|
364
|
+
**Status: Next Up**
|
|
291
365
|
|
|
292
366
|
Files: `network.prune.ts`, `network.ts`, new `network.sparsityBudget.ts`
|
|
293
367
|
Steps:
|
|
@@ -297,10 +371,24 @@ Steps:
|
|
|
297
371
|
3. (N) Integrate soft heap monitor vs `nodeHeapSoftLimitMB` for early pruning.
|
|
298
372
|
4. (B) Use `browserMemoryBudgetMB` soft target; preempt budget breaches proactively.
|
|
299
373
|
5. (C) Exponential backoff for repeated denied growth.
|
|
300
|
-
6. (C) Tests verifying cap adherence.
|
|
301
|
-
7. (
|
|
374
|
+
6. (C) Tests verifying cap adherence and budget-driven pruning.
|
|
375
|
+
7. (C) **Validation:** Add a benchmark scenario to measure and report the `bytes/connection` metric before and after pruning, verifying progress toward the -25% target.
|
|
376
|
+
8. (H) While some hooks align with Morphogenesis, the core sparsity and budget logic is independent and critical for the `-25% bytes/connection` target. This work will proceed in parallel.
|
|
377
|
+
|
|
378
|
+
### Phase 5 – Genotype / Phenotype & Adjacency Caching (Hyper Intensive)
|
|
379
|
+
|
|
380
|
+
Files: `hyper/phenotypeBuilder.ts`, `hyper/genotype.ts`, new `hyper/adjacencyCache.ts`
|
|
381
|
+
Steps:
|
|
382
|
+
|
|
383
|
+
1. (C/H) Hash genotype signature; reuse phenotype slabs (copy-on-write mutated sections) with ref counts.
|
|
384
|
+
2. (H) Adjacency cache key = (genotypeHash, substrateHash, cppnHash, threshold, precisionMode). Store SoA: src/dst Uint32, weight Float32|Uint16, flags Uint8, optional plasticity Float32.
|
|
385
|
+
3. (N) Optional disk persistence (binary blobs + JSON header) gated by size threshold.
|
|
386
|
+
4. (B) IndexedDB/OPFS chunk storage; async hydration & eviction statistics.
|
|
387
|
+
5. (C) LRU eviction with byte cap (`hyperAdjacencyCacheMaxBytes`).
|
|
388
|
+
6. (C) Tests: deterministic hits; eviction preserves correctness; stale pointer detection.
|
|
389
|
+
7. (H) Metrics: hit ratio, rebuild speed-up (>2× target), cache memory overhead per active connection, eviction cost (<5% build time).
|
|
302
390
|
|
|
303
|
-
### Phase
|
|
391
|
+
### Phase 6 – Adaptive Precision & Mixed Precision
|
|
304
392
|
|
|
305
393
|
Files: `network.ts`, `node.ts`, `activationArrayPool.ts`
|
|
306
394
|
Actions:
|
|
@@ -312,7 +400,7 @@ Actions:
|
|
|
312
400
|
5. (C) Loss scaling with overflow/underflow counters auto-adjusting scale.
|
|
313
401
|
6. (H) Apply precision modes to large Hyper-generated adjacency/phenotype slabs.
|
|
314
402
|
|
|
315
|
-
### Phase
|
|
403
|
+
### Phase 7 – Allocation Churn Reduction
|
|
316
404
|
|
|
317
405
|
Files: `activationArrayPool.ts`, `network.connect.ts`
|
|
318
406
|
Steps:
|
|
@@ -324,19 +412,6 @@ Steps:
|
|
|
324
412
|
5. (B) Cooperative compaction (microtask slices / idle callbacks) to avoid jank.
|
|
325
413
|
6. (H) Morphogenesis growth bursts use batch API to cap reallocations.
|
|
326
414
|
|
|
327
|
-
### Phase 7 – Genotype / Phenotype & Adjacency Caching (Hyper Intensive)
|
|
328
|
-
|
|
329
|
-
Files: `hyper/phenotypeBuilder.ts`, `hyper/genotype.ts`, new `hyper/adjacencyCache.ts`
|
|
330
|
-
Steps:
|
|
331
|
-
|
|
332
|
-
1. (C/H) Hash genotype signature; reuse phenotype slabs (copy-on-write mutated sections) with ref counts.
|
|
333
|
-
2. (H) Adjacency cache key = (genotypeHash, substrateHash, cppnHash, threshold, precisionMode). Store SoA: src/dst Uint32, weight Float32|Uint16, flags Uint8, optional plasticity Float32.
|
|
334
|
-
3. (N) Optional disk persistence (binary blobs + JSON header) gated by size threshold.
|
|
335
|
-
4. (B) IndexedDB/OPFS chunk storage; async hydration & eviction statistics.
|
|
336
|
-
5. (C) LRU eviction with byte cap (`hyperAdjacencyCacheMaxBytes`).
|
|
337
|
-
6. (C) Tests: deterministic hits; eviction preserves correctness; stale pointer detection.
|
|
338
|
-
7. (H) Metrics: hit ratio, rebuild speed-up (>2× target), cache memory overhead per active connection, eviction cost (<5% build time).
|
|
339
|
-
|
|
340
415
|
### Phase 8 – Serialization Compression
|
|
341
416
|
|
|
342
417
|
Files: `network.serialize.ts`, `hyper/serialization.ts`
|
|
@@ -360,36 +435,31 @@ Use Cases: Deep recurrent nets, streaming sensor data, on-device low-memory infe
|
|
|
360
435
|
4. (C) API `forwardWindowed(inputs[])` + docs on trade-offs.
|
|
361
436
|
5. (H) Align morphogenesis events to window boundaries to stabilize temporal metrics for module focus scoring.
|
|
362
437
|
|
|
363
|
-
---
|
|
364
|
-
|
|
365
438
|
## Cross-Cutting Utilities
|
|
366
439
|
|
|
367
|
-
1. `memoryStats()` : counts & approximate bytes (connections, nodes, slabs, pools, caches) + active flag states + environment heuristics (browser only).
|
|
440
|
+
1. `memoryStats()` : counts & approximate bytes (connections, nodes, slabs, pools, caches) + active flag states + environment heuristics (browser only). All data will be sourced from the `Centralized Memory Manager`.
|
|
368
441
|
2. Flag definitions in `config.ts` with environment gating (auto-disable unsupported features; expose status via stats).
|
|
369
|
-
3. `
|
|
370
|
-
4. `
|
|
371
|
-
5. `
|
|
372
|
-
|
|
373
|
-
---
|
|
442
|
+
3. `wiringStats()`: Tracks wiring cost metrics required by Hyper MorphoNEAT, such as `totalWiringLength`, `interModuleEdgeCount`, `meanEdgeLength`, and `modularityQ`.
|
|
443
|
+
4. `adjacencyCacheStats()` (Hyper): entries, bytes, hit/miss, evictions, persistence bytes.
|
|
444
|
+
5. `precisionStats()` capturing current precision modes, overflow/underflow counters, scaling adjustments.
|
|
445
|
+
6. `poolHighWaterMarks()` for churn leak detection and morphogenesis stress tests.
|
|
374
446
|
|
|
375
447
|
## Risk Matrix (Expanded)
|
|
376
448
|
|
|
377
|
-
| Risk | Impact
|
|
378
|
-
| -------------------------------- |
|
|
379
|
-
| Pool reset bug (stale gradients) | Incorrect training
|
|
380
|
-
| Typed array vs object desync | Silent logic errors
|
|
381
|
-
| Precision downcast loss | Accuracy degradation| Both | Opt-in + drift tests + fallback
|
|
382
|
-
| Cache retention leak | Memory bloat
|
|
383
|
-
| Adjacency cache blow-up | OOM / GC thrash
|
|
384
|
-
| Plasticity buffer leak | Gradual creep
|
|
385
|
-
| Morphogenesis fragmentation | Retained wasted bytes| Browser
|
|
386
|
-
| Large slab copy jank | UI stalls
|
|
387
|
-
| IndexedDB growth overflow | Quota errors
|
|
388
|
-
| Disk cache stale bloat | Disk waste
|
|
389
|
-
| WASM incompatibility | Crash / wrong math
|
|
390
|
-
| SAB unavailable | Worker perf drop
|
|
391
|
-
|
|
392
|
-
---
|
|
449
|
+
| Risk | Impact | Env Bias | Mitigation |
|
|
450
|
+
| -------------------------------- | --------------------- | -------- | --------------------------------------- |
|
|
451
|
+
| Pool reset bug (stale gradients) | Incorrect training | Both | Comprehensive reset + tests |
|
|
452
|
+
| Typed array vs object desync | Silent logic errors | Both | Version counter + dev asserts |
|
|
453
|
+
| Precision downcast loss | Accuracy degradation | Both | Opt-in + drift tests + fallback |
|
|
454
|
+
| Cache retention leak | Memory bloat | Node | Ref counts + weak maps + idle sweep |
|
|
455
|
+
| Adjacency cache blow-up | OOM / GC thrash | Browser | Byte cap + LRU + soft budget trigger |
|
|
456
|
+
| Plasticity buffer leak | Gradual creep | Both | Pool reset tests + leak harness |
|
|
457
|
+
| Morphogenesis fragmentation | Retained wasted bytes | Browser | Periodic compaction + metrics |
|
|
458
|
+
| Large slab copy jank | UI stalls | Browser | Chunked copies + cooperative scheduling |
|
|
459
|
+
| IndexedDB growth overflow | Quota errors | Browser | Size accounting + eviction threshold |
|
|
460
|
+
| Disk cache stale bloat | Disk waste | Node | TTL metadata + size pruning |
|
|
461
|
+
| WASM incompatibility | Crash / wrong math | Both | Feature detection + test parity |
|
|
462
|
+
| SAB unavailable | Worker perf drop | Browser | Graceful downgrade to standard workers |
|
|
393
463
|
|
|
394
464
|
## Test Strategy Additions (Environment Aware)
|
|
395
465
|
|
|
@@ -407,8 +477,6 @@ Use Cases: Deep recurrent nets, streaming sensor data, on-device low-memory infe
|
|
|
407
477
|
| Persistence | Disk/IndexedDB eviction & size accounting | Node/Browser |
|
|
408
478
|
| WASM Kernels | Parity + performance improvement metrics | Feature-detected |
|
|
409
479
|
|
|
410
|
-
---
|
|
411
|
-
|
|
412
480
|
## Benchmark Scenarios (Initial Set)
|
|
413
481
|
|
|
414
482
|
1. Build-only: construct 100k sparse connections (Browser variant 50k if limits encountered).
|
|
@@ -423,14 +491,6 @@ Use Cases: Deep recurrent nets, streaming sensor data, on-device low-memory infe
|
|
|
423
491
|
|
|
424
492
|
Metrics: wall time, RSS / usedJSHeapSize, GC events, bytes/connection, slab fragmentation %, cache hit ratio, frame overrun %, compression ratio, copy bandwidth (MB/s), heuristic error factor (Browser).
|
|
425
493
|
|
|
426
|
-
---
|
|
427
|
-
|
|
428
|
-
## Incremental Adoption Flags (config.ts)
|
|
429
|
-
|
|
430
|
-
See extended flag table (not yet implemented). Add environment gating & expose flag activation status in `memoryStats().flags`.
|
|
431
|
-
|
|
432
|
-
---
|
|
433
|
-
|
|
434
494
|
## Documentation & Developer Guidance
|
|
435
495
|
|
|
436
496
|
1. Update README performance section after Phase 3 (slabs) & Phase 5 (precision) with environment notes.
|
|
@@ -439,8 +499,6 @@ See extended flag table (not yet implemented). Add environment gating & expose f
|
|
|
439
499
|
4. Troubleshooting guide: leak detection, reading stats, tuning budgets, Browser responsiveness tips.
|
|
440
500
|
5. Hyper docs cross-link memory flags required for adjacency/phenotype caching.
|
|
441
501
|
|
|
442
|
-
---
|
|
443
|
-
|
|
444
502
|
## Baseline & Progress Logging
|
|
445
503
|
|
|
446
504
|
Append after each phase:
|
|
@@ -455,8 +513,6 @@ Metrics (Env): frame jank %, disk/IndexedDB bytes, heuristic error factor, compr
|
|
|
455
513
|
Notes:
|
|
456
514
|
```
|
|
457
515
|
|
|
458
|
-
---
|
|
459
|
-
|
|
460
516
|
## Coordination With Hyper MorphoNEAT Plan (Expanded)
|
|
461
517
|
|
|
462
518
|
Dependency Mapping:
|
|
@@ -468,19 +524,18 @@ Hyper Phase -> Memory Requirement -> Memory Phase
|
|
|
468
524
|
8 (Scale validation) -> Bench infra -> Phase 0,6,7
|
|
469
525
|
|
|
470
526
|
Extended Mapping (Granular Alignment, Environment nuance):
|
|
471
|
-
Hyper Phase | Memory Concern | Memory Layer / Phase | Notes
|
|
472
|
-
------------------------- | -------------- | -------------------- | -----
|
|
473
|
-
0 (Scaffolding) | Flag isolation & zero overhead | Flags + baseline instrumentation (Phase 0) | Ensure feature off path identical
|
|
474
|
-
1 (Genotype/Substrate) | Genotype size vs phenotype ratio | Metrics extension (Target + Additional) | Track bytes/genotype
|
|
475
|
-
2 (Rule Engine) | Deterministic expansion cost | Phase 1 slimming + profiling harness | Avoid premature allocations
|
|
476
|
-
3 (CPPN Indirect) | Adjacency generation & cache | L7 (adjacency cache) + Phase 7 | Hit ratio & byte cap
|
|
477
|
-
4 (Morphogenesis) | Churn & budget enforcement | Phase 2,4 + churn tests | Monitor pool high-water marks
|
|
478
|
-
5 (Plasticity) | Side buffer footprint | Phase 3 packing + new flag | Optional typed arrays only
|
|
479
|
-
6 (Telemetry) | Lazy metrics buffers | Cross-cutting utilities | Zero retained when disabled
|
|
480
|
-
7 (Evolution Integration) | Multi-offspring rebuild reuse | Phenotype cache (L7) | Minimize rebuild duplicates
|
|
481
|
-
8 (Scale Validation) | Peak memory, rebuild variance | Benchmark suite & CI thresholds | Pass/fail gating
|
|
482
527
|
|
|
483
|
-
|
|
528
|
+
| Hyper Phase | Memory Concern | Memory Layer / Phase | Notes |
|
|
529
|
+
| ------------------------- | -------------------------------- | ------------------------------------------ | --------------------------------- |
|
|
530
|
+
| 0 (Scaffolding) | Flag isolation & zero overhead | Flags + baseline instrumentation (Phase 0) | Ensure feature off path identical |
|
|
531
|
+
| 1 (Genotype/Substrate) | Genotype size vs phenotype ratio | Metrics extension (Target + Additional) | Track bytes/genotype |
|
|
532
|
+
| 2 (Rule Engine) | Deterministic expansion cost | Phase 1 slimming + profiling harness | Avoid premature allocations |
|
|
533
|
+
| 3 (CPPN Indirect) | Adjacency generation & cache | L7 (adjacency cache) + Phase 7 | Hit ratio & byte cap |
|
|
534
|
+
| 4 (Morphogenesis) | Churn & budget enforcement | Phase 2,4 + churn tests | Monitor pool high-water marks |
|
|
535
|
+
| 5 (Plasticity) | Side buffer footprint | Phase 3 packing + new flag | Optional typed arrays only |
|
|
536
|
+
| 6 (Telemetry) | Lazy metrics buffers | Cross-cutting utilities | Zero retained when disabled |
|
|
537
|
+
| 7 (Evolution Integration) | Multi-offspring rebuild reuse | Phenotype cache (L7) | Minimize rebuild duplicates |
|
|
538
|
+
| 8 (Scale Validation) | Peak memory, rebuild variance | Benchmark suite & CI thresholds | Pass/fail gating |
|
|
484
539
|
|
|
485
540
|
## Future (Post Core) Environment-Specific Explorations
|
|
486
541
|
|
|
@@ -498,21 +553,49 @@ Hyper Phase | Memory Concern | Memory Layer / Phase | Notes
|
|
|
498
553
|
|
|
499
554
|
### Dev Notes
|
|
500
555
|
|
|
556
|
+
This section contains active, project-wide guidelines for development and testing. All contributions should adhere to these standards to maintain code quality, consistency, and educational clarity.
|
|
557
|
+
|
|
501
558
|
Testing requirements:
|
|
559
|
+
|
|
502
560
|
- all tests should have a single expectation.
|
|
503
|
-
- follow AAA pattern (arrange, act, assert)
|
|
561
|
+
- follow AAA pattern (arrange, act, assert)
|
|
504
562
|
- group tests into scenarios with describe(), nest scenarios as needed, no limit on layers.
|
|
505
563
|
- when possible, define common testing data directly on the describe() and then write the assertions for it, this also applies for nested scenarios as they each represent more specific cases as it goes down into sub branches.
|
|
506
564
|
- aim for 100% testing coverage
|
|
507
565
|
- make sure to check existing files before creating/updating one, to be sure you are using the right file, in the right folder, for example `test/neat/` and also to be following the same file pattern inside that folder.
|
|
508
566
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
567
|
+
A good test structure follows the single-expectation rule:
|
|
568
|
+
|
|
569
|
+
```typescript
|
|
570
|
+
describe('Scenario: A group of related tests', () => {
|
|
571
|
+
// Arrange: Set up common data or mocks here
|
|
572
|
+
const testData = {
|
|
573
|
+
/* ... */
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
describe('Context: A more specific sub-scenario', () => {
|
|
577
|
+
// Act: Perform a common action for this context
|
|
578
|
+
const result = performAction(testData);
|
|
579
|
+
|
|
580
|
+
it('should fulfill a single, specific expectation', () => {
|
|
581
|
+
// Assert
|
|
582
|
+
expect(result.property).toBe(true);
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
it('should meet another distinct expectation', () => {
|
|
586
|
+
// Assert
|
|
587
|
+
expect(result.otherValue).toEqual(42);
|
|
588
|
+
});
|
|
512
589
|
});
|
|
513
590
|
});
|
|
591
|
+
```
|
|
514
592
|
|
|
515
593
|
Also:
|
|
594
|
+
|
|
516
595
|
- Always add JSDocs to all methods, classes, const, let
|
|
517
596
|
- Add or update inline comments within methods to explain each step or detail.
|
|
518
597
|
- This is an educative NN library, keep the docs detailed and educative
|
|
598
|
+
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ONNX Export / Import Plan for NeatapticTS
|
|
2
2
|
|
|
3
|
-
_Last updated: 2025-
|
|
3
|
+
_Last updated: 2025-09-06 (Phase 4 initial increment complete; Phase 3 deep testing finalizing)_
|
|
4
4
|
|
|
5
5
|
## 0. Purpose
|
|
6
6
|
|
|
@@ -17,7 +17,7 @@ Completed (Phase 0):
|
|
|
17
17
|
- Layer inference & validation: detects non-layered or missing full connectivity; enforces homogeneous activation per non-input layer.
|
|
18
18
|
- Supported activations mapped to ONNX: ReLU, Tanh, Sigmoid (Logistic), Identity (fallback with warning for unknown custom activations).
|
|
19
19
|
- Parameter export: weights + biases as ONNX initializers (float32 scalars in `float_data`).
|
|
20
|
-
- Graph structure assembly with a pair of nodes per layer transition (Gemm + Activation)
|
|
20
|
+
- Graph structure assembly with a pair of nodes per layer transition (Gemm + Activation). The initial implementation emitted nodes in a non-standard `Activation -> Gemm` order, which was corrected in Phase 1 to the standard `Gemm -> Activation` sequence.
|
|
21
21
|
- Bias handling integrated in Gemm (alpha=1, beta=1, transB=1 attributes included).
|
|
22
22
|
- Single-layer perceptron edge case handled (inputs → outputs only).
|
|
23
23
|
|
|
@@ -85,9 +85,7 @@ Baseline IMPLEMENTED (extended):
|
|
|
85
85
|
|
|
86
86
|
1. Self-recurrence support for ANY hidden layer (one or multiple) in single-step form when `allowRecurrent && recurrentSingleStep`.
|
|
87
87
|
|
|
88
|
-
- For each recurrent hidden layer `k` a previous-state input is added:
|
|
89
|
-
- First recurrent layer: `hidden_prev`
|
|
90
|
-
- Subsequent recurrent layers: `hidden_prev_l{k}`
|
|
88
|
+
- For each recurrent hidden layer `k` a previous-state input is added with a consistent naming convention: `hidden_prev_l{k}`.
|
|
91
89
|
- Forward path per recurrent layer: Gemm (`gemm_in_l{k}`) + recurrent Gemm (`gemm_rec_l{k}` using `R{k-1}`) -> Add (`add_recurrent_l{k}`) -> Activation (`act_l{k}`).
|
|
92
90
|
- Recurrent weight matrices `Rk` currently diagonal (self-connections only) but sized for future dense intra-layer recurrence.
|
|
93
91
|
- Metadata `recurrent_single_step` now stores JSON array of recurrent layer indices (1-based) instead of boolean.
|
|
@@ -114,7 +112,7 @@ LSTM / GRU Heuristic Sub-plan Progress:
|
|
|
114
112
|
3. ONNX Node Emission – COMPLETED (emits experimental single-step `LSTM` / `GRU` nodes alongside unfused Gemm path; no pruning yet).
|
|
115
113
|
4. Metadata & Fallback – COMPLETED (`lstm_emitted_layers`, `gru_emitted_layers`, `rnn_pattern_fallback`).
|
|
116
114
|
5. Import Path Extension – COMPLETED (reconstructs Layer.lstm / Layer.gru using emitted tensors; best-effort, silent skip on mismatch).
|
|
117
|
-
6. Testing –
|
|
115
|
+
6. Testing – FINALIZING (deep parity tests to be integrated):
|
|
118
116
|
|
|
119
117
|
- Unit tests for LSTM/GRU emission presence (initializers + node types) under controlled synthetic layer partitions.
|
|
120
118
|
- Round-trip reconstruction tests verifying gate weight & bias mapping fidelity within tolerance (1e-9) and self-connection restoration.
|
|
@@ -194,7 +192,7 @@ Next Planned Increment (proposed order):
|
|
|
194
192
|
3. Heuristic Conv auto-promotion (feature-flagged): if sharing validation passes (or small layer), emit Conv instead of Gemm, preserving a fallback path during transition.
|
|
195
193
|
4. Multi-channel heuristic extension: detect repeated kernel tiles across channels, infer inChannels > 1.
|
|
196
194
|
5. Negative tests for flatten + pooling interplay (ensure metadata only – forward outputs unchanged vs baseline).
|
|
197
|
-
6.
|
|
195
|
+
6. Finalize and integrate deeper recurrent parity tests (Phase 3 Step 6) in parallel with spatial feature development.
|
|
198
196
|
|
|
199
197
|
### Phase 5 (Advanced Graph Constructs)
|
|
200
198
|
|
|
@@ -274,8 +272,8 @@ Backward compatibility: default options reproduce current behavior except correc
|
|
|
274
272
|
|
|
275
273
|
## 11. Short-Term Action Items (Post Phase 2 Completion)
|
|
276
274
|
|
|
277
|
-
1. Link schema doc from root README & docs index. (
|
|
278
|
-
2. Provide CLI example for exporting an evolved genome (README snippet). (
|
|
275
|
+
1. Link schema doc from root README & docs index. (COMPLETED - Link now present in `README.md`)
|
|
276
|
+
2. Provide CLI example for exporting an evolved genome (README snippet). (COMPLETED - Example now present in `README.md`)
|
|
279
277
|
3. Property-based randomized topology tests (1–6 hidden layers; varying sparsity & mixed activations) ensure import/export fidelity. (Planned)
|
|
280
278
|
4. Fusion optimization pass for decomposed layers (homogeneity collapse). (Planned)
|
|
281
279
|
5. Sparse representation design (`sparseFormat` CSR draft spec). (Planned)
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
<div id="ascii-maze-status" aria-live="polite" style="margin-top:8px;color:#f88"></div>
|
|
27
27
|
<!-- Deterministic script path (test environment -> docs assets) -->
|
|
28
28
|
<script
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
src="../../assets/ascii-maze.bundle.js"
|
|
30
|
+
data-ascii-maze-root="../../assets/"
|
|
31
31
|
defer
|
|
32
32
|
onload="(window.asciiMazeStart ? window.asciiMazeStart('ascii-maze-output') : (window.asciiMaze && window.asciiMaze.start && window.asciiMaze.start()))"
|
|
33
33
|
onerror="document.getElementById('ascii-maze-status').textContent='Failed to load ascii-maze.bundle.js';"
|