# EEG-sAAD optimization board

## CURRENT_BEST
- Train mean: focal↔synth + held temperature, H 0.8844 / Acc 83.38.
- Hardest train fold AVGC: H 0.8245 / Acc 75.64.
- External: linear_hp30, AASD H 0.6422 / Acc 53.12; Carta H 0.6520 / Acc 60.54.

## FORBIDDEN
- Source of truth: `multi_agent_opt/ALREADY_TRIED.md`.
- Closed: Group-DRO/CVaR, IRM, focal/mixup/BCE retunes, PCGrad, SAM, CORAL,
  DANN/SSL, switch-schedule fine-tuning, logit calibration/stacking/gating,
  high-pass grids, V-REx from IRM/focal stem, and previously logged classifier
  backbones.

## ACTIVE_RUN
- None. Round 2 is closed by its pre-registered D0/PAD gates.

## RESULTS_LOG
- R2-3 PAD Step 0 completed and failed its proceed gate. KUL dry/dichotic
  normal Acc1 **73.59%**, `dom:=0` **69.80%** (−3.79 pt); KUL HRTF normal
  **75.18%**, `dom:=0` **70.90%** (−4.27 pt). HRTF−dry was only **+1.58 pt**
  (<2 pt), and dominance ablation hurt both conditions. On report-only
  external labels, `dom:=0` also reduced AASD **54.71→53.25%** and Carta
  **59.91→58.65%**. `proceed=false`; no PAD retrain. Artifacts:
  `results/research/pad_diag.json` and
  `runs/r2_pad_diag_20261107/{metrics.json,run.log}`.
- R2-D0 match–mismatch diagnostic completed on five LODO datasets plus
  AASD/Carta. In-domain subject-mean M/M accuracy was **0.5574**; AASD was
  **0.5932** (deficit **−0.0358**, gate requires ≥+0.05 deficit), Carta
  **0.5774**. AASD subject Spearman(M/M, steady attention) was **0.4530**
  and Carta **0.5148** (diagnostic only). The pre-registered route is
  **ceiling**: skip R2-1/R2-2 and run only R2-3 PAD. Artifacts:
  `results/research/mm_diag.json` and
  `runs/r2_d0_mmdiag_20261107/{metrics.json,run.log}`.
- T3 CF-Null diagnostic passed strongly (AASD rho 0.9765, Carta rho 0.8652),
  but honest SW2 fine-tune (lambda 0.1, seed 0, 4x250 steps, all five folds
  plus all5 external) was non-improving: LODO mean H **0.7880** / Acc
  **71.74**; AASD H **0.6367** / Acc **52.35**; Carta H **0.6428** /
  Acc **58.57**. Stopped before seeds 1-3. Artifacts:
  `runs/t3_cfnull_diag_20261107/metrics.json`,
  `runs/t3_cfnull_train_20261107/metrics.json`, and
  `results/research/cfnull_l0p1.json`.
- T2 ESR final (`t2_esr_20261106`, no train): LODO mean H 0.7489 / Acc 71.91;
  AASD H 0.607 / Acc 50.68; Carta H 0.543 / Acc 50.35; gates PASS. CLOSED,
  non-competitive vs tip/target. `runs/t2_esr_20261106/metrics_final.json`,
  `HANDSHAKE_T2_ESR_DONE.md`.
- T2 ESR-stem (`t2_esr_20261106`) full 5-fold + all5 external completed:
  1500 steps, batch 512, K=8. Structural gates pass exactly
  (`max|f(x)+f(-x)|=0`, position agreement 1.0). LODO mean H **0.7489** /
  Acc **71.91** (AVGC 0.6998/68.55); AASD H **0.6073** / Acc **50.68**;
  Carta H **0.5429** / Acc **50.35**. Honest but non-improving; closed.
  Artifacts: `results/research/stem_esr.json`,
  `runs/t2_esr_20261106/{metrics.json,full_run.log}`, `models/stem_esr/`.
- T1 Step A (`t1_latency_20261106`) completed on all AASD trials (18 subjects,
  900 trials), 4 frozen SW2 seeds, lag −16…+16 samples at 32 Hz. Peak is
  **0 samples / 0 ms**, subject-mean acc1 **0.53977** (median 0.54103);
  no nonzero lag improves over zero and `over_2se=false`. There is no fixed
  conversion-offset evidence, so causal lag-bank Step B is skipped. Artifacts:
  `results/research/lagbank_diag.{json,csv}` and
  `runs/t1_latency_20261106/{metrics.json,run.log}`.
  Carta peak is −1 sample / −31.25 ms, acc1 0.60441 vs 0.59908 at zero
  (Δ+0.00532, bootstrap SE 0.00447), also below the >2 SE gate.
- Focal x V-REx hybrid (`vrex_focal_20261106`) completed exit 0: LODO mean H 0.8636 /
  Acc 81.91; synth fuse H 0.8769 / Acc 82.99 (SUSPECT column-0 stem); AASD H 0.6222 /
  Acc 50.99; Carta H 0.5397 / Acc 47.98. FAIL external, non-improving, closed.
  **STOP stem V-REx variants** (no more init/λ tweaks). NEXT stays T1 -> T2.
  Artifacts: `runs/vrex_focal_20261106/metrics.json`, `HANDSHAKE_VREX_FOCAL_DONE.md`.
- V-REx stem (`vrex_stem_20261106`) completed exit 0: LODO mean H 0.8652 /
  Acc 82.10; synth fuse H 0.8794 / Acc 83.03 (SUSPECT column-0 stem);
  AASD H 0.6196 / Acc 51.10; Carta H 0.5412 / Acc 47.99. Closed as
  non-improving externally. Artifacts:
  `runs/vrex_stem_20261106/metrics.json`, `HANDSHAKE_VREX_DONE.md`.
- Group-DRO result discovered complete: raw mean H 0.8609 / Acc 81.54; synth
  fuse H 0.8743 / Acc 82.73; AASD H 0.6217 / Acc 51.23; Carta H 0.5459 /
  Acc 48.25. Closed as non-improving.
- V-REx focal-init (`vrex_focal_20261106`) completed exit 0: raw LODO mean
  H 0.8636 / Acc 81.91; synth fuse H 0.8769 / Acc 82.99; AASD H 0.6222 /
  Acc 50.99; Carta H 0.5397 / Acc 47.98. Closed. Like every stem result,
  these LODO numbers are **SUSPECT** until the GAP-01 oddness/position gates.
  Artifacts: `runs/vrex_focal_20261106/`.

## NEXT_ACTION
- Round 2 closed. Do not run MM-TTA/SAA/PAD retraining: their gates failed.
  AASD Acc>63 is likely infeasible under the present causal/data constraints;
  any further round requires a new claim that changes the task-level evidence
  limit, not another front-end adaptation or dominance/readout retune.


## INVENTORY_READY  (2026-11-06)
Agents: ĐỌC TRƯỚC khi claim/chạy. Handshake 1 trang: `experiments/multi_agent_opt/HANDSHAKE_INVENTORY.md`.

- **Inventory**: `/root/disk_3tb/eeg-thao/experiments/multi_agent_opt/00_inventory.md` (đọc người) và
  `/root/disk_3tb/eeg-thao/experiments/multi_agent_opt/00_inventory.json` (máy đọc; `forbidden_methods[]`, `gaps`,
  `best_metrics`, `train_entrypoints`, `eval_entrypoints`, `data_paths`). Script sinh: `_build_inventory_json.py`.
- **FORBIDDEN = 79 mục** (JSON `forbidden_methods`): 48 closed_negative, 11 closed_no_gain, 11 in_stack (dùng nguyên trạng,
  không re-tune), 7 integrity_suspect (không chạy lại), 2 kept_open (semi-Markov B1, learned rule B3).
  Mục `FORBIDDEN` ở trên + `multi_agent_opt/ALREADY_TRIED.md` vẫn hiệu lực; inventory là bản đã gom.
- **Metrics (H là phân số, Acc %)**

  | Loại | Cấu hình | LODO mean H / Acc | AASD H / Acc | Carta H / Acc |
  |---|---|---|---|---|
  | TRUSTED (antisym) | 4 dec + 4 clf `sw2`, a 0.5, p_stay 0.998 | **0.7981** / 73.30 | 0.6329 / 52.11 | 0.6427 / 58.73 |
  | TRUSTED real best | `linear_hp30` (HP tau 30 s) | 0.7899 / 69.21 | 0.6422 / 53.12 | 0.6520 / 60.54 |
  | TRUSTED Acc tip | `tip_fuse_a0.50@SW2emis` | — | 0.6453 / **54.05** | 0.6488 / 60.60 |
  | SUSPECT (cột-0) | focal-IRM↔synth + `held_T_nll_med` (đang ghi CURRENT_BEST) | 0.8844 / 83.38 (AVGC 0.8245/75.64) | 0.6224 / 51.18 | 0.5556 / 49.51 |
  | SUSPECT (cột-0) | `causal_eeg_nested_lodo` | 0.8834 / 83.45 | 0.6224 / 51.18 | 0.5556 / 49.51 |
  | SUSPECT (cột-0) | `stem_ms96` công bố (nested) | 0.8677 / 82.42 | 0.6158 / 51.54 | 0.5695 / 51.03 |

  **CẢNH BÁO CURRENT_BEST**: mục `CURRENT_BEST` ở đầu file (0.8844/83.38) là số SUSPECT chưa xác thực đối xứng;
  KHÔNG dùng làm mốc "honest". Mốc honest train = 0.7981.
- **GAP-01 (critical) — cột-0 / stem asymmetry**: họ `stem_ms96` (mọi H 0.86–0.884) dùng tầng 2 KHÔNG phản đối xứng
  (nhãn `y=(att==0)`, bias zero-init, đệm 0 đầu trial, absolute position embedding). Audit mạng tương đương: LODO
  0.863→0.827 khi đối xứng hoá; real Carta chỉ 0.55. Chưa ai chạy swap-cột / symmetrise / position-invariance cho bất kỳ
  stem nào trong workspace. Tầng 2 mới BẮT BUỘC `f(-x) = -f(x)`: không bias, không pos-embedding, không đệm 0; báo cáo kèm
  kiểm tra đổi cột. Không dùng ID dataset/subject/trial, thứ tự cột, vị trí trong trial, lịch switch.
- **GAP-03 (high) — AASD Acc ceiling ~54**: >150 biến thể hậu xử lý (T, isotonic, stack, gate, CORAL, HMM) đều ≤ 54.05
  (AASD acc1 0.50–0.54). Trần là chất lượng EEG view/decoder, không phải readout/decision layer.
  Đừng thêm tip-fuse post-processing; cần front-end EEG mới (claim riêng).
- **GAP-02 (critical, nhắc)**: LODO synthetic không dự đoán real; báo cả hai, chỉ chấp nhận khi CẢ HAI tăng.
- **TARGET reminder**: train: mean H ≥ 0.85 và Acc ≥ 78 (từng dataset, AVGC còn thiếu ≈ −0.0255 H / −2.4 Acc);
  external: **AASD (ASSD) Acc > 63**, **Carta Acc > 60** (inventory reading 2: cả H lẫn Acc; reading 1: H>0.63 & Acc>60).
  Hiện: AASD Acc max 54.05 (thiếu ≈ −9), Carta 60.60 (đạt Acc, chỉ bằng `linear_hp30`/tip xattn). Chưa mô hình nào đạt
  đồng thời train + cả hai external.
- **Không sửa/chạy lại**: ACTIVE_RUN `vrex_stem_20261106` ở trên là họ stem → kết quả của nó phải qua kiểm tra
  đối xứng (GAP-01) trước khi được coi là cải thiện.

## PENDING_PROPOSALS  (technique-designer, 2026-11-06)
Full text: `experiments/multi_agent_opt/01_technique_proposals.md`; machine-readable: `01_technique_proposals.json`
(`candidates[]`, `top3`, `gates`, `acceptance_rule`). None claimed, none running. Orchestrator: claim one ID at a time in
`multi_agent_opt/CLAIMS.md`, take `multi_agent_opt/gpu.lock` for GPU steps.

New fact behind the ranking: in all 5 training corpora `att_col == 0` for 100 % of samples of 100 % of trials, and the
synthetic LODO schedule always starts unswapped with a first segment ≥ 30 s. The stem family can read "time since trial
start" as the label, which explains SUSPECT 0.88 LODO and Carta Acc 49–51. Honest LODO baseline stays **0.7981**.

| Rank | ID | Technique | Track | Effort | Status |
|---:|---|---|---|---|---|
| 1 | T1 | LagBank-Sel: latency audit + causal within-trial stimulus lag-bank on frozen `sw2` classifiers | evidence, inference-only | low (~3 GPU h) | PENDING |
| 2 | T2 | ESR-stem: exactly odd, position-free stem trained on resynthesised schedules (random start sign, 4–90 s dwell, lag ramps) | 2nd stage | medium (~2 GPU h) | PENDING |
| 3 | T3 | CF-Null: counterfactual-null regulariser (mismatched EEG → logit 0) + causal null-debias | evidence, train+inference | medium (~9 GPU h) | PENDING (diag gate ρ ≥ 0.25 first) |
| 4 | T4 | Lapse-aware label cleaning from offline bidirectional OOF teacher | evidence, train | medium-high | PENDING |
| 5 | T5 | In-trial distractor ranking (past-envelope reference) | inference-only | low | PENDING |
| 6 | T6 | Lookahead reallocation: classifier-only stack at 0.96 s | retrain | medium | PENDING |
| 7 | T7 | Weight soup across seeds × folds | inference-only | low | PENDING |

Gates for every candidate (fail = do not report as improvement): column swap `|f(x)+f(−x)| < 1e-5`; position invariance
(prepend 60 s → ≥ 99 % same decisions after 60 s); `leakage_test.py` ≤ 0.969 s. Accept only if, paired by seed, AASD and
Carta H rise ≥ 0.005 each and honest LODO drops ≤ 0.01. AASD/Carta labels never select hyperparameters (T1 step A reads
them only as a diagnostic).

## STATUS
- 2026-11-06 22:30 +07 — technique-designer: proposals T1–T7 written; no training run; no file outside
  `experiments/multi_agent_opt/` modified. Recommended next claim: **T1 step A** (inference-only diagnostic, cheapest,
  decides whether AASD's near-chance Acc is a latency/alignment problem).
- Feasibility note: under the gates, a valid LODO H ≥ 0.85 needs about +5–6 pt frame accuracy in the evidence.
  The decision-layer space is closed. The joint target (LODO 0.85/78 + AASD > 63 + Carta > 60) may not be reachable
  honestly; T1/T3 are the candidates that could move external Acc, and T2 is the one that could move honest LODO.
- `vrex_stem_20261106` (ACTIVE_RUN) is stem family: its numbers need the GAP-01 gates before comparison.

## PROPOSALS_READY  (2026-11-06)
Agents: ĐỌC TRƯỚC khi claim. Handshake 1 trang: `experiments/multi_agent_opt/HANDSHAKE_PROPOSALS.md`.
- Proposals: `/root/disk_3tb/eeg-thao/experiments/multi_agent_opt/01_technique_proposals.md` (+ `.json`: `candidates[]`, `top3`, `gates`, `acceptance_rule`).
- Top-3: **T1** LagBank-Sel (latency audit + causal stimulus lag-bank, inference-only) · **T2** ESR-stem (exactly odd, position-free, resynth schedule) · **T3** CF-Null (counterfactual-null reg + debias; diag ρ ≥ 0.25 trước).
- Finding: `att_col == 0` cho 100 % mẫu/trial ở cả 5 corpus train + schedule LODO luôn bắt đầu unswapped (đoạn đầu ≥ 30 s) → họ stem đọc được "thời gian từ đầu trial" = shortcut. Honest LODO baseline = 0.7981 / 73.30; 0.884 là SUSPECT.
- Gates: column swap `|f(x)+f(−x)| < 1e-5`; position invariance (prepend 60 s, ≥ 99 % agreement); `leakage_test.py` ≤ 0.969 s.
- **NEXT_ACTION (bắt buộc):** sau V-REx (`vrex_stem_20261106`) → **T1 latency diagnostic (Step A)** → **T2 ESR-stem**.
  **KHÔNG claim bất kỳ metric stem nào (V-REx/stem/IRM/ESR) trước khi qua column-swap audit (GAP-01).**

## PENDING_PROPOSALS_R2  (technique-designer, 2026-11-07)
Full text: `experiments/multi_agent_opt/02_technique_proposals_r2.md`; machine-readable: `02_technique_proposals_r2.json`
(`key_findings`, `shared_gate_D0`, `candidates[]`, `rejected[]`, `top3`, `order`). No training run. None claimed, none running.
Focus: AASD Acc +9 without tip-fuse post-processing.

New facts (labels + frozen SW2 evidence only):
- AASD trials are 58 s; key-press switches have a **median dwell of 8.9 s** (19 % of segments < 5 s); Carta 25 s. An oracle detector
  delayed by 5 s scores only **61.1 %** on AASD (4 s → 67.6 %).
- Frozen SW2 evidence crosses chance about 3.5 s after a switch; learned pooling `tw` is near-flat (centroid 4.4–4.7 s before window end).
  The steady AASD 10-s accuracy is **0.60** (Carta 0.64, in-domain acc10 0.69–0.78). An oracle 3-s latency cut lifts AASD only to ~56 %.
- Calibrated simulation: AASD Acc > 63 needs **steady accuracy ≈ 0.78 on AASD** (DTU in-domain level, ~3× today's d′) plus a ~2-s read-out.
  A within-trial linear decoder with *oracle* labels gives only 0.59–0.62 (`adapt_within_trial.csv`), so per-trial linear adaptation is dead.
- Probability of AASD > 63 this round: < 10 %. Realistic combined gain: +2…+5 Acc.

| Rank | ID | Technique | Lever | Status |
|---:|---|---|---|---|
| gate | D0 | Label-free match–mismatch tracking diagnostic (frozen nets; f(E,s,s_past) for both streams): shift vs ceiling | decides route | PENDING (~20 min GPU) |
| 1 | R2-1 | MM-TTA: per-trial label-free match–mismatch test-time adapter (zero-init low-rank EEG spatial map, re-fit from zero on last 30 s) | d′ | PENDING |
| 2 | R2-2 | SAA: stimulus-anchored alignment (causal Procrustes of the EEG×(A+B) auditory pattern onto the population pattern) | d′ | PENDING (frozen screen first) |
| 3 | R2-3 | PAD: presentation-aware dominance (dichotic-consistent `dom`; KUL dry vs HRTF in-domain test first) | d′ | PENDING (Step 0 diag first) |
| 4 | R2-4 | MC-mask TTA (in-distribution channel/cluster masks ×16) | variance | stack only |
| 5 | R2-5 | SR-Pool + LODO-fast (short re-pool of per-position logits) | latency multiplier | companion only; readout-family warning |

Acceptance: gates pass (column swap, position, leakage ≤ 0.969 s, per-trial state reset + bounded buffer); paired by seed
AASD Acc ≥ +1.0 & H ≥ +0.005, Carta Acc ≥ −0.3, honest LODO H drop ≤ 0.01; AASD/Carta attention labels never select.
**NEXT_ACTION (R2):** claim **D0** → if "shift": R2-1 seed 0 on LODO then external (+ R2-2 screen on CPU); if "ceiling": R2-3 Step 0, then
report AASD > 63 as infeasible under the rules.
