initium-deeplearning 0.1.0__tar.gz → 0.3.0__tar.gz

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.
Files changed (116) hide show
  1. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/.gitignore +5 -0
  2. initium_deeplearning-0.3.0/PKG-INFO +411 -0
  3. initium_deeplearning-0.3.0/README.md +380 -0
  4. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/pyproject.toml +1 -0
  5. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/__init__.py +1 -1
  6. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/LNN_controller/cfc_backbone_parallel.py +59 -15
  7. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/LNN_controller/cfc_controller.py +195 -6
  8. initium_deeplearning-0.3.0/src/initium/MoE/moe_layer.py +972 -0
  9. initium_deeplearning-0.3.0/src/initium/__init__.py +104 -0
  10. initium_deeplearning-0.3.0/src/initium/analysis/__init__.py +1 -0
  11. initium_deeplearning-0.3.0/src/initium/analysis/kl_attribution.py +291 -0
  12. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/config/controller_config.py +14 -0
  13. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/config/train_config.py +1 -1
  14. initium_deeplearning-0.3.0/src/initium/core_training.py +4951 -0
  15. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/data/common/chain_task.py +10 -3
  16. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/data/common/digit_codec.py +14 -0
  17. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/data/dataset_registry.py +3 -0
  18. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/data/graph_traversal/graph_traversal.py +15 -4
  19. initium_deeplearning-0.3.0/src/initium/data/graph_traversal/order_probe.py +219 -0
  20. initium_deeplearning-0.3.0/src/initium/data/graph_traversal/relational_probe.py +123 -0
  21. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/data/multimodal/multimodal_dataset.py +7 -1
  22. initium_deeplearning-0.3.0/src/initium/data/prepared_dataset.py +56 -0
  23. initium_deeplearning-0.3.0/src/initium/diagnostics/__init__.py +1 -0
  24. initium_deeplearning-0.3.0/src/initium/diagnostics/segment_logging.py +584 -0
  25. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/model_loader.py +38 -1
  26. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/run_inference.py +68 -6
  27. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/tasks/audio_task.py +2 -2
  28. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/tasks/graph_traversal_task.py +15 -2
  29. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/tasks/task_registry.py +1 -0
  30. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/tasks/text_task.py +2 -2
  31. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/tasks/video_task.py +2 -2
  32. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/mamba_controller/mamba_backbone_parallel.py +55 -14
  33. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/mamba_controller/mamba_controller.py +12 -2
  34. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/mamba_controller/split_graph_dnc.py +209 -30
  35. initium_deeplearning-0.3.0/src/initium/memory_manipulation/dnc_mechanisms.py +786 -0
  36. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/memory_manipulation/dynamic_memory_resize.py +38 -5
  37. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/memory_manipulation/link_matrix_ablation.py +29 -11
  38. initium_deeplearning-0.3.0/src/initium/memory_manipulation/nvrtc_compat.py +230 -0
  39. initium_deeplearning-0.3.0/src/initium/workspace/__init__.py +5 -0
  40. initium_deeplearning-0.3.0/src/initium/workspace/bistability.py +303 -0
  41. initium_deeplearning-0.3.0/src/initium/workspace/broadcast.py +533 -0
  42. initium_deeplearning-0.3.0/tests/unit/test_bistable_workspace_gate.py +106 -0
  43. initium_deeplearning-0.3.0/tests/unit/test_optimized_dnc_memory.py +96 -0
  44. initium_deeplearning-0.3.0/tests/unit/test_workspace_reconsideration.py +99 -0
  45. initium_deeplearning-0.1.0/PKG-INFO +0 -253
  46. initium_deeplearning-0.1.0/README.md +0 -222
  47. initium_deeplearning-0.1.0/src/initium/MoE/moe_layer.py +0 -552
  48. initium_deeplearning-0.1.0/src/initium/__init__.py +0 -1
  49. initium_deeplearning-0.1.0/src/initium/core_training.py +0 -2182
  50. initium_deeplearning-0.1.0/src/initium/memory_manipulation/nvrtc_compat.py +0 -143
  51. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/LICENSE +0 -0
  52. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/LNN_controller/chained_controller.py +0 -0
  53. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/LNN_controller/hybrid_controller.py +0 -0
  54. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/MoE/README.md +0 -0
  55. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/data/__init__.py +0 -0
  56. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/data/audio/__init__.py +0 -0
  57. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/data/audio/audio_dataset.py +0 -0
  58. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/data/base_dataset.py +0 -0
  59. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/data/common/__init__.py +0 -0
  60. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/data/common/graph_io.py +0 -0
  61. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/data/common/real_data.py +0 -0
  62. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/data/graph_traversal/__init__.py +0 -0
  63. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/data/multimodal/__init__.py +0 -0
  64. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/data/text/__init__.py +0 -0
  65. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/data/text/text_dataset.py +0 -0
  66. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/data/video/__init__.py +0 -0
  67. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/data/video/video_dataset.py +0 -0
  68. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/__init__.py +0 -0
  69. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/cache/__init__.py +0 -0
  70. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/cache/base_cache.py +0 -0
  71. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/cache/cache_config.py +0 -0
  72. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/cache/cache_registry.py +0 -0
  73. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/cache/cached_engine.py +0 -0
  74. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/cache/keys.py +0 -0
  75. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/cache/prefix_cache.py +0 -0
  76. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/cache/result_cache.py +0 -0
  77. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/cache/state_utils.py +0 -0
  78. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/cache/stores.py +0 -0
  79. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/capabilities.py +0 -0
  80. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/checkpoint_io.py +0 -0
  81. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/engine.py +0 -0
  82. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/inference_config.py +0 -0
  83. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/metrics.py +0 -0
  84. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/run_logging.py +0 -0
  85. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/tasks/__init__.py +0 -0
  86. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/tasks/base_task.py +0 -0
  87. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/inference/tasks/multimodal_task.py +0 -0
  88. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/mamba_controller/mamba2_controller.py +0 -0
  89. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/mamba_controller/mamba3_controller.py +0 -0
  90. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/memory_manipulation/dynamic_n_controller.py +0 -0
  91. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/memory_manipulation/stochastic_write_head_v2.py +0 -0
  92. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/src/initium/setup_wheels.py +0 -0
  93. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/README.md +0 -0
  94. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/checkpoint/test_checkpoint_roundtrip.py +0 -0
  95. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/checkpoint/test_resume_training.py +0 -0
  96. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/conftest.py +0 -0
  97. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/gradients/test_controller_cell_backward.py +0 -0
  98. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/gradients/test_kl_gradients.py +0 -0
  99. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/gradients/test_moe_aux_loss_gradients.py +0 -0
  100. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/integration/test_controller_matrix.py +0 -0
  101. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/integration/test_dynamic_n_end_to_end.py +0 -0
  102. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/integration/test_moe_integration.py +0 -0
  103. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/integration/test_resize_x_link_matrix.py +0 -0
  104. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/integration/test_split_graph_dnc.py +0 -0
  105. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/smoke/test_inference_smoke.py +0 -0
  106. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/smoke/test_tiny_training_run.py +0 -0
  107. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/unit/test_capabilities.py +0 -0
  108. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/unit/test_checkpoint_io.py +0 -0
  109. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/unit/test_dynamic_n_controller.py +0 -0
  110. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/unit/test_link_matrix_ablation.py +0 -0
  111. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/unit/test_model_loader.py +0 -0
  112. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/unit/test_moe_layer.py +0 -0
  113. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/unit/test_nvrtc_compat.py +0 -0
  114. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/unit/test_real_data_pipeline.py +0 -0
  115. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/unit/test_resize_memory.py +0 -0
  116. {initium_deeplearning-0.1.0 → initium_deeplearning-0.3.0}/tests/unit/test_stochastic_write_head.py +0 -0
@@ -216,3 +216,8 @@ __marimo__/
216
216
 
217
217
  # Streamlit
218
218
  .streamlit/secrets.toml
219
+
220
+ # Experimental documents for context, not to be committed
221
+ documents/*
222
+ dnc-context/*
223
+ tmp/*
@@ -0,0 +1,411 @@
1
+ Metadata-Version: 2.5
2
+ Name: initium-deeplearning
3
+ Version: 0.3.0
4
+ Summary: Differentiable Neural Computer research framework with pluggable LSTM/Mamba/CfC controllers, MoE, split-graph and stochastic write heads.
5
+ Project-URL: Homepage, https://github.com/samueleternity/initium
6
+ Project-URL: Issues, https://github.com/samueleternity/initium/issues
7
+ Author: samueleternity
8
+ License-Expression: GPL-3.0
9
+ License-File: LICENSE
10
+ Keywords: differentiable-neural-computer,dnc,liquid-neural-networks,mamba,pytorch
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Requires-Python: >=3.10
19
+ Requires-Dist: dnc>=1.1.0
20
+ Requires-Dist: ncps>=0.0.7
21
+ Requires-Dist: numpy>=1.26
22
+ Requires-Dist: torch>=2.4
23
+ Provides-Extra: real-data
24
+ Requires-Dist: opencv-python>=4.8; extra == 'real-data'
25
+ Requires-Dist: tokenizers>=0.19; extra == 'real-data'
26
+ Provides-Extra: text
27
+ Requires-Dist: tokenizers>=0.19; extra == 'text'
28
+ Provides-Extra: video
29
+ Requires-Dist: opencv-python>=4.8; extra == 'video'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # Initium
33
+
34
+ Initium is an experimental research framework for combining a Differentiable Neural Computer (DNC)/augmented memory with interchangeable sequence controllers and task/data pipelines. Its central idea is to keep an explicit, addressable external memory while exploring controllers such as LSTM, Mamba-family state-space models, and closed-form continuous-time (CfC) networks. The code also includes stochastic memory-write regularization, sparse expert layers, split-graph models, memory-structure experiments, and checkpoint-driven inference.
35
+
36
+ > **Research status:** Alpha and actively changing. Results below are experiment-specific observations, not guarantees that a configuration will reproduce on another machine, code revision, or dataset. This README is deliberately maintained as a working guide: update it when the code, default configuration, or evidence changes.
37
+
38
+ ## What the project is investigating
39
+
40
+ The project studies how a neural controller can interact with a differentiable external memory on sequential tasks, especially graph traversal. It asks questions at several levels:
41
+
42
+ 1. **Memory and controller:** Can a controller process a sequence and use DNC read/write operations to store and retrieve information needed later?
43
+ 2. **Generalization:** How does performance change between the training curriculum and a held-out or out-of-distribution (OOD) evaluation distribution?
44
+ 3. **Write regularization:** Does placing a probabilistic prior on each memory write improve generalization, and what are the costs or seed-to-seed variations?
45
+ 4. **Compute structure:** Can the controller's sequence computation be parallelized or sparsified while preserving the sequential memory interface?
46
+ 5. **Task breadth and deployment:** Can trained checkpoints be evaluated through a common inference interface across graph, text, audio, video, and multimodal tasks?
47
+
48
+ These are research questions, not all established project claims. In particular, supported dataset interfaces do not imply that every modality has been trained and validated to the same standard as graph traversal.
49
+
50
+ ## Launch
51
+
52
+ You can either fork/clone the repository and customize everything you need or you can use pip/pdm/uv for ready to use installation.
53
+
54
+ Guide for pip usage:
55
+
56
+ To install the whole framework: pip install initium-deeplearning
57
+
58
+ For ANY mamba related operation you need: python -m initium.setup_wheels
59
+
60
+ Optionally you can try:
61
+ pip install "initium-deeplearning[text]"
62
+ pip install "initium-deeplearning[video]"
63
+ pip install "initium-deeplearning[real-data]"
64
+
65
+ To see all CLI optionality:
66
+ initium-infer --help
67
+ python initium.core_training --help
68
+
69
+ Example usage:
70
+
71
+ python -m initium.core_training 0.0 --controller lstm
72
+ python -m initium.core_training 0.0 --split-graph --split-graph-variant mamba1 ...
73
+
74
+ Inference runs need a checkpoint first. The built-in tool analyzes it and refuses unsupported task types or dimensions. Dataset preparation-only mode does not need a checkpoint.
75
+
76
+ ### Reusing prepared datasets
77
+
78
+ Training and inference can save the processed dataset state so the raw source is not parsed or tokenized again. `--save DIRECTORY` writes to `DIRECTORY/<type>/<source> [prepared]/dataset.pkl`; `--load-prepared` accepts that prepared folder (or a save root containing exactly one prepared dataset of the requested type). When loading, `--dataset-link` is optional. Use `--prepare-only` with `--save` to prepare and save a dataset without starting a run:
79
+
80
+ ```bash
81
+ python -m initium.core_training 0.0 --dataset-type text --dataset-link ./corpus.txt --save ./prepared --prepare-only
82
+ python -m initium.core_training 0.0 --dataset-type text --load-prepared "./prepared/text/corpus [prepared]"
83
+ initium-infer checkpoint.pt --dataset-type text --load-prepared "./prepared/text/corpus [prepared]"
84
+ initium-infer --dataset-type text --dataset-link ./corpus.txt --save ./prepared --prepare-only
85
+ ```
86
+
87
+ Prepared artifacts retain the resolved train/test pools or graph mappings, including the split used when they were created. They are Python pickle files and should only be loaded from sources you trust.
88
+
89
+ ## High-level flow
90
+
91
+ ```text
92
+ Configuration and random seed
93
+ │
94
+ ▼
95
+ Dataset registry ──► task episodes / curriculum ──► batch and sequence tensors
96
+ │
97
+ ▼
98
+ Controller + DNC external memory
99
+ ├─ controller processes sequence
100
+ ├─ write head updates memory
101
+ └─ read heads return memory content
102
+ │
103
+ ▼
104
+ task loss + optional KL / MoE auxiliary losses
105
+ │
106
+ ▼
107
+ optimizer, evaluation, logs, checkpoints, curriculum
108
+ │
109
+ ▼
110
+ checkpoint loader ──► task inference ──► metrics and run logs
111
+ ```
112
+
113
+ The training core delegates task construction and task-specific behavior to a dataset interface. The model combines a selected controller with DNC memory operations. During training, the loop computes task and optional auxiliary objectives, updates model parameters, periodically evaluates ID and OOD performance, advances the curriculum when its criteria are met, writes diagnostics, and saves resumable checkpoints. Inference reconstructs a model from a checkpoint, checks that the requested task and dimensions are supported, creates the task runner, and reports episode metrics. Optional inference caches can reuse eligible results or shared prefixes.
114
+
115
+ ## Architecture and major components
116
+
117
+ ### Differentiable external memory
118
+
119
+ The DNC supplies a memory matrix and differentiable read/write interface. The memory can retain information beyond a controller's immediate hidden state. Content-based addressing, read heads, and temporal-link structures are part of the underlying DNC implementation. The temporal link matrix has quadratic cost in the number of memory cells, which motivates the project's link-matrix ablations and memory-size investigations.
120
+
121
+ ### Read/write mechanism roadmap
122
+
123
+ The split-graph memory exposes independent read and write variants while retaining the DNC usage, allocation, write addressing, read modes, and temporal-link machinery:
124
+
125
+ - `--dnc-read-variant cosine` is the DNC baseline. `relational-mlp` replaces cosine similarity with a learned score for each `(query, memory row)` pair. `relational-residual` adds a scaled learned pairwise score to cosine and zero-initializes its final layer, so it starts exactly at the DNC baseline. `--dnc-read-residual-scale` controls that correction's strength (default `1.0`). Track A logs the correction-to-cosine RMS ratio to show whether it contributes meaningfully. Write content addressing remains cosine-based for both learned readers.
126
+ - `--dnc-write-variant learned` is the DNC baseline. `kanerva-closed-form` turns the existing write-value projection into an observation and applies a per-row online isotropic Gaussian posterior update. It does not import the Kanerva Machine's exchangeable episode objective or claim to reproduce its full generative model.
127
+ - The variants compose, so the four baseline / Track A / Track B / combined cells are expressible through the same training and checkpoint pipeline. The closed-form writer uses a deterministic observation projection; the stochastic write head is not installed for that variant.
128
+ - The graph curriculum emits ID, OOD, and OOD-offset metrics as before. Graph runs also write `run_<id>_relational_probe.csv`, with cosine top-1, selected read-head top-1, and held-out-composition accuracy. `data/graph_traversal/order_probe.py` supplies paired prefix-permutation helpers for the Q99 order-sensitivity evaluation.
129
+ - Split-graph graph runs also write `run_<id>_track_a.csv` and `run_<id>_track_b.csv`. Track A records ID/OOD accuracy, relational stress and held-out-composition accuracy, ordinary-input read-score/cosine correlation, and read-content entropy/maximum weight. Track B records the Q99 order-sensitivity gate, ID/OOD posterior variance and write-update diagnostics, and training-window loss, gradient norm, AMP scale, and learning rate. These are experiment logs; no training or evaluation results are checked in.
130
+
131
+ The DNC implementation defaults to `--base-dnc`. `--dnc-fast-allocation` uses the exact allocation implementation that reuses the stock sorted usage permutation and removes its second full sort; `--dnc-compile-memory` compiles the per-timestep memory forward with `torch.compile`. These preserve DNC equations and state-dict keys. `--dnc-allocation-topk K` is an independent approximation that allocates among only the K least-used cells. It can reduce selection work, but omits allocation mass outside the selected cells and may affect learning. `--dnc-link-sharpness [EXPONENT]` is a parameter-free learning variant inspired by arXiv:1904.10278 that sharpens the shape of forward/backward temporal-link reads while preserving their original total mass; it defaults to exponent 2. Both functional variants can be started from a lesson-14 checkpoint. `--optimized-dnc` enables fast allocation and compiled memory forward; for split-graph runs it also defaults to top-64 allocation and exponent-2 link sharpening. Compilation is lazy, so compare sustained steps/s after warm-up. The exact execution options do not remove dense temporal-link cost.
132
+
133
+ `--link-matrix-mode ablated` bypasses temporal-link updates and traversal products, which saves dense link work but removes ordered recall; `sparse_topk` currently masks a dense update and therefore is not a speed optimization. The paper evidence is task-dependent: rsDNC reports that temporal links contribute little on its QA workload, while the original DNC reports sparse links working on copy but link removal failing there. Split-graph traversal chains multiple hops, so link removal stays an isolated comparison, never part of `--optimized-dnc`. Use `--batch-size` to sweep larger episode batches; this can improve utilization but increases memory use and changes gradient noise. Compare equal seeds and optimizer-step budgets, and report both steps/s and steps-to-target accuracy.
134
+
135
+ Gradient checkpointing is omitted from the speed bundle because it saves activation memory by recomputing work in backward. Truncated BPTT is omitted because graph facts needed for a later query can precede it by many steps; detaching DNC state can remove that learning signal. A hybrid scan over guessed addressing weights is plausible mathematically, since memory updates become affine once weights are fixed, but the addressing depends on the evolving memory. It would need an iterative solver and convergence/accuracy evidence; at the current short lesson-1 sequences, its repeated passes may cost more than the sequential loop. These are follow-up research directions rather than robust drop-in optimizations.
136
+
137
+ The paper review supports this staged approach. Sparse Access Memory reports much faster sparse reads/writes, including a temporal-association variant, but it changes the addressing/indexing mechanism and is not a drop-in exact DNC optimization. BPPSA and parallel-scan work apply to linear recurrences; the DNC loop here has a nonlinear read-to-next-write dependency, so parallelizing timesteps would require a changed model. The rsDNC work's slimmer memory and link changes were developed for question answering, and the local link ablation already gives us a direct task-specific control. For now, compilation and exact allocation are the faithful speed tests; sparse addressing remains a distinct research branch.
138
+
139
+ Use the selected split-graph baseline with either supported controller combiner:
140
+
141
+ ```bash
142
+ python -m initium.core_training 0.0 --split-graph --split-graph-variant mamba1 --split-graph-combiner-mode controller --split-graph-combiner-variant cfc
143
+ python -m initium.core_training 0.0 --split-graph --split-graph-variant mamba1 --split-graph-combiner-mode controller --split-graph-combiner-variant mamba+cfc
144
+ ```
145
+
146
+ ### Phase 0 shared workspace (MoE broadcast)
147
+
148
+ The optional `--workspace` path adds a persistent shared slot matrix to a split-graph model with MoE enabled. The final parallel-backbone MoE bank supplies the specialist candidates and its existing noisy top-k routes. At each sequence timestep, selected expert outputs compete for slot writes; a learned RMC-style gate blends proposed slot content with the previous matrix. Every expert in that bank then attends to the updated matrix, and the existing sparse MoE routes combine the context-enriched expert outputs. The workspace resets at the beginning of each episode and persists across its timesteps. The `--moe-backbone-residual-scale` setting scales the complete final-bank delta, including its broadcast contribution, just as it scales the ordinary MoE residuals in the selection-only backbone. The DNC memory uses the same fp32/autocast-disabled path with or without workspace. This is a shared-object broadcast implementation; it does not implement per-recipient translation.
149
+
150
+ Use the Phase 1 matched split-graph/CfC-combiner setup with MoE and the workspace enabled as follows:
151
+
152
+ ```bash
153
+ python -m src.initium.core_training 0.0 --seed 0 --run-id-suffix phase2-workspace-coadapted --split-graph --split-graph-variant mamba1 --split-graph-num-blocks 2 --split-graph-combiner-mode controller --split-graph-combiner-variant cfc --moe --moe-placement all --moe-backbone-residual-scale 0.1 --moe-num-experts 8 --moe-top-k 1 --moe-capacity-factor 1.5 --moe-load-balance-alpha 0.01 --workspace --workspace-num-slots 5 --workspace-train-mode coadapted --total-steps 30000
154
+ ```
155
+
156
+ `--workspace` requires both `--split-graph` and `--moe`. The default is 5 slots, based on Goyal et al.'s shared-workspace reference result; it is a starting configuration, not a claimed optimum for graph traversal. `--workspace-train-mode coadapted` trains the full model. Choose `frozen` to train only workspace parameters while freezing the backbone, MoE/combiner, DNC, stochastic write heads, and task output projection. `--workspace-no-selection` replaces competitive selected writes with random unweighted writes for the no-Selection control. `--workspace-reset-each-step` resets slots before each timestep to test persistence. `--workspace-num-slots 0` bypasses workspace writes and readback, providing a plumbing comparison against the existing MoE model. Run IDs encode these conditions to avoid log/checkpoint collisions.
157
+
158
+ For a frozen-workspace experiment, pass a compatible workspace-disabled baseline checkpoint through `--resume`. Initium detects this case, verifies the saved architecture/settings and shared tensor shapes, loads the matching backbone, MoE, combiner, DNC, stochastic-write, and task-head weights, and keeps the newly added workspace parameters at their fresh initialization. It then resets the optimizer, scaler, RNG streams, training step, and curriculum to step 0 / lesson 1 so the workspace learns across the full curriculum. The checkpoint's final memory size is used to load its weights, then memory is resized to the first lesson's configured size. This warm-start accepts only matching beta/model settings and rejects missing or mismatched non-workspace weights. A checkpoint that already includes workspace state follows the ordinary exact-resume path, including optimizer and progress restoration. Example: add `--resume checkpoints/<baseline-checkpoint>.pt` to the frozen-workspace command above and use a distinct `--run-id-suffix` for the new experiment.
159
+
160
+ The console prints a startup line that reports whether the workspace is active or bypassed, its capacity, write-selection mode, persistence setting, train mode, and active compute precision. Active workspace attention and slot-state updates run in fp32 outside CUDA autocast; zero-slot/closed-gate bypass retains the selection-only path. At the normal training log cadence, `workspace[...]` reports selected write mass and active-write fraction, the learned write-gate mean, slot-state RMS, readback-to-expert-output RMS ratio, and read-gate value. These values show whether the path is active and the relative scale of its write and broadcast signals; they do not by themselves establish a task benefit.
161
+
162
+ The shared object operates on the final backbone MoE bank; earlier backbone MoE layers retain their existing behavior. This is the Phase 0 plumbing target, not evidence that Broadcast improves task performance. The first short run should compare the zero-slot bypass against the same MoE configuration without `--workspace`; only after this plumbing gate should the frozen/co-adapted and no-Selection comparisons begin. Record seed, full command, commit, hardware/software environment, curriculum completion, ID/OOD metrics, convergence steps, and any failures in `07-Experiment/Broadcasting/Progress/Phase-0-Implementation.md`. All current evidence is graph-traversal-specific; transfer across task families remains untested.
163
+
164
+ ### Phase 4 experimental bistable write gate
165
+
166
+ The default `--workspace-gate-variant continuous` preserves the Phase 0–3 sigmoid update. The opt-in `bistable` variant treats each workspace slot as a competing write candidate. It combines the workspace's content-selection score and the MoE route confidence with independent Gaussian background noise, then iterates recurrent self-excitation and lateral inhibition before making a hard write/no-write decision. A straight-through estimator carries gradients through the pre-commit probabilities. This is an experimental adaptation of GNW ignition, not a mechanism implemented by the source neuroscience papers.
167
+
168
+ For the matched gate-only comparison, resume the same five-slot frozen-workspace checkpoint twice. The frozen control updates only the existing continuous `write_gate`; the bistable condition updates only the new recurrent gate parameters. The gate-variant warm start loads shared model/workspace weights, initializes only the new gate, and starts with a fresh optimizer. `--workspace-train-mode coadapted` remains available to train the full model from that same checkpoint as a separate condition. Bistable background noise uses an independent checkpointed RNG stream, so zero-noise and selection-strength ablations do not change the graph episode RNG stream.
169
+
170
+ ```bash
171
+ python -m src.initium.core_training 0.0 --seed 0 --resume <step-8000-workspace-checkpoint.pt> --run-id-suffix phase4-continuous-gate-pilot --split-graph --split-graph-variant mamba1 --split-graph-num-blocks 2 --split-graph-combiner-mode controller --split-graph-combiner-variant cfc --moe --moe-placement all --moe-backbone-residual-scale 0.1 --moe-num-experts 8 --moe-top-k 1 --moe-capacity-factor 1.5 --moe-load-balance-alpha 0.01 --workspace --workspace-num-slots 5 --workspace-train-mode frozen --workspace-train-scope gate --workspace-gate-variant continuous --total-steps 8100
172
+ ```
173
+
174
+ Use the same command, checkpoint, seed, and step budget for the bistable condition, changing the suffix and adding `--workspace-gate-variant bistable`. Gate-only runs use a safety tripwire that aborts before backward/update if any instrumented segment exceeds `--workspace-stability-max-activation` (default `100000`). Segment diagnostics report activation/gradient RMS and maxima; bistable diagnostics additionally report the pre-commit probability histogram (10 bins), low/middle/high occupancy, hard commit frequency, writer frequencies, slot RMS, and readback scale during training and held-out ID/OOD evaluation. A zero-noise ablation uses `--workspace-bistable-noise-scale 0`; selection-strength sweeps use `--workspace-bistable-selection-scale` while holding `--eval-seed` fixed. The gate still samples noise during evaluation unless `--workspace-bistable-deterministic` is supplied.
175
+
176
+ The preregistered operational bimodality check is at least 10% of held-out candidate probabilities below 0.1, at least 10% above 0.9, and at most 20% in [0.1, 0.9], sustained across episodes. Also require finite, nonzero gate gradients, no repeated skipped optimizer updates, and no task or paired-memory-dependency collapse. Run the short stability/pilot budget first; do not start a long Phase 4 run unless the histogram and stability gates pass. Results remain specific to graph traversal and the single available trained model seed.
177
+
178
+ After saving a pilot checkpoint, evaluate that same checkpoint and `--eval-seed` under each `--eval-workspace-mode checkpoint`, `reset-each-step`, and `bypass`. For noise and selection ablations, use the same `--eval-seed` and change only the corresponding bistable scale. The gate RNG is separately checkpointed, so these changes keep the episode stream fixed; use distinct run suffixes when recording each condition.
179
+
180
+ ### MoE numerical and memory-use diagnostics
181
+
182
+ MoE experts now initialize as a zero-output residual branch: each expert's final projection starts at zero, so enabling MoE preserves the original controller signal at step 0 while the output projections learn. Top-1 routing retains the selected expert's probability from the full expert softmax; normalizing a one-expert selected set would turn every gate into 1 and eliminate task-loss gradients to the router. Top-k greater than one continues to normalize over selected experts. The CfC multi-source combiner likewise retains its original affine projection over the concatenated backbone and previous-read inputs; its source-aware experts contribute an additive correction around that baseline. Capacity slots go to the highest-confidence routes rather than the earliest rows in the flattened token batch, avoiding a systematic advantage for the first source when source batches share an expert's capacity. CfC source diagnostics report accepted and dropped route fractions separately for each source at training-log cadence.
183
+
184
+ The SwitchMoE router projection and expert MLPs run in FP32 even when the surrounding model uses CUDA autocast; low-precision inputs receive FP32 MoE outputs so large finite expert values are not converted into fp16 infinities at the residual boundary. Ordinary routing dispatches activations into fixed-capacity per-expert buffers and applies each expert's original Linear parameters directly. It does not expand or gather full expert weight matrices per token. This matters for recurrent controllers: the intermediate batched-weight route materialized a 512×1536 projection matrix for every route and autograd retained those copies across timesteps. With 32 source tokens, one such projection copy was 96 MiB; input and output projections were both affected. Each expert now evaluates its capacity buffer, including any unused capacity rows. Route-expert and route-slot indices are both shaped `(tokens, top_k)` before gathering; this avoids advanced-index broadcasting across unrelated tokens. The workspace's specialist-candidate path intentionally evaluates every expert because broadcast requires all candidates, but it shares the expert parameters instead of copying them per token. Training logs include the fraction of selected routes dropped by capacity. Router and per-source diagnostics stay on-device during recurrent steps and synchronize only when needed for log output. The load-balancing loss is averaged across repeated calls to a recurrent MoE layer (for example, one call per CfC timestep), then summed across distinct MoE layers; its weight no longer scales with episode length.
185
+
186
+ Periodic memory-dependency checks replay the exact random episode batch used by the corresponding memory-on ID evaluation, then restore the RNG streams. This makes `memory on - memory off` a paired functional ablation rather than a difference between two independently sampled batches. The training loop also clips all trainable optimizer parameters, including the task output projection, stops before backward on non-finite forward outputs/losses, reports the first parameter with a non-finite unscaled gradient, logs skipped non-finite-gradient updates, and aborts after eight consecutive such steps instead of continuing a run that is no longer updating safely.
187
+
188
+ The supplied Phase 1/2 traces are pre-fix evidence. One Phase 2 trace first reports a non-finite task loss at step 11,665, recurrent outputs become non-finite at step 11,666, and the process continues to step 14,106 with an AMP scale of zero before manual interruption. Memory-on/off checks in those logs used separate random episode batches, so their small positive or negative differences are not reliable paired evidence. See `07-Experiment/Broadcasting/Progress/Phase-1-MoE-Failure-Analysis.md` for the causal breakdown and re-run gate. Re-run the Phase 1 selection-only condition before Phase 2; keep the proposed 8-expert, top-1 configuration and matched seed/settings fixed while checking finite gradients, per-bank routing, and paired memory dependency.
189
+
190
+ Training console logs now show **one MoE-bank record per 100-step logging window**: route and router-importance fractions by expert, router entropy and maximum probability, input/expert/MoE-delta activation RMS and maximum magnitude, capacity-drop fraction, and accepted gate mass. The `moe_residual:` segment records the complete MoE block output after its skip connection, separately from `moe_delta_rms/max`. A separate `[segment-diag:train]` line reports each recognized module's call count, input/output RMS and max, non-finite fraction, boundary input/output gradient RMS and non-finite fraction, and hierarchical parameter-gradient norms. Boundary gradients are collected during training backward and during failure traces; evaluation remains forward-only. The collector recognizes Mamba and CfC backbones/blocks, Mamba/CfC controller wrappers/blocks/cells, MoE blocks, chained controllers, DNC memory, workspace, and task output; names include their module paths, so the same logger works across supported controller combinations.
191
+
192
+ Split-graph DNC interface transforms, cosine content addressing, usage/allocation, write/read weighting, temporal links, and recurrent memory updates now run in fp32 even when the outer controller uses CUDA autocast. The stock cosine rule divides by the memory/key norm product plus `1e-6`; the instrumented trace showed finite score-side gradients but a non-finite key-side gradient, so fp32 protects that path from low-precision intermediate-gradient overflow. The startup log and checkpoint metadata identify this precision choice. The equations remain unchanged.
193
+
194
+ To inspect DNC internals, add `--dnc-backward-trace` to a split-graph training command. The flag watches gradients at read/write interface values, cosine-addressing scores/logits/softmax, usage, allocation, write weights, temporal links, precedence, recurrent memory, and read vectors, plus the patched CUDA `torch.prod`/`torch.cumprod` outputs and their inputs. It reports every distinct hooked boundary with a non-finite gradient on the first affected optimizer step, rather than stopping after the first hook label, and includes affected batch rows. At the regular logging interval and on failure, `[dnc-numerics:...]` reports memory/read/link magnitudes, read-weight mass violations, and per-product input min/max, fraction below `1e-6`, negative/non-finite fraction, and call count. The flag synchronizes at watched backward boundaries, so use a short diagnostic capture around a known first event. Earlier captures reported their first bad memory-input gradients at steps 1,120 and 626; the matched fp32 validation run below completed 5,000 steps without a bad DNC hook or non-finite-gradient skip.
195
+
196
+ ```bash
197
+ python -m src.initium.core_training 0.0 --seed 0 --run-id-suffix dnc-backward-trace --split-graph --split-graph-variant mamba1 --split-graph-num-blocks 2 --split-graph-combiner-mode controller --split-graph-combiner-variant cfc --moe --moe-placement all --moe-backbone-residual-scale 0.1 --moe-num-experts 8 --moe-top-k 1 --moe-capacity-factor 1.5 --moe-load-balance-alpha 0.01 --total-steps 1800 --dnc-backward-trace
198
+ ```
199
+
200
+ Keep other flags exactly matched to the run being investigated. The fp32 DNC path removed the observed bad-key-gradient pattern in the 5,000-step matched validation capture. That run also acquired strong paired ID memory dependence by step 2,500; see `AI-Architecture-Research/07-Experiment/Broadcasting/Progress/Phase-1-MoE-Failure-Analysis.md` for the complete result and remaining generalization limits. Repeat across seeds before treating the numerical and learning outcomes as robust.
201
+
202
+ Evaluation emits separate channel lines for ID, OOD, memory-off, combiner-stage ablations, and final ID/OOD checks. These summarize the evaluations independently from training windows. If a forward value or gradient becomes non-finite, the current segment window and MoE-bank window are printed immediately before training stops or skips the unsafe update. The summaries aggregate detached device-side scalars and synchronize at log/evaluation boundaries; they do not retain activation graphs.
203
+
204
+ To isolate where split-graph MoE changes the memory-learning transition, `--moe-placement` selects which component receives expert banks while keeping the model, seed, and router settings matched. `all` (the default) preserves the existing behavior; `backbone` enables MoE only in the parallel backbone; `combiner` enables MoE only in the sequential controller combiner. For the CfC combiner, the latter is its source-aware multi-source MoE bank. Component placement requires `--moe --split-graph`; combiner-only additionally requires controller combiner mode. The workspace requires backbone MoE and therefore cannot be combined with combiner-only placement.
205
+
206
+ Run these short, seed-matched diagnostics on the same source revision. Each is capped at 5,000 steps so the usual early memory-use transition can be compared before committing to the full Phase 1 horizon:
207
+
208
+ ```bash
209
+ python -m src.initium.core_training 0.0 --seed 0 --run-id-suffix phase1-smoke-no-moe --split-graph --split-graph-variant mamba1 --split-graph-combiner-mode controller --split-graph-combiner-variant cfc --total-steps 5000
210
+ python -m src.initium.core_training 0.0 --seed 0 --run-id-suffix phase1-smoke-moe-backbone --split-graph --split-graph-variant mamba1 --split-graph-combiner-mode controller --split-graph-combiner-variant cfc --moe --moe-placement backbone --moe-num-experts 8 --moe-top-k 1 --moe-capacity-factor 1.5 --moe-load-balance-alpha 0.01 --total-steps 5000
211
+ python -m src.initium.core_training 0.0 --seed 0 --run-id-suffix phase1-smoke-moe-combiner --split-graph --split-graph-variant mamba1 --split-graph-combiner-mode controller --split-graph-combiner-variant cfc --moe --moe-placement combiner --moe-num-experts 8 --moe-top-k 1 --moe-capacity-factor 1.5 --moe-load-balance-alpha 0.01 --total-steps 5000
212
+ python -m src.initium.core_training 0.0 --seed 0 --run-id-suffix phase1-smoke-moe-all --split-graph --split-graph-variant mamba1 --split-graph-combiner-mode controller --split-graph-combiner-variant cfc --moe --moe-placement all --moe-num-experts 8 --moe-top-k 1 --moe-capacity-factor 1.5 --moe-load-balance-alpha 0.01 --total-steps 5000
213
+ ```
214
+
215
+ Compare the paired memory-on/off dependency, ID/OOD metrics, curriculum progress, per-component segment diagnostics, and per-bank routing/activation summaries. The placement runs distinguish backbone-MoE effects from the CfC multi-source path; the `all` condition checks their interaction. These are diagnostic smoke runs, not evidence of a completed Phase 1 result.
216
+
217
+ For a backbone-only run, `--moe-backbone-block-isolation INDEX` installs an MoE bank after only the selected zero-based parallel-backbone block. The other backbone blocks still run their Mamba/CfC computation but have no MoE; the sequential combiner must also be excluded with `--moe-placement backbone`. The flag is range-checked against `--split-graph-num-blocks`, included in run IDs and checkpoint metadata, and cannot be combined with the workspace broadcast path. For a two-block Mamba backbone, run one isolated condition per block:
218
+
219
+ ```bash
220
+ python -m src.initium.core_training 0.0 --seed 0 --run-id-suffix phase1-moe-backbone-block0 --split-graph --split-graph-variant mamba1 --split-graph-num-blocks 2 --split-graph-combiner-mode controller --split-graph-combiner-variant cfc --moe --moe-placement backbone --moe-backbone-block-isolation 0 --moe-num-experts 8 --moe-top-k 1 --moe-capacity-factor 1.5 --moe-load-balance-alpha 0.01 --total-steps 5000
221
+ python -m src.initium.core_training 0.0 --seed 0 --run-id-suffix phase1-moe-backbone-block1 --split-graph --split-graph-variant mamba1 --split-graph-num-blocks 2 --split-graph-combiner-mode controller --split-graph-combiner-variant cfc --moe --moe-placement backbone --moe-backbone-block-isolation 1 --moe-num-experts 8 --moe-top-k 1 --moe-capacity-factor 1.5 --moe-load-balance-alpha 0.01 --total-steps 5000
222
+ ```
223
+
224
+ `--moe-backbone-residual-scale SCALE` multiplies the active parallel-backbone MoE delta before its residual addition (`backbone_output + SCALE * moe_delta`). Its default is `1.0`, preserving prior behavior. The scale must be finite and non-negative, requires split-graph MoE with `--moe-placement backbone` or `all`, and is included in run IDs/checkpoint metadata. With `all`, this changes only the parallel-backbone MoE residuals; combiner MoE residuals remain at 1.0. It scales the task-loss path through the backbone MoE branch while leaving routing and the load-balancing auxiliary loss active. When workspace broadcast is enabled, the scale applies to the complete final-bank delta after expert readback, including both the selected expert outputs and their broadcast contribution. Workspace slot writes and router/load-balancing calculations remain active at their existing scales. Active workspace attention and slot updates run in fp32 outside CUDA autocast, and split-graph DNC memory math uses its fp32 path in both workspace and selection-only runs. In an isolated-block run, only that block has an MoE residual to scale. For the current block-1 follow-up, use a deliberately conservative 0.1 scale:
225
+
226
+ ```bash
227
+ python -m src.initium.core_training 0.0 --seed 0 --run-id-suffix phase1-block1-residual-scale-0p1 --split-graph --split-graph-variant mamba1 --split-graph-num-blocks 2 --split-graph-combiner-mode controller --split-graph-combiner-variant cfc --moe --moe-placement backbone --moe-backbone-block-isolation 1 --moe-backbone-residual-scale 0.1 --moe-num-experts 8 --moe-top-k 1 --moe-capacity-factor 1.5 --moe-load-balance-alpha 0.01 --total-steps 5000
228
+ ```
229
+
230
+ To test backbone and combiner MoE together after the backbone-only scale control, omit block isolation and select `--moe-placement all`. The residual scale still applies only to the backbone; the combiner MoE keeps its default residual scale of 1.0:
231
+
232
+ ```bash
233
+ python -m src.initium.core_training 0.0 --seed 0 --run-id-suffix phase1-backbone-combiner-backbone-scale-0p1 --split-graph --split-graph-variant mamba1 --split-graph-num-blocks 2 --split-graph-combiner-mode controller --split-graph-combiner-variant cfc --moe --moe-placement all --moe-backbone-residual-scale 0.1 --moe-num-experts 8 --moe-top-k 1 --moe-capacity-factor 1.5 --moe-load-balance-alpha 0.01 --total-steps 5000
234
+ ```
235
+
236
+ Each `moe-bank[backbone.moe_blocks.INDEX ...]` line reports router-selected expert load, router importance, entropy, maximum probability, and capacity-drop rate separately for valid graph timesteps and all-zero padded timesteps. The valid-token mask is derived from the graph input encoding and is diagnostic-only in this experiment: routing, shared capacity, balancing loss, and outputs still include padding, so the run measures the current behavior without applying a padding fix. The per-block isolation changes which banks are active but leaves the routing policy otherwise unchanged. Compare the two blocks' valid/padded distributions and memory-dependency curves against the non-isolated backbone-only trace before deciding whether to test mask-aware routing.
237
+
238
+ Add `--dnc-read-variant relational-mlp` to reproduce the original Track A reader, or `--dnc-read-variant relational-residual --dnc-read-residual-scale 1.0` to use the cosine-anchored Track A reader. Lower scales such as `0.5` are available for follow-up comparisons. Use `--dnc-write-variant kanerva-closed-form` for Track B. Add a reader and writer variant together only for the combined cell after each track is characterized. Dense temporal links remain the default. The short-run baseline reproduction gate and the Q99 paired-order evaluation are deliberate user-run experiment steps; no run results are assumed by this repository change.
239
+
240
+ ### Controllers
241
+
242
+ The training core exposes controller choices through its command-line interface and configuration:
243
+
244
+ - **LSTM:** baseline recurrent controller.
245
+ - **Mamba:** selective state-space controller.
246
+ - **Mamba-2 and Mamba-3:** additional state-space variants; current experiment notes report that these configurations underperformed in earlier tests and need further investigation.
247
+ - **CfC:** closed-form continuous-time controller.
248
+ - **Hybrid chains:** compositions of supported controller stages, such as a Mamba/CfC sequence.
249
+ - **Split-graph:** a parallel sequence backbone plus a separate combiner for the sequential memory-addressing work. It is an experimental way to expose more of the controller computation to parallel execution while retaining the memory interface and currently performs the best out of all options.
250
+
251
+ Some options require optional or hardware-sensitive dependencies, particularly `mamba-ssm` and `causal-conv1d`. A controller being selectable in code should not be read as evidence that it is equally mature or portable on every platform.
252
+
253
+ ### Stochastic writes and KL regularization
254
+
255
+ The write-head extension models a write vector as a diagonal Gaussian. It can sample a write using the reparameterization trick and add a KL penalty to a prior distribution. The implementation supports a fixed standard-normal prior and a learned prior updated from recent write statistics on a periodic, detached snapshot schedule. The loss can include KL annealing and free bits; the learned-prior path logs its snapshot state separately.
256
+
257
+ The intended locality distinction is important: the per-write KL is computed from the current write distribution and a prior snapshot. In the learned-prior variant, the prior itself is fitted from recent writes periodically, outside the per-step gradient path. That makes the overall mechanism periodically data-conditioned even though the per-write calculation uses the current write and frozen prior snapshot.
258
+
259
+ Also KL regularization has specific, uninvestigated behaviour: it tends to stabilize grad_norms allowing the model to not collapse (detected once and needs further investigations) - it was mildly visible in graph-traversal experiments but its full strength occured in multimodal tasks where a model managed to collapse in lesson 14 with beta=0.0, meanwhile with beta=0.001(KL term active) the same model kept going with no issues.
260
+
261
+ ### Other experimental mechanisms
262
+
263
+ - **Mixture of Experts (MoE):** sparse expert feed-forward capacity with routing and load-balancing diagnostics. The current project notes caution that this overhead may be unnecessary or harmful at smaller model sizes; its motivation is future scaling, not a demonstrated benefit for the current compact experiments.
264
+ - **Dynamic memory size (Dynamic-N):** usage-triggered growth of the memory cell array within configured bounds.
265
+ - **Link-matrix options:** ablations or sparsification of temporal-link computation.
266
+ - **Dynamic beta:** an optional bounded controller for the KL weight, distinct from a fixed-beta sweep.
267
+ - **Multimodal and real-data loaders:** interfaces for synthetic and selected real text, audio, video, graph, and multimodal inputs. Their practical coverage and validation are still evolving.
268
+
269
+ ## Repository map
270
+
271
+ | Path | Role |
272
+ | --- | --- |
273
+ | `src/initium/core_training.py` | Dataset-agnostic training loop, CLI, evaluation, logging, checkpointing, and orchestration of model options. |
274
+ | `src/initium/config/` | Training, regularization, controller, and architecture defaults. |
275
+ | `src/initium/data/` | Dataset registry, task episodes, curriculum/data handling, codecs, and real-data utilities. |
276
+ | `src/initium/mamba_controller/` | DNC controller integration, Mamba variants, hybrid controllers, and split-graph implementation. |
277
+ | `src/initium/LNN_controller/` | CfC and hybrid continuous-time controller implementations. |
278
+ | `src/initium/memory_manipulation/` | Stochastic write heads, prior snapshots, memory resizing, link-matrix ablations, and compatibility helpers. |
279
+ | `src/initium/MoE/` | Sparse expert layer and its local usage notes. |
280
+ | `src/initium/inference/` | Checkpoint loading, task registry, inference engine, metrics, logging, and cache support. |
281
+ | `setup_wheels.py` | Environment/dependency setup entry point for specialized wheels. |
282
+ | `pyproject.toml` | Package metadata, base and optional dependencies, and development tooling groups. |
283
+
284
+ ## Setup
285
+
286
+ The PyPI distribution is named `initium-deeplearning`; its Python import package is `initium`. The project targets Python 3.10 or later. Core dependencies are declared in `pyproject.toml`; accelerated state-space controllers may need platform-specific PyTorch/CUDA wheels and additional packages. Install the project and optional task dependencies in an environment appropriate to your hardware. For specialized dependency setup, inspect the repository's `setup_wheels.py` and its help output before running it; GPU package compatibility depends on the installed PyTorch, CUDA, and Python versions.
287
+
288
+ Typical editable installation for development:
289
+
290
+ ```bash
291
+ python -m pip install -e .
292
+ ```
293
+
294
+ Optional dependencies are grouped by modality, for example `text`, `video`, and `real-data` in the project metadata. Audio/video processing may also rely on system tools such as FFmpeg. Mamba-family components can require packages beyond the base install. The default training path is intended to be usable without those optional controller dependencies.
295
+
296
+ The source tree is packaged as `initium`; internal modules use the `initium.*` namespace.
297
+
298
+ ## Training
299
+
300
+ The main entry point is `src/initium/core_training.py`. From the repository root, inspect the available arguments with:
301
+
302
+ ```bash
303
+ python -m initium.core_training --help
304
+ ```
305
+
306
+ The script accepts a positional KL weight (`beta`); omitting it runs the configured beta sweep. It also accepts a random seed and controller/task/architecture options. A representative graph-task run with the Mamba controller and the dynamic-memory/split-graph experiments enabled is:
307
+
308
+ ```bash
309
+ python -m initium.core_training 0.0 --seed 0 --controller mamba --dynamic-n-mode --split-graph
310
+ ```
311
+
312
+ This is an example of the CLI shape, not a universal best configuration. Check `src/initium/config/train_config.py` and `src/initium/config/controller_config.py` for the defaults in the checkout you're running. In particular, training duration, model size, beta sweep, dataset, evaluation cadence, and memory options may have changed since older experiment records were produced.
313
+
314
+ Training runs typically produce:
315
+
316
+ - periodic and final checkpoints, including model, optimizer, random-generator, curriculum, and architecture/prior state needed to resume or evaluate;
317
+ - step-level or periodic logs for task loss, KL, accuracy, OOD evaluation, and training health;
318
+ - additional CSV diagnostics for learned-prior snapshots and optional architecture features;
319
+ - a run identifier that encodes relevant settings to reduce accidental collisions.
320
+
321
+ Keep seeds, source revision, full command, configuration, device/dependency versions, and evaluation protocol with any result you intend to compare. A single final metric is not enough to characterize these experiments: curriculum position, checkpoint step, sampled versus deterministic writes, and evaluation sample count can change the interpretation.
322
+
323
+ ## Evaluation and inference
324
+
325
+ The checkpoint-based inference CLI lives at `src/initium/inference/run_inference.py`. Its help output is the current reference for arguments:
326
+
327
+ ```bash
328
+ python -m initium.inference.run_inference --help
329
+ ```
330
+
331
+ The command accepts a checkpoint, task type, optional data link, episode count, seed, device, and task-specific settings. It can inspect checkpoint capabilities, compare reset and persistent experience modes, report memory-ablation behavior, and optionally configure inference caches. A basic invocation has this form:
332
+
333
+ ```bash
334
+ python -m initium.inference.run_inference path/to/checkpoint.pt --dataset-type graph
335
+ ```
336
+
337
+ The loader checks checkpoint/task compatibility and refuses unsupported task types or dimensions. Graph, text, audio, and video task runners are registered; multimodal execution is also represented in the code but its input dimensions depend on the selected modality combination. Verify the checkpoint's recorded dataset configuration before comparing results across task types.
338
+
339
+ ## Experiments and current evidence
340
+
341
+ The supplied experiment records describe a staged investigation of a KL penalty on DNC memory writes. They are summarized here as results rather than by the names of the individual working files, so this overview can remain useful if those files are renamed or reorganized. -> If anyone wishes to see the original files, you can create an issue and will be contacted afterwards.
342
+
343
+ ### Fixed-prior multi-seed study
344
+
345
+ The first study compared a no-KL anchor with a small fixed-prior KL weight over multiple random seeds with --controller lstm. It found meaningful heterogeneity: several seeds showed non-collapsed OOD gains, some showed little benefit, and two seeds showed genuine reversals. The strongest observed seed improved OOD triple accuracy by roughly 11–12 percentage points over its own anchor. The study therefore supports a **conditional** positive result for the tested configuration, not a claim that the effect is universal or statistically settled. The measured OOD perfect-traversal fraction also did not track triple accuracy uniformly, so the metric definition matters.
346
+
347
+ ### Learned-prior study
348
+
349
+ The follow-up replaced the fixed prior with a prior periodically estimated from recent write statistics. Four deliberately selected seeds were tested: two previous reversal cases and two stronger fixed-prior cases. Outcomes were mixed: the two former reversals improved, one strong case was nearly flat, and the strongest fixed-prior result regressed by about five to six OOD points. Across the four seeds, the mean OOD change was small and not statistically distinguishable from zero; ID accuracy was lower by about 1.1–2.7 points in all four comparisons. Diagnostics did not indicate KL collapse. A regression-to-the-mean explanation is plausible (the reported correlation was large at n=4), but the sample is too small to distinguish that from a true repair of the earlier reversal cases. The structural audit found the learned prior's snapshot update was detached and periodic, with no second online posterior; that is a design characterization, not proof of a generalization benefit.
350
+
351
+ ### Alternate Mamba-controller study
352
+
353
+ A separate study compared beta 0 and beta 0.001 in a Mamba, dynamic-memory, split-graph configuration across five seeds. The logs showed no statistically clear OOD or ID-to-OOD offset improvement from the KL term; beta 0 had a small nominal OOD edge in four of five seeds. The beta 0.001 runs consistently left the first curriculum lesson later. The comparison is provisional: only one seed reached the final curriculum lesson, four runs were unfinished, and there was no wide-evaluation sweep for that batch. This configuration should not be described as a completed replication of the earlier study because its controller, memory size, training budget, and evaluation coverage differ.
354
+
355
+ ### Evidence boundaries and open work
356
+
357
+ - Results above apply to the exact runs and evaluation procedures recorded; they do not establish broad performance across modalities, hardware, or model scales.
358
+ - Phase 1's seed variation and Phase 2's four-seed selection limit aggregate claims. Report per-seed values and uncertainty alongside averages.
359
+ - The learned prior's apparent variance-dampening/mean-reversion effect needs more seeds and controls to separate it from failure-mode-specific repair.
360
+ - The alternate Mamba batch needs completion of unfinished seeds and late-curriculum evaluation before a gate-level conclusion.
361
+ - Mamba-2/Mamba-3 performance, MoE's useful scaling regime, memory-link trade-offs, dynamic memory growth, and real-data/multimodal behavior remain active investigation areas.
362
+ - Experiment status can change. Update this section when new runs are verified; retain the method, sample size, seed set, incompleteness, and uncertainty so summaries do not outrun evidence.
363
+
364
+ ## Research foundations
365
+
366
+ The project draws on several complementary lines of work. These references motivate components and questions; their inclusion does not imply that Initium reproduces each paper's results.
367
+
368
+ ### Differentiable memory and neural sequence models
369
+
370
+ - Graves et al., **“Hybrid computing using a neural network with dynamic external memory.”** DNC memory, differentiable addressing, and the graph-traversal motivation.
371
+ - Hasani et al., **“Closed-form Continuous-time Neural Networks.”** Continuous-time controller design.
372
+ - Gu and Dao, **“Mamba-3: Improved Sequence Modeling using State Space Principles.”** State-space sequence-modeling direction explored by controller variants.
373
+ - Dao and Gu, **“Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality.”** Structured state-space/sequence computation background.
374
+
375
+ ### Delta-rule and state-space improvements
376
+
377
+ - **“Gated Delta Networks: Improving Mamba 2 with Delta Rule.”** Gated delta-rule sequence processing.
378
+ - **“Parallelizing Linear Transformers with the Delta Rule over Sequence Length.”** Parallelization ideas related to sequence-length computation.
379
+
380
+ ### Sparse expert models
381
+
382
+ - Shazeer et al., **“Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer.”** Sparse expert routing foundations.
383
+ - Fedus et al., **“Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity.”** Simplified sparse expert scaling.
384
+ - **“Multi-Rate Mixture of Experts for Accelerating Liquid Neural Network Training.”** Motivation for combining expert computation with liquid-network training.
385
+ - **“MoE-Mamba: Efficient Selective State Space Models with Mixture of Experts.”** MoE and selective state-space combination.
386
+
387
+ ### Stochastic regularization and the DNC baseline
388
+
389
+ - Higgins et al., **“beta-VAE: Learning Basic Visual Concepts with a Constrained Variational Framework.”** Gaussian KL regularization and reparameterized latent sampling adapted here to memory writes.
390
+ - Graves et al., **“Hybrid computing using a neural network with dynamic external memory.”** Baseline memory architecture and task family used by the Q21 study.
391
+ - Additional work on local credit assignment, priors, and continual-learning regularization informed the experiment design and interpretation. Consult the experiment notes for the specific comparisons and caveats.
392
+
393
+ ## Development principles
394
+
395
+ Because the repository is new and research directions are still changing:
396
+
397
+ - Prefer describing mechanisms and measured outcomes over calling a configuration “best” without a scoped comparison.
398
+ - Distinguish implemented, exercised, and validated features. A registry entry is implementation coverage, not empirical validation.
399
+ - Preserve negative and mixed results; record the seed, comparison anchor, metric, evaluation window, and incomplete runs.
400
+ - Keep CLI help, configuration defaults, this README, and experiment records aligned as the project evolves.
401
+ - Treat research papers as motivation and technical background, not as evidence that this implementation matches their methods or results unless a reproduction has been explicitly checked.
402
+
403
+ ## License
404
+
405
+ Initium is distributed under the GNU General Public License v3.0. See [`LICENSE`](LICENSE).
406
+
407
+ ## Publishing to PyPI
408
+
409
+ Package versions come from `__version__` in `src/__init__.py`. After merging a version update into `main`, create a GitHub Release whose tag matches that version (for example, `v0.1.0`). The `Publish to PyPI` workflow builds and validates the wheel and source distribution, then publishes them automatically. It refuses releases whose tag points to a commit outside `main` or whose tag does not match the package version.
410
+
411
+ The PyPI distribution name is `initium-deeplearning`; the source directory and import namespace remain `initium`. The configured PyPI Trusted Publisher should target project `initium-deeplearning` with owner `samueleternity`, repository `initium`, workflow `publish-pypi.yml`, and GitHub environment `pypi`. Publishing uses short-lived OIDC credentials, so no PyPI API token is stored in GitHub.