Repository navigation
Commit b2b0643
Add atol to test_within_transformer output comparison
Summary:
`test_within_transformer` compares the static-attention transformer against the MHA transformer with `torch.isclose(rtol=1e-3)` and the default `atol=1e-8`, which is effectively a pure relative tolerance. Some output logits land near zero (~7e-4), where float noise of ~3e-7 is already a large fraction of the relative budget. The margin depends on which GEMM kernel MKL picks: on master the worst relative error is 3.2e-4 to 6.3e-4 with the default path and 9.5e-4 with `MKL_CBWR=COMPATIBLE`, just under the 1e-3 limit.
D129776559 (pytorch/pytorch#197785) makes `Vectorized<float>::exp_u20()`, used by the CPU SDPA softmax, more accurate, which shifts the MHA output enough to cross the limit on CI hosts.
Add `atol=1e-5`, matching `test_sliding_window_chunked_prefill` in the same file. The largest absolute error observed is 3.6e-7, while a real attention regression moves outputs far more than 1e-5. This is independent of the PyTorch change and can land before the DiffTrain import.
Authored with assistance from Claude.
Differential Revision: D1301288601 parent 9aa28d6 commit b2b0643
1 file changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
253 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
254 | 256 | | |
255 | 257 | | |
256 | 258 | | |
| |||
0 commit comments