experiments/
├── cross_model_convergence.py # E1: 跨模型谱收敛流水线
├── emergence_detection.py # E3: 能力涌现谱突变检测
├── visualization_direction9.py # 可视化模块
├── run_direction9_experiments.py # 统一运行脚本
└── DIRECTION9_GUIDE.md # 本文档
source venv/bin/activate
python experiments/run_direction9_experiments.py
# 运行 E1 + E3 + 可视化
python experiments/run_direction9_experiments.py --all
# E1: 基础谱收敛验证
python experiments/run_direction9_experiments.py --experiment E1
# E3: 能力涌现检测
python experiments/run_direction9_experiments.py --experiment E3
# 仅生成可视化
python experiments/run_direction9_experiments.py --visualize
目的: 验证不同模型对同一文本集的 r_eff 是否随模型能力增大而收敛
输出:
output/cross_model/e1_result.json - 完整结果output/cross_model/e1_summary.md - 摘要报告output/figures/rs_cross_comparison.png - RS_cross 对比图output/figures/spd_heatmap_*.png - SPD 热力图配置: 在 run_direction9_experiments.py 中修改 run_experiment_e1() 函数
目的: 检测 r_eff 曲线中的突变点,关联能力涌现
输出:
output/emergence/emergence_results.json - 完整结果output/emergence/emergence_summary.md - 摘要报告output/figures/emergence_curves.png - 涌现曲线图配置: 在 run_direction9_experiments.py 中修改 run_experiment_e3() 函数
from experiments.cross_model_convergence import CrossModelConvergence, ExperimentConfig
config = ExperimentConfig(
models=["llama3.2-3b-instruct", "Mistral-7B-v0.3", ...],
model_paths={...},
datasets=["gsm8k", "math", ...],
output_dir="output/e1"
)
analyzer = CrossModelConvergence(config)
result = analyzer.run_experiment_e1()
from experiments.emergence_detection import EmergenceDetector
detector = EmergenceDetector(
model_sequence=[...],
model_paths={...},
model_mmlu={...},
output_dir="output/e3"
)
results = detector.run_full_analysis(
abilities=["cot_reasoning", "arithmetic", ...]
)
r_effs: 各模型在各数据集上的有效秩rs_cross: 跨模型谱方差(核心指标)spd_matrices: 模型间谱距离矩阵r_eff_curve: 能力轴上的 r_eff 变化曲线changepoints: 检测到的突变点位置rs_cross_comparison.png: RS_cross 跨域分层对比spd_heatmap_*.png: SPD 模型间谱距离热力图emergence_curves.png: 能力涌现 r_eff 曲线summary_dashboard.png: 实验摘要仪表盘在 run_direction9_experiments.py 中修改:
MODEL_SEQUENCE = [
..., # 现有模型
"your-model-name" # 新增
]
MODEL_PATHS = {
...,
"your-model-name": "model/weights/your-model"
}
MODEL_MMLU = {
...,
"your-model-name": 75.0 # 近似 MMLU 分数
}
# 下载数据
python database/download_direction9_datasets.py --dataset your_dataset --sample-num 500
然后在实验配置中添加数据集名称。
降低 batch_size:
config = ExperimentConfig(..., batch_size=4)
已自动处理,如仍有问题检查模型是否有有效 eos_token。
运行前置检查确认数据集存在:
python experiments/run_direction9_experiments.py
| 实验 | 模型数 | 数据集数 | 预估时长 |
|---|---|---|---|
| E1 | 5 | 5 | ~2 小时 |
| E3 | 5 | 4 能力 | ~1.5 小时 |
实际时长取决于 GPU 性能和文本数量。