| # ProbeShift |
|
|
| > *ProbeShift: A Systematic, Label-free Benchmark for the OOD Directional Stability of Linear |
| > Probes under Label-preserving Semantic Shift, with a Unified Evaluation of A-priori Predictors.* |
| > |
| > 投稿目标:ACML 2026 主会。定位:**benchmark-first**(见 [PROPOSAL.md](PROPOSAL.md))。 |
| > 预算锚:单卡 4090 ≤ 200 GPU·h、LLM API <$100、零新人工标注。 |
|
|
| ## 核心贡献(benchmark-first,见 PROPOSAL.md) |
|
|
| - **G1(主)ProbeShift 基准**:concept(≥12)× shift(paraphrase/domain/length)× size(Pythia ladder |
| + GPT-2 + Qwen)× estimator(LogReg/mass-mean/MLP)的网格,记录 **解耦的** accuracy-drop 与 direction |
| cosine-rotation 作为 ground truth。完全免新标注;随激活缓存发布,分钟级复现。 |
| - **G2(主)统一 a-priori 预测信号评测**:在同一基准上 head-to-head 评测现有 label-free 训练前信号 |
| —— **SIP**(eigengap)、**RAPTOR-stability**、**Fragility**、**augmentation-robustness**、**Xie |
| feature-dispersion** —— 对探针 OOD 方向 drop 的预测力(Spearman/Kendall + leave-one-concept-out CV)。 |
| - **G3(次)PAC 入选项**:简单、IID-only、免 OOD 数据的双分量复合分数(dispersion ⊕ augmentation- |
| consistency),作为基准上的一个 entry,做互补性消融。**不宣称 SOTA。** |
| - **支撑**:estimator × size 外部效度;本地 NLI 的 label-fidelity sanity check。 |
|
|
| > 关键 framing:G1+G2 即使 PAC 毫无增量也独立成立 —— 把"赛道很挤"从威胁转成贡献。 |
| > 所有竞品均经直连 arXiv 核实为真(见 [PRIOR_ART.md](PRIOR_ART.md) §四),并已转化为 baseline。 |
|
|
| ## Pipeline |
|
|
| ``` |
| extract 一次性抽取 residual-stream 激活,float16 分片缓存 (唯一大头 GPU) |
| eval 训练 LogReg/mass-mean/MLP 探针,IID/OOD accuracy + 方向旋转 (读缓存) -> G1 ground truth |
| predict 对每个 config 计算全部 a-priori 预测器(SIP/Fragility/.../PAC)(读缓存) -> G2 信号 |
| score PAC 双分量明细 + 互补性消融 (读缓存) -> G3 |
| stats 每个预测器 vs 真实 OOD drop 的 Spearman/Kendall + LOCO 排名表 (读缓存) -> G2 主结果 |
| ``` |
|
|
| **关键设计:激活只抽一次、落盘、之后全部读缓存** —— 这是整个项目守住算力预算 + 可复现的命门。 |
| 缓存可直接随论文发布,reviewer 几分钟即可复现探针实验。 |
|
|
| ## 安装 |
|
|
| ```bash |
| cd probe_stability |
| python -m venv .venv && source .venv/bin/activate # 或用 conda |
| pip install -r requirements.txt |
| ``` |
|
|
| ## 最小可行实验(M2 go/no-go,Day 3) |
|
|
| 一条命令在单模型单数据集上验证"探针脆性"是否存在(OOD drop + 方向旋转): |
|
|
| ```bash |
| python run_pipeline.py smoke --model EleutherAI/pythia-410m --dataset sst2 |
| ``` |
|
|
| 若代表性概念上 **OOD drop < 5pt 或方向 cosine > 0.9**(探针根本不脆)→ 触发退路:切提案② |
| (Demonstration Order Illusion),M0/M1 基础设施可复用。 |
|
|
| ## 全量运行 |
|
|
| ```bash |
| python run_pipeline.py extract --all # 抽取所有 (model,dataset,distribution) 激活 |
| python run_pipeline.py eval --all # 训练探针 + IID/OOD + 旋转矩阵 (G1 ground truth) |
| python run_pipeline.py predict --all # 计算全部 a-priori 预测器 (G2 信号) |
| python run_pipeline.py score --all # PAC 双分量明细 + 互补性消融 (G3) |
| python run_pipeline.py stats # 多预测器 vs OOD drop 排名表 (G2 主结果;读全部结果) |
| ``` |
|
|
| ## 目录结构 |
|
|
| ``` |
| probe_stability/ |
| ├── README.md |
| ├── requirements.txt |
| ├── config.py # 模型/数据/shift 注册表 + 路径 + 超参 |
| ├── cache.py # 激活分片的命名/保存/mmap 读取 + manifest |
| ├── metrics.py # accuracy / 方向旋转 / Spearman / bootstrap CI / Cliff's delta / Holm-BH |
| ├── probes.py # LogReg / mass-mean / MLP / control-task 探针 |
| ├── stability_score.py # dispersion + augmentation-consistency |
| ├── extract_activations.py # HF 模型 hooks,residual-stream 抽取 + float16 分片落盘 |
| ├── run_pipeline.py # CLI 编排 M1–M5 |
| └── data/ |
| ├── __init__.py |
| ├── datasets.py # 统一加载 HF 数据集 -> (text, label, concept) |
| ├── shifts.py # label-preserving shift 构造(back-translation / domain / length) |
| └── label_fidelity.py # DeBERTa-MNLI 过滤 label-flip |
| ``` |
|
|
| ## 状态 |
|
|
| 骨架代码:核心数据流、缓存、探针、Stability Score、指标已实现;以下处标注 `TODO` 待在 4090 上迭代: |
| back-translation 模型选型与显存调参、各数据集 domain-shift 配对、MLP 探针方向旋转的处理。 |
| `PROPOSAL.md` / `PRIOR_ART.md` 由研究工作流产出后补入。 |
|
|