iomgaa d6a3107e4e feat(question_gen): loader 按 unit 分层采样 + load_benchmark 读回 pair 字段
stratified_sample 先 build_units 聚合,以 QuestionUnit 为采样原子做
分层/去重/补足/rng.sample,返回前 flatten_units 展开为逐题列表;
size/correct_ratio/min_per_class 均按 unit 计数,单元正确性走成员 AND,
孪生对两题永不被劈开。纯 single 输入下 build_units 1:1 折叠、顺序不变,
rng 消耗与旧逐题实现字节级一致(新增回归测试守护)。

_backfill_per_class candidates 改按 unit 枚举去重;build_units/flatten_units
函数内延迟导入以规避 question_gen<->harness 循环依赖(沿用 adversarial_filter)。

load_benchmark 反序列化补 pair_id/question_role/flip_axis/unit_id 四字段,
用 .get 兼容旧 JSON(缺失退化为 single,unit_id 由 __post_init__ 回填)。

pools._sample_excluding 随之改为透传 flatten_units(candidates) 给已单元化的
stratified_sample(不再用 lone pair-original 代表),行为对 single-only 保持等价。
2026-07-15 06:27:41 -04:00

Video-Tree-TRM5

在层次化视频树上构建可自我进化的搜索 Agent,实现长视频理解。目标会议:EMNLP 2026。

系统概览

本项目是 Video-Tree-TRM4MVP)的生产级重构,采用 Clean Architecture 分层设计。

核心思想:自进化循环对标 PyTorch 训练

PyTorch 本项目 模块
DataLoader 出题 question_gen app/question_gen/
model.forward() 推理 inference app/harness/inference.py + core/agent/loop.py
loss.backward() 诊断 diagnose core/evolution/diagnose.py
optimizer.step() 进化 evolve core/evolution/evolve.py
nn.Parameter Skills + Prompts(版本化) store/skills/, store/prompts/

三大模块

模块 目录 说明
建树 app/tree/ 离线预处理:VLM 生成三层 TreeIndex(L1段落→L2片段→L3帧),支持字幕注入和后增强
训练 app/harness/ + core/ 自进化循环:推理→诊断→进化,含 CE-Gate 统计检验、信息阶梯、mini-batch 调度
新题构建 app/question_gen/ 生成 Video-MME 风格训练题,原始 benchmark 作 held-out 泛化评测

可提取内核

core/agent/core/evolution/ 只依赖 Protocol 接口,可独立提取用于其他项目。

快速开始

# 1. 创建 Conda 环境
conda create -n Video-Tree-TRM python=3.11 -y
conda activate Video-Tree-TRM
pip install -e ".[dev]"

# 2. 配置环境变量
cp .env.example .env
# 编辑 .env 填入 API 密钥

# 3. 验证
make lint
make test

项目结构

详见 research-wiki/ARCHITECTURE.md

文档

文档 说明
research-wiki/ARCHITECTURE.md 系统架构与边界
research-wiki/overview.md 自进化循环总览
CLAUDE.md Agent 工作指令
reference/docs/architecture.md 建树+检索器参考设计
S
Description
No description provided
Readme 3.1 MiB
Languages
Python 97.6%
Shell 2.2%
TypeScript 0.2%