jgrusewski
875f263ec9
feat(bf16): f32 backward dX scratch + bf16 staging — eliminates dX truncation
Backward pass dX computation now uses f32 scratch buffers with bf16
staging for the backward chain. Pattern: f32 GemmEx → relu_mask (f32) →
f32→bf16 cast → next layer reads bf16 dY.
Changes:
- 6 bw_d_h_* scratch buffers: CudaSlice<half::bf16> → CudaSlice<f32>
- New bw_dy_bf16_staging: shared bf16 buffer for layer transitions
- backward_fc_layer dX: gemmex_bf16 → gemmex_bf16_acc_f32 (f32 output)
- launch_dx_only: gemmex_bf16 → gemmex_bf16_acc_f32 (f32 with beta)
- relu_mask_kernel: reads/writes f32 (no bf16 clamp needed)
- f32_to_bf16_cast_kernel: ±500 clamp at type boundary (in backward_kernels.cu)
- cast_dx_to_staging: f32 scratch → bf16 staging per layer
- IQN/ensemble backward: bf16→f32 cast for dX input, f32→bf16 for dY output
- bw_d_h_s2_as_bf16(): attention backward receives bf16 via staging
Hyperparameters updated for f32 Adam:
- learning_rate: 1e-5 → 1e-4 (updates must exceed bf16 shadow step ~1e-3)
- adam_epsilon: 1e-3 → 1e-8 (standard Adam, bf16 workaround no longer needed)
- grad_norm NaN skip kept as defense-in-depth (source still under investigation)
895/895 unit + 359/359 ml-dqn tests pass.
7-11/11 smoke tests (intermittent NaN from unknown source — NOT backward dX).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 12:17:04 +02:00
..
2026-03-13 10:18:35 +01:00
2026-03-27 19:52:44 +01:00
2026-03-12 19:10:18 +01:00
2026-03-14 11:35:15 +01:00
2026-03-13 10:18:35 +01:00
2026-03-13 10:18:35 +01:00
2026-03-29 12:17:04 +02:00
2026-03-13 10:18:35 +01:00
2026-03-13 10:18:35 +01:00
2026-03-13 10:18:35 +01:00
2026-03-28 12:13:45 +01:00
2026-03-13 10:18:35 +01:00
2026-03-29 09:48:44 +02:00
2026-03-28 01:51:45 +01:00
2026-03-28 01:51:45 +01:00
2026-03-15 11:59:31 +01:00
2026-03-27 00:33:05 +01:00
2026-03-19 00:39:03 +01:00
2026-03-13 10:18:35 +01:00
2026-03-13 10:18:35 +01:00
2026-03-28 13:11:47 +01:00
2026-03-16 21:01:28 +01:00
2026-03-13 10:18:35 +01:00
2026-03-13 10:18:35 +01:00
2026-03-13 10:18:35 +01:00
2026-03-10 13:18:57 +01:00
2026-03-28 01:51:45 +01:00
2026-03-13 10:18:35 +01:00
2026-03-13 10:18:35 +01:00
2026-03-13 10:18:35 +01:00
2026-03-18 00:53:47 +01:00
2026-03-14 11:35:15 +01:00
2026-03-15 11:59:31 +01:00