mirror of
https://github.com/wassname/ml-debug.git
synced 2026-09-26 14:00:26 +08:00
1 line
2.3 KiB
JSON
1 line
2.3 KiB
JSON
{"root_cause":"The reshape is reinterpreting contiguous memory instead of swapping tensor axes, so features or tokens are being mixed across the batch dimension. The leading cause is a tensor-layout bug introduced by replacing transpose/permute with reshape.","confidence":0.98,"evidence":["Observation: validation example 3 changes when unrelated examples in the same batch are replaced.","Observation: shapes remain valid, so shape checks cannot detect the corruption.","Observation: single-example inference looks normal, which is expected when cross-example mixing is hidden by batch size 1.","Observation: the refactor replaced a transpose with a reshape solely because the output dimensions matched.","Inference: reshape preserves linear storage order and cannot generally implement an axis permutation.","Inference: the batch-dependence strongly localizes the error to unintended mixing across the batch axis."],"competing_hypotheses":["Unmasked batch-coupled computation such as BatchNorm or attention across examples could cause the same symptom, but the transpose-to-reshape change is much stronger direct evidence.","Mutable cache or shared state keyed incorrectly across examples is possible, but less likely because the failure began after a tensor-layout refactor."],"first_action":"Run a batch-independence dependency test: compute the selected output scalar for example 3, backpropagate it to the batched input, and assert that gradients for every other batch element are exactly zero; repeat after restoring the explicit transpose/permute. This mechanically localizes cross-example mixing and verifies the proposed cause.","prediction_if_true":"With the reshape, the selected output for example 3 will have nonzero gradients with respect to at least one unrelated batch element; replacing it with the intended transpose/permute will eliminate those gradients and make example 3 invariant to batch companions.","prediction_if_false":"The selected output will have zero gradients to unrelated inputs despite changing with batch companions, pointing instead to non-differentiable shared state, batch-dependent normalization, caching, randomness, or an error in the test setup.","immediate_changes":["Replace the reshape with the explicit transpose/permute required by the semantic axis mapping."],"fallback_logic":[]} |