Downloads · 30 days
0
yueqy111222/visllm
visllm is a machine learning model from yueqy111222. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
本目录是一个与官方源码隔离的实验框架。它只读使用 ILVR 的定制 Transformers 和训练类,不修改:
Downloads · 30 days
0
Access
Public
Updated Oct 22, 2026
Repo size
34.5 GB
Likes
0
Public
Click a slice to open those files.
.safetensors16.6 GB · 48%
From the Hugging Face model README
本目录是一个与官方源码隔离的实验框架。它只读使用 ILVR 的定制 Transformers 和训练类,不修改:
../../ILVR../../mlrm-LEAD../comt-test本实验不使用早期的图像 two-pass 方案。原有 Monet/CoMT answer-teacher 三个实验仍只在推理时使用熵控制;新增的 CoMT/Monet Stage2 实验会在训练 rollout 中用熵决定 latent 位置,但都不加载 EMA teacher 或辅助图像。
默认评测矩阵训练两个 Monet-SFT-125K 模型:
monet_ilvr:完全使用官方 ILVR EMA teacher query。monet_answer_teacher:student batch 与模型 1 相同,仅在 EMA teacher 选择 helper patches 时增加标准答案表示。另有一个独立的 comt_answer_teacher 训练:只把数据切换为 CoMT,标准答案仍仅供 EMA teacher 使用,student 不可见。三个训练过程都不使用熵控制;熵控制只在训练完成后的推理/评测阶段启用。
每个模型分别进行:
natural:模型自然生成 <|latent_start|>;entropy:高熵且满足窗口/冷却条件时,单次生成中强制 <|latent_start|>,之后的固定 8 个 latent hidden-state feedback 继续由官方 ILVR generation loop 完成。评测包括 VStar、HR-Bench 4K、HR-Bench 8K 和 MME-RealWorld-Lite,共 16 个条件。
官方 shuai22/comt_ckpt 另有三组不训练对照,每组覆盖上述 4 个实际评测条件:
natural:官方 ILVR baseline,只允许模型自然生成 <|latent_start|>;entropy:允许自然生成,也允许熵阈值强制生成 <|latent_start|>;entropy_only:正常文本生成时屏蔽 <|latent_start|>,只允许熵阈值强制进入 latent。默认路径来自 comt-test/REMOTE_RUN.md:
/high_perf_store2/users/shanhao/visllm/
ILVR/
model/ # 官方 shuai22/comt_ckpt 权重
mlrm-test/ # 本实验目录(本地 visllm 的对应位置)
ILVR-main/ # 官方 ILVR 源码(本地 F:\BUAA\yzx\code\ILVR)
mlrm-LEAD/
base-model/
qwen2.5-vl-7b-instruct/
Qwen3-30B-A3B-Instruct-2507/ # HR-Bench 官方判分 LLM
data/
comt/
Monet-SFT-125K/
benchmark/
scripts/ # 三个 benchmark 发布的评测源码
vstar_bench/
HR-Bench/
MME-RealWorld-Lite/data/
官方 checkpoint 与 benchmark 路径已分别固定为:
/high_perf_store2/users/shanhao/visllm/ILVR/model/high_perf_store2/users/shanhao/visllm/benchmark训练和评测模型输出路径位于 ILVR/mlrm-test/outputs,不需要提前创建。
所有命令都在前台运行。常规 ILVR 脚本会激活 /root/miniconda3 下的
ilvr 环境并设置离线 Hugging Face 环境变量;下面单独说明的 LVR 外部
基线使用隔离解释器,不注入 ILVR Transformers。
LVR 代码和权重位于本项目之外:
/high_perf_store2/users/shanhao/visllm/lvr
/high_perf_store2/users/shanhao/visllm/lvrmodel
LVR 可以复用 ilvr 环境中的 PyTorch/CUDA/FlashAttention,但不能加载
ILVR-main/transformers/src。当前 LVR 源码固定使用 stock
transformers==4.54.0,因此先建立不修改共享 ilvr 环境的轻量 overlay,
再执行预检和评测:
cd /high_perf_store2/users/shanhao/visllm/ILVR/mlrm-test
export CONDA_BASE=/root/miniconda3
bash scripts/setup_lvr_eval_overlay.sh
bash scripts/preflight_lvr_vstar.sh
CUDA_VISIBLE_DEVICES=0 bash scripts/run_lvr_vstar.sh
overlay 安装是一次性联网/本地 wheel 步骤;正式 worker 保持离线。若已下载 Transformers wheel,可用:
LVR_TRANSFORMERS_SPEC=/absolute/path/to/transformers-4.54.0-py3-none-any.whl \
bash scripts/setup_lvr_eval_overlay.sh
冒烟测试只跑 1 条、16 个 latent steps:
RUN_TAG=lvr7b-vstar-smoke LVR_LIMIT=1 LVR_STEPS=16 \
CUDA_VISIBLE_DEVICES=0 bash scripts/run_lvr_vstar.sh
正式运行不要复用 smoke 的 RUN_TAG。默认会分别评测 4/8/16 个 latent
steps,输出到 outputs/lvr_vstar/<UTC-RUN_TAG>/,包含 preflight.log、
run.log、resolved_config.json、三个逐样本 JSON 和 metrics.json。
显式复用 OUT_ROOT 时,脚本只允许运行身份完全相同且已有 step JSON
样本数完整的断点重算;否则拒绝混合结果。
这里复现的是 LVR 作者的自回归生成 + 选项字母 exact-match 协议,不是本项目
VStar 的 option-token cross-entropy 正式适配器,二者分数不能直接横向比较。
三个 LVR 脚本都不会 source scripts/common.sh,也不会修改 LVR/ILVR 源码。
当前数据布局不需要继续解压:VStar 已是目录,HR-Bench 的 .tsv 和 .parquet 都是数据文件,MME-RealWorld-Lite 已解压到 data/。在远端检查:
ls -lh /high_perf_store2/users/shanhao/visllm/benchmark/vstar_bench/test_questions.jsonl
ls -lh /high_perf_store2/users/shanhao/visllm/benchmark/HR-Bench/hr_bench_4k.parquet
ls -lh /high_perf_store2/users/shanhao/visllm/benchmark/HR-Bench/hr_bench_4k.tsv
ls -lh /high_perf_store2/users/shanhao/visllm/benchmark/HR-Bench/hr_bench_8k.parquet
ls -lh /high_perf_store2/users/shanhao/visllm/benchmark/HR-Bench/hr_bench_8k.tsv
ls -lh /high_perf_store2/users/shanhao/visllm/benchmark/MME-RealWorld-Lite/data/MME-RealWorld-Lite.json
ls -ld /high_perf_store2/users/shanhao/visllm/benchmark/MME-RealWorld-Lite/data/imgs
ls -lh /high_perf_store2/users/shanhao/visllm/benchmark/scripts/HR-Bench-main/hrbench/run.py
ls -lh /high_perf_store2/users/shanhao/visllm/benchmark/scripts/MME-RealWorld-main/evaluation/eval_your_results.py
ls -lh /high_perf_store2/users/shanhao/visllm/benchmark/scripts/vstar-main/vstar_bench_eval.py
ls -lh /high_perf_store2/users/shanhao/visllm/base-model/Qwen3-30B-A3B-Instruct-2507/config.json
模型生成阶段读取 HR-Bench 的 .parquet,官方 run.py 判分阶段还会读取同名 .tsv,两者都必须保留。MME 评测读取 data/MME-RealWorld-Lite.json 和 data/imgs/。
HR-Bench 发布代码固定的 lmdeploy==0.5.3 不能加载 Qwen3-MoE,因此不安装到 ILVR 训练环境。本项目把判分器放入单独的 hrbench-judge conda 环境,默认使用与当前 CUDA 12.4/PyTorch 2.6 环境匹配、且支持 Qwen3 的 lmdeploy==0.11.1:
cd /high_perf_store2/users/shanhao/visllm/ILVR/mlrm-test
export CONDA_BASE=/root/miniconda3
bash scripts/setup_hrbench_judge_env.sh
脚本默认沿用机器当前配置的 PyPI 镜像,避免在无法访问
download.pytorch.org 的计算环境中失败。只有确认官方 PyTorch 源可访问时,才需要显式覆盖:
TORCH_INDEX_URL=https://download.pytorch.org/whl/cu124 bash scripts/setup_hrbench_judge_env.sh
安装中断后可以直接重新运行同一脚本;它会继续补齐现有的 hrbench-judge 环境。
主 ilvr 环境负责从 parquet 导出官方 XLSX;若还没有导出依赖,再执行一次:
source /root/miniconda3/etc/profile.d/conda.sh
conda activate ilvr
python -m pip install pandas==2.2.2 openpyxl==3.1.5
默认 judge Python 是 /root/miniconda3/envs/hrbench-judge/bin/python。若环境位于其他位置,评测前设置 HRBENCH_PYTHON=/实际路径/bin/python。判分子进程会清除 ILVR 定制 Transformers 的 PYTHONPATH,不会污染训练环境。
cd /high_perf_store2/users/shanhao/visllm/ILVR/mlrm-test
bash scripts/preflight.sh
预检会确认 CUDA、基础模型、Qwen3 judge、judge Python 及 lmdeploy、官方评测源码、四套数据、transformers 是否来自
ILVR-main/transformers/src,并验证本项目 DeepSpeed ZeRO-3 配置确实在
zero_optimization 内启用了最终权重聚合。该项失败时不要启动训练。
先只检查配置:
bash scripts/diagnose_official.sh --validate-only
实际执行:
bash scripts/diagnose_official.sh
诊断从 COMT TEST.jsonl 的 creation、deletion、update、selection 四类任务中分别选择前 8 条,共运行 32 个 case。任务类别由 images_comt/<类别>/... 输入图像目录确定,并记录在每行 trace 的 task_category 字段中;任一类别不足 8 条时任务会直接失败。
输出:
outputs/official_diagnostics/checkpoint_report.jsonoutputs/official_diagnostics/latent_traces.jsonl*_heatmap.png:全部视觉 token group 的连续分数热力图;*_selected.png:把 selector teacher 最终选中的 patch 以半透明红色覆盖到原图,并按选择顺序编号。如果 checkpoint 没有保存 EMA teacher,报告会写入:
{"teacher_source": "checkpoint_clone", "historical_teacher_recovered": false}
此时 patch 图检验的是发布模型特征上的官方选择机制,不代表训练过程中历史 EMA teacher 的原始选择。红色覆盖区域越不透明,表示该选中 group 在本样本已选 group 中的分数越高。
该任务仍从 COMT TEST.jsonl 四类任务中各取 8 条,但 patch selector 使用训练产物中单独保存的 ema_teacher.pt,并以 context_answer 模式把标准答案只提供给 EMA teacher。学生 checkpoint 负责自然生成回答和熵 trace;为了避免两个 7B 模型同时驻留显存,任务先由 EMA teacher 完成 patch 选择和可视化,释放它后再加载学生模型生成回答。
先校验路径:
bash scripts/diagnose_comt_answer_teacher.sh --validate-only
正式执行:
bash scripts/diagnose_comt_answer_teacher.sh
输出写入 outputs/comt_answer_teacher_diagnostics/,格式与 official_diagnostics 相同。该任务不会在 EMA 缺失或损坏时回退到 checkpoint clone;成功加载时 checkpoint_report.json 必须包含:
{"teacher_source": "serialized_ema", "historical_teacher_recovered": true}
三个脚本都加载 /high_perf_store2/users/shanhao/visllm/ILVR/model,依次评测 VStar、HR-Bench 4K、HR-Bench 8K 和 MME-RealWorld-Lite。分别执行:
bash scripts/eval_official_baseline.sh
bash scripts/eval_official_entropy.sh
bash scripts/eval_official_entropy_only.sh
熵控制采用 LEAD 的高熵进入阈值 1.0,ILVR 适配参数为 min_text_steps=8、cooldown_steps=8、latent_size=8。其中 entropy 有自然和熵强制两种进入来源,entropy_only 会屏蔽自然 <|latent_start|>。逐条件结果写入 outputs/evaluation_official/official_ilvr__<mode>__<benchmark>/,三份独立汇总为:
matrix_summary__natural.json / .mdmatrix_summary__entropy.json / .mdmatrix_summary__entropy_only.json / .md官方发布权重不要求训练生成的 run_manifest.json;评测器会根据 checkpoint 路径、模型文件大小和纳秒修改时间生成只读身份指纹。Monet/CoMT 训练模型仍严格要求完整训练 manifest。
这里汇总的准确率不再来自本项目的答案解析器:
raw_output 合并后,直接执行发布的 eval_your_results.py;hrbench/run.py,由本地 Qwen3-30B-A3B judge 按官方 yes/no 协议评分;vstar-author-option-ce-qwen-adapter-v1。该 PPL 评分不经过 natural/entropy 解码,所以报告记录 latent_decoding_applied: false。原来的生成期 metrics.json 只保留作答案和熵 telemetry 诊断;正式分数写入 official_metrics.json,矩阵汇总也只读取正式分数。完整的旧 results.jsonl 会在加载 7B checkpoint 前直接复用,不重新生成回答。
HR-Bench 和 MME-RealWorld-Lite 的生成阶段现在分别使用作者发布代码中的完整
prompt,而不再共用早期的 Reason carefully ... Final answer: (X) 模板:
Question:、Options:、逐项 A. ...,并以
Please select the correct answer from the options above. 结尾;The choices are listed below:、
Respond with only the letter ...,并以 The best answer is: 结尾。两种作者 prompt 各有独立版本号并进入评测指纹,因此不会复用旧统一 prompt 的
生成结果。这个隔离入口还会让 VStar 通过 ILVR generation loop 自回归生成完整回答,
因此 natural、entropy 和 entropy_only 都能按各自策略进入 latent;原有正式
option-token PPL 路径不调用自回归生成,保持不变。专用入口会严格复刻
evaluation_metrics_only_20260827T064303Z 中已有的模型/模式组合,并将新结果与
三个历史输出根目录完全隔离:
# 先验证三套矩阵,共 36 个条件
bash scripts/eval_official_benchmark_prompts.sh --validate-only
# 串行执行全部模型及其原有模式
bash scripts/eval_official_benchmark_prompts.sh
36 个条件包括:官方 checkpoint 的三种模式共 12 条、两个 CoMT checkpoint 的 natural 共 8 条、两个 Monet checkpoint 的 natural/entropy 共 16 条。输出分别写入:
outputs/evaluation_benchmark_prompts/evaluation_official/
outputs/evaluation_benchmark_prompts/evaluation_comt_checkpoints/
outputs/evaluation_benchmark_prompts/evaluation/
四个实际条件(VStar、HR-Bench 4K/8K、MME-RealWorld-Lite)统一按生成结果中的
正确选项字母或无歧义正确选项文本判对;每条结果记录 prediction_source,汇总记录
字母/选项文本的命中数。这个 ilvr-autoregressive-letter-or-choice-text-v1 分数是为
横向比较 latent 模式而定义的兼容生成式分数,不是 VStar PPL、HR-Bench LLM judge
或 MME 作者正则的正式官方分数。该隔离任务不改变 generation 参数、latent template、
熵控制条件或校准阈值。
以下命令使用默认 ILVR natural 推理,比较旧 stage1 和 answer-teacher 模型;每个模型运行 VStar、HR-Bench 4K、HR-Bench 8K、MME-RealWorld-Lite,共 8 个条件:
bash scripts/eval_comt_checkpoints.sh
模型路径分别为:
/high_perf_store2/users/shanhao/visllm/ILVR/comt-test/checkpoint/stage1/high_perf_store2/users/shanhao/visllm/ILVR/mlrm-test/outputs/comt_answer_teacherTransformers 会根据目录内的 index 文件自动加载 4 片 .safetensors 或 7 片 .bin,不需要手工合并。结果写入 outputs/evaluation_comt_checkpoints/。
bash scripts/prepare_comt.sh
bash scripts/prepare_monet.sh
远端原始数据虽已准备好,训练器仍读取规范化后的 manifest,因此首次训练前需各运行一次准备脚本。输出:
artifacts/comt_prepared/train.jsonlartifacts/monet_prepared/train.jsonlartifacts/monet_prepared/calibration.jsonl两次 Monet 训练必须使用同一个 train.jsonl 校验和。
本地无图像结构扫描结果为:125,072 条原始记录,125,065 条有效记录,7 条因缺少非空标准答案被排除;其中训练 124,065 条,校准 1,000 条。远端会重新检查全部图像是否存在。
三个模型分别启动训练;不要把三条命令放在同一个前台 shell 中同时运行。脚本会自动使用当前全部可见 GPU,无需 smoke test:
bash scripts/train_comt_answer_teacher.sh
bash scripts/train_monet_official.sh
bash scripts/train_monet_answer_teacher.sh
三个模型分别输出到 outputs/comt_answer_teacher、outputs/monet_ilvr 和 outputs/monet_answer_teacher。CoMT 模型不自动加入默认的 2 × 2 × 4 Monet 评测矩阵。
模型最终权重和 run_manifest.json 成功保存后,训练脚本会自动启动该模型的四项官方评测。三个 Stage1 模型使用 natural,四个 Stage2 模型使用 entropy_only。训练失败、--validate-only、--smoke 或 --help 不会启动评测。需要只训练时可设置 AUTO_EVAL=0;已有模型只补评测时可设置 POST_TRAIN_EVAL_ONLY=1,例如:
POST_TRAIN_EVAL_ONLY=1 bash scripts/train_monet_official.sh
POST_TRAIN_EVAL_ONLY=1 bash scripts/train_monet_answer_teacher.sh
自动评测写入 outputs/post_train_evaluation/<job>/。即使某一 benchmark 失败,也会继续尝试其余项目,最后通过 post_train_summary.json 汇总并返回非零状态。
训练脚本不会依赖机器上的默认 Accelerate 配置:它会按可见 GPU 数生成显式配置;多卡时固定使用 distributed_type: MULTI_GPU 和 gpu_ids: all。
EMA teacher 在每个成功的 optimizer step 后更新。每个 checkpoint-* 都保存 ema_teacher.pt,恢复训练时会同时恢复 teacher,并严格校验数据、配置、实验代码、ILVR 关键源码和 world size;不匹配时拒绝续训,避免混用旧 checkpoint。最终 run_manifest.json 还包含包/CUDA 信息与模型权重 SHA-256。
脚本自动使用当前可见 GPU 数量。两份 Monet YAML 经过测试约束,只允许以下字段不同:
training.teacher_query_modetraining.output_dir三个训练配置中的 entropy_training 始终为 false。
2026-08-20 完成的两个 Monet 任务使用了 ILVR 原始 config_stage3.json。该文件把
stage3_gather_16bit_weights_on_model_save 写在 zero_optimization 外层,因而被
Accelerate 忽略。训练步骤已经全部完成;报错只发生在最终 Hugging Face 权重导出,
无需重训。输出目录根部保存的最终 global_step* ZeRO-3 分片可恢复为可加载的
pytorch_model-*.bin 和 index。
先只检查两个目录各自发现的 checkpoint,不写文件:
cd /high_perf_store2/users/shanhao/visllm/ILVR/mlrm-test
bash scripts/recover_monet_stage1.sh --inspect-only
两项都必须指向各自输出目录根部的 global_step5814,而不是较旧的
checkpoint-*。然后确认磁盘至少还能容纳约 60 GB 的新增 FP32 权重,再依次恢复:
df -h /high_perf_store2/users/shanhao/visllm/ILVR/mlrm-test/outputs
bash scripts/recover_monet_stage1.sh
恢复使用 DeepSpeed 自带的 zero_to_fp32 逻辑,默认按 5 GB 分片;不加载学生或
EMA teacher,也不需要 GPU。每个模型完成后,脚本校验 index 覆盖的全部分片、计算
SHA-256,并把原 run_manifest.json 更新为 status: complete 和最终权重身份。
转换和哈希会运行较长时间,其间不要再次启动同一恢复命令。确认模型能成功加载和
评测前,不要删除原 global_step* 或 checkpoint-* 分片。
这两个任务都从以下官方方法训练得到的 Stage1 权重初始化:
/high_perf_store2/users/shanhao/visllm/ILVR/comt-test/checkpoint/stage1
训练直接读取 data/comt/TRAIN.jsonl,只给模型原始图像和问题;数据中已有的 latent 标注与 helper image 会被删除。Stage2 不加载 EMA teacher,不做 patch 选择,也没有 latent alignment loss。自然生成 <|latent_start|> 会被屏蔽,latent 只能由熵控制器触发;默认条件为 entropy > 1.0 且大于当前 reference entropy,最少文本窗口与 cooldown 都是 8,最多 5 段,每段固定 8 个 latent hidden-state feedback。
方案 A(动态熵触发 CE)使用 teacher forcing:训练时可见文本始终喂入数据里的正确 token,模型只决定在哪些文本 token 之间插入 latent 段。无梯度 rollout 先确定动态位置,再以相同位置做一次可微 Stage2 replay;prompt 与 latent 特殊 token 的 label 都是 -100,只有可见回答文本计算交叉熵。因此 latent 段数不需要与原数据标注一致,这仍是监督学习而不是强化学习。默认训练 2 epoch、学习率 1e-5、每卡 batch 1、梯度累积 8。
方案 B(动态熵触发 GRPO)让模型自由生成完整回答。8 张 GPU 分别针对同一个 prompt 采样 1 条 completion,组成 8 条 GRPO group;奖励为 1.0 × 答案正确 + 0.1 × 最终答案格式。答案正确性优先解析 <answer>...</answer> 或 Final answer: 声明;模型尚未学会声明格式时,也允许在 completion 尾部保守匹配正确答案或选项,但格式奖励仍为 0。KL reference 是冻结的原始 Stage1,beta=0.04,clip epsilon 为 0.2,采样参数为 temperature 0.9、top-p 1.0、top-k 50、最大 completion 512,默认训练 2 epoch、学习率 5e-6。不使用 SLVR 的 paired semantic reward 或外部 judge。
两种方案都将“无梯度决定触发位置”和“可微回放计算损失”分开。为了避免 ZeRO-3 下各 rank 因 latent 数量不同而出现内部 collective 次序不一致,每个 microstep 会在生成序列末尾(正常结束时即终止 token 之后)追加完全 mask 的 dummy latent 块,使回放 latent 次数补齐到本组 rank 的最大值;这些块位于回答之后,不改变可见 token、奖励、CE 或 KL。
先验证配置(不会加载 7B 权重):
bash scripts/train_comt_stage2_entropy_ce.sh --validate-only
bash scripts/train_comt_stage2_entropy_grpo.sh --validate-only
正式执行:
bash scripts/train_comt_stage2_entropy_ce.sh
NUM_PROCESSES=8 bash scripts/train_comt_stage2_entropy_grpo.sh
GRPO 脚本要求恰好 8 张可见 GPU,因为当前 ILVR 动态 latent replay 保持 batch 1,每张卡生成一条回答。策略和冻结 reference 会同时存在,资源占用显著高于方案 A。两个输出目录分别为:
outputs/comt_stage2_entropy_ce
outputs/comt_stage2_entropy_grpo
输出包含模型/processor、Trainer checkpoint/state、resolved_config.json 和 run_manifest.json;GRPO reward、KL、clip fraction、completion 长度与 latent 段数写入 Trainer 日志。GRPO 还会在 rollout_samples/rank-*.jsonl 中为每个 rank 最多记录 64 条原始 completion、标准答案和各奖励分量,用于诊断奖励是否真正生效。任务可从输出目录中最后一个 checkpoint-* 自动续训。恢复前会校验完整配置、训练数据 SHA-256、Stage1/reference 权重身份、Stage2 源码身份和 world size;任一项变化都会拒绝混合恢复。
两个 Stage2 训练入口同样只在最终 manifest 标记为 complete 且包含最终权重 SHA-256 身份后自动运行四项评测;方案 A 和 B 均使用 entropy_only 推理策略。
Monet 版本复用 5.2 节完全相同的 CE/GRPO 目标与熵控制参数,但初始化权重改为:
/high_perf_store2/users/shanhao/visllm/ILVR/mlrm-test/outputs/monet_ilvr
训练读取远端预处理生成的:
/high_perf_store2/users/shanhao/visllm/ILVR/mlrm-test/artifacts/monet_prepared/train.jsonl
只把 input_images 中的原始图像送给模型;steps 中 kind: latent 的辅助图像会被删除,可见文本步骤继续作为 CE target 或 GRPO reward 的标准答案来源。Monet 的 CE 与 GRPO 当前均训练 1 epoch。先验证配置:
bash scripts/train_monet_stage2_entropy_ce.sh --validate-only
bash scripts/train_monet_stage2_entropy_grpo.sh --validate-only
正式执行:
bash scripts/train_monet_stage2_entropy_ce.sh
NUM_PROCESSES=8 bash scripts/train_monet_stage2_entropy_grpo.sh
输出分别写入 outputs/monet_stage2_entropy_ce 和 outputs/monet_stage2_entropy_grpo,成功保存后均自动执行四项 entropy_only 官方评测。
两个 Python 入口也支持显式覆盖 --train-data、--dataset-format {comt,monet}、--stage1-checkpoint、--output-dir 和 --epochs;GRPO 额外支持 --reference-checkpoint。这些参数可直接追加在上述 shell 命令末尾。切换初始化 checkpoint 时,GRPO 应同时显式切换 reference checkpoint,避免策略与 KL reference 来自不同实验。训练后的自动评测会继承实际使用的配置文件和这些 CLI 覆盖,因此 --output-dir 不会错误评测默认目录中的旧模型。
该实验把强教师选区和学生训练拆成三个独立的前台任务,完整遍历 CoMT TRAIN:
ilvr 环境加载已训练的 C0 ILVR/comt-test/checkpoint/stage1,冻结参数,用答案 NLL 验证候选并做 MMR,同时发布 selected 和数量/面积匹配的二维连通 random safetensors 缓存;random,C2 读取 selected,都从原始 Qwen2.5-VL base model 初始化、训练 15 epoch,并自动进行 natural 模式的四项官方评测。C0 只作冻结验证器,不重新训练,也不是 C1/C2 的初始化权重。C1/C2 训练时不加载 Qwen3-VL、不创建在线 EMA teacher,student 输入中也没有教师答案、辅助图像或 proposal 文本;标准答案只用于正常的 teacher-forcing 标签。零正增益区域仍保留 8-pad latent 模板,但只产生答案 CE。
远端生成内容固定写入:
artifacts/comt_offline_roi/qwen3_candidates/ # Qwen3 proposal,可断点续跑
artifacts/comt_offline_roi/verified/ # C0 NLL/MMR 验证及统计/overlay
artifacts/comt_offline_roi/vectors/ # selected/random 不可变缓存
outputs/comt_offline_random/ # C1
outputs/comt_offline_roi_distillation/ # C2
先准备 CoMT manifest 并验证 proposal 入口;QWEN3_VL_TEACHER 必须指向远端已经下载好的本地 Qwen3-VL 模型目录:
cd /high_perf_store2/users/shanhao/visllm/ILVR/mlrm-test
export CONDA_BASE=/root/miniconda3
export TEACHER_PYTHON=/high_perf_store2/users/shanhao/visllm/envs/hrbench-judge-overlay/bin/python
export QWEN3_VL_TEACHER=/absolute/path/to/local/Qwen3-VL-235B-A22B-Instruct
export TEACHER_TENSOR_PARALLEL_SIZE=8
bash scripts/prepare_comt.sh
bash scripts/preflight_offline_teacher.sh
bash scripts/generate_comt_offline_rois.sh --validate-only
正式任务必须按阶段提交:先 proposal;proposal 完整发布后运行 bash scripts/verify_comt_offline_rois.sh --validate-only,再执行验证/cache;cache 完整发布后分别运行两个训练脚本的 --validate-only。检查完整性、错误率、零正增益率、NLL 增益分布和四类任务 overlay 后,C1/C2 可分别提交。完整可复制命令见 REMOTE_SYNC.md。所有发布物都绑定配置、数据、模型/processor、关键源码和缓存身份;身份一致时断点续跑,变化时拒绝混用。不要并发启动相同 identity 的 proposal 或 verifier publisher。
bash scripts/calibrate_entropy.sh
默认分别使用最多 256 条 Monet calibration prompts,从固定候选阈值中选择最接近 25% 样本触发率的阈值。该过程不读取任何 benchmark 标签,输出:
artifacts/entropy_calibration/monet_ilvr.jsonartifacts/entropy_calibration/monet_answer_teacher.json评测矩阵会自动读取这两个文件;若文件不存在,则使用 LEAD 对应的默认高熵阈值 1.0。
bash scripts/eval_smoke.sh
该命令运行两个模型 × 两种解码模式 × HR-Bench 4K 的前 2 条样本,共 4 个条件。
只验证完整矩阵配置而不加载模型:
bash scripts/eval_all.sh --validate-only
bash scripts/eval_all.sh
该命令会评测已经恢复完成的 outputs/monet_ilvr 与 outputs/monet_answer_teacher,每个模型运行 natural/entropy × 四项 benchmark。此前两个 CoMT checkpoint 使用 bash scripts/eval_comt_checkpoints.sh;官方 checkpoint 的三种模式仍使用 3.2 节的三条脚本。
评测恢复指纹包含最终模型权重身份、decoding、generation 参数和 prompt 版本。单条件输出还包含 resolved_config.json 与 report.md;只要仍有未解决的样本错误,该条件和整个矩阵都会失败,不会发布部分样本分数。
每个条件的结果目录包含:
results.jsonl:逐样本答案、latent/熵 telemetry 和耗时;errors.jsonl:逐样本错误;metrics.json:总体、分类准确率、latent 触发率、平均 latent 段数、平均 token 数、耗时与 delta_h。official_metrics.json:正式 benchmark 协议得分及发布脚本、判分模型、依赖版本、输入身份;official_scoring/:送给发布评测器的 JSON/XLSX、stdout/stderr 和 HR-Bench 官方 score CSV。汇总结果:
outputs/evaluation/matrix_summary.jsonoutputs/evaluation/matrix_summary.md评测按 run_fingerprint + sample_id 断点续跑。配置、模型或 prompt 改变后不会错误复用旧结果。
答案解析器 v2 接受 The final answer is: A 这类同时包含 is 和冒号的输出。旧评测无需重新生成模型回答,可以从结果目录或 .tar.gz 归档离线重算;重算写入新目录,不覆盖原文件。例如本地 PowerShell:
$env:PYTHONPATH='src'
python -m mlrm_test.evaluation.rescore `
--input 'F:\BUAA\yzx\code\outputs_download\evaluation_official.tar.gz' `
--benchmark-root 'F:\BUAA\yzx\code\data' `
--output-root 'outputs\evaluation_official_rescored'
若远端开发机保留了上次完整的三个评测结果根目录,可一次性重算全部 36 个 run:
cd /high_perf_store2/users/shanhao/visllm/ILVR/mlrm-test
export CONDA_BASE=/root/miniconda3
bash scripts/rescore_evaluation_36.sh
该脚本固定读取 outputs/evaluation_official(12 个)、
outputs/evaluation_comt_checkpoints(8 个)和 outputs/evaluation(16 个)。它只保留
每个 resolved_config.json 当前 run_fingerprint 对应的行,并检查 run 完整、错误数为
0、样本数/样本 ID/标准答案与 benchmark 标注严格对齐。解析时优先接受最终答案中的独立
选项字母;没有字母时,仅在最终答案能无歧义匹配一个完整选项文本时恢复答案。原始
results.jsonl 不会被修改,结果默认另存为:
outputs/evaluation_choice_text_rescore/choice_text_rescore_<UTC>.json
输出包含每个 run 的 archived、严格字母和“字母或选项文本”三组准确率、增益、解析来源
计数及全部文本恢复 case。可用 RESCORE_OUTPUT=/absolute/output.json 指定结果文件。该分数
仅是生成输出兼容诊断,不替代 VStar PPL、HR-Bench LLM judge 或 MME 作者脚本的正式分数。
Windows PowerShell:
$env:PYTHONPATH='src'
python -m unittest discover -s tests -v
python -m compileall -q src tests
远端 Linux:
export PYTHONPATH="$PWD/src:/high_perf_store2/users/shanhao/visllm/ILVR-main/src:/high_perf_store2/users/shanhao/visllm/ILVR-main/transformers/src"
python -m unittest discover -s tests -v
bash -n scripts/*.sh
B1 - A1:answer-aware EMA teacher 的训练效果。A2 - A1:熵控制对官方 teacher 模型的推理效果。B2 - B1:熵控制对 answer-aware teacher 模型的推理效果。B2 - A2:answer-aware teacher 在熵控制下是否仍有增益。delta_h < 0:latent 结束后的局部 token 熵低于进入前,仅作为观测指标;准确率对照才是主要效果证据。