Skip to content
VovyHPublic

About

IPD: Iterative-Prompt Distillation

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

IPD · Iterative Prompt Distillation

IPD 让教师用优化后的提示词指导学生,再用默认提示词评估学生。每轮先为每个源任务选出一个用户提示词,再从相同权重分别蒸馏系统提示词候选,根据默认提示词下的源任务得分决定保留哪组权重。

统一运行与对比入口(run.py)

仓库根目录提供统一调度入口 run.py,直接路由至经过验证的原始实验脚本(保真复现论文协议,支持 --dry-run 预览完整命令):

export PROMPT_DISTILL_MODEL_ROOT=/data/wuyuhang/projects/models/backbone

# 1. Review Analysis(0.6B 学生 + 8B 优化器,支持 cluster / random 两种采样对照)
python3 run.py review --sampling cluster --seed 42 --out runs/review_cluster_s42
python3 run.py review --sampling random  --seed 42 --out runs/review_random_s42

# 2. 单领域 0.6B 四方法对照(medmcqa / bigbench / grounding × ipd / metaspo_eval / gepa / sft / baseline)
python3 run.py domain --domain medmcqa --method ipd --seed 42

# 3. 跨任务迁移 0.6B IPD(global / ner × cluster / random)
python3 run.py transfer --domain global --sampling cluster --seed 42

# 4. 0.6B 同更新步数参数训练对照(GRPO / 直接 LoRA / IPD+LoRA)
python3 run.py paired --method grpo --mode train --domain amazon --seed 42
python3 run.py paired --method lora --mode train --domain amazon --seed 42

# 5. Qwen3.5-9B 自进化对照(ipd / metaspo / gepa / default)
python3 run.py self-evolution --method ipd --domain global

# 6. 汇总本地已归档结果
python3 run.py summarize

任何子命令前加上 --dry-run(如 python3 run.py --dry-run domain --domain medmcqa --method ipd --seed 42)可只打印真实执行的脚本与工作目录而不启动训练。

实验结果

结果按 方法 → 模型 → 实验 存放在 results/:

实验 结果入口 提示词或配置
0.6B 主实验(Domain 与 Global) IPD · MetaSPO · GEPA · Default IPD 逐轮提示词 · Table 2 提示词 Demo
0.6B 相同步数训练对照 GRPO · 直接 LoRA · IPD 后再做 LoRA 训练脚本
9B 自进化(seed 42,B50) IPD · MetaSPO · GEPA · Default 9B 代码 · 运行流水日志
历史对照 8B 学生实验 · 早期 Review LoRA-SFT SFT 协议

目录结构

目录 / 文件 用途
run.py 统一 CLI 入口,便于跨方法对比与一键复现
train.py / infer.py Review Analysis 训练(支持 --sampling {random,cluster})与推理入口
prompt_distill/ IPD 核心实现(已合并 cluster_batches.py,消除重复代码)
experiments/ 单领域、跨任务迁移、9B 自进化、GRPO/LoRA 对照与公共模块
results/ 所有方法的指标表、逐题 result.json 与实验报告
prompts/ 各方法迭代出的提示词 Demo 与固定 10UP 测试模板
runs/ 训练后的 Checkpoints(ipd-0.6b-cluster/、ipd-0.6b-review-sft/、ipd-9b-selfopt/、grpo-0.6b/、ipd-lora-0.6b/)及 loss/(loss 曲线与统计)
docs/ · analysis/ 方法公式、训练指南、预算与耗时分析
tests/ 19 项 CPU 单元测试(python3 -m unittest discover -s tests -v)

第三方来源见 THIRD_PARTY.md。

About

IPD: Iterative-Prompt Distillation

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages