summaryrefslogtreecommitdiff
path: root/research/flossing/run_trm_cf_abcd.sh
blob: 3086f67cbd977abe59eebc02a7e8f369ca0cc8e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# TRM CF experiments from step_260410 (final ckpt, baseline acc ~0.77).
# A: α=10 λ*=0       (universal default, like ABCDEF on HRM)
# B: α=10 λ*=+0.03   (保护 TRM succ 区间)
# C: α=1  λ*=0       (gentler α)
# D: α=0  baseline   (just continue training, no CF)
set -e
cd /home/yurenh2/rrm/research/flossing
source /home/yurenh2/miniconda3/etc/profile.d/conda.sh
conda activate rrm
export CUDA_VISIBLE_DEVICES=0

CKPT_ROOT="/home/yurenh2/rrm/trm/checkpoints/Sudoku-extreme-1k-aug-1000-ACT-torch/pretrain_mlp_t_sudoku_singleGPU"
# Start from step_26041 (epoch 5K, acc 0.576, succ λ=-0.036 HRM-like margin) — 8/8 attractor 还没结构化
# 这是 TRM 唯一 succ 有 -0.04 margin、CF λ*=0 完全 vacuous on succ 的 ckpt
SRC_CKPT="step_26041"

run_cf() {
  local TAG=$1; local ALPHA=$2; local LSTAR=$3
  local OUT=step5_${TAG}_trm_${SRC_CKPT}_alpha${ALPHA}_lstar${LSTAR}.json
  local LOG=step5_${TAG}.log
  if [ -f "$OUT" ]; then echo "skip $TAG"; return; fi
  echo "[$(date '+%H:%M:%S')] Starting $TAG (α=$ALPHA λ*=$LSTAR) from $SRC_CKPT" >> step5_runner.log
  python step5_train_trm_cf.py \
    --ckpt-root "$CKPT_ROOT" --ckpt-name "$SRC_CKPT" \
    --n-steps 500 --batch-size 8 \
    --alpha-rf $ALPHA --rf-mode fixed --lambda-star $LSTAR \
    --k-lyap 2 --lyap-act-steps 4 \
    --eval-every 100 --eval-n 512 --eval-batch-size 32 \
    --out $OUT > $LOG 2>&1
  echo "[$(date '+%H:%M:%S')] $TAG done" >> step5_runner.log
}

run_cf D 0    0
run_cf A 10   0
run_cf B 10   0.03
run_cf C 1    0

echo "[$(date '+%H:%M:%S')] All TRM CF conditions complete" >> step5_runner.log