jgrusewski
eeeb4e0a90
feat(generalization): #31 bottleneck — experience collector + backward kernels
Complete temporal causal bottleneck implementation across all GPU paths:
Experience collector (data collection):
- Loads bn_tanh_concat_kernel from utility cubin
- Bottleneck GEMM + tanh + concat runs per timestep before Q-forward
- Same 2D compression as training → consistent Q-values for action selection
- Buffers: exp_bn_hidden [N, bn_dim], exp_bn_concat [N, concat_dim]
Backward pass (gradient kernels):
- bn_tanh_backward_kernel: d_bn = d_concat * (1 - tanh^2)
Reads saved tanh values from forward, applies derivative
- bn_bias_grad_kernel: db_bn = sum(d_bn, dim=0) via atomicAdd
- dW_bn via cuBLAS launch_dw_only: d_bn^T @ states[:, :market_dim]
- All gradients accumulate into grad_buf at tensors 20-21
The 2D bottleneck is now end-to-end:
Forward: states → W_bn GEMM → tanh → concat → h_s1 → ... → Q-values
Backward: d_logits → ... → d_h_s1 → d_concat → d_bn (tanh') → dW_bn, db_bn
Experience: states → bottleneck → Q-forward → action selection → env step
Set bottleneck_dim=2 to enable. Default: 0 (disabled, backward compatible).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 09:54:47 +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-01 22:47:39 +01:00
2026-03-30 09:54:47 +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-29 16:18:37 +02:00
2026-03-01 22:47:39 +01:00
2026-03-13 10:18:35 +01:00
2026-03-29 21:32:04 +02:00
2026-03-29 22:35:37 +02:00
2026-03-29 22:35:37 +02:00
2026-03-15 11:59:31 +01:00
2026-03-29 19:18:47 +02: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-29 16:18:37 +02: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-01 22:47:39 +01:00
2026-03-15 11:59:31 +01:00
2026-03-01 22:47:39 +01:00
2026-03-03 22:16:35 +01:00