fix: OFI_DIAG reads new canonical indices [42..62), remove state_dim from evaluate_baseline

- OFI_DIAG now reads positions [42..62) using OFI_START constant instead of
  hardcoded [66..74). Verified: raw_mean=0.0891, delta_mean=-0.0370,
  book_agg=0.4500, log_dur=-0.2303 (was all zeros before).
- Removed 3 stale state_dim field initializers from evaluate_baseline.rs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-04-20 15:33:42 +02:00
parent 66bc8d12e5
commit 882497caa4
4 changed files with 8 additions and 10 deletions

View File

@@ -1 +0,0 @@
{"sessionId":"4d4aa47f-4eb8-44d0-9d38-840da6e33fc0","pid":173970,"acquiredAt":1776019129035}

View File

@@ -889,7 +889,6 @@ fn evaluate_dqn_fold(
// must match exactly, otherwise checkpoint loading fails (tensor shape mismatch).
#[allow(clippy::integer_division)]
let config = DQNConfig {
state_dim: args.feature_dim,
num_actions: args.num_actions,
hidden_dims: {
let base = hp_usize(hp, "hidden_dim_base").unwrap_or(256);
@@ -1059,7 +1058,6 @@ fn evaluate_dqn_fold_gpu(
#[allow(clippy::integer_division)]
let config = DQNConfig {
state_dim: args.feature_dim,
num_actions: args.num_actions,
hidden_dims: {
let base = hp_usize(hp, "hidden_dim_base").unwrap_or(256);
@@ -1366,7 +1364,6 @@ fn evaluate_ppo_fold_gpu(
// ── Build PPO config matching training ───────────────────────────────
#[allow(clippy::integer_division)]
let config = PPOConfig {
state_dim: args.feature_dim,
num_actions: 63,
policy_hidden_dims: {
let base = hp_usize(hp, "hidden_dim_base").unwrap_or(256);

View File

@@ -1941,15 +1941,17 @@ impl DQNTrainer {
);
}
// OFI feature diagnostic (every 10 epochs)
// OFI feature diagnostic (every 10 epochs).
// Layout per state_layout.rs: OFI at [42..62) = raw[42..50) + delta[50..58) + book_agg[58] + log_dur[59] + accel[60] + toxicity[61].
if (epoch + 1) % 10 == 1 {
if let Some(ref fused) = self.fused_ctx {
match fused.read_state_sample(0) {
Ok(sample) if sample.len() > 83 => {
let ofi_raw: &[f32] = &sample[66..74];
let ofi_delta: &[f32] = &sample[74..82];
let book_agg = sample[82];
let log_dur = sample[83];
Ok(sample) if sample.len() >= ml_core::state_layout::STATE_DIM => {
let ofi_start = ml_core::state_layout::OFI_START;
let ofi_raw: &[f32] = &sample[ofi_start..ofi_start + 8];
let ofi_delta: &[f32] = &sample[ofi_start + 8..ofi_start + 16];
let book_agg = sample[ofi_start + 16];
let log_dur = sample[ofi_start + 17];
info!(
"OFI_DIAG: raw_mean={:.4}, delta_mean={:.4}, book_agg={:.4}, log_dur={:.4}",
ofi_raw.iter().sum::<f32>() / 8.0,