Initial release: code for WCL2026-1544 (context-aware embedding masking via DRL)

This commit is contained in:
Ki-Ho Lee
2026-06-22 17:31:32 +09:00
commit 8b7f70d650
26 changed files with 3445 additions and 0 deletions
+61
View File
@@ -0,0 +1,61 @@
#!/bin/bash
# =========================================================
# run_drl_improvements.sh
# DRL performance-improvement experiments to close the gap
# to MAML at U=4. Each run: 200 epochs, saves to
# results_improve/<tag>/.
# Expected wall-clock per run on M-series Mac (MPS): ~15-25 min.
# =========================================================
set -e
cd "/Users/kyo/Documents/AY/논문/5. WCL-DRL"
EMB="bert_agnews_8000.pt"
PY="/opt/anaconda3/bin/python"
OUT="results_improve"
mkdir -p "$OUT"
COMMON_ARGS=(
--mode drl --embed-file "$EMB"
--users 4 --mux-factor 4
--epochs 200 --steps-per-epoch 200
--eval-trials 200
--det-eval-trials 32
)
# ---- A: Baseline (reproduces the existing 200ep run with the same seed)
echo ">>> [A] baseline (log_std_init=-1.0, rank=64)"
$PY Code/drl_mask_policy.py "${COMMON_ARGS[@]}" \
--log-std-init -1.0 --rank 64 \
--save-dir "$OUT/A_baseline" \
2>&1 | tee "$OUT/A_baseline.log" | tail -3
# ---- B: Reduced sigma (log_std_init = -2.0 → sigma ~ 0.14)
# Reduces the ~0.12 stochastic-sample bias that we measured.
echo ">>> [B] low-sigma (log_std_init=-2.0, rank=64)"
$PY Code/drl_mask_policy.py "${COMMON_ARGS[@]}" \
--log-std-init -2.0 --rank 64 \
--save-dir "$OUT/B_lowsigma" \
2>&1 | tee "$OUT/B_lowsigma.log" | tail -3
# ---- C: Higher rank (r=128) for more expressive mask generator
echo ">>> [C] higher-rank (log_std_init=-1.0, rank=128)"
$PY Code/drl_mask_policy.py "${COMMON_ARGS[@]}" \
--log-std-init -1.0 --rank 128 \
--save-dir "$OUT/C_rank128" \
2>&1 | tee "$OUT/C_rank128.log" | tail -3
# ---- D: Combination: low-sigma + higher-rank (recommended)
echo ">>> [D] combo (log_std_init=-2.0, rank=128)"
$PY Code/drl_mask_policy.py "${COMMON_ARGS[@]}" \
--log-std-init -2.0 --rank 128 \
--save-dir "$OUT/D_combo" \
2>&1 | tee "$OUT/D_combo.log" | tail -3
# ---- E: Low sigma + larger PPO batch (richer updates per policy step)
echo ">>> [E] low-sigma + larger ppo-batch (log_std_init=-2.0, rank=64, B=128)"
$PY Code/drl_mask_policy.py "${COMMON_ARGS[@]}" \
--log-std-init -2.0 --rank 64 --ppo-batch 128 \
--save-dir "$OUT/E_bigbatch" \
2>&1 | tee "$OUT/E_bigbatch.log" | tail -3
echo "=== All runs finished. Now analyze: ==="
echo " $PY Code/analyze_drl_improvements.py"