From Branch 48-from-45-implement-compression-with-error-correction
P1: Correctness and integration issues in ErrorCorrectingMultiScaleAttnNode
This issue tracks the six P1 correctness, numerical-stability, architectural, and integration problems identified in ErrorCorrectingMultiScaleAttnNode.
The scope is limited to the implementation in nodes.py, its integration with graph.py, and any resulting changes to the node-specific FFN configuration in config.py. The established graph architecture, recurrence, LTI injection, ACT halting, and other vetted mechanisms are architectural invariants and should not be redesigned as part of this issue.
Problems to resolve
-
Incomplete diagnosis of NaN gradients
The root cause of the NaN gradients observed during the initial 96-token CPU ablation is deeper than the first-pass remediation concluded. The implementation must be made numerically stable under orthodox BF16 settings; disabling AMP or otherwise bypassing standard numerical paths is not an acceptable fix.
-
Causality violation in the compressed path
The compressed representation may still have access to future tokens, violating the causal-language-model assumption. The compressed path must be audited and corrected so that no future information can influence the representation used for token i.
-
Padding contamination of compressed representations
Padding may be contributing to or biasing the compressed representation. Padding behavior must be verified and corrected so that invalid or padded positions do not affect valid compressed states.
-
Conflation of attention and gradient masks
The current live-mask behavior may conflate the attention mask with the gradient mask. For token i, all causally available tokens in [0, i-1] should be eligible for attention. Separately, gradient computation should include only valid tokens through i-1 within the relevant stride. These two masking purposes must be represented and applied independently.
-
Possible omission of the first multiscale node
Verify whether the first multiscale node can be skipped, fail to execute, or be bypassed by the current graph integration. Confirm that every intended multiscale node is instantiated and executed in the correct order.
-
Duplicative FFN expansion
Audit whether FFN expansion is being applied redundantly between ErrorCorrectingMultiScaleAttnNode, graph.py, and config.py. Determine whether the node-specific FFN expansion must be removed or revised as a consequence of correcting the node integration.
Acceptance criteria
- The intended architecture in the design specification is implemented without altering the established recurrence, LTI injection, ACT halting, or graph semantics.
- The compressed path is demonstrably causal.
- Padding and live-mask behavior are correct and separately defined for attention and gradient computation.
- The first multiscale node is confirmed to execute correctly.
- FFN expansion occurs exactly where intended, with no duplicate node-specific expansion.
- The 96-token smoke-test ablation completes without NaN gradients or runtime failures under BF16.
- Any changes are limited to the node implementation, its graph integration, and directly related configuration or masking code.
This issue does not cover the separate P0 training-log metadata problem or the P2 chunked cross-entropy optimization.
TODO:
| # |
Finding |
Status |
Agent's recommendation |
Action to execute |
| 1 |
Blanket NaN replacement hides genuine corruption |
Confirmed |
Prevent NaNs only for structurally empty attention rows; raise on non-finite values in valid rows. |
Parameterize. Leave the current non-raising behavior as the default. Make “raise on NaN” a training option. |
| 2 |
Compressed path leaks future tokens |
Confirmed |
Replace time-axis adaptive pooling, unrestricted compressed MHA, and nearest-neighbor expansion with causal prefix compression, causal compressed attention, and causal expansion. |
Recommendation affirmed. |
| 3 |
Padding biases compressed summaries |
Confirmed |
Use torch.where, valid-token sums and counts, and compressed-position validity masks. |
Recommendation affirmed. |
| 4 |
Attention and loss masks are conflated |
Confirmed in four dataset paths |
Keep overlap tokens visible in attention_mask; mask them only in labels. |
Recommendation affirmed. |
| 5 |
Root multiscale node is skipped |
Confirmed by inspection |
Remove root-node cache prepopulation; execute roots with raw x. Add a forward hook. |
Recommendation affirmed. |
| 6 |
FFN expansion is duplicated |
Confirmed |
Remove the multiscale node’s output FFN; retain its correction FFN and the graph-owned SwiGLU. |
Recommendation affirmed. |
| 7 |
Training progress metadata disappears |
Confirmed control-flow consequence |
Non-finite batches continue before set_postfix; also prevent an all-skipped epoch from reporting zero loss. |
Set to P2 and this proposed change is still being investigated and will be executed later with the other P2 issue. |
| 8 |
Chunked cross-entropy absent |
Confirmed, deferred |
Do not implement until the corrected 96-token ablation passes. |
Recommendation affirmed; defer to P2. |
From Branch 48-from-45-implement-compression-with-error-correction
P1: Correctness and integration issues in
ErrorCorrectingMultiScaleAttnNodeThis issue tracks the six P1 correctness, numerical-stability, architectural, and integration problems identified in
ErrorCorrectingMultiScaleAttnNode.The scope is limited to the implementation in
nodes.py, its integration withgraph.py, and any resulting changes to the node-specific FFN configuration inconfig.py. The established graph architecture, recurrence, LTI injection, ACT halting, and other vetted mechanisms are architectural invariants and should not be redesigned as part of this issue.Problems to resolve
Incomplete diagnosis of NaN gradients
The root cause of the NaN gradients observed during the initial 96-token CPU ablation is deeper than the first-pass remediation concluded. The implementation must be made numerically stable under orthodox BF16 settings; disabling AMP or otherwise bypassing standard numerical paths is not an acceptable fix.
Causality violation in the compressed path
The compressed representation may still have access to future tokens, violating the causal-language-model assumption. The compressed path must be audited and corrected so that no future information can influence the representation used for token
i.Padding contamination of compressed representations
Padding may be contributing to or biasing the compressed representation. Padding behavior must be verified and corrected so that invalid or padded positions do not affect valid compressed states.
Conflation of attention and gradient masks
The current live-mask behavior may conflate the attention mask with the gradient mask. For token
i, all causally available tokens in[0, i-1]should be eligible for attention. Separately, gradient computation should include only valid tokens throughi-1within the relevant stride. These two masking purposes must be represented and applied independently.Possible omission of the first multiscale node
Verify whether the first multiscale node can be skipped, fail to execute, or be bypassed by the current graph integration. Confirm that every intended multiscale node is instantiated and executed in the correct order.
Duplicative FFN expansion
Audit whether FFN expansion is being applied redundantly between
ErrorCorrectingMultiScaleAttnNode,graph.py, andconfig.py. Determine whether the node-specific FFN expansion must be removed or revised as a consequence of correcting the node integration.Acceptance criteria
This issue does not cover the separate P0 training-log metadata problem or the P2 chunked cross-entropy optimization.
TODO:
torch.where, valid-token sums and counts, and compressed-position validity masks.attention_mask; mask them only in labels.x. Add a forward hook.set_postfix; also prevent an all-skipped epoch from reporting zero loss.