Two ghost-feature fixes from the pre-L40S cleanup audit (tasks #66
and #68 tracked internally).
### #66 — delete apply_accumulated_gradients (dead code from removed path)
The agent-audit confirmed this function is residue from a prior
Candle-gradient-tracking training path that was REMOVED (see the
now-deleted test crates/ml/tests/test_var_source_gradients.rs which
was `#[ignore]`'d with the comment "Candle gradient tracking removed
-- DQN/PPO use custom CUDA backward passes"). Evidence:
- `DQN::optimizer: Option<GpuAdamW>` is always `None` — never
initialised anywhere in the codebase.
- `DQN` uses `OwnedGpuLinear` + `NoisyLinear` with standalone
`CudaSlice<f32>` BY DESIGN (see comment at branching.rs:988-989
"this layout exists to avoid a GpuVarStore intermediate"). There
is no GpuVarStore to feed GpuAdamW.
- Zero external callers for `DqnTrainer::apply_accumulated_gradients`,
`DQN::apply_accumulated_gradients`, `RegimeConditionalDQN::
apply_accumulated_gradients`, or the various `optimizer_vars()`
wrappers.
- The only test exercising this path was `#[ignore]`'d with the
"Candle gradient tracking removed" rationale.
- Production training goes through the fused CUDA trainer
(`trainers/dqn/fused_training.rs`) which applies gradients into a
flat `params_buf` — a separate, live path.
Deleted: 6 functions across 3 files + the stale test. Preserving a
ghost that has zero callers, zero initialisation path, and a design
direction explicitly chosen AWAY from its premise is not "keep and
wire" — it's accumulating fiction. Per feedback_no_functionality_
removal.md the rule preserves FUNCTIONAL features; this wasn't one.
### #68 — TFT honest error message
Audit found TFT is architecturally incompatible with GpuAdamW in its
current form (not a wiring gap, an architectural absence):
- `TemporalFusionTransformer` has no GpuVarStore, no `parameters()`,
no `named_parameters()` accessor
- Internal layers use `StreamLinear` which has NO `backward()`
- `TFTModel` trait only exposes `forward()`, `get_config()`,
`clear_cache()` — no gradient accessor
- `TemporalFusionTransformer::train()` runs forward + accumulates
loss but never calls backward or optimizer step
- `TrainableTFT` adapter's `backward()` explicitly returns "not
supported — use TFTTrainer::train() instead"
The previous error string "TFT optimizer not yet migrated to
GpuAdamW" implied 99% done and a simple constructor wiring would
finish it. Actual gap: GpuVarStore threading through 5+ layers +
StreamLinear→GpuLinear migration + backward ops for softmax
attention / layer norm 3D / quantile monotonicity chain / stack +
trait extension for var_store accessor + train-loop gradient
assembly. ~3-7 day dedicated architectural project.
New error message states this explicitly so no one wastes time
chasing an "almost migrated" fiction. Full-lift tracked separately.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>