dsh-aris-panel 0.2.7 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +117 -108
- package/README_CN.md +98 -89
- package/aris/.claude-plugin/marketplace.json +34 -0
- package/aris/.claude-plugin/plugin.json +19 -0
- package/aris/.codex-plugin/plugin.json +18 -0
- package/aris/.env.example +53 -0
- package/aris/.gitattributes +6 -0
- package/aris/.github/agents/aris-reviewer-claude.agent.md +10 -0
- package/aris/.github/agents/aris-reviewer-openai.agent.md +10 -0
- package/aris/.github/workflows/check-skills-inventory.yml +32 -0
- package/aris/.github/workflows/lint-skills-helpers.yml +38 -0
- package/aris/.github/workflows/test-install-aris-ps1.yml +31 -0
- package/aris/.github/workflows/test-suite.yml +59 -0
- package/aris/AGENT_GUIDE.md +222 -0
- package/aris/CONTRIBUTING.md +83 -0
- package/aris/CONTRIBUTING_CN.md +83 -0
- package/aris/LICENSE +21 -0
- package/aris/README.md +1739 -0
- package/aris/README_CN.md +1526 -0
- package/aris/SETUP_GUIDE.md +279 -0
- package/aris/SETUP_GUIDE_CN.md +279 -0
- package/aris/UPSTREAM.txt +2 -0
- package/aris/aris-monitor/README.md +158 -0
- package/aris/aris-monitor/assets/screenshot.png +0 -0
- package/aris/aris-monitor/focus-tty.sh +156 -0
- package/aris/aris-monitor/focus.py +93 -0
- package/aris/aris-monitor/run.sh +49 -0
- package/aris/aris-monitor/scanner.py +445 -0
- package/aris/aris-monitor/ticker.py +81 -0
- package/aris/aris-monitor/widget.py +372 -0
- package/aris/assets/claude-fleet-preview.png +0 -0
- package/aris/assets/community_showcase_7_10_codex.png +0 -0
- package/aris/assets/community_showcase_8_10.png +0 -0
- package/aris/assets/feishu_interactive.jpg +0 -0
- package/aris/assets/feishu_push.png +0 -0
- package/aris/assets/paper_illustration_demo.png +0 -0
- package/aris/commands/setup.md +77 -0
- package/aris/community_papers/UAV-CC.pdf +0 -0
- package/aris/docs/ALI_CODING_PLAN_GUIDE.md +324 -0
- package/aris/docs/ANTIGRAVITY_ADAPTATION.md +409 -0
- package/aris/docs/ANTIGRAVITY_ADAPTATION_CN.md +363 -0
- package/aris/docs/ARIS-Code-README_CN.md +8 -0
- package/aris/docs/ARIS-Code-README_EN.md +8 -0
- package/aris/docs/ARIS_INTRO.html +902 -0
- package/aris/docs/ARIS_INTRO.md +368 -0
- package/aris/docs/ARIS_INTRO.review.json +79 -0
- package/aris/docs/CODEX_CLAUDE_REVIEW_GUIDE.md +116 -0
- package/aris/docs/CODEX_CLAUDE_REVIEW_GUIDE_CN.md +116 -0
- package/aris/docs/CODEX_GEMINI_REVIEW_GUIDE.md +249 -0
- package/aris/docs/CODEX_GEMINI_REVIEW_GUIDE_CN.md +250 -0
- package/aris/docs/COPILOT_CLI_ADAPTATION.md +388 -0
- package/aris/docs/CURSOR_ADAPTATION.md +305 -0
- package/aris/docs/CUSTOMIZATION.md +155 -0
- package/aris/docs/CUSTOMIZATION_CN.md +154 -0
- package/aris/docs/GPU_SETUP.md +57 -0
- package/aris/docs/GPU_SETUP_CN.md +54 -0
- package/aris/docs/LLM_API_MIX_MATCH_GUIDE.md +256 -0
- package/aris/docs/MANUAL_REVIEW_GUIDE.md +128 -0
- package/aris/docs/MANUAL_REVIEW_GUIDE_CN.md +116 -0
- package/aris/docs/MINIMAX_MCP_GUIDE.md +198 -0
- package/aris/docs/MODELSCOPE_GUIDE.md +305 -0
- package/aris/docs/MODEL_COMBINATIONS.md +134 -0
- package/aris/docs/MODEL_COMBINATIONS_CN.md +134 -0
- package/aris/docs/MiniMax-GLM-Configuration.md +195 -0
- package/aris/docs/NARRATIVE_REPORT_EXAMPLE.md +143 -0
- package/aris/docs/OPENCLAW_ADAPTATION.md +59 -0
- package/aris/docs/OPENROUTER_GUIDE.md +255 -0
- package/aris/docs/OPENROUTER_GUIDE_CN.md +255 -0
- package/aris/docs/PROJECT_FILES_GUIDE.md +161 -0
- package/aris/docs/PROJECT_FILES_GUIDE_CN.md +161 -0
- package/aris/docs/RESUBMIT_AND_TALK.md +91 -0
- package/aris/docs/RESUBMIT_AND_TALK_CN.md +91 -0
- package/aris/docs/SESSION_RECOVERY_GUIDE.md +439 -0
- package/aris/docs/SESSION_RECOVERY_GUIDE_CN.md +431 -0
- package/aris/docs/SKILLS_CATALOG.md +204 -0
- package/aris/docs/TRAE_ARIS_RUNBOOK_CN.md +329 -0
- package/aris/docs/TRAE_ARIS_RUNBOOK_EN.md +329 -0
- package/aris/docs/WATCHDOG_GUIDE.md +200 -0
- package/aris/docs/WATCHDOG_GUIDE_CN.md +199 -0
- package/aris/docs/aris-code-banner.png +0 -0
- package/aris/docs/aris-code-screenshot.png +0 -0
- package/aris/docs/aris-movie-director-method.png +0 -0
- package/aris/docs/aris_intro_slides.pdf +0 -0
- package/aris/docs/aris_logo.svg +126 -0
- package/aris/docs/auto_review_score_curve.png +0 -0
- package/aris/docs/blogs/continuous_dlm_2026h1_survey.html +3262 -0
- package/aris/docs/hero_combined.svg +844 -0
- package/aris/docs/hero_idea.svg +158 -0
- package/aris/docs/hero_implement.svg +109 -0
- package/aris/docs/hero_interaction.svg +172 -0
- package/aris/docs/hf_daily_paper_1.svg +19 -0
- package/aris/docs/integrations/FEISHU.md +208 -0
- package/aris/docs/integrations/FEISHU_CN.md +208 -0
- package/aris/docs/integrations/OBSIDIAN.md +65 -0
- package/aris/docs/integrations/OBSIDIAN_CN.md +65 -0
- package/aris/docs/integrations/VAST_GPU_GUIDE.md +96 -0
- package/aris/docs/integrations/VAST_GPU_GUIDE_CN.md +96 -0
- package/aris/docs/integrations/ZOTERO.md +57 -0
- package/aris/docs/integrations/ZOTERO_CN.md +57 -0
- package/aris/docs/tutorials/3d_generation_tutorial.html +1018 -0
- package/aris/docs/tutorials/3d_generation_tutorial.md +1206 -0
- package/aris/docs/tutorials/3d_generation_tutorial.review.json +34 -0
- package/aris/docs/tutorials/3d_generation_tutorial_en.html +1018 -0
- package/aris/docs/tutorials/3d_generation_tutorial_en.md +1206 -0
- package/aris/docs/tutorials/README.md +77 -0
- package/aris/docs/tutorials/agent_foundations_tutorial.html +1081 -0
- package/aris/docs/tutorials/agent_foundations_tutorial.md +1229 -0
- package/aris/docs/tutorials/agent_foundations_tutorial.review.json +146 -0
- package/aris/docs/tutorials/agent_foundations_tutorial_en.html +1081 -0
- package/aris/docs/tutorials/agent_foundations_tutorial_en.md +1229 -0
- package/aris/docs/tutorials/agentic_rl_tutorial.html +1269 -0
- package/aris/docs/tutorials/agentic_rl_tutorial.md +1544 -0
- package/aris/docs/tutorials/agentic_rl_tutorial.review.json +74 -0
- package/aris/docs/tutorials/agentic_rl_tutorial_en.html +1269 -0
- package/aris/docs/tutorials/agentic_rl_tutorial_en.md +1544 -0
- package/aris/docs/tutorials/attention_tutorial.html +774 -0
- package/aris/docs/tutorials/attention_tutorial.md +812 -0
- package/aris/docs/tutorials/attention_tutorial.review.json +51 -0
- package/aris/docs/tutorials/attention_tutorial_en.html +774 -0
- package/aris/docs/tutorials/attention_tutorial_en.md +812 -0
- package/aris/docs/tutorials/diffusion_distillation_tutorial.html +1421 -0
- package/aris/docs/tutorials/diffusion_distillation_tutorial.md +1672 -0
- package/aris/docs/tutorials/diffusion_distillation_tutorial.review.json +114 -0
- package/aris/docs/tutorials/diffusion_distillation_tutorial_en.html +1421 -0
- package/aris/docs/tutorials/diffusion_distillation_tutorial_en.md +1672 -0
- package/aris/docs/tutorials/diffusion_foundations_tutorial.html +1239 -0
- package/aris/docs/tutorials/diffusion_foundations_tutorial.md +1481 -0
- package/aris/docs/tutorials/diffusion_foundations_tutorial.review.json +56 -0
- package/aris/docs/tutorials/diffusion_foundations_tutorial_en.html +1239 -0
- package/aris/docs/tutorials/diffusion_foundations_tutorial_en.md +1481 -0
- package/aris/docs/tutorials/diffusion_post_training_tutorial.html +1135 -0
- package/aris/docs/tutorials/diffusion_post_training_tutorial.md +1322 -0
- package/aris/docs/tutorials/diffusion_post_training_tutorial.review.json +63 -0
- package/aris/docs/tutorials/diffusion_post_training_tutorial_en.html +1138 -0
- package/aris/docs/tutorials/diffusion_post_training_tutorial_en.md +1325 -0
- package/aris/docs/tutorials/distributed_training_tutorial.html +1429 -0
- package/aris/docs/tutorials/distributed_training_tutorial.md +1587 -0
- package/aris/docs/tutorials/distributed_training_tutorial.review.json +98 -0
- package/aris/docs/tutorials/distributed_training_tutorial_en.html +1429 -0
- package/aris/docs/tutorials/distributed_training_tutorial_en.md +1587 -0
- package/aris/docs/tutorials/flow_matching_tutorial.html +755 -0
- package/aris/docs/tutorials/flow_matching_tutorial.md +537 -0
- package/aris/docs/tutorials/flow_matching_tutorial.review.json +37 -0
- package/aris/docs/tutorials/flow_matching_tutorial_en.html +755 -0
- package/aris/docs/tutorials/flow_matching_tutorial_en.md +537 -0
- package/aris/docs/tutorials/image_generation_systems_tutorial.html +1181 -0
- package/aris/docs/tutorials/image_generation_systems_tutorial.md +1448 -0
- package/aris/docs/tutorials/image_generation_systems_tutorial.review.json +49 -0
- package/aris/docs/tutorials/image_generation_systems_tutorial_en.html +1181 -0
- package/aris/docs/tutorials/image_generation_systems_tutorial_en.md +1448 -0
- package/aris/docs/tutorials/kl_divergence_rlhf_tutorial.html +1210 -0
- package/aris/docs/tutorials/kl_divergence_rlhf_tutorial.md +1502 -0
- package/aris/docs/tutorials/kl_divergence_rlhf_tutorial.review.json +55 -0
- package/aris/docs/tutorials/kl_divergence_rlhf_tutorial_en.html +1212 -0
- package/aris/docs/tutorials/kl_divergence_rlhf_tutorial_en.md +1504 -0
- package/aris/docs/tutorials/kv_cache_speculative_decoding_tutorial.html +1118 -0
- package/aris/docs/tutorials/kv_cache_speculative_decoding_tutorial.md +1258 -0
- package/aris/docs/tutorials/kv_cache_speculative_decoding_tutorial.review.json +91 -0
- package/aris/docs/tutorials/kv_cache_speculative_decoding_tutorial_en.html +1118 -0
- package/aris/docs/tutorials/kv_cache_speculative_decoding_tutorial_en.md +1258 -0
- package/aris/docs/tutorials/llm_opd_tutorial.html +1109 -0
- package/aris/docs/tutorials/llm_opd_tutorial.md +1195 -0
- package/aris/docs/tutorials/llm_opd_tutorial.review.json +125 -0
- package/aris/docs/tutorials/llm_opd_tutorial_en.html +1112 -0
- package/aris/docs/tutorials/llm_opd_tutorial_en.md +1198 -0
- package/aris/docs/tutorials/long_context_rope_yarn_mla_tutorial.html +1130 -0
- package/aris/docs/tutorials/long_context_rope_yarn_mla_tutorial.md +1209 -0
- package/aris/docs/tutorials/long_context_rope_yarn_mla_tutorial.review.json +79 -0
- package/aris/docs/tutorials/long_context_rope_yarn_mla_tutorial_en.html +1132 -0
- package/aris/docs/tutorials/long_context_rope_yarn_mla_tutorial_en.md +1211 -0
- package/aris/docs/tutorials/moe_tutorial.html +968 -0
- package/aris/docs/tutorials/moe_tutorial.md +1031 -0
- package/aris/docs/tutorials/moe_tutorial.review.json +54 -0
- package/aris/docs/tutorials/moe_tutorial_en.html +968 -0
- package/aris/docs/tutorials/moe_tutorial_en.md +1031 -0
- package/aris/docs/tutorials/multi_agent_long_horizon_tutorial.html +1409 -0
- package/aris/docs/tutorials/multi_agent_long_horizon_tutorial.md +1803 -0
- package/aris/docs/tutorials/multi_agent_long_horizon_tutorial.review.json +62 -0
- package/aris/docs/tutorials/multi_agent_long_horizon_tutorial_en.html +1413 -0
- package/aris/docs/tutorials/multi_agent_long_horizon_tutorial_en.md +1807 -0
- package/aris/docs/tutorials/quantization_tutorial.html +1117 -0
- package/aris/docs/tutorials/quantization_tutorial.md +1344 -0
- package/aris/docs/tutorials/quantization_tutorial.review.json +56 -0
- package/aris/docs/tutorials/quantization_tutorial_en.html +1117 -0
- package/aris/docs/tutorials/quantization_tutorial_en.md +1344 -0
- package/aris/docs/tutorials/reasoning_models_tutorial.html +1085 -0
- package/aris/docs/tutorials/reasoning_models_tutorial.md +1285 -0
- package/aris/docs/tutorials/reasoning_models_tutorial.review.json +66 -0
- package/aris/docs/tutorials/reasoning_models_tutorial_en.html +1085 -0
- package/aris/docs/tutorials/reasoning_models_tutorial_en.md +1285 -0
- package/aris/docs/tutorials/rlhf_dpo_grpo_ppo_tutorial.html +1015 -0
- package/aris/docs/tutorials/rlhf_dpo_grpo_ppo_tutorial.md +1125 -0
- package/aris/docs/tutorials/rlhf_dpo_grpo_ppo_tutorial.review.json +69 -0
- package/aris/docs/tutorials/rlhf_dpo_grpo_ppo_tutorial_en.html +1014 -0
- package/aris/docs/tutorials/rlhf_dpo_grpo_ppo_tutorial_en.md +1123 -0
- package/aris/docs/tutorials/self_evolving_agents_tutorial.html +1354 -0
- package/aris/docs/tutorials/self_evolving_agents_tutorial.md +1554 -0
- package/aris/docs/tutorials/self_evolving_agents_tutorial.review.json +64 -0
- package/aris/docs/tutorials/self_evolving_agents_tutorial_en.html +1356 -0
- package/aris/docs/tutorials/self_evolving_agents_tutorial_en.md +1556 -0
- package/aris/docs/tutorials/vae_vqvae_vqgan_tutorial.html +1197 -0
- package/aris/docs/tutorials/vae_vqvae_vqgan_tutorial.md +1419 -0
- package/aris/docs/tutorials/vae_vqvae_vqgan_tutorial.review.json +67 -0
- package/aris/docs/tutorials/vae_vqvae_vqgan_tutorial_en.html +1196 -0
- package/aris/docs/tutorials/vae_vqvae_vqgan_tutorial_en.md +1419 -0
- package/aris/docs/tutorials/video_generation_tutorial.html +1169 -0
- package/aris/docs/tutorials/video_generation_tutorial.md +1189 -0
- package/aris/docs/tutorials/video_generation_tutorial.review.json +72 -0
- package/aris/docs/tutorials/video_generation_tutorial_en.html +1170 -0
- package/aris/docs/tutorials/video_generation_tutorial_en.md +1190 -0
- package/aris/docs/tutorials/vlm_multimodal_tutorial.html +1208 -0
- package/aris/docs/tutorials/vlm_multimodal_tutorial.md +1446 -0
- package/aris/docs/tutorials/vlm_multimodal_tutorial.review.json +67 -0
- package/aris/docs/tutorials/vlm_multimodal_tutorial_en.html +1208 -0
- package/aris/docs/tutorials/vlm_multimodal_tutorial_en.md +1446 -0
- package/aris/docs/wechat_group.jpg +0 -0
- package/aris/mcp-servers/claude-review/README.md +96 -0
- package/aris/mcp-servers/claude-review/run_with_claude_aws.sh +49 -0
- package/aris/mcp-servers/claude-review/server.py +718 -0
- package/aris/mcp-servers/codex-exec/README.md +57 -0
- package/aris/mcp-servers/codex-exec/server.py +480 -0
- package/aris/mcp-servers/codex-image2/README.md +65 -0
- package/aris/mcp-servers/codex-image2/server.py +893 -0
- package/aris/mcp-servers/feishu-bridge/requirements.txt +1 -0
- package/aris/mcp-servers/feishu-bridge/server.py +240 -0
- package/aris/mcp-servers/gemini-review/README.md +171 -0
- package/aris/mcp-servers/gemini-review/server.py +1856 -0
- package/aris/mcp-servers/llm-chat/requirements.txt +1 -0
- package/aris/mcp-servers/llm-chat/server.py +664 -0
- package/aris/mcp-servers/manual-review/README.md +133 -0
- package/aris/mcp-servers/manual-review/server.py +910 -0
- package/aris/mcp-servers/manual-review/ui.html +279 -0
- package/aris/mcp-servers/minimax-chat/requirements.txt +1 -0
- package/aris/mcp-servers/minimax-chat/server.py +381 -0
- package/aris/skills/ablation-planner/SKILL.md +123 -0
- package/aris/skills/alphaxiv/SKILL.md +196 -0
- package/aris/skills/analyze-results/SKILL.md +46 -0
- package/aris/skills/arxiv/SKILL.md +248 -0
- package/aris/skills/auto-paper-improvement-loop/SKILL.md +695 -0
- package/aris/skills/auto-review-loop/SKILL.md +1137 -0
- package/aris/skills/auto-review-loop-llm/SKILL.md +259 -0
- package/aris/skills/auto-review-loop-minimax/SKILL.md +302 -0
- package/{skills/citation-audit-claude → aris/skills/citation-audit}/SKILL.md +11 -21
- package/aris/skills/claims-drafting/SKILL.md +227 -0
- package/aris/skills/comm-lit-review/SKILL.md +297 -0
- package/aris/skills/deepxiv/SKILL.md +263 -0
- package/aris/skills/dse-loop/SKILL.md +296 -0
- package/aris/skills/embodiment-description/SKILL.md +129 -0
- package/aris/skills/exa-search/SKILL.md +205 -0
- package/{skills/experiment-audit-claude → aris/skills/experiment-audit}/SKILL.md +16 -26
- package/aris/skills/experiment-bridge/SKILL.md +376 -0
- package/aris/skills/experiment-plan/SKILL.md +249 -0
- package/aris/skills/experiment-queue/SKILL.md +431 -0
- package/aris/skills/experiment-queue/scripts/build_manifest.py +142 -0
- package/aris/skills/experiment-queue/scripts/queue_manager.py +433 -0
- package/aris/skills/feishu-notify/SKILL.md +156 -0
- package/aris/skills/figure-description/SKILL.md +138 -0
- package/aris/skills/figure-spec/SKILL.md +262 -0
- package/aris/skills/figure-spec/scripts/figure_renderer.py +799 -0
- package/aris/skills/formula-derivation/SKILL.md +280 -0
- package/aris/skills/gemini-search/SKILL.md +231 -0
- package/aris/skills/grant-proposal/SKILL.md +698 -0
- package/aris/skills/idea-creator/SKILL.md +584 -0
- package/aris/skills/idea-discovery/SKILL.md +527 -0
- package/aris/skills/idea-discovery-robot/SKILL.md +363 -0
- package/aris/skills/integrity-forensics/SKILL.md +284 -0
- package/aris/skills/interview-cheatsheet/SKILL.md +245 -0
- package/aris/skills/invention-structuring/SKILL.md +188 -0
- package/aris/skills/jurisdiction-format/SKILL.md +192 -0
- package/aris/skills/kill-argument/SKILL.md +437 -0
- package/aris/skills/mermaid-diagram/SKILL.md +419 -0
- package/{skills/meta-apply-claude → aris/skills/meta-apply}/SKILL.md +5 -15
- package/aris/skills/meta-optimize/SKILL.md +437 -0
- package/aris/skills/monitor-experiment/SKILL.md +140 -0
- package/aris/skills/novelty-check/SKILL.md +142 -0
- package/aris/skills/openalex/SKILL.md +237 -0
- package/aris/skills/overleaf-sync/SKILL.md +220 -0
- package/{skills/paper-claim-audit-claude → aris/skills/paper-claim-audit}/SKILL.md +13 -23
- package/aris/skills/paper-compile/SKILL.md +266 -0
- package/aris/skills/paper-figure/SKILL.md +312 -0
- package/aris/skills/paper-illustration/SKILL.md +736 -0
- package/aris/skills/paper-illustration-image2/SKILL.md +391 -0
- package/aris/skills/paper-illustration-image2/scripts/paper_illustration_image2.py +255 -0
- package/aris/skills/paper-plan/SKILL.md +386 -0
- package/aris/skills/paper-poster/SKILL.md +19 -0
- package/aris/skills/paper-poster-html/DESIGN_FINAL.md +176 -0
- package/aris/skills/paper-poster-html/IMPLEMENTATION_CONVENTIONS.md +161 -0
- package/aris/skills/paper-poster-html/LICENSES/posterly-MIT.txt +21 -0
- package/aris/skills/paper-poster-html/NOTICE.md +57 -0
- package/aris/skills/paper-poster-html/SKILL.md +323 -0
- package/aris/skills/paper-poster-html/scripts/_posterly/__init__.py +0 -0
- package/aris/skills/paper-poster-html/scripts/_posterly/canvas.py +200 -0
- package/aris/skills/paper-poster-html/scripts/_posterly/measure.py +588 -0
- package/aris/skills/paper-poster-html/scripts/_posterly/polish.py +498 -0
- package/aris/skills/paper-poster-html/scripts/_posterly/preflight.py +489 -0
- package/aris/skills/paper-poster-html/scripts/_posterly/render.py +215 -0
- package/aris/skills/paper-poster-html/scripts/_posterly/textutil.py +16 -0
- package/aris/skills/paper-poster-html/scripts/_posterly/verify_final.py +171 -0
- package/aris/skills/paper-poster-html/scripts/asset_check.py +897 -0
- package/aris/skills/paper-poster-html/scripts/extract_pdf_figures.py +666 -0
- package/aris/skills/paper-poster-html/scripts/poster_check.py +251 -0
- package/aris/skills/paper-poster-html/scripts/preprocess_figures.py +238 -0
- package/aris/skills/paper-poster-html/scripts/render_preview.py +217 -0
- package/aris/skills/paper-poster-html/scripts/run_gates.py +556 -0
- package/aris/skills/paper-poster-html/scripts/style_check.py +1324 -0
- package/aris/skills/paper-poster-html/templates/COMPONENTS.md +462 -0
- package/aris/skills/paper-poster-html/templates/README.md +170 -0
- package/aris/skills/paper-poster-html/templates/landscape_4col.html +1032 -0
- package/aris/skills/paper-poster-html/templates/landscape_hero.html +1046 -0
- package/aris/skills/paper-poster-html/templates/portrait_2col.html +947 -0
- package/aris/skills/paper-poster-html/templates/tokens/acl.json +9 -0
- package/aris/skills/paper-poster-html/templates/tokens/cvpr.json +9 -0
- package/aris/skills/paper-poster-html/templates/tokens/generic.json +9 -0
- package/aris/skills/paper-poster-html/templates/tokens/iclr.json +9 -0
- package/aris/skills/paper-poster-html/templates/tokens/icml.json +9 -0
- package/aris/skills/paper-poster-html/templates/tokens/neurips.json +9 -0
- package/aris/skills/paper-slides/SKILL.md +635 -0
- package/aris/skills/paper-talk/SKILL.md +381 -0
- package/aris/skills/paper-write/SKILL.md +682 -0
- package/aris/skills/paper-write/templates/IEEEtran.bst +2409 -0
- package/aris/skills/paper-write/templates/IEEEtran.cls +6347 -0
- package/aris/skills/paper-write/templates/iclr2026.tex +84 -0
- package/aris/skills/paper-write/templates/icml2025.tex +87 -0
- package/aris/skills/paper-write/templates/ieee_conference.tex +89 -0
- package/aris/skills/paper-write/templates/ieee_journal.tex +93 -0
- package/aris/skills/paper-write/templates/math_commands.tex +48 -0
- package/aris/skills/paper-write/templates/neurips2025.tex +80 -0
- package/aris/skills/paper-writing/SKILL.md +929 -0
- package/aris/skills/patent-novelty-check/SKILL.md +153 -0
- package/aris/skills/patent-pipeline/SKILL.md +344 -0
- package/aris/skills/patent-review/SKILL.md +203 -0
- package/aris/skills/pixel-art/SKILL.md +137 -0
- package/aris/skills/prior-art-search/SKILL.md +146 -0
- package/aris/skills/proof-checker/SKILL.md +866 -0
- package/aris/skills/proof-orchestrator/NOTICE.md +24 -0
- package/aris/skills/proof-orchestrator/SKILL.md +254 -0
- package/aris/skills/proof-orchestrator/references/audit-output-contract.md +126 -0
- package/aris/skills/proof-orchestrator/references/deepseek-routing.md +74 -0
- package/aris/skills/proof-orchestrator/references/dispatch-prompts.md +227 -0
- package/aris/skills/proof-orchestrator/references/notation-audit.md +135 -0
- package/aris/skills/proof-orchestrator/references/proof-audit-rubric.md +70 -0
- package/aris/skills/proof-orchestrator/references/stress-tests.md +38 -0
- package/aris/skills/proof-writer/SKILL.md +223 -0
- package/aris/skills/qzcli/SKILL.md +324 -0
- package/aris/skills/rebuttal/SKILL.md +376 -0
- package/aris/skills/render-html/SKILL.md +316 -0
- package/aris/skills/render-html/scripts/render_html.py +1006 -0
- package/aris/skills/render-html/scripts/templates/academic.html +703 -0
- package/aris/skills/render-html/scripts/templates/dashboard.html +333 -0
- package/aris/skills/research-implement-feature/SKILL.md +583 -0
- package/aris/skills/research-lit/SKILL.md +756 -0
- package/aris/skills/research-pipeline/SKILL.md +390 -0
- package/aris/skills/research-refine/SKILL.md +770 -0
- package/aris/skills/research-refine-pipeline/SKILL.md +186 -0
- package/aris/skills/research-review/SKILL.md +223 -0
- package/aris/skills/research-wiki/SKILL.md +461 -0
- package/aris/skills/resubmit-pipeline/SKILL.md +447 -0
- package/{skills/result-to-claim-claude → aris/skills/result-to-claim}/SKILL.md +7 -17
- package/aris/skills/run-experiment/SKILL.md +313 -0
- package/aris/skills/semantic-scholar/SKILL.md +236 -0
- package/aris/skills/serverless-modal/SKILL.md +335 -0
- package/aris/skills/shared-references/acceptance-gate.md +324 -0
- package/aris/skills/shared-references/assurance-contract.md +248 -0
- package/aris/skills/shared-references/capture-antipatterns.md +78 -0
- package/aris/skills/shared-references/citation-discipline.md +583 -0
- package/aris/skills/shared-references/compute-env-contract.md +163 -0
- package/aris/skills/shared-references/effort-contract.md +183 -0
- package/aris/skills/shared-references/evidence-precheck.md +65 -0
- package/aris/skills/shared-references/experiment-integrity.md +49 -0
- package/aris/skills/shared-references/external-cadence.md +326 -0
- package/aris/skills/shared-references/fan-out-pattern.md +366 -0
- package/aris/skills/shared-references/injection-hygiene.md +127 -0
- package/aris/skills/shared-references/integration-contract.md +461 -0
- package/aris/skills/shared-references/output-composition.md +93 -0
- package/aris/skills/shared-references/output-language.md +45 -0
- package/aris/skills/shared-references/output-manifest.md +49 -0
- package/aris/skills/shared-references/output-versioning.md +111 -0
- package/aris/skills/shared-references/patent-format-cn.md +199 -0
- package/aris/skills/shared-references/patent-format-ep.md +173 -0
- package/aris/skills/shared-references/patent-format-us.md +161 -0
- package/aris/skills/shared-references/patent-writing-principles.md +197 -0
- package/aris/skills/shared-references/prior-art-databases.md +141 -0
- package/aris/skills/shared-references/resumable-runs.md +109 -0
- package/aris/skills/shared-references/review-scope-limits.md +81 -0
- package/aris/skills/shared-references/review-tracing.md +391 -0
- package/aris/skills/shared-references/reviewer-independence.md +79 -0
- package/aris/skills/shared-references/reviewer-routing.md +852 -0
- package/aris/skills/shared-references/skill-governance.md +104 -0
- package/aris/skills/shared-references/taste-calibration.md +85 -0
- package/aris/skills/shared-references/venue-checklists.md +114 -0
- package/aris/skills/shared-references/wiki-helper-resolution.md +134 -0
- package/aris/skills/shared-references/writing-principles.md +525 -0
- package/aris/skills/skills-codex/README.md +102 -0
- package/aris/skills/skills-codex/README_CN.md +100 -0
- package/aris/skills/skills-codex/ablation-planner/SKILL.md +126 -0
- package/aris/skills/skills-codex/alphaxiv/SKILL.md +186 -0
- package/aris/skills/skills-codex/analyze-results/SKILL.md +45 -0
- package/aris/skills/skills-codex/arxiv/SKILL.md +210 -0
- package/aris/skills/skills-codex/auto-paper-improvement-loop/SKILL.md +618 -0
- package/aris/skills/skills-codex/auto-review-loop/SKILL.md +500 -0
- package/aris/skills/skills-codex/auto-review-loop-llm/SKILL.md +247 -0
- package/aris/skills/skills-codex/auto-review-loop-minimax/SKILL.md +290 -0
- package/aris/skills/skills-codex/citation-audit/SKILL.md +504 -0
- package/aris/skills/skills-codex/claims-drafting/SKILL.md +239 -0
- package/aris/skills/skills-codex/comm-lit-review/SKILL.md +299 -0
- package/aris/skills/skills-codex/comm-lit-review/references/domain-taxonomy.md +57 -0
- package/aris/skills/skills-codex/comm-lit-review/references/output-template.md +37 -0
- package/aris/skills/skills-codex/comm-lit-review/references/source-policy.md +99 -0
- package/aris/skills/skills-codex/comm-lit-review/references/venue-tiering.md +112 -0
- package/aris/skills/skills-codex/deepxiv/SKILL.md +142 -0
- package/aris/skills/skills-codex/dse-loop/SKILL.md +285 -0
- package/aris/skills/skills-codex/embodiment-description/SKILL.md +129 -0
- package/aris/skills/skills-codex/exa-search/SKILL.md +192 -0
- package/aris/skills/skills-codex/experiment-audit/SKILL.md +286 -0
- package/aris/skills/skills-codex/experiment-bridge/SKILL.md +356 -0
- package/aris/skills/skills-codex/experiment-plan/SKILL.md +249 -0
- package/aris/skills/skills-codex/experiment-queue/SKILL.md +401 -0
- package/aris/skills/skills-codex/feishu-notify/SKILL.md +155 -0
- package/aris/skills/skills-codex/figure-description/SKILL.md +138 -0
- package/aris/skills/skills-codex/figure-spec/SKILL.md +252 -0
- package/aris/skills/skills-codex/formula-derivation/SKILL.md +280 -0
- package/aris/skills/skills-codex/gemini-search/SKILL.md +205 -0
- package/aris/skills/skills-codex/grant-proposal/SKILL.md +626 -0
- package/aris/skills/skills-codex/idea-creator/SKILL.md +438 -0
- package/aris/skills/skills-codex/idea-discovery/SKILL.md +477 -0
- package/aris/skills/skills-codex/idea-discovery-robot/SKILL.md +362 -0
- package/aris/skills/skills-codex/integrity-forensics/SKILL.md +108 -0
- package/aris/skills/skills-codex/interview-cheatsheet/SKILL.md +245 -0
- package/aris/skills/skills-codex/invention-structuring/SKILL.md +188 -0
- package/aris/skills/skills-codex/jurisdiction-format/SKILL.md +192 -0
- package/aris/skills/skills-codex/kill-argument/SKILL.md +403 -0
- package/aris/skills/skills-codex/mermaid-diagram/SKILL.md +379 -0
- package/aris/skills/skills-codex/meta-apply/SKILL.md +154 -0
- package/aris/skills/skills-codex/meta-optimize/SKILL.md +348 -0
- package/aris/skills/skills-codex/monitor-experiment/SKILL.md +98 -0
- package/aris/skills/skills-codex/novelty-check/SKILL.md +130 -0
- package/aris/skills/skills-codex/openalex/SKILL.md +228 -0
- package/aris/skills/skills-codex/overleaf-sync/SKILL.md +220 -0
- package/aris/skills/skills-codex/paper-claim-audit/SKILL.md +350 -0
- package/aris/skills/skills-codex/paper-compile/SKILL.md +253 -0
- package/aris/skills/skills-codex/paper-figure/SKILL.md +311 -0
- package/aris/skills/skills-codex/paper-illustration/SKILL.md +690 -0
- package/aris/skills/skills-codex/paper-illustration-image2/SKILL.md +383 -0
- package/aris/skills/skills-codex/paper-illustration-image2/scripts/paper_illustration_image2.py +255 -0
- package/aris/skills/skills-codex/paper-plan/SKILL.md +278 -0
- package/aris/skills/skills-codex/paper-poster/SKILL.md +19 -0
- package/aris/skills/skills-codex/paper-poster-html/SKILL.md +377 -0
- package/aris/skills/skills-codex/paper-slides/SKILL.md +571 -0
- package/aris/skills/skills-codex/paper-talk/SKILL.md +381 -0
- package/aris/skills/skills-codex/paper-write/SKILL.md +487 -0
- package/aris/skills/skills-codex/paper-write/templates/IEEEtran.bst +2409 -0
- package/aris/skills/skills-codex/paper-write/templates/IEEEtran.cls +6347 -0
- package/aris/skills/skills-codex/paper-write/templates/aaai2026.bst +1493 -0
- package/aris/skills/skills-codex/paper-write/templates/aaai2026.sty +315 -0
- package/aris/skills/skills-codex/paper-write/templates/aaai2026.tex +952 -0
- package/aris/skills/skills-codex/paper-write/templates/acl.sty +312 -0
- package/aris/skills/skills-codex/paper-write/templates/acl2026.tex +377 -0
- package/aris/skills/skills-codex/paper-write/templates/acl_natbib.bst +1940 -0
- package/aris/skills/skills-codex/paper-write/templates/acm.bst +3081 -0
- package/aris/skills/skills-codex/paper-write/templates/acm_mm2026.tex +204 -0
- package/aris/skills/skills-codex/paper-write/templates/acmart.cls +3520 -0
- package/aris/skills/skills-codex/paper-write/templates/cvpr.bst +1448 -0
- package/aris/skills/skills-codex/paper-write/templates/cvpr.sty +508 -0
- package/aris/skills/skills-codex/paper-write/templates/cvpr2026.tex +63 -0
- package/aris/skills/skills-codex/paper-write/templates/iclr2026.tex +84 -0
- package/aris/skills/skills-codex/paper-write/templates/iclr2026_conference.bst +1440 -0
- package/aris/skills/skills-codex/paper-write/templates/iclr2026_conference.sty +246 -0
- package/aris/skills/skills-codex/paper-write/templates/icml2026.sty +767 -0
- package/aris/skills/skills-codex/paper-write/templates/icml2026.tex +662 -0
- package/aris/skills/skills-codex/paper-write/templates/ieee_conference.tex +89 -0
- package/aris/skills/skills-codex/paper-write/templates/ieee_journal.tex +93 -0
- package/aris/skills/skills-codex/paper-write/templates/math_commands.tex +48 -0
- package/aris/skills/skills-codex/paper-write/templates/neurips2026.tex +493 -0
- package/aris/skills/skills-codex/paper-write/templates/neurips_2026.sty +437 -0
- package/aris/skills/skills-codex/paper-writing/SKILL.md +744 -0
- package/aris/skills/skills-codex/patent-novelty-check/SKILL.md +153 -0
- package/aris/skills/skills-codex/patent-pipeline/SKILL.md +344 -0
- package/aris/skills/skills-codex/patent-review/SKILL.md +202 -0
- package/aris/skills/skills-codex/pixel-art/SKILL.md +139 -0
- package/aris/skills/skills-codex/prior-art-search/SKILL.md +146 -0
- package/aris/skills/skills-codex/proof-checker/SKILL.md +554 -0
- package/aris/skills/skills-codex/proof-orchestrator/SKILL.md +260 -0
- package/aris/skills/skills-codex/proof-orchestrator/references/audit-output-contract.md +126 -0
- package/aris/skills/skills-codex/proof-orchestrator/references/deepseek-routing.md +76 -0
- package/aris/skills/skills-codex/proof-orchestrator/references/dispatch-prompts.md +227 -0
- package/aris/skills/skills-codex/proof-orchestrator/references/notation-audit.md +135 -0
- package/aris/skills/skills-codex/proof-orchestrator/references/proof-audit-rubric.md +70 -0
- package/aris/skills/skills-codex/proof-orchestrator/references/stress-tests.md +38 -0
- package/aris/skills/skills-codex/proof-writer/SKILL.md +222 -0
- package/aris/skills/skills-codex/qzcli/SKILL.md +324 -0
- package/aris/skills/skills-codex/rebuttal/SKILL.md +305 -0
- package/aris/skills/skills-codex/render-html/SKILL.md +305 -0
- package/aris/skills/skills-codex/render-html/scripts/render_html.py +909 -0
- package/aris/skills/skills-codex/render-html/scripts/templates/academic.html +342 -0
- package/aris/skills/skills-codex/render-html/scripts/templates/dashboard.html +333 -0
- package/aris/skills/skills-codex/research-implement-feature/SKILL.md +406 -0
- package/aris/skills/skills-codex/research-lit/SKILL.md +464 -0
- package/aris/skills/skills-codex/research-pipeline/SKILL.md +346 -0
- package/aris/skills/skills-codex/research-refine/SKILL.md +721 -0
- package/aris/skills/skills-codex/research-refine-pipeline/SKILL.md +186 -0
- package/aris/skills/skills-codex/research-review/SKILL.md +160 -0
- package/aris/skills/skills-codex/research-wiki/SKILL.md +421 -0
- package/aris/skills/skills-codex/resubmit-pipeline/SKILL.md +444 -0
- package/aris/skills/skills-codex/result-to-claim/SKILL.md +246 -0
- package/aris/skills/skills-codex/run-experiment/SKILL.md +236 -0
- package/aris/skills/skills-codex/semantic-scholar/SKILL.md +219 -0
- package/aris/skills/skills-codex/serverless-modal/SKILL.md +335 -0
- package/aris/skills/skills-codex/shared-references/acceptance-gate.md +336 -0
- package/aris/skills/skills-codex/shared-references/assurance-contract.md +139 -0
- package/aris/skills/skills-codex/shared-references/capture-antipatterns.md +84 -0
- package/aris/skills/skills-codex/shared-references/citation-discipline.md +452 -0
- package/aris/skills/skills-codex/shared-references/compute-env-contract.md +163 -0
- package/aris/skills/skills-codex/shared-references/effort-contract.md +143 -0
- package/aris/skills/skills-codex/shared-references/evidence-precheck.md +73 -0
- package/aris/skills/skills-codex/shared-references/experiment-integrity.md +49 -0
- package/aris/skills/skills-codex/shared-references/external-cadence.md +334 -0
- package/aris/skills/skills-codex/shared-references/fan-out-pattern.md +375 -0
- package/aris/skills/skills-codex/shared-references/injection-hygiene.md +132 -0
- package/aris/skills/skills-codex/shared-references/integration-contract.md +372 -0
- package/aris/skills/skills-codex/shared-references/output-composition.md +98 -0
- package/aris/skills/skills-codex/shared-references/output-language.md +45 -0
- package/aris/skills/skills-codex/shared-references/output-manifest.md +40 -0
- package/aris/skills/skills-codex/shared-references/output-versioning.md +111 -0
- package/aris/skills/skills-codex/shared-references/patent-format-cn.md +199 -0
- package/aris/skills/skills-codex/shared-references/patent-format-ep.md +173 -0
- package/aris/skills/skills-codex/shared-references/patent-format-us.md +161 -0
- package/aris/skills/skills-codex/shared-references/patent-writing-principles.md +197 -0
- package/aris/skills/skills-codex/shared-references/prior-art-databases.md +141 -0
- package/aris/skills/skills-codex/shared-references/resumable-runs.md +125 -0
- package/aris/skills/skills-codex/shared-references/review-scope-limits.md +81 -0
- package/aris/skills/skills-codex/shared-references/review-tracing.md +144 -0
- package/aris/skills/skills-codex/shared-references/reviewer-independence.md +66 -0
- package/aris/skills/skills-codex/shared-references/reviewer-routing.md +128 -0
- package/aris/skills/skills-codex/shared-references/skill-governance.md +119 -0
- package/aris/skills/skills-codex/shared-references/taste-calibration.md +90 -0
- package/aris/skills/skills-codex/shared-references/venue-checklists.md +73 -0
- package/aris/skills/skills-codex/shared-references/wiki-helper-resolution.md +69 -0
- package/aris/skills/skills-codex/shared-references/writing-principles.md +525 -0
- package/aris/skills/skills-codex/slides-polish/SKILL.md +563 -0
- package/aris/skills/skills-codex/specification-writing/SKILL.md +211 -0
- package/aris/skills/skills-codex/system-profile/SKILL.md +103 -0
- package/aris/skills/skills-codex/training-check/SKILL.md +83 -0
- package/aris/skills/skills-codex/vast-gpu/SKILL.md +394 -0
- package/aris/skills/skills-codex/web-debug-search/SKILL.md +334 -0
- package/aris/skills/skills-codex/wiki-enrich/SKILL.md +255 -0
- package/aris/skills/skills-codex/writing-systems-papers/SKILL.md +184 -0
- package/aris/skills/skills-codex-claude-review/README.md +79 -0
- package/aris/skills/skills-codex-claude-review/README_CN.md +78 -0
- package/aris/skills/skills-codex-claude-review/auto-paper-improvement-loop/SKILL.md +625 -0
- package/aris/skills/skills-codex-claude-review/auto-review-loop/SKILL.md +516 -0
- package/{skills/novelty-check-claude → aris/skills/skills-codex-claude-review/novelty-check}/SKILL.md +2 -10
- package/aris/skills/skills-codex-claude-review/paper-figure/SKILL.md +319 -0
- package/aris/skills/skills-codex-claude-review/paper-plan/SKILL.md +287 -0
- package/aris/skills/skills-codex-claude-review/paper-write/SKILL.md +496 -0
- package/aris/skills/skills-codex-claude-review/research-refine/SKILL.md +732 -0
- package/aris/skills/skills-codex-claude-review/research-review/SKILL.md +177 -0
- package/aris/skills/skills-codex-gemini-review/README.md +176 -0
- package/aris/skills/skills-codex-gemini-review/README_CN.md +175 -0
- package/aris/skills/skills-codex-gemini-review/auto-paper-improvement-loop/SKILL.md +376 -0
- package/aris/skills/skills-codex-gemini-review/auto-review-loop/SKILL.md +304 -0
- package/aris/skills/skills-codex-gemini-review/grant-proposal/SKILL.md +630 -0
- package/aris/skills/skills-codex-gemini-review/idea-creator/SKILL.md +287 -0
- package/aris/skills/skills-codex-gemini-review/idea-discovery/SKILL.md +275 -0
- package/aris/skills/skills-codex-gemini-review/idea-discovery-robot/SKILL.md +365 -0
- package/aris/skills/skills-codex-gemini-review/novelty-check/SKILL.md +133 -0
- package/aris/skills/skills-codex-gemini-review/paper-figure/SKILL.md +289 -0
- package/aris/skills/skills-codex-gemini-review/paper-plan/SKILL.md +265 -0
- package/aris/skills/skills-codex-gemini-review/paper-poster-html/SKILL.md +102 -0
- package/aris/skills/skills-codex-gemini-review/paper-slides/SKILL.md +582 -0
- package/aris/skills/skills-codex-gemini-review/paper-write/SKILL.md +422 -0
- package/aris/skills/skills-codex-gemini-review/paper-writing/SKILL.md +325 -0
- package/aris/skills/skills-codex-gemini-review/research-refine/SKILL.md +674 -0
- package/aris/skills/skills-codex-gemini-review/research-review/SKILL.md +137 -0
- package/aris/skills/slides-polish/SKILL.md +565 -0
- package/aris/skills/specification-writing/SKILL.md +211 -0
- package/aris/skills/system-profile/SKILL.md +103 -0
- package/aris/skills/training-check/SKILL.md +132 -0
- package/aris/skills/vast-gpu/SKILL.md +394 -0
- package/aris/skills/web-debug-search/SKILL.md +334 -0
- package/aris/skills/wiki-enrich/SKILL.md +257 -0
- package/aris/skills/writing-systems-papers/SKILL.md +184 -0
- package/aris/templates/CLAUDE_MD_TEMPLATE.md +29 -0
- package/aris/templates/EXPERIMENT_LOG_TEMPLATE.md +47 -0
- package/aris/templates/EXPERIMENT_PLAN_TEMPLATE.md +51 -0
- package/aris/templates/EXPERIMENT_PLAN_TEMPLATE_CN.md +53 -0
- package/aris/templates/FINDINGS_TEMPLATE.md +52 -0
- package/aris/templates/IDEA_CANDIDATES_TEMPLATE.md +47 -0
- package/aris/templates/IDEA_CANDIDATES_TEMPLATE_CN.md +47 -0
- package/aris/templates/INVENTION_BRIEF_TEMPLATE.md +87 -0
- package/aris/templates/MANIFEST_TEMPLATE.md +7 -0
- package/aris/templates/NARRATIVE_REPORT_TEMPLATE.md +49 -0
- package/aris/templates/PAPER_PLAN_TEMPLATE.md +47 -0
- package/aris/templates/PATENT_CLAIMS_TEMPLATE.md +78 -0
- package/aris/templates/PATENT_SPECIFICATION_TEMPLATE.md +68 -0
- package/aris/templates/README.md +57 -0
- package/aris/templates/RESEARCH_BRIEF_TEMPLATE.md +35 -0
- package/aris/templates/RESEARCH_BRIEF_TEMPLATE_CN.md +41 -0
- package/aris/templates/RESEARCH_CONTRACT_TEMPLATE.md +60 -0
- package/aris/templates/claude-hooks/corpus_write_guard.json +16 -0
- package/aris/templates/claude-hooks/corpus_write_guard.py +85 -0
- package/aris/templates/claude-hooks/meta_logging.json +74 -0
- package/aris/templates/gitignore-trace.txt +3 -0
- package/aris/tests/__init__.py +0 -0
- package/aris/tests/_feishu_bridge_helpers.py +82 -0
- package/aris/tests/_llm_chat_helpers.py +179 -0
- package/aris/tests/_minimax_helpers.py +189 -0
- package/aris/tests/test_argument_hint_lint.py +183 -0
- package/aris/tests/test_arxiv_fetch.py +266 -0
- package/aris/tests/test_auto_proceed_contract.py +106 -0
- package/aris/tests/test_capture_filter.py +86 -0
- package/aris/tests/test_claude_review_artifact_tools.py +171 -0
- package/aris/tests/test_claude_review_generator.py +51 -0
- package/aris/tests/test_claude_review_overlay.py +64 -0
- package/aris/tests/test_claude_review_parse.py +290 -0
- package/aris/tests/test_codex_exec_bridge.py +306 -0
- package/aris/tests/test_codex_image2_server.py +424 -0
- package/aris/tests/test_codex_install_update.py +511 -0
- package/aris/tests/test_codex_skill_mirror.py +547 -0
- package/aris/tests/test_copilot_install.py +1202 -0
- package/aris/tests/test_copilot_native_evidence.py +562 -0
- package/aris/tests/test_corpus_write_guard.py +76 -0
- package/aris/tests/test_deepxiv_fetch.py +180 -0
- package/aris/tests/test_evidence_check.py +189 -0
- package/aris/tests/test_exa_search.py +220 -0
- package/aris/tests/test_feishu_bridge_server.py +289 -0
- package/aris/tests/test_forensics_gate.py +565 -0
- package/aris/tests/test_http_reviewer_fallback_contract.py +43 -0
- package/aris/tests/test_http_reviewer_provenance_alignment.py +25 -0
- package/aris/tests/test_http_reviewer_review_gate.py +112 -0
- package/aris/tests/test_idea_creator_query_pack_scan.py +238 -0
- package/aris/tests/test_idea_discovery_gate.py +400 -0
- package/aris/tests/test_install_aris_agent_profiles.py +98 -0
- package/aris/tests/test_install_aris_ps1.py +359 -0
- package/aris/tests/test_install_aris_replace_link.py +119 -0
- package/aris/tests/test_install_aris_selective.py +235 -0
- package/aris/tests/test_install_aris_tools_symlink.py +196 -0
- package/aris/tests/test_iteration_log.py +85 -0
- package/aris/tests/test_llm_chat_converter.py +61 -0
- package/aris/tests/test_llm_chat_review_fallback.py +516 -0
- package/aris/tests/test_llm_chat_server.py +414 -0
- package/aris/tests/test_mainline_large_payload_prompts.py +72 -0
- package/aris/tests/test_manual_review.py +804 -0
- package/aris/tests/test_manual_review_integration.py +305 -0
- package/aris/tests/test_minimax_chat_server.py +464 -0
- package/aris/tests/test_minimax_integration.py +241 -0
- package/aris/tests/test_openalex_fetch.py +197 -0
- package/aris/tests/test_plugin_manifest.py +40 -0
- package/aris/tests/test_proof_suite_integration.py +66 -0
- package/aris/tests/test_provenance.py +284 -0
- package/aris/tests/test_research_wiki_claims.py +93 -0
- package/aris/tests/test_research_wiki_encoding.py +74 -0
- package/aris/tests/test_research_wiki_experiments.py +88 -0
- package/aris/tests/test_research_wiki_fetch_arxiv_metadata.py +242 -0
- package/aris/tests/test_research_wiki_helper_resolution.py +253 -0
- package/aris/tests/test_research_wiki_ideas.py +113 -0
- package/aris/tests/test_review_gate.py +358 -0
- package/aris/tests/test_reviewer_pins.py +90 -0
- package/aris/tests/test_run_state.py +313 -0
- package/aris/tests/test_skill_groups.py +111 -0
- package/aris/tests/test_skill_picker.py +207 -0
- package/aris/tests/test_threat_scan.py +139 -0
- package/aris/tests/test_trigger_eval.py +171 -0
- package/aris/tests/test_verify_paper_audits.py +198 -0
- package/aris/tests/test_watchdog.py +496 -0
- package/aris/tests/test_watchdog_loop.py +148 -0
- package/aris/tests/test_web_debug_search.py +157 -0
- package/aris/tools/arxiv_fetch.py +311 -0
- package/aris/tools/capture_filter.py +126 -0
- package/aris/tools/check_skills_inventory.py +287 -0
- package/aris/tools/convert_skills_to_llm_chat.py +282 -0
- package/aris/tools/copilot_native_evidence.py +818 -0
- package/aris/tools/deepxiv_fetch.py +213 -0
- package/aris/tools/evidence_check.py +212 -0
- package/aris/tools/exa_search.py +425 -0
- package/aris/tools/experiment_queue/README.md +118 -0
- package/aris/tools/experiment_queue/build_manifest.py +44 -0
- package/aris/tools/experiment_queue/queue_manager.py +44 -0
- package/aris/tools/extract_paper_style.py +560 -0
- package/aris/tools/figure_renderer.py +69 -0
- package/aris/tools/forensics_gate.py +669 -0
- package/aris/tools/generate_codex_claude_review_overrides.py +355 -0
- package/aris/tools/idea_discovery_gate.py +256 -0
- package/aris/tools/install_aris.ps1 +1372 -0
- package/aris/tools/install_aris.sh +1416 -0
- package/aris/tools/install_aris_codex.sh +1023 -0
- package/aris/tools/install_aris_copilot.sh +1052 -0
- package/aris/tools/iteration_log.py +143 -0
- package/aris/tools/lint_skills_helpers.sh +84 -0
- package/aris/tools/meta_opt/check_ready.sh +80 -0
- package/aris/tools/meta_opt/log_event.sh +91 -0
- package/aris/tools/meta_opt/trigger_eval.py +280 -0
- package/aris/tools/meta_opt/trigger_evals.sample.json +28 -0
- package/aris/tools/openalex_fetch.py +326 -0
- package/aris/tools/overleaf_audit.sh +104 -0
- package/aris/tools/overleaf_setup.sh +150 -0
- package/aris/tools/paper_illustration_image2.py +62 -0
- package/aris/tools/provenance.py +294 -0
- package/aris/tools/research_wiki.py +1720 -0
- package/aris/tools/review_gate.py +502 -0
- package/aris/tools/run_state.py +399 -0
- package/aris/tools/save_trace.sh +477 -0
- package/aris/tools/semantic_scholar_fetch.py +438 -0
- package/aris/tools/skill-groups.tsv +117 -0
- package/aris/tools/skill_picker.py +238 -0
- package/aris/tools/smart_update.ps1 +521 -0
- package/aris/tools/smart_update.sh +591 -0
- package/aris/tools/smart_update_codex.sh +419 -0
- package/aris/tools/smart_update_copilot.sh +605 -0
- package/aris/tools/threat_scan.py +222 -0
- package/aris/tools/verify_paper_audits.sh +487 -0
- package/aris/tools/verify_papers.py +613 -0
- package/aris/tools/verify_wiki_coverage.sh +176 -0
- package/aris/tools/watchdog.py +485 -0
- package/aris/xhs_post.md +125 -0
- package/dsh/client.js +43 -14
- package/dsh/http-rpc.mjs +8 -7
- package/mcp-servers/codex-exec/README.md +4 -4
- package/mcp-servers/codex-exec/server.py +1 -1
- package/package.json +4 -5
- package/skills/ablation-planner/SKILL.md +1 -1
- package/skills/auto-paper-improvement-loop/SKILL.md +10 -10
- package/skills/auto-paper-improvement-loop-claude/SKILL.md +25 -612
- package/skills/auto-review-loop/SKILL.md +4 -4
- package/skills/auto-review-loop-claude/SKILL.md +25 -503
- package/skills/citation-audit/SKILL.md +3 -3
- package/skills/claims-drafting/SKILL.md +2 -2
- package/skills/experiment-audit/SKILL.md +4 -4
- package/skills/experiment-bridge/SKILL.md +14 -12
- package/skills/figure-spec/SKILL.md +1 -1
- package/skills/grant-proposal/SKILL.md +7 -7
- package/skills/human-in-loop-refine/SKILL.md +119 -0
- package/skills/human-in-loop-refine/scripts/refine_round.py +449 -0
- package/skills/human-in-loop-refine/scripts/test_refine_round.py +200 -0
- package/skills/human-in-loop-refine/templates/INPUTS.md +20 -0
- package/skills/human-in-loop-refine/templates/PAPER_NOTE.md +29 -0
- package/skills/human-in-loop-refine/templates/REVISION.md +27 -0
- package/skills/idea-creator/SKILL.md +2 -2
- package/skills/idea-discovery/SKILL.md +15 -13
- package/skills/idea-discovery-robot/SKILL.md +11 -9
- package/skills/integrity-forensics/SKILL.md +1 -1
- package/skills/interview-cheatsheet/SKILL.md +3 -3
- package/skills/invention-structuring/SKILL.md +2 -2
- package/skills/kill-argument/SKILL.md +8 -8
- package/skills/kill-argument-claude/SKILL.md +30 -431
- package/skills/meta-apply/SKILL.md +1 -1
- package/skills/meta-optimize/SKILL.md +2 -2
- package/skills/novelty-check/SKILL.md +2 -2
- package/skills/paper-claim-audit/SKILL.md +5 -5
- package/skills/paper-figure/SKILL.md +4 -3
- package/skills/paper-figure-claude/SKILL.md +24 -305
- package/skills/paper-plan/SKILL.md +3 -3
- package/skills/paper-plan-claude/SKILL.md +24 -273
- package/skills/paper-poster-html/SKILL.md +11 -9
- package/skills/paper-slides/SKILL.md +5 -5
- package/skills/paper-talk/SKILL.md +10 -8
- package/skills/paper-write/SKILL.md +3 -3
- package/skills/paper-write-claude/SKILL.md +24 -482
- package/skills/paper-writing/SKILL.md +19 -17
- package/skills/patent-novelty-check/SKILL.md +3 -3
- package/skills/patent-pipeline/SKILL.md +2 -2
- package/skills/patent-review/SKILL.md +3 -3
- package/skills/proof-checker/SKILL.md +12 -12
- package/skills/proof-checker-claude/SKILL.md +30 -860
- package/skills/rebuttal/SKILL.md +12 -10
- package/skills/render-html/SKILL.md +1 -1
- package/skills/research-implement-feature/SKILL.md +1 -1
- package/skills/research-pipeline/SKILL.md +15 -13
- package/skills/research-refine/SKILL.md +6 -6
- package/skills/research-refine-claude/SKILL.md +24 -719
- package/skills/research-refine-pipeline/SKILL.md +10 -8
- package/skills/research-review/SKILL.md +7 -7
- package/skills/research-review-claude/SKILL.md +25 -164
- package/skills/resubmit-pipeline/SKILL.md +14 -12
- package/skills/result-to-claim/SKILL.md +2 -2
- package/skills/shared-references/assurance-contract.md +1 -1
- package/skills/shared-references/effort-contract.md +1 -1
- package/skills/shared-references/fan-out-pattern.md +4 -4
- package/skills/shared-references/resumable-runs.md +2 -2
- package/skills/shared-references/review-scope-limits.md +1 -1
- package/skills/shared-references/review-tracing.md +2 -2
- package/skills/shared-references/reviewer-routing.md +16 -14
- package/skills/shared-references/skill-governance.md +3 -3
- package/skills/skills-codex/ablation-planner/SKILL.md +1 -1
- package/skills/skills-codex/auto-paper-improvement-loop/SKILL.md +8 -8
- package/skills/skills-codex/auto-review-loop/SKILL.md +2 -2
- package/skills/skills-codex/citation-audit/SKILL.md +4 -4
- package/skills/skills-codex/claims-drafting/SKILL.md +2 -2
- package/skills/skills-codex/experiment-audit/SKILL.md +9 -9
- package/skills/skills-codex/experiment-bridge/SKILL.md +1 -1
- package/skills/skills-codex/figure-spec/SKILL.md +1 -1
- package/skills/skills-codex/grant-proposal/SKILL.md +7 -7
- package/skills/skills-codex/idea-creator/SKILL.md +4 -4
- package/skills/skills-codex/idea-discovery/SKILL.md +6 -6
- package/skills/skills-codex/idea-discovery-robot/SKILL.md +1 -1
- package/skills/skills-codex/integrity-forensics/SKILL.md +4 -2
- package/skills/skills-codex/interview-cheatsheet/SKILL.md +3 -3
- package/skills/skills-codex/invention-structuring/SKILL.md +2 -2
- package/skills/skills-codex/kill-argument/SKILL.md +7 -7
- package/skills/skills-codex/meta-apply/SKILL.md +1 -1
- package/skills/skills-codex/meta-optimize/SKILL.md +2 -2
- package/skills/skills-codex/novelty-check/SKILL.md +1 -1
- package/skills/skills-codex/paper-claim-audit/SKILL.md +6 -6
- package/skills/skills-codex/paper-figure/SKILL.md +3 -3
- package/skills/skills-codex/paper-plan/SKILL.md +3 -3
- package/skills/skills-codex/paper-poster-html/SKILL.md +3 -3
- package/skills/skills-codex/paper-slides/SKILL.md +4 -4
- package/skills/skills-codex/paper-write/SKILL.md +3 -3
- package/skills/skills-codex/paper-writing/SKILL.md +7 -7
- package/skills/skills-codex/patent-novelty-check/SKILL.md +3 -3
- package/skills/skills-codex/patent-pipeline/SKILL.md +2 -2
- package/skills/skills-codex/patent-review/SKILL.md +3 -3
- package/skills/skills-codex/proof-checker/SKILL.md +11 -11
- package/skills/skills-codex/rebuttal/SKILL.md +2 -2
- package/skills/skills-codex/render-html/SKILL.md +1 -1
- package/skills/skills-codex/research-implement-feature/SKILL.md +1 -1
- package/skills/skills-codex/research-pipeline/SKILL.md +5 -5
- package/skills/skills-codex/research-refine/SKILL.md +6 -6
- package/skills/skills-codex/research-review/SKILL.md +6 -6
- package/skills/skills-codex/resubmit-pipeline/SKILL.md +4 -4
- package/skills/skills-codex/result-to-claim/SKILL.md +2 -2
- package/skills/skills-codex/shared-references/assurance-contract.md +2 -2
- package/skills/skills-codex/shared-references/resumable-runs.md +3 -3
- package/skills/skills-codex/shared-references/review-scope-limits.md +1 -1
- package/skills/skills-codex/shared-references/review-tracing.md +3 -3
- package/skills/skills-codex/shared-references/reviewer-independence.md +2 -2
- package/skills/skills-codex/shared-references/reviewer-routing.md +10 -10
- package/skills/skills-codex/slides-polish/SKILL.md +3 -3
- package/skills/skills-codex/specification-writing/SKILL.md +2 -2
- package/skills/slides-polish/SKILL.md +3 -3
- package/skills/specification-writing/SKILL.md +2 -2
- package/skills/training-check/SKILL.md +2 -2
- package/skills/verify-manager/SKILL.md +88 -0
- package/skills/verify-manager/phases/1-specify.md +17 -0
- package/skills/verify-manager/phases/2-plan.md +14 -0
- package/skills/verify-manager/phases/3-tasks.md +19 -0
- package/skills/verify-manager/phases/4-run.md +12 -0
- package/skills/verify-manager/phases/5-analyze.md +21 -0
- package/skills/verify-manager/phases/6-next.md +19 -0
- package/skills/verify-manager/scripts/test_verify_space.py +202 -0
- package/skills/verify-manager/scripts/verify_space.py +451 -0
- package/skills/verify-manager/templates/HYPOTHESIS.md +37 -0
- package/skills/verify-manager/templates/NEXT_IDEAS.md +20 -0
- package/skills/verify-manager/templates/PILOT_PLAN.md +56 -0
- package/skills/verify-manager/templates/PILOT_TASKS.md +28 -0
- package/skills/verify-manager/templates/PROMOTION.md +17 -0
- package/skills/verify-manager/templates/RESULT.md +36 -0
- package/test/client-render-smoke.mjs +143 -0
- package/test/test_claude_overlays.py +99 -0
- package/test/transport-smoke.mjs +16 -4
- package/tools/__pycache__/build_claude_overlays.cpython-314.pyc +0 -0
- package/tools/__pycache__/verify_lane.cpython-314.pyc +0 -0
- package/tools/build_claude_overlays.py +187 -0
- package/tools/check_skills_inventory.py +17 -3
- package/tools/convert_skills_to_llm_chat.py +15 -15
- package/tools/generate_codex_claude_review_overrides.py +12 -12
- package/tools/run_state.py +1 -1
- package/tools/save_trace.sh +2 -2
|
@@ -0,0 +1,1189 @@
|
|
|
1
|
+
## §0 TL;DR Cheat Sheet
|
|
2
|
+
|
|
3
|
+
> 💡 **7 句话搞定 Video Generation** — 2024-2025 视频生成大爆发。一页吃下面试高频要点(详见后文 §1–§11 推导)。
|
|
4
|
+
|
|
5
|
+
1. **范式**:主流视频生成 = **3D Causal VAE 压缩 + Latent DiT 扩散 / Flow Matching**。Sora(2024-02)首次把 Transformer 推到 60s + 高分辨率;Hunyuan-Video (Tencent 2024-12) / Wan 2.x (Alibaba 2024-2025) / Mochi-1 / CogVideoX / Movie Gen / Kling / Veo 2 都是这一架构家族的变体。
|
|
6
|
+
|
|
7
|
+
2. **3D Causal VAE**:把 $H \times W \times T$ 视频压成 $h \times w \times t$ latent(典型空间下采样 $8\times$、时间下采样 $4\times$)。**因果 (causal)** 关键:当前帧 latent **不能看未来帧**——使训练好的 VAE 同时支持图像($t{=}1$)与视频($t{>}1$)、并允许后续帧流式 / 自回归生成。
|
|
8
|
+
|
|
9
|
+
3. **Spacetime Patches (Sora)**:把视频 latent 切成 $p_t \times p_h \times p_w$ 的 3D patch 当 token;像 ViT 但增加了时间维。支持**变分辨率 / 变时长 / 变长宽比**:直接把不同 shape 的 patch 序列打包到一个 batch(用 mask 区分),无需 resize 到固定尺寸。
|
|
10
|
+
|
|
11
|
+
4. **时空 Attention 三大变体**:(a) **Factorized 2+1D**(Latte / OpenSora / AnimateDiff):先 spatial-only,再 temporal-only,复杂度 $O(T \cdot S^2 + S \cdot T^2)$;(b) **Full 3D**(Sora / Hunyuan-Video / Mochi):所有 token 互相 attend,复杂度 $O((ST)^2)$,最贵但效果最好;(c) **Window / 稀疏 ST**(Wan 2.x / CogVideoX 部分块):滑窗 3D,折中。
|
|
12
|
+
|
|
13
|
+
5. **MM-DiT for Video (Hunyuan-Video / Mochi)**:text token 与 video token **同序列**做 self-attention(不再用 cross-attn),两个 stream 各自的 QKV 投影 + AdaLN 调制;条件信息在 token-level 直接交互——Hunyuan/Mochi/Wan 把 SD3 image MM-DiT 思路扩展到视频。
|
|
14
|
+
|
|
15
|
+
6. **Image-to-Video (I2V)**:主流三招——(i) **First-frame concat**:把 ref image 编码后沿 channel 拼到 latent;(ii) **Cross-attention 注入**:ref image token 作 K/V;(iii) **AnimateDiff** 风格:冻结 T2I 主干,只插入 temporal module。SVD / DynamiCrafter / I2VGen-XL / Wan-I2V 是代表。
|
|
16
|
+
|
|
17
|
+
7. **长视频** = keyframe + interpolation / hierarchical / autoregressive chunks。**评测**:VBench (Huang CVPR 2024) 16 维细粒度评分,是当下事实标准;FVD(Unterthiner 2018)仍作辅助;CLIPSim-V 评估 text-video 对齐。
|
|
18
|
+
|
|
19
|
+
> ⚠️ **Caveat** — 本文中 model-specific 数字(参数量、压缩比、attention 类型)均依据各模型公开 paper / tech report;具体训练 hyperparam 与最终架构以原文为准。
|
|
20
|
+
|
|
21
|
+
## §1 直觉与全景
|
|
22
|
+
|
|
23
|
+
### 1.1 为什么视频比图像难
|
|
24
|
+
|
|
25
|
+
记 $H{\times}W{\times}T$ 视频,pixel 数随 $T$ 线性增长,token 数(patchify 后)也线性增长。**Attention 复杂度二次于 token 数**——这意味着在原 pixel 空间做 full 3D attention 对 $T \ge 16$ 已经爆炸。所以视频生成的核心工程问题是:
|
|
26
|
+
|
|
27
|
+
- **压缩**:3D VAE 在空间 + 时间双维度压缩 token 数(典型 $8 \times 8 \times 4$)
|
|
28
|
+
- **架构**:在 latent 上跑 attention(spatiotemporal patterns 是设计点)
|
|
29
|
+
- **生成范式**:DDPM / Rectified Flow / FM(v-prediction 主流;SD3-style)
|
|
30
|
+
|
|
31
|
+
### 1.2 2024-2025 时间线(按发布顺序)
|
|
32
|
+
|
|
33
|
+
| 时间 | 模型 | 出品 | 关键贡献 |
|
|
34
|
+
| --- | --- | --- | --- |
|
|
35
|
+
| 2023-07 → ICLR'24 | **AnimateDiff** | Guo et al. | T2I 主干 + plug-in motion module,开源 I2V/T2V 鼻祖 |
|
|
36
|
+
| 2023-11 | **SVD** | Stability | I2V 开源 baseline;SD2.1 + temporal layers |
|
|
37
|
+
| 2024-01 | **Latte** | Ma et al. | 早期 DiT-Video;factorized spatial+temporal |
|
|
38
|
+
| 2024-02 | **Sora** | OpenAI | DiT + spacetime patches + 大规模 caption;闭源 |
|
|
39
|
+
| 2024-05 | **Veo** | Google DeepMind | 闭源 1080p / 1 分钟 |
|
|
40
|
+
| 2024-06 | **Kling** | Kuaishou | 国产闭源,时长 2 分钟 |
|
|
41
|
+
| 2024-08 | **CogVideoX** (arXiv) | Zhipu/THU | 开源 5B/15B;Expert Transformer + 3D VAE |
|
|
42
|
+
| 2024-10 | **Movie Gen** | Meta | 30B;视频 + 音频联合;DiT + FM |
|
|
43
|
+
| 2024-10 | **Mochi-1** | Genmo | 10B 开源;AsymmDiT 非对称 MM-DiT |
|
|
44
|
+
| 2024-11 | **LTX-Video** | Lightricks | 实时(2B);强压缩 VAE + DiT |
|
|
45
|
+
| 2024-12 | **Hunyuan-Video** | Tencent | 13B 开源 SoTA;3D Causal VAE + MM-DiT + prompt rewriter |
|
|
46
|
+
| 2024-12 | **Veo 2** | Google | 4K / 2 分钟 |
|
|
47
|
+
| 2025-02 | **Wan 2.1** | Alibaba (Team Wan) | 14B 开源;T2V + I2V 双模 |
|
|
48
|
+
| 2025-07 | **Wan 2.2** | Alibaba | 升级版;MoE expert + 更长时序 |
|
|
49
|
+
| 2024-2025 | **OpenSora / OpenSora-Plan** | HPC-AI / PKU | 全开源训练栈复刻 Sora pipeline |
|
|
50
|
+
|
|
51
|
+
> ⚠️ **闭源 vs 开源** — Sora / Veo / Kling / Movie Gen 没放 weights,所有架构细节基于官方 technical report;面试时不要把内部 ablation 当真硬数字,要主动说 "according to their report"。
|
|
52
|
+
|
|
53
|
+
### 1.3 整体 pipeline(共性骨架)
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
Text --T5/CLIP/MLLM--> text tokens [B, L_t, D]
|
|
57
|
+
Video --3D Causal VAE--> latent z₁ [B, C, t, h, w] --patchify (p_t×p_h×p_w)--> tokens [B, N_v, D]
|
|
58
|
+
│
|
|
59
|
+
Latent DiT / MM-DiT
|
|
60
|
+
(full 3D / factorized 2+1D / window ST attention)
|
|
61
|
+
│ Train: regress v_θ(τ, z_τ, text) -> z₁ - z₀ (RF)
|
|
62
|
+
↓
|
|
63
|
+
sampled z₁ --3D Causal VAE Decoder--> Generated video [B, 3, T, H, W]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## §2 3D Causal VAE — 视频压缩的基石
|
|
67
|
+
|
|
68
|
+
### 2.1 形式化
|
|
69
|
+
|
|
70
|
+
VAE encoder $E$ 与 decoder $D$:
|
|
71
|
+
|
|
72
|
+
$$E: \mathbb{R}^{3 \times T \times H \times W} \to \mathbb{R}^{C \times t \times h \times w}, \quad D: \mathbb{R}^{C \times t \times h \times w} \to \mathbb{R}^{3 \times T \times H \times W}$$
|
|
73
|
+
|
|
74
|
+
下采样率 $T/t \in \{4, 8\}$(时间)、$H/h, W/w \in \{8, 16\}$(空间)。Hunyuan-Video / CogVideoX / Wan 用 $4{\times}8{\times}8$,LTX-Video 极限 $8{\times}32{\times}32 = 8192\times$ token 压缩。
|
|
75
|
+
|
|
76
|
+
潜空间维度 $C$ 一般 $16$(Hunyuan)或 $4$(OpenSora);越大保留信息越多,但 latent prior 离 $\mathcal{N}(0,I)$ 越远,diffusion 收敛越慢。
|
|
77
|
+
|
|
78
|
+
### 2.2 为什么必须 "Causal" — 三个关键收益
|
|
79
|
+
|
|
80
|
+
> ✅ **3D Causal VAE 三大优势**
|
|
81
|
+
|
|
82
|
+
- **Image / video 同构**:当 $T=1$(单帧)时,causal 3D conv 退化为 2D conv(kernel 在时间维只看历史,但历史为空 → 等价于无时间维)。Encoder 既能压视频也能压图像,**图像与视频可以共享同一 latent 空间**——这是 Hunyuan-Video / Wan 同时支持 I2V/T2V 的前提。
|
|
83
|
+
|
|
84
|
+
- **流式 / 自回归推理**:因果保证当前帧 latent 只依赖历史帧,**长视频可分 chunk 处理**,无需一次性 decode 全部 $T$ 帧;与 LLM 的 KV cache 同源思路。
|
|
85
|
+
|
|
86
|
+
- **训练数据 utilization**:图像 + 视频混合训练时,图像可视作 $T{=}1$ 视频;标准 3D VAE 在时间维 kernel 中心要看未来,不能这么做。
|
|
87
|
+
|
|
88
|
+
### 2.3 Causal Conv3d 的实现
|
|
89
|
+
|
|
90
|
+
标准 3D conv 在时间维做 zero padding 时左右各 pad $\lfloor k_t/2 \rfloor$(symmetric),这会让 output[t] 依赖 input[t-1], input[t], input[t+1]——**泄露未来**。
|
|
91
|
+
|
|
92
|
+
**Causal 3D conv** = 把 padding 全堆到时间左侧(过去方向),右侧(未来)不 pad:
|
|
93
|
+
|
|
94
|
+
$$\text{output}[t] = \sum_{\tau=0}^{k_t - 1} W[\tau] \cdot \text{input}[t - (k_t - 1) + \tau]$$
|
|
95
|
+
|
|
96
|
+
即 output 在时间 $t$ 只看 $[t - k_t + 1, t]$ 这一段历史。空间维仍 symmetric padding(图像问题,无方向)。
|
|
97
|
+
|
|
98
|
+
> ⚠️ **下采样的 causal 化** — 时间 stride > 1 的下采样层(如 $T \to T/2$)要保证窗口对齐。常见做法:让 stride 在时间维只看历史窗 `[t-1, t]`,输出 `t' = t//2`。Hunyuan-Video / Mochi 在 paper 里都画了这一层。
|
|
99
|
+
|
|
100
|
+
### 2.4 损失函数(与图像 VAE 同骨架)
|
|
101
|
+
|
|
102
|
+
$$\mathcal{L}_\text{VAE} = \mathcal{L}_\text{recon} + \lambda_\text{KL} \cdot \mathcal{L}_\text{KL} + \lambda_\text{LPIPS} \cdot \mathcal{L}_\text{LPIPS} + \lambda_\text{GAN} \cdot \mathcal{L}_\text{GAN}$$
|
|
103
|
+
|
|
104
|
+
视频 VAE 还需要 **temporal consistency loss**(如相邻帧重建差异 + 光流约束)防闪烁。Hunyuan-Video 用 GAN(PatchGAN 在 spatiotemporal patch 上)+ 3D 感知损失。
|
|
105
|
+
|
|
106
|
+
### 2.5 代码:Causal Conv3d 与编码器骨架
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
import math
|
|
110
|
+
import torch
|
|
111
|
+
import torch.nn as nn
|
|
112
|
+
import torch.nn.functional as F
|
|
113
|
+
|
|
114
|
+
class CausalConv3d(nn.Module):
|
|
115
|
+
"""
|
|
116
|
+
时间维度因果 conv3d.
|
|
117
|
+
输入 [B, C_in, T, H, W] -> 输出 [B, C_out, T, H, W](stride=1 时形状不变).
|
|
118
|
+
时间 kernel 大小 k_t -> 左侧 pad (k_t-1),右侧不 pad;空间维 symmetric pad.
|
|
119
|
+
"""
|
|
120
|
+
def __init__(self, in_ch, out_ch, kernel=(3, 3, 3), stride=(1, 1, 1), dilation=(1, 1, 1)):
|
|
121
|
+
super().__init__()
|
|
122
|
+
k_t, k_h, k_w = kernel
|
|
123
|
+
d_t, d_h, d_w = dilation
|
|
124
|
+
# 时间维 causal padding(全部堆到左侧)
|
|
125
|
+
self.t_pad_left = (k_t - 1) * d_t
|
|
126
|
+
# 空间维 symmetric padding
|
|
127
|
+
self.h_pad = ((k_h - 1) * d_h) // 2
|
|
128
|
+
self.w_pad = ((k_w - 1) * d_w) // 2
|
|
129
|
+
# 注意 nn.Conv3d 自带 padding 是 symmetric, 这里手动 pad + 关闭 conv 自带 pad
|
|
130
|
+
self.conv = nn.Conv3d(in_ch, out_ch, kernel_size=kernel,
|
|
131
|
+
stride=stride, dilation=dilation, padding=0)
|
|
132
|
+
|
|
133
|
+
def forward(self, x):
|
|
134
|
+
# x: [B, C, T, H, W]
|
|
135
|
+
# F.pad order: (W_left, W_right, H_left, H_right, T_left, T_right)
|
|
136
|
+
x = F.pad(x, (self.w_pad, self.w_pad,
|
|
137
|
+
self.h_pad, self.h_pad,
|
|
138
|
+
self.t_pad_left, 0)) # 时间右侧不 pad => 不看未来
|
|
139
|
+
return self.conv(x)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
class CausalResBlock3D(nn.Module):
|
|
143
|
+
def __init__(self, ch, groups=8):
|
|
144
|
+
super().__init__()
|
|
145
|
+
self.norm1 = nn.GroupNorm(groups, ch)
|
|
146
|
+
self.conv1 = CausalConv3d(ch, ch, kernel=(3, 3, 3))
|
|
147
|
+
self.norm2 = nn.GroupNorm(groups, ch)
|
|
148
|
+
self.conv2 = CausalConv3d(ch, ch, kernel=(3, 3, 3))
|
|
149
|
+
|
|
150
|
+
def forward(self, x):
|
|
151
|
+
h = self.conv1(F.silu(self.norm1(x)))
|
|
152
|
+
h = self.conv2(F.silu(self.norm2(h)))
|
|
153
|
+
return x + h
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class CausalVAEEncoder(nn.Module):
|
|
157
|
+
"""
|
|
158
|
+
教学版 3D Causal VAE encoder. 实际 Hunyuan / CogVideoX 用更深的 stack + GAN 判别器.
|
|
159
|
+
Downsample 用 stride=(2,2,2) 的 CausalConv3d (时间维仍 causal).
|
|
160
|
+
"""
|
|
161
|
+
def __init__(self, in_ch=3, base_ch=64, z_ch=16, num_levels=3, blocks_per_level=2):
|
|
162
|
+
super().__init__()
|
|
163
|
+
self.in_proj = CausalConv3d(in_ch, base_ch, kernel=(3, 3, 3))
|
|
164
|
+
levels, ch = [], base_ch
|
|
165
|
+
for _ in range(num_levels):
|
|
166
|
+
blocks = [CausalResBlock3D(ch) for _ in range(blocks_per_level)]
|
|
167
|
+
blocks.append(CausalConv3d(ch, ch * 2, kernel=(3, 3, 3), stride=(2, 2, 2)))
|
|
168
|
+
levels.append(nn.Sequential(*blocks))
|
|
169
|
+
ch *= 2
|
|
170
|
+
self.levels = nn.ModuleList(levels)
|
|
171
|
+
self.norm_out = nn.GroupNorm(8, ch)
|
|
172
|
+
self.head = CausalConv3d(ch, 2 * z_ch, kernel=(1, 1, 1)) # mu + logvar
|
|
173
|
+
|
|
174
|
+
def forward(self, x):
|
|
175
|
+
# 期望 T, H, W 能整除 2^num_levels
|
|
176
|
+
h = self.in_proj(x)
|
|
177
|
+
for lvl in self.levels:
|
|
178
|
+
h = lvl(h)
|
|
179
|
+
h = F.silu(self.norm_out(h))
|
|
180
|
+
return self.head(h).chunk(2, dim=1) # (mu, logvar)
|
|
181
|
+
|
|
182
|
+
@staticmethod
|
|
183
|
+
def reparameterize(mu, logvar):
|
|
184
|
+
return mu + torch.exp(0.5 * logvar) * torch.randn_like(mu)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
> 💡 **首帧 / chunk boundary 处理(面试加分)** — 因果 pad 让首帧时间维"看 0"——VAE 训练时随机扔掉时间起点的 $k_t{-}1$ 帧损失贡献,或者用 anchor padding(首帧复制填充)。Hunyuan-Video 在 paper 里讨论了 chunk-by-chunk 编码时 boundary frame 的一致性问题,工程上常通过 chunked overlapping 解决。
|
|
188
|
+
|
|
189
|
+
## §3 Spacetime Patches (Sora 视角)
|
|
190
|
+
|
|
191
|
+
### 3.1 一句话
|
|
192
|
+
|
|
193
|
+
像 ViT 把图像切 $p \times p$ patch 当 token,Sora 把 **视频 latent** 切 $p_t \times p_h \times p_w$ 的 **3D patch** 当 token。$N = (t/p_t) \cdot (h/p_h) \cdot (w/p_w)$ 个 token 喂给 Transformer。
|
|
194
|
+
|
|
195
|
+
公式上把一段 latent $z \in \mathbb{R}^{C \times t \times h \times w}$ 重排:
|
|
196
|
+
|
|
197
|
+
$$z \mapsto Z \in \mathbb{R}^{N \times (C \cdot p_t \cdot p_h \cdot p_w)} \xrightarrow{W_\text{proj}} Z' \in \mathbb{R}^{N \times D}$$
|
|
198
|
+
|
|
199
|
+
### 3.2 为什么 patch 化(而非每 voxel 一个 token)
|
|
200
|
+
|
|
201
|
+
- **token 数缩减**:$p_t \cdot p_h \cdot p_w$ 倍降低 $N$,attention 二次成本大幅下降。
|
|
202
|
+
- **局部归纳偏置**:每个 patch 内是固定 mlp 投影,类似 conv 的局部融合。
|
|
203
|
+
- **支持变形**:不同分辨率 / 时长直接产生不同 $N$,模型在 Transformer 内对 $N$ 不敏感。
|
|
204
|
+
|
|
205
|
+
### 3.3 Variable resolution / duration / aspect ratio(Sora 关键贡献)
|
|
206
|
+
|
|
207
|
+
Sora 不把每段视频 resize 到固定尺寸(如 $256 \times 256 \times 16$)。它把不同 $(T, H, W)$ 的视频都切成 patch 序列,**用 packing**(不同样本混到同一 batch 用 segment mask 分离)训练。
|
|
208
|
+
|
|
209
|
+
实现要点:
|
|
210
|
+
|
|
211
|
+
- **位置编码用相对 / 解耦** :space 用 RoPE-2D,time 用 RoPE-1D;不绑死最大长度。
|
|
212
|
+
- **Attention mask**:同一 batch 内不同 sample 的 token 之间 mask 掉。
|
|
213
|
+
- **target aspect ratio token**:作为额外条件让模型知道当前生成的是 16:9 还是 9:16。
|
|
214
|
+
|
|
215
|
+
这一招让 Sora 可以训 / 生成任意比例的视频;后续 Wan-2.x、Hunyuan-Video 都借鉴。
|
|
216
|
+
|
|
217
|
+
### 3.4 代码:Spacetime patchify / unpatchify
|
|
218
|
+
|
|
219
|
+
```python
|
|
220
|
+
class SpacetimePatchify(nn.Module):
|
|
221
|
+
"""
|
|
222
|
+
把 video latent [B, C, t, h, w] 切成 3D patch token [B, N, D].
|
|
223
|
+
p_t/p_h/p_w 必须能整除 t/h/w(输入时保证).
|
|
224
|
+
"""
|
|
225
|
+
def __init__(self, in_ch, patch=(2, 2, 2), embed_dim=1024):
|
|
226
|
+
super().__init__()
|
|
227
|
+
self.p_t, self.p_h, self.p_w = patch
|
|
228
|
+
self.proj = nn.Conv3d(
|
|
229
|
+
in_ch, embed_dim,
|
|
230
|
+
kernel_size=(self.p_t, self.p_h, self.p_w),
|
|
231
|
+
stride=(self.p_t, self.p_h, self.p_w),
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
def forward(self, z):
|
|
235
|
+
# z: [B, C, t, h, w]
|
|
236
|
+
x = self.proj(z) # [B, D, t/p_t, h/p_h, w/p_w]
|
|
237
|
+
B, D, tt, hh, ww = x.shape
|
|
238
|
+
N = tt * hh * ww
|
|
239
|
+
x = x.flatten(2).transpose(1, 2) # [B, N, D]
|
|
240
|
+
return x, (tt, hh, ww)
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
class SpacetimeUnpatchify(nn.Module):
|
|
244
|
+
""" Patchify 的逆操作: [B, N, D] + shape -> [B, C_out, t, h, w] """
|
|
245
|
+
def __init__(self, embed_dim, out_ch, patch=(2, 2, 2)):
|
|
246
|
+
super().__init__()
|
|
247
|
+
self.p_t, self.p_h, self.p_w = patch
|
|
248
|
+
self.out_ch = out_ch
|
|
249
|
+
# 每个 token 解码回 (out_ch * p_t * p_h * p_w) 维 voxel block
|
|
250
|
+
self.proj = nn.Linear(embed_dim, out_ch * self.p_t * self.p_h * self.p_w)
|
|
251
|
+
|
|
252
|
+
def forward(self, x, grid):
|
|
253
|
+
# x: [B, N, D], grid = (tt, hh, ww)
|
|
254
|
+
B, N, D = x.shape
|
|
255
|
+
tt, hh, ww = grid
|
|
256
|
+
assert N == tt * hh * ww
|
|
257
|
+
y = self.proj(x) # [B, N, out_ch * p_t * p_h * p_w]
|
|
258
|
+
y = y.view(B, tt, hh, ww, self.out_ch, self.p_t, self.p_h, self.p_w)
|
|
259
|
+
# 把 patch 内坐标拼回原始空间:(tt, p_t) -> T, (hh, p_h) -> H, ...
|
|
260
|
+
y = y.permute(0, 4, 1, 5, 2, 6, 3, 7).contiguous()
|
|
261
|
+
return y.view(B, self.out_ch, tt * self.p_t, hh * self.p_h, ww * self.p_w)
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
> ⚠️ **patch 大小如何选** — $p_t$ 通常 1-2(时间维已被 VAE 压过 4x,不能再压太多),$p_h = p_w$ 通常 2。开源模型常用 $p_t{=}1, p_h{=}p_w{=}2$(Mochi-1 / Hunyuan-Video,配合 4×8×8 latent VAE)。Sora 未公开实现细节,只描述了 "spacetime patches" 概念。
|
|
265
|
+
|
|
266
|
+
## §4 Spatiotemporal Attention 三大变体
|
|
267
|
+
|
|
268
|
+
### 4.1 复杂度对比(核心面试题)
|
|
269
|
+
|
|
270
|
+
定义 $S = h \cdot w / (p_h p_w)$(每帧 token 数),$T_t = t / p_t$(时间 token 数),$N = S \cdot T_t$。
|
|
271
|
+
|
|
272
|
+
| 类型 | 公式形式 | Time | Score memory (vanilla) | 用在哪 |
|
|
273
|
+
| --- | --- | --- | --- | --- |
|
|
274
|
+
| **Factorized 2+1D** | $\text{TempAttn}(\text{SpatialAttn}(x))$ | $O(T_t S^2 + S T_t^2) \cdot d$ | $O(T_t S^2 + S T_t^2)$ | Latte, OpenSora, AnimateDiff |
|
|
275
|
+
| **Full 3D ST** | $\text{Attn}_{\text{ST}}(x \in \mathbb{R}^{N \times D})$ | $O(N^2 d) = O(S^2 T_t^2 d)$ | $O(N^2)$ | Hunyuan-Video, Mochi, (Sora 推测) |
|
|
276
|
+
| **2+1D + 周期 full** | 大部分块 2+1D, 少量块 full | 介于两者 | 介于两者 | OpenSora-Plan, CogVideoX |
|
|
277
|
+
| **Window 3D / 稀疏** | 局部 3D window | $O(N \cdot w^3 d)$ ($w$ = window) | $O(N \cdot w^3)$ | 部分工程实践 |
|
|
278
|
+
|
|
279
|
+
> 💡 **核心对比** — Full 3D 是 spacetime token 全交互,**表达力最强**;Factorized 是先空间后时间两次 attn,**强假设 space ⊗ time 可分**,但成本低 $\min(S, T_t)$ 量级倍。Sora 官方未披露具体 attention 类型,社区基于其 "spacetime patches" 描述普遍推测是 full 3D / 大序列统一 attention(Hunyuan-Video / Mochi 已采用此设计)。
|
|
280
|
+
|
|
281
|
+
### 4.2 Factorized 2+1D Attention(Latte / OpenSora)
|
|
282
|
+
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Input [B, T_t, S, D]
|
|
286
|
+
│
|
|
287
|
+
│ rearrange -> [B*T_t, S, D]
|
|
288
|
+
↓
|
|
289
|
+
SpatialAttn (每帧内 self-attention) → [B*T_t, S, D]
|
|
290
|
+
│
|
|
291
|
+
│ rearrange -> [B*S, T_t, D]
|
|
292
|
+
↓
|
|
293
|
+
TempAttn (跨帧 self-attention) → [B*S, T_t, D]
|
|
294
|
+
│
|
|
295
|
+
│ rearrange -> [B, T_t, S, D]
|
|
296
|
+
↓
|
|
297
|
+
FFN
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
强假设:每帧的 spatial relations 与跨帧的 temporal relations **可分离**。这是简化但工程上非常好用——多数情况下视频里相邻帧大体相似(temporal "光流" 信息可用 1D attn 抓到),帧内 patch 关系类似图像。
|
|
301
|
+
|
|
302
|
+
### 4.3 Full 3D Spatiotemporal Attention(Sora / Hunyuan / Mochi)
|
|
303
|
+
|
|
304
|
+
直接把 $N = S \cdot T_t$ 个 token 串成一维序列,标准 self-attention:
|
|
305
|
+
|
|
306
|
+
$$\text{Attn}(Z) = \text{softmax}\!\left(\frac{Q K^\top}{\sqrt{d_k}}\right) V, \quad Z \in \mathbb{R}^{N \times D}$$
|
|
307
|
+
|
|
308
|
+
复杂度 $O(N^2 d)$。$N$ 在长视频下大:例如 720p × 5s × 24fps 经 $4{\times}8{\times}8$ VAE 后 latent shape 约为 $30 \times 90 \times 160$,再做 (1,2,2) patchify 得 $N = 30 \cdot 45 \cdot 80 = 108000$ token,$N^2 \approx 1.17 \times 10^{10}$。**所以工程上必须用 FlashAttention v2/v3 + Tensor Parallelism + Sequence Parallelism**。
|
|
309
|
+
|
|
310
|
+
### 4.4 RoPE-3D(位置编码)
|
|
311
|
+
|
|
312
|
+
视频 token 需要同时编码 (time, height, width) 三维位置。**做法 1(解耦)**:把 $d$ 维向量切三段,分别对 (t, h, w) 做 RoPE。**做法 2(共享)**:每段都 stack 三种频率的旋转(Hunyuan-Video)。
|
|
313
|
+
|
|
314
|
+
CogVideoX 用 **3D RoPE**:把 $d$ 维 query/key 切成三段 $q = [q^{(t)} \,|\, q^{(h)} \,|\, q^{(w)}]$(disjoint subspace),三段分别用 (t, h, w) 对应的频率做 1D RoPE 后 concat:
|
|
315
|
+
|
|
316
|
+
$$\text{RoPE}_{3D}(q,\, t, h, w) = \big[\, R_t(\theta_t) q^{(t)} \,\big|\, R_h(\theta_h) q^{(h)} \,\big|\, R_w(\theta_w) q^{(w)} \,\big]$$
|
|
317
|
+
|
|
318
|
+
实操即三段独立 1D RoPE 拼接(block-diagonal 旋转),自然得到相对时空位置编码。
|
|
319
|
+
|
|
320
|
+
### 4.5 代码:Factorized 2+1D 实现
|
|
321
|
+
|
|
322
|
+
```python
|
|
323
|
+
class AxisAttention(nn.Module):
|
|
324
|
+
"""
|
|
325
|
+
沿一个指定轴 (spatial 'S' 或 temporal 'T') 做 self-attention.
|
|
326
|
+
输入 [B, T, S, D] -> 输出 [B, T, S, D].
|
|
327
|
+
"""
|
|
328
|
+
def __init__(self, dim, heads, head_dim, axis="S", causal=False):
|
|
329
|
+
super().__init__()
|
|
330
|
+
assert axis in ("S", "T")
|
|
331
|
+
self.heads, self.head_dim, self.axis, self.causal = heads, head_dim, axis, causal
|
|
332
|
+
self.qkv = nn.Linear(dim, 3 * heads * head_dim, bias=False)
|
|
333
|
+
self.out = nn.Linear(heads * head_dim, dim, bias=False)
|
|
334
|
+
|
|
335
|
+
def forward(self, x):
|
|
336
|
+
B, T, S, D = x.shape
|
|
337
|
+
if self.axis == "S":
|
|
338
|
+
x_ = x.reshape(B * T, S, D); L_seq = S; merge_batch = T
|
|
339
|
+
else: # "T": 把 spatial 维 collapse 进 batch, 时间维当 seq
|
|
340
|
+
x_ = x.permute(0, 2, 1, 3).reshape(B * S, T, D); L_seq = T; merge_batch = S
|
|
341
|
+
qkv = self.qkv(x_).reshape(-1, L_seq, 3, self.heads, self.head_dim)
|
|
342
|
+
q, k, v = (t.transpose(1, 2) for t in qkv.unbind(dim=2)) # [B', H, L, d_k]
|
|
343
|
+
# PyTorch SDPA 自动选 FlashAttention v2/v3
|
|
344
|
+
out = F.scaled_dot_product_attention(q, k, v, is_causal=self.causal)
|
|
345
|
+
out = out.transpose(1, 2).reshape(-1, L_seq, self.heads * self.head_dim)
|
|
346
|
+
out = self.out(out)
|
|
347
|
+
if self.axis == "S":
|
|
348
|
+
return out.reshape(B, T, S, D)
|
|
349
|
+
else:
|
|
350
|
+
return out.reshape(B, S, T, D).permute(0, 2, 1, 3)
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
class Factorized2plus1DBlock(nn.Module):
|
|
354
|
+
""" Latte-style: SpatialAttn -> TempAttn -> FFN. """
|
|
355
|
+
def __init__(self, dim, heads, head_dim, mlp_ratio=4.0):
|
|
356
|
+
super().__init__()
|
|
357
|
+
self.norm1 = nn.LayerNorm(dim); self.spatial = AxisAttention(dim, heads, head_dim, "S")
|
|
358
|
+
self.norm2 = nn.LayerNorm(dim); self.temporal = AxisAttention(dim, heads, head_dim, "T")
|
|
359
|
+
self.norm3 = nn.LayerNorm(dim)
|
|
360
|
+
hidden = int(dim * mlp_ratio)
|
|
361
|
+
self.mlp = nn.Sequential(nn.Linear(dim, hidden), nn.GELU(), nn.Linear(hidden, dim))
|
|
362
|
+
|
|
363
|
+
def forward(self, x):
|
|
364
|
+
x = x + self.spatial(self.norm1(x))
|
|
365
|
+
x = x + self.temporal(self.norm2(x))
|
|
366
|
+
x = x + self.mlp(self.norm3(x))
|
|
367
|
+
return x
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### 4.6 代码:Full 3D Spatiotemporal Attention(with FlashAttention via SDPA)
|
|
371
|
+
|
|
372
|
+
```python
|
|
373
|
+
class Full3DSpatiotemporalAttention(nn.Module):
|
|
374
|
+
"""
|
|
375
|
+
把 [B, T, S, D] 当作 [B, N, D] 做 self-attention(N = T*S).
|
|
376
|
+
使用 PyTorch SDPA, 底层在 H100/A100 上会自动调度 FlashAttention v2/v3.
|
|
377
|
+
与 MM-DiT 结合时, text/video token 直接 concat 到这一序列做 attention(见 §5.4).
|
|
378
|
+
"""
|
|
379
|
+
def __init__(self, dim, heads, head_dim):
|
|
380
|
+
super().__init__()
|
|
381
|
+
self.heads = heads
|
|
382
|
+
self.head_dim = head_dim
|
|
383
|
+
self.qkv = nn.Linear(dim, 3 * heads * head_dim, bias=False)
|
|
384
|
+
self.out = nn.Linear(heads * head_dim, dim, bias=False)
|
|
385
|
+
|
|
386
|
+
def forward(self, x, attn_bias=None):
|
|
387
|
+
# x: [B, N, D] (调用前先把 T*S flatten)
|
|
388
|
+
B, N, D = x.shape
|
|
389
|
+
qkv = self.qkv(x).reshape(B, N, 3, self.heads, self.head_dim)
|
|
390
|
+
q, k, v = qkv.unbind(dim=2) # [B, N, H, d_k]
|
|
391
|
+
q, k, v = (t.transpose(1, 2) for t in (q, k, v)) # [B, H, N, d_k]
|
|
392
|
+
out = F.scaled_dot_product_attention(q, k, v, attn_mask=attn_bias)
|
|
393
|
+
out = out.transpose(1, 2).reshape(B, N, -1)
|
|
394
|
+
return self.out(out)
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
## §5 MM-DiT for Video(Hunyuan-Video / Mochi-1 思路)
|
|
398
|
+
|
|
399
|
+
### 5.1 从 SD3 MM-DiT 推广到视频
|
|
400
|
+
|
|
401
|
+
SD3 (Esser et al. 2024) 引入 **MM-DiT**:把 text token 和 image token concat 到同一序列做 self-attention,**两个 stream 各自有独立的 QKV / FFN / AdaLN 参数**,但 attention 是同一矩阵:
|
|
402
|
+
|
|
403
|
+
$$Z = [Z_\text{text} \,|\, Z_\text{img}], \quad \text{Attn}(Z) \text{ shared, FFN per-stream}$$
|
|
404
|
+
|
|
405
|
+
视频化 = 把 image stream 换成 video stream(spacetime token),text stream 不变。
|
|
406
|
+
|
|
407
|
+
### 5.2 Hunyuan-Video 的 dual-stream → single-stream 设计
|
|
408
|
+
|
|
409
|
+
Hunyuan-Video tech report 把 DiT 分成两段:
|
|
410
|
+
|
|
411
|
+
- **Dual-stream blocks**(前 N 层):text token 与 video token 在 attention 共享,但 FFN / AdaLN 独立——让两个模态先各自精炼表示。
|
|
412
|
+
- **Single-stream blocks**(后 M 层):text token 和 video token 完全 share weight,相当于普通 Transformer 处理统一序列。
|
|
413
|
+
|
|
414
|
+
这与 Mochi-1 的 **AsymmDiT** 类似(Mochi 让 video stream 比 text stream 宽 4 倍参数,因为视频信息远多于文本)。
|
|
415
|
+
|
|
416
|
+
### 5.3 文本编码器(一览)
|
|
417
|
+
|
|
418
|
+
| 模型 | Text encoder | 备注 |
|
|
419
|
+
| --- | --- | --- |
|
|
420
|
+
| Hunyuan-Video | CLIP-L + MLLM (LLaVA 风) | MLLM 提供长 prompt + 物体关系 |
|
|
421
|
+
| Mochi-1 | T5-XXL | 与 SD3 同 |
|
|
422
|
+
| Wan 2.1 / 2.2 | UMT5 (multilingual) | 支持中英双语 |
|
|
423
|
+
| CogVideoX | T5-XXL | — |
|
|
424
|
+
| Sora | 未公开 | OpenAI 报告只提到使用 re-captioning 流程 |
|
|
425
|
+
|
|
426
|
+
> 💡 **prompt rewriter(Hunyuan-Video / Sora 报告)** — 训练数据 caption 通常长且细致,用户 short prompt 与训练分布有 gap。Sora 官方报告提到训练前对视频做 dense re-captioning;Hunyuan-Video 在推理时用 LLM 改写短 prompt 成 dense caption 再喂模型。面试常问"为什么需要 prompt rewriter"——答:训练/推理 caption 分布对齐 + 用户原 prompt 太短。
|
|
427
|
+
|
|
428
|
+
### 5.4 代码:MM-DiT video block
|
|
429
|
+
|
|
430
|
+
```python
|
|
431
|
+
class MMDiTVideoBlock(nn.Module):
|
|
432
|
+
"""
|
|
433
|
+
Dual-stream MM-DiT block (Hunyuan-Video / Mochi-1 / SD3 style).
|
|
434
|
+
Text token 与 video token 共享 self-attention 矩阵, 但 QKV / FFN / AdaLN 各自参数.
|
|
435
|
+
"""
|
|
436
|
+
def __init__(self, dim, heads, head_dim, mlp_ratio=4.0):
|
|
437
|
+
super().__init__()
|
|
438
|
+
self.heads = heads
|
|
439
|
+
self.head_dim = head_dim
|
|
440
|
+
self.scale = 1.0 / math.sqrt(head_dim)
|
|
441
|
+
|
|
442
|
+
# 各自的 QKV
|
|
443
|
+
self.qkv_text = nn.Linear(dim, 3 * heads * head_dim, bias=False)
|
|
444
|
+
self.qkv_vid = nn.Linear(dim, 3 * heads * head_dim, bias=False)
|
|
445
|
+
self.out_text = nn.Linear(heads * head_dim, dim, bias=False)
|
|
446
|
+
self.out_vid = nn.Linear(heads * head_dim, dim, bias=False)
|
|
447
|
+
|
|
448
|
+
# 各自的 FFN
|
|
449
|
+
hidden = int(dim * mlp_ratio)
|
|
450
|
+
self.mlp_text = nn.Sequential(nn.Linear(dim, hidden), nn.GELU(), nn.Linear(hidden, dim))
|
|
451
|
+
self.mlp_vid = nn.Sequential(nn.Linear(dim, hidden), nn.GELU(), nn.Linear(hidden, dim))
|
|
452
|
+
|
|
453
|
+
# 各自的 AdaLN(由 timestep + pooled text condition 调制)
|
|
454
|
+
self.norm_text = nn.LayerNorm(dim, elementwise_affine=False)
|
|
455
|
+
self.norm_vid = nn.LayerNorm(dim, elementwise_affine=False)
|
|
456
|
+
self.norm_ff_text = nn.LayerNorm(dim, elementwise_affine=False)
|
|
457
|
+
self.norm_ff_vid = nn.LayerNorm(dim, elementwise_affine=False)
|
|
458
|
+
self.cond_text = nn.Linear(dim, 6 * dim)
|
|
459
|
+
self.cond_vid = nn.Linear(dim, 6 * dim)
|
|
460
|
+
|
|
461
|
+
@staticmethod
|
|
462
|
+
def _modulate(x, shift, scale):
|
|
463
|
+
return x * (1 + scale.unsqueeze(1)) + shift.unsqueeze(1)
|
|
464
|
+
|
|
465
|
+
def _proj_qkv(self, x, qkv_mod):
|
|
466
|
+
B, L, _ = x.shape
|
|
467
|
+
qkv = qkv_mod(x).reshape(B, L, 3, self.heads, self.head_dim)
|
|
468
|
+
q, k, v = qkv.unbind(dim=2) # [B, L, H, d_k]
|
|
469
|
+
return q.transpose(1, 2), k.transpose(1, 2), v.transpose(1, 2) # [B, H, L, d_k]
|
|
470
|
+
|
|
471
|
+
def forward(self, text, vid, cond):
|
|
472
|
+
"""
|
|
473
|
+
text: [B, L_t, D] vid: [B, N_v, D]
|
|
474
|
+
cond: [B, D] (timestep emb + pooled text)
|
|
475
|
+
"""
|
|
476
|
+
# Modulation params
|
|
477
|
+
st_a, sc_t_a, gt_a, st_m, sc_t_m, gt_m = self.cond_text(F.silu(cond)).chunk(6, dim=-1)
|
|
478
|
+
sv_a, sc_v_a, gv_a, sv_m, sc_v_m, gv_m = self.cond_vid(F.silu(cond)).chunk(6, dim=-1)
|
|
479
|
+
|
|
480
|
+
# Pre-norm + modulate (各 stream 独立)
|
|
481
|
+
t = self._modulate(self.norm_text(text), st_a, sc_t_a)
|
|
482
|
+
v_ = self._modulate(self.norm_vid(vid), sv_a, sc_v_a)
|
|
483
|
+
|
|
484
|
+
# 各 stream 的 QKV (独立参数)
|
|
485
|
+
qt, kt, vt = self._proj_qkv(t, self.qkv_text)
|
|
486
|
+
qv, kv, vv = self._proj_qkv(v_, self.qkv_vid)
|
|
487
|
+
|
|
488
|
+
# Concat 两 stream 沿 seq 维一起 self-attention
|
|
489
|
+
q = torch.cat([qt, qv], dim=2) # [B, H, L_t + N_v, d_k]
|
|
490
|
+
k = torch.cat([kt, kv], dim=2)
|
|
491
|
+
v = torch.cat([vt, vv], dim=2)
|
|
492
|
+
out = F.scaled_dot_product_attention(q, k, v) # [B, H, L_t + N_v, d_k]
|
|
493
|
+
|
|
494
|
+
L_t = text.shape[1]
|
|
495
|
+
out_t, out_v = out[:, :, :L_t], out[:, :, L_t:]
|
|
496
|
+
out_t = out_t.transpose(1, 2).reshape(*text.shape[:2], -1)
|
|
497
|
+
out_v = out_v.transpose(1, 2).reshape(*vid.shape[:2], -1)
|
|
498
|
+
|
|
499
|
+
# Out projection (各 stream)
|
|
500
|
+
text = text + gt_a.unsqueeze(1) * self.out_text(out_t)
|
|
501
|
+
vid = vid + gv_a.unsqueeze(1) * self.out_vid(out_v)
|
|
502
|
+
|
|
503
|
+
# FFN (各 stream)
|
|
504
|
+
text = text + gt_m.unsqueeze(1) * self.mlp_text(
|
|
505
|
+
self._modulate(self.norm_ff_text(text), st_m, sc_t_m))
|
|
506
|
+
vid = vid + gv_m.unsqueeze(1) * self.mlp_vid(
|
|
507
|
+
self._modulate(self.norm_ff_vid(vid), sv_m, sc_v_m))
|
|
508
|
+
return text, vid
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
### 5.5 训练目标
|
|
512
|
+
|
|
513
|
+
主流 = **v-prediction 或 rectified flow vector**(与 SD3 一致)。给定 video latent $x_1$、噪声 $x_0$、随机 $\tau \in [0, 1]$(logit-normal 分布更常用):
|
|
514
|
+
|
|
515
|
+
$$x_\tau = (1 - \tau) x_0 + \tau\, x_1, \quad u_\tau = x_1 - x_0$$
|
|
516
|
+
|
|
517
|
+
$$\mathcal{L} = \mathbb{E}_{\tau, x_0, x_1, c} \, \| v_\theta(\tau, x_\tau, c) - u_\tau \|^2$$
|
|
518
|
+
|
|
519
|
+
其中 $c$ 是 text condition(+ optional 图像 / 视频条件)。Hunyuan-Video / Mochi / Wan 都用 RF(与 image 端 SD3 同 paradigm);Sora 未公开但社区推测也是 RF / v-pred 家族。
|
|
520
|
+
|
|
521
|
+
## §6 Image-to-Video (I2V) — 主流三种条件注入
|
|
522
|
+
|
|
523
|
+
### 6.1 First-Frame Channel Concat(最简、最常用)
|
|
524
|
+
|
|
525
|
+
把参考图 $I_\text{ref}$ 编码成 latent $z_\text{ref}^{(0)} \in \mathbb{R}^{C \times 1 \times h \times w}$(VAE 在 $T{=}1$ 下退化为 2D 编码),沿 latent 时间维 $t$(不是原始帧 $T$)做 zero-padded broadcast,并和 noisy latent 沿 channel 维拼接:
|
|
526
|
+
|
|
527
|
+
$$\tilde{z}_\tau = \text{concat}_C\!\left(z_\tau, \, \tilde{z}_\text{ref}, \, m\right) \in \mathbb{R}^{(2C+1) \times t \times h \times w}$$
|
|
528
|
+
|
|
529
|
+
其中 $\tilde{z}_\text{ref}[:, t', :, :] = z_\text{ref}^{(0)}$ 若 $t'$ 是参考位(一般为 $t' = 0$),其余位为 0;$m \in \{0, 1\}^{1 \times t \times h \times w}$ 是同 shape 的 mask channel(参考位为 1,待生成位为 0)。模型第一层 conv 的 in_channels 从 $C$ 改成 $2C + 1$。
|
|
530
|
+
|
|
531
|
+
**优点**:实现简单,与 T2V 主干完全兼容;改一层 conv 就行。**缺点**:参考信息混在 channel 里,模型要靠 conv 自己提取;远距离帧的引导能力弱。
|
|
532
|
+
|
|
533
|
+
SVD (Stable Video Diffusion, Blattmann 2023) / DynamiCrafter / I2VGen-XL 都用这套。
|
|
534
|
+
|
|
535
|
+
### 6.2 Cross-Attention 注入(细粒度控制)
|
|
536
|
+
|
|
537
|
+
把 $z_\text{ref}$ patchify 成 token,作为额外 K/V 注入到 video stream 的 attention:
|
|
538
|
+
|
|
539
|
+
$$\text{CrossAttn}: \quad Q = z_\text{video tokens}, \, K, V = [z_\text{text}, z_\text{ref tokens}]$$
|
|
540
|
+
|
|
541
|
+
或更复杂——为 ref image 增加独立 cross-attention 层。AnimateDiff 风格的 LoRA tuning 也基本用这条路。
|
|
542
|
+
|
|
543
|
+
### 6.3 AnimateDiff 风格 plug-in motion module
|
|
544
|
+
|
|
545
|
+
> ✅ **AnimateDiff (Guo et al. arXiv 2023-07, ICLR 2024)** — 冻结一个 T2I (Stable Diffusion),**只插入并训练 temporal motion module**(temporal self-attention),就把 T2I 变 T2V。优势:复用 T2I 生态(LoRA / ControlNet);劣势:质量受 base T2I 限制。Motion module 通常插在每个 spatial block 后:`[B,T,C,H,W] -> rearrange [B*H*W, T, C] -> temporal self-attn -> back`。
|
|
546
|
+
|
|
547
|
+
### 6.4 代码:first-frame concat I2V
|
|
548
|
+
|
|
549
|
+
```python
|
|
550
|
+
class FirstFrameI2VAdapter(nn.Module):
|
|
551
|
+
"""
|
|
552
|
+
把 ref image latent 沿时间 broadcast + 沿 channel concat 到 noisy latent.
|
|
553
|
+
用法: 替换 DiT 的 patchify 输入投影, in_ch 从 C 改为 (2C + 1).
|
|
554
|
+
"""
|
|
555
|
+
def __init__(self, latent_ch=16, embed_dim=1024, patch=(1, 2, 2)):
|
|
556
|
+
super().__init__()
|
|
557
|
+
self.patch = patch
|
|
558
|
+
# +1 是 mask channel
|
|
559
|
+
self.proj = nn.Conv3d(
|
|
560
|
+
in_channels=2 * latent_ch + 1,
|
|
561
|
+
out_channels=embed_dim,
|
|
562
|
+
kernel_size=patch, stride=patch,
|
|
563
|
+
)
|
|
564
|
+
|
|
565
|
+
def forward(self, noisy_latent, ref_latent, ref_mask):
|
|
566
|
+
"""
|
|
567
|
+
noisy_latent: [B, C, t, h, w] - 加噪 latent
|
|
568
|
+
ref_latent: [B, C, t, h, w] - 参考帧 latent (待生成位为 0)
|
|
569
|
+
ref_mask: [B, 1, t, h, w] - 1 = 该位置 (在 t 维) 是参考帧, 0 = 待生成
|
|
570
|
+
"""
|
|
571
|
+
x = torch.cat([noisy_latent, ref_latent, ref_mask], dim=1) # [B, 2C+1, t, h, w]
|
|
572
|
+
x = self.proj(x) # [B, D, t', h', w']
|
|
573
|
+
B, D, tt, hh, ww = x.shape
|
|
574
|
+
return x.flatten(2).transpose(1, 2), (tt, hh, ww) # [B, N, D]
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
> 💡 **build ref_latent + mask 的伪代码** — 给定 video latent `z_full` 和参考帧索引 `ref_indices`(如 `[0]` 表示 first-frame I2V),把 `z_full[:, :, idx]` 拷贝到 `ref_latent` 同位置、其余位 0,并在 `ref_mask` 对应位置赋 1。具体实现见 §A.2 `video_gen_forward` 内部。
|
|
578
|
+
|
|
579
|
+
### 6.5 训练时的"noise-only on未来帧" trick
|
|
580
|
+
|
|
581
|
+
I2V 训练时给参考帧 latent 不加噪(或加极小噪声),待生成帧加正常 $\tau$ 噪声。loss 只在待生成帧位置计算。这点在 SVD / Hunyuan-Video I2V variant 中都有提到。
|
|
582
|
+
|
|
583
|
+
## §7 长视频生成(开放问题)
|
|
584
|
+
|
|
585
|
+
### 7.1 三大主流路线
|
|
586
|
+
|
|
587
|
+
| 路线 | 方法 | 代表 | 缺点 |
|
|
588
|
+
| --- | --- | --- | --- |
|
|
589
|
+
| **Keyframe + interpolation** | 先生成 $K$ 个关键帧(远距),再每段插值出中间帧 | NUWA-XL, Movie Gen 部分 pipeline | 关键帧 transition 可能不自然 |
|
|
590
|
+
| **Hierarchical (coarse → fine)** | 先生成 low-fps 低分辨率版本,再 cascade 超分 + 帧插 | Phenaki, Imagen Video, Sora 部分 | 多阶段累积误差 |
|
|
591
|
+
| **Autoregressive chunks** | 每次生成 $T$ 帧 chunk,下一 chunk 以前 chunk 末尾为条件 | Mochi-1 部分模式, StreamingT2V | 误差累积 → drift, "loop" |
|
|
592
|
+
|
|
593
|
+
### 7.2 Sora 的 "duration as condition"
|
|
594
|
+
|
|
595
|
+
Sora 把 video duration 当成 conditioning(不是固定 $T$),训练时把不同时长视频都见过;推理时给定目标时长,生成对应长度 patch 序列。这在公开 report 中只是简短提到。
|
|
596
|
+
|
|
597
|
+
### 7.3 Autoregressive Video Generation 兼容性(Causal VAE 派上用场)
|
|
598
|
+
|
|
599
|
+
由于 3D **Causal** VAE encoder 不看未来,自然支持 chunk-wise 自回归:encoder 可以一段一段处理。但 DiT 部分要做到自回归还需在 token 维度也加 causal——这是研究方向("VAR for Video" 等)。Hunyuan-Video / Wan 现版本仍是 non-AR diffusion。
|
|
600
|
+
|
|
601
|
+
### 7.4 简单的 chunk 自回归伪代码
|
|
602
|
+
|
|
603
|
+
```python
|
|
604
|
+
@torch.no_grad()
|
|
605
|
+
def chunk_autoregressive(rf_sample_fn, vae, text, num_chunks, chunk_t_lat=4, overlap=1,
|
|
606
|
+
latent_shape=(16, 60, 90)):
|
|
607
|
+
"""
|
|
608
|
+
Chunk-wise 自回归生成长视频伪代码框架.
|
|
609
|
+
rf_sample_fn(z_init, text, ref_full, ref_mask) -> z_out
|
|
610
|
+
——使用 §A.3 的 video_gen_sample 风格, 但接受外部 z_init 与 ref clamp.
|
|
611
|
+
latent_shape = (C, h_lat, w_lat); 每段 latent 时间长度 = chunk_t_lat.
|
|
612
|
+
"""
|
|
613
|
+
chunks = []
|
|
614
|
+
ref_latent = None
|
|
615
|
+
C, hl, wl = latent_shape
|
|
616
|
+
device = next(vae.parameters()).device
|
|
617
|
+
for c in range(num_chunks):
|
|
618
|
+
# 初始 noise
|
|
619
|
+
z_init = torch.randn(1, C, chunk_t_lat, hl, wl, device=device)
|
|
620
|
+
# 上一段末尾 overlap 帧当 ref
|
|
621
|
+
if ref_latent is not None:
|
|
622
|
+
z_init[:, :, :overlap] = ref_latent[:, :, -overlap:]
|
|
623
|
+
ref_full = torch.zeros_like(z_init)
|
|
624
|
+
ref_full[:, :, :overlap] = ref_latent[:, :, -overlap:]
|
|
625
|
+
ref_mask = torch.zeros(1, 1, chunk_t_lat, hl, wl, device=device)
|
|
626
|
+
ref_mask[:, :, :overlap] = 1.0
|
|
627
|
+
else:
|
|
628
|
+
ref_full, ref_mask = None, None
|
|
629
|
+
z = rf_sample_fn(z_init, text, ref_full, ref_mask) # [1, C, chunk_t_lat, h, w]
|
|
630
|
+
chunks.append(z)
|
|
631
|
+
ref_latent = z
|
|
632
|
+
|
|
633
|
+
# 拼接 chunks(去重 overlap), VAE decode
|
|
634
|
+
z_full = torch.cat([chunks[0]] + [c[:, :, overlap:] for c in chunks[1:]], dim=2)
|
|
635
|
+
return vae.decoder(z_full)
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
> ⚠️ **drift 问题** — 即使有 overlap,AR 模式下后期 chunk 容易出现内容 drift(人物消失、色调变化)。Movie Gen / Hunyuan 采用全局 attention 一次生成短视频(5-10s)+ 后处理超分时长 trick 而非纯 AR。
|
|
639
|
+
|
|
640
|
+
## §8 控制 / 编辑 / 角色一致性(简表)
|
|
641
|
+
|
|
642
|
+
| 任务 | 代表方法 | 注入手段 |
|
|
643
|
+
| --- | --- | --- |
|
|
644
|
+
| Camera 控制 | **MotionCtrl** (Wang et al. 2023) | CMCM: 相机轨迹 $R, T$ 序列 → temporal embedding |
|
|
645
|
+
| Object trajectory 控制 | **MotionCtrl** OMCM 模块 | 2D 轨迹点 → spatial heatmap 当 condition |
|
|
646
|
+
| 人物动画 | **AnimateAnyone** (Hu et al. CVPR 2024) | ReferenceNet (sibling SD 主干) + Pose Guider (OpenPose/DWPose) + temporal layers |
|
|
647
|
+
| 角色一致 | IP-Adapter / DreamBooth-style | ID embedding 经 cross-attn 注入 |
|
|
648
|
+
| 局部编辑 | Mask-guided generation | 角色 mask + ref image 一同注入 |
|
|
649
|
+
|
|
650
|
+
## §9 评测:VBench / FVD / CLIPSim-V
|
|
651
|
+
|
|
652
|
+
> ✅ **VBench (Huang et al. CVPR 2024) — 现 SoTA 标准** — 16 个细粒度维度,分两大类。
|
|
653
|
+
|
|
654
|
+
- **Video Quality (7 维)**:Subject Consistency, Background Consistency, Temporal Flickering, Motion Smoothness, Dynamic Degree, Aesthetic Quality, Imaging Quality
|
|
655
|
+
- **Video-Condition Consistency (9 维)**:Object Class, Multiple Objects, Human Action, Color, Spatial Relationship, Scene, Appearance Style, Temporal Style, Overall Consistency
|
|
656
|
+
|
|
657
|
+
每维有定制 prompt 集 + 自动评测器(GroundingDINO / DOVER / RAFT / CLIP 等),最后给加权综合分。Hunyuan-Video / Mochi / Movie Gen / Sora 等都在 VBench 上自报或被独立测。
|
|
658
|
+
|
|
659
|
+
**FVD (Unterthiner et al. 2018)** — FID 推广到视频。生成 / 真实视频分别过一个预训练 video classifier(I3D / VideoMAE / S3D)拿中间层 feature,计算两组分布的 Fréchet 距离:
|
|
660
|
+
|
|
661
|
+
$$\text{FVD} = \|\mu_g - \mu_r\|^2 + \text{Tr}\!\left(\Sigma_g + \Sigma_r - 2\sqrt{\Sigma_g \Sigma_r}\right)$$
|
|
662
|
+
|
|
663
|
+
低 FVD = 生成分布更接近真实;缺点:依赖 classifier domain,不反映 text-video alignment。
|
|
664
|
+
|
|
665
|
+
**CLIPSim-V** — 每帧取 CLIP image embedding 与 prompt CLIP text embedding 计算余弦:$\frac{1}{T} \sum_t \cos(\text{CLIP-I}(f_t), \text{CLIP-T}(\text{prompt}))$。评 text-video 对齐,但忽略时序连贯。
|
|
666
|
+
|
|
667
|
+
**实务**:Hunyuan-Video tech report 同时报 VBench + 人评(user study 1-5 likert);Sora / Veo demos 只给定性可视化。面试碰到"你怎么评测"——说 VBench + 人评 + 在 UCF-101 / MSR-VTT 上算 FVD。
|
|
668
|
+
|
|
669
|
+
## §10 复杂度与显存
|
|
670
|
+
|
|
671
|
+
### 10.1 Token 数与 attention cost
|
|
672
|
+
|
|
673
|
+
| 视频规格 | VAE 下采样 | VAE 后 latent shape | Patchify (1,2,2) 后 N | Full-3D Attn $N^2$ |
|
|
674
|
+
| --- | --- | --- | --- | --- |
|
|
675
|
+
| $256{\times}256{\times}16$ (2s, 8fps) | $4{\times}8{\times}8$ | $4 \times 32 \times 32$ | $4 \cdot 16 \cdot 16 = 1024$ | $\approx 10^6$ |
|
|
676
|
+
| $720p{\times}48$ (2s, 24fps, latent $12{\times}90{\times}160$) | $4{\times}8{\times}8$ | $12 \times 90 \times 160$ | $12 \cdot 45 \cdot 80 = 43200$ | $\approx 1.9 \times 10^9$ |
|
|
677
|
+
| $1080p{\times}120$ (5s, 24fps, latent $30{\times}136{\times}240$) | $4{\times}8{\times}8$ | $30 \times 136 \times 240$ | $30 \cdot 68 \cdot 120 = 244800$ | $\approx 6.0 \times 10^{10}$ |
|
|
678
|
+
|
|
679
|
+
很快爆。面试常问 "长视频/高分辨率 attention 瓶颈"——答:$O(N^2)$ 二次成本 + FlashAttention 也减不了 token 数本质;解法是 factorized / window / cascaded 多阶段。
|
|
680
|
+
|
|
681
|
+
### 10.2 显存与 FLOPs 要点
|
|
682
|
+
|
|
683
|
+
- **Score 矩阵显存**:vanilla 是 $O(L^2)$;FlashAttention 降到 $O(L)$ activation
|
|
684
|
+
- **KV cache**:纯 diffusion 无 AR step,训练时无 KV cache 概念;activation checkpointing + ZeRO-3 是必备
|
|
685
|
+
- **3D Causal VAE 推理**:可分 chunk,显存 $O(\text{chunk}_T \cdot h \cdot w \cdot C)$
|
|
686
|
+
- **训练 FLOPs**:13B 模型 per-batch attention FLOPs ≈ $4 B N^2 d$ × layers(B = batch size);Hunyuan-Video 全模型 ≈ 几百到上千 PFLOP / sample 量级,用数千 H100 数月级别训出
|
|
687
|
+
|
|
688
|
+
## §11 与其他生成模型的关系
|
|
689
|
+
|
|
690
|
+
### 11.1 Image diffusion vs Video diffusion
|
|
691
|
+
|
|
692
|
+
| 维度 | Image (SD3 / SDXL / FLUX) | Video (Hunyuan / Mochi / Wan) |
|
|
693
|
+
| --- | --- | --- |
|
|
694
|
+
| VAE | 2D VAE, $\downarrow 8\times$ | 3D Causal VAE, $\downarrow 4\times8\times8$ |
|
|
695
|
+
| Token 数 | $\sim 10^3$ (1024² @ 16²) | $\sim 10^4 - 10^5$ |
|
|
696
|
+
| Attention | Self + Cross | ST (factorized / full 3D) + Cross/MM-DiT |
|
|
697
|
+
| 训练 token 量 | 数十亿 image-text pair | 数千万 video-text pair(视频数据稀缺) |
|
|
698
|
+
| 评测 | FID, CLIPScore | VBench, FVD, CLIPSim-V |
|
|
699
|
+
| 主要难点 | 美学 / prompt 跟随 | 时序一致性 / 物理合理性 / 长时长 |
|
|
700
|
+
|
|
701
|
+
### 11.2 Video LLM vs Video Generation vs AR Video
|
|
702
|
+
|
|
703
|
+
- **Video LLM** (VideoChat / Video-LLaVA / NaVit):输入视频,输出文本(理解方向);CLIP/ViViT/VideoMAE feature + LLM
|
|
704
|
+
- **Diffusion Video Gen**(本文主线):质量高,长视频靠 chunk / hierarchical
|
|
705
|
+
- **AR Video** (Cosmos-Predict, VAR-Video 系列):视频 token 化 (VQ-VAE / FSQ) + LM 风格生成。优势:天然 streaming + 长视频;劣势:质量目前不如 diffusion
|
|
706
|
+
- **Unified** (Show-o / Emu3 等 2025 苗头):同时理解 + 生成;视频版本尚未爆发
|
|
707
|
+
- 2024-2025 SoTA 仍以 diffusion 占主流
|
|
708
|
+
|
|
709
|
+
## §12 25 高频面试题
|
|
710
|
+
|
|
711
|
+
按难度分 3 档:L1 必会(任何 MLE 岗)、L2 进阶(research-oriented)、L3 顶级 lab(diffusion / video specialist)。每题点开看答案要点 + 易踩坑。
|
|
712
|
+
|
|
713
|
+
### L1 必会题(基础 — 任何视频生成相关岗)
|
|
714
|
+
|
|
715
|
+
<details>
|
|
716
|
+
|
|
717
|
+
<summary>Q1. 当下主流视频生成模型的整体 pipeline 是什么?</summary>
|
|
718
|
+
|
|
719
|
+
- **3D Causal VAE** 把视频从 $H{\times}W{\times}T$ 压到 $h{\times}w{\times}t$ latent
|
|
720
|
+
- **Latent DiT / MM-DiT** 在 latent 空间做扩散 / flow matching
|
|
721
|
+
- **Text encoder**(T5 / CLIP / MLLM)提供 condition
|
|
722
|
+
- **VAE Decoder** 把 latent decode 回视频
|
|
723
|
+
- 推理用 ODE/SDE sampler(Euler / Heun / DDIM)从噪声积分到数据
|
|
724
|
+
|
|
725
|
+
只说 "diffusion + UNet",忘了 latent / 3D / VAE 三件套;或说 pixel-space 跑 attention(早就不可行)。
|
|
726
|
+
|
|
727
|
+
</details>
|
|
728
|
+
|
|
729
|
+
<details>
|
|
730
|
+
|
|
731
|
+
<summary>Q2. 3D Causal VAE 的 "Causal" 是什么意思?为什么必须 causal?</summary>
|
|
732
|
+
|
|
733
|
+
- 时间维度 conv padding 全堆到**左侧(过去)**,右侧不 pad,**不让 current frame 看未来**
|
|
734
|
+
- 三大收益:(1) **图像和视频可共享 latent 空间**($T{=}1$ 时退化成 2D,图像也能进 encoder),便于 image+video 联合训练;(2) **流式 / 自回归推理**,长视频可 chunk-wise 处理;(3) 训练时 image 视为 $T{=}1$ 视频,数据利用率高
|
|
735
|
+
- Hunyuan-Video / Wan / Mochi / CogVideoX 都用 causal 3D VAE
|
|
736
|
+
|
|
737
|
+
说 "causal 就是 mask 掉未来"——这是表面,关键是为什么有那 3 个工程收益。
|
|
738
|
+
|
|
739
|
+
</details>
|
|
740
|
+
|
|
741
|
+
<details>
|
|
742
|
+
|
|
743
|
+
<summary>Q3. Sora 的 "spacetime patches" 解决了什么问题?</summary>
|
|
744
|
+
|
|
745
|
+
- 把视频 latent 切 3D patch $p_t \times p_h \times p_w$,每个 patch 是一个 token
|
|
746
|
+
- **支持变 resolution / 变 duration / 变 aspect ratio**——不同 shape 视频直接打包到同 batch(用 attention mask 分离)
|
|
747
|
+
- 类似 ViT 但加了时间维;解耦了网络结构与具体输入形状
|
|
748
|
+
|
|
749
|
+
只说"切 patch",没说核心收益(变形状训练 / 推理)。
|
|
750
|
+
|
|
751
|
+
</details>
|
|
752
|
+
|
|
753
|
+
<details>
|
|
754
|
+
|
|
755
|
+
<summary>Q4. Factorized 2+1D attention 和 Full 3D attention 的复杂度差多少?</summary>
|
|
756
|
+
|
|
757
|
+
- 记每帧 token 数 $S$、时间 token 数 $T_t$、总 token 数 $N = S T_t$
|
|
758
|
+
- **Factorized 2+1D**:spatial $O(T_t S^2)$ + temporal $O(S T_t^2)$
|
|
759
|
+
- **Full 3D**:$O(N^2) = O(S^2 T_t^2)$
|
|
760
|
+
- Full 3D 比 Factorized 多 $\min(S, T_t)$ 倍
|
|
761
|
+
- 但 Full 3D **表达力更强**(允许 spatial + temporal 联合 pattern)
|
|
762
|
+
|
|
763
|
+
只比 Full 3D 不算时间项;或忽略两者本质差是"是否假设 space ⊗ time 可分"。
|
|
764
|
+
|
|
765
|
+
</details>
|
|
766
|
+
|
|
767
|
+
<details>
|
|
768
|
+
|
|
769
|
+
<summary>Q5. MM-DiT for video 是怎么注入文本的?</summary>
|
|
770
|
+
|
|
771
|
+
- Text token 和 video token **拼接到同一序列**做 self-attention
|
|
772
|
+
- 每个 stream 各自的 QKV / FFN / AdaLN 参数(dual-stream),但 attention 矩阵共享
|
|
773
|
+
- 对比传统 cross-attention(Q from video, KV from text):MM-DiT 让两个模态在 token 级别**对等**交互
|
|
774
|
+
- Hunyuan-Video / Mochi 用此架构(video 端);SD3 (Esser et al. 2024) 是 image 端的原始 MM-DiT
|
|
775
|
+
|
|
776
|
+
说 video 主干 + cross-attn from text——这是 SDXL 风格,MM-DiT 已替代它。
|
|
777
|
+
|
|
778
|
+
</details>
|
|
779
|
+
|
|
780
|
+
<details>
|
|
781
|
+
|
|
782
|
+
<summary>Q6. I2V (Image-to-Video) 最简单的实现是怎样的?</summary>
|
|
783
|
+
|
|
784
|
+
- 参考图 $I_\text{ref}$ 编码为 latent $z_\text{ref}$
|
|
785
|
+
- 沿时间维 broadcast,沿 channel 维与 noisy latent 拼接:input channel 从 $C$ 改成 $2C{+}1$(加一个 mask channel 标注哪些帧是 ref)
|
|
786
|
+
- 模型其他部分不变;改 patchify 第一层 conv
|
|
787
|
+
- 训练时参考帧不加噪 / 加极小噪,loss 只在待生成帧上算
|
|
788
|
+
|
|
789
|
+
只说"再喂一张图",没说 concat 在哪 / mask 怎么处理。
|
|
790
|
+
|
|
791
|
+
</details>
|
|
792
|
+
|
|
793
|
+
<details>
|
|
794
|
+
|
|
795
|
+
<summary>Q7. AnimateDiff 的核心思路?</summary>
|
|
796
|
+
|
|
797
|
+
- **冻结**一个 T2I 模型(Stable Diffusion)
|
|
798
|
+
- **插入 + 仅训 temporal motion module**(temporal self-attention),插在每个 spatial block 后
|
|
799
|
+
- 优势:直接复用所有 T2I 生态(LoRA, ControlNet, custom checkpoint)
|
|
800
|
+
- 劣势:质量受限于 base T2I 模型;难做长视频
|
|
801
|
+
|
|
802
|
+
说"用 transformer 替换 UNet"——错,AnimateDiff 是 plug-in,不替换主干。
|
|
803
|
+
|
|
804
|
+
</details>
|
|
805
|
+
|
|
806
|
+
<details>
|
|
807
|
+
|
|
808
|
+
<summary>Q8. VBench 评测什么?与 FVD 有什么区别?</summary>
|
|
809
|
+
|
|
810
|
+
- **VBench** (Huang CVPR 2024):16 个**细粒度维度**(如 Subject Consistency, Motion Smoothness, Object Class, Color, ...),每维用专门 detector / classifier 评分;现 SoTA 视频生成标准
|
|
811
|
+
- **FVD** (Unterthiner 2018):FID 推广到视频;用 I3D / VideoMAE feature 算两组分布的 Fréchet 距离;单一数字
|
|
812
|
+
- VBench 更解释性强,能定位哪个维度差;FVD 单一但黑盒
|
|
813
|
+
- 实务:两者一起报 + 人评
|
|
814
|
+
|
|
815
|
+
只听过 FVD 不知道 VBench——2024 后这是大缺口。
|
|
816
|
+
|
|
817
|
+
</details>
|
|
818
|
+
|
|
819
|
+
<details>
|
|
820
|
+
|
|
821
|
+
<summary>Q9. Sora / Hunyuan-Video / Mochi-1 / Kling 哪些开源?</summary>
|
|
822
|
+
|
|
823
|
+
- **开源**:Hunyuan-Video (13B, 2024-12), Mochi-1 (10B, 2024-10), CogVideoX (5B/15B, arXiv 2024-08), OpenSora / OpenSora-Plan, LTX-Video (2B, 2024-11), Wan 2.1/2.2 (14B, 2025), SVD (2023-11)
|
|
824
|
+
- **闭源**:Sora (2024-02), Veo / Veo 2 (Google), Kling (Kuaishou 2024-06), Movie Gen (Meta, 30B)
|
|
825
|
+
- 国内开源主力:Hunyuan / Wan / CogVideoX
|
|
826
|
+
|
|
827
|
+
只记得 Sora 和 SVD——闭源开源都得知道时间线。
|
|
828
|
+
|
|
829
|
+
</details>
|
|
830
|
+
|
|
831
|
+
<details>
|
|
832
|
+
|
|
833
|
+
<summary>Q10. Text encoder 选择:T5 vs CLIP vs MLLM?</summary>
|
|
834
|
+
|
|
835
|
+
- **CLIP-L / G**:与图像 latent 对齐好(image-text 联合训练),短文本工作得好,但长 prompt 跟随差
|
|
836
|
+
- **T5-XXL**:sequence-to-sequence 模型,**长 prompt 跟随更好**;SD3 / Mochi / CogVideoX 都用
|
|
837
|
+
- **MLLM**(LLaVA-like):理解 prompt 内物体关系强;Hunyuan-Video 用 CLIP-L + MLLM 双编码器
|
|
838
|
+
- 工程上长 prompt 推理时还会用 **prompt rewriter**(LLM 改写)补齐 train/test caption 分布差
|
|
839
|
+
|
|
840
|
+
只说 CLIP——2024 后基本被 T5 / MLLM 替代或并用。
|
|
841
|
+
|
|
842
|
+
</details>
|
|
843
|
+
|
|
844
|
+
### L2 进阶题(research-oriented / 中级岗)
|
|
845
|
+
|
|
846
|
+
<details>
|
|
847
|
+
|
|
848
|
+
<summary>Q11. 推导一下 3D Causal VAE 在 $T{=}1$ 时为什么能"行为上"等价于 2D conv?</summary>
|
|
849
|
+
|
|
850
|
+
- Causal 3D conv 在时间维 kernel size $k_t$,左 pad $k_t - 1$,右 pad 0;stride=1。
|
|
851
|
+
- 输入 shape $[B, C, 1, H, W]$($T{=}1$ 单帧);经左 pad $k_t - 1$ 后,时间维长度变为 $1 + (k_t - 1) = k_t$,前 $k_t - 1$ 个时间位是 padding 0,最后 1 个是真实 frame。
|
|
852
|
+
- Output 时间长度 = $(k_t + 0 - k_t)/1 + 1 = 1$(用 conv 输出长度公式 $(L_\text{in} + p - k) / s + 1$,其中 $L_\text{in}=1$、$p=k_t-1$、$k=k_t$、$s=1$)。所以**只产生一个时间位输出**。
|
|
853
|
+
- 设时间维权重序列 $W_0, W_1, \dots, W_{k_t-1}$,对该唯一输出位的计算是 $\sum_{\tau=0}^{k_t-1} W_\tau \star x_\tau$。但只有 $\tau = k_t - 1$ 对应真实 frame,其余 $x_\tau$ 是 padding 0——**只有 $W_{k_t - 1}$ 这一片时间权重对输出有贡献**。
|
|
854
|
+
- **结论**:$T{=}1$ 时整个 causal 3D conv 退化为一个**有效的** 2D conv(kernel = $W_{k_t - 1}[:, :, :, :]$);其余时间片权重对 image batch "看不到"任何真实输入,相当于在 image path 上不被激活。
|
|
855
|
+
|
|
856
|
+
> 工程上:训练时 image 用 $T{=}1$ batch 走 "2D conv 子集" 路径,无需额外 2D head;这是 Hunyuan-Video / Mochi / CogVideoX 等同时训 image + video 的前提。
|
|
857
|
+
|
|
858
|
+
把"等价于 2D conv"当成权重物理合并——其实是 padding-0 让其他 time slice 权重对 image 输入不起作用。
|
|
859
|
+
|
|
860
|
+
</details>
|
|
861
|
+
|
|
862
|
+
<details>
|
|
863
|
+
|
|
864
|
+
<summary>Q12. Full 3D attention 与 factorized 2+1D 的表达力差异?(L2/L3 之间)</summary>
|
|
865
|
+
|
|
866
|
+
- Factorized:先 $\text{Attn}_S$ 把空间 token 互相 attend (在每帧内),再 $\text{Attn}_T$ 在时间维做 attention
|
|
867
|
+
- **假设**:时空交互是 separable——任意两个时空位置 $(t_1, s_1)$ 与 $(t_2, s_2)$ 的关系,可以分解为"先 $s_1 \leftrightarrow s_2$ 在 $t_1$"再"$t_1 \leftrightarrow t_2$ 在 $s_2$"两步
|
|
868
|
+
- Full 3D 不假设可分:任意两 token 直接 attention;可学**斜向时空 pattern**(如 diagonal motion)
|
|
869
|
+
- **数学上**:factorized 是 full 3D 的一个**严格子集**(参数化受限)
|
|
870
|
+
- 实测:full 3D 在 fast motion / 复杂时空 pattern 上更好
|
|
871
|
+
|
|
872
|
+
只说"full 3D 更准确",不知具体能学到的 pattern 多在哪里(diagonal / non-separable motion)。
|
|
873
|
+
|
|
874
|
+
</details>
|
|
875
|
+
|
|
876
|
+
<details>
|
|
877
|
+
|
|
878
|
+
<summary>Q13. 为什么 video VAE 主流停在 $\downarrow 4{\sim}8 \times 8 \times 8$ 范围?</summary>
|
|
879
|
+
|
|
880
|
+
- 体素级压缩比 $= 4 \cdot 8 \cdot 8 = 256$($1{:}256$),$C=16$ latent channel 后净比约 $1{:}48$
|
|
881
|
+
- **更激进(如 LTX-Video 报告的 $1{:}8192$ 总压缩)→ token 数变少但重建质量下降**(细节 / 锐度损失)
|
|
882
|
+
- DiT 主干 attention $O(N^2)$,所以激进压缩工程友好;但 lost detail 难以恢复
|
|
883
|
+
- 时间下采样 $4{\times}$ 是经验上 motion 平滑性可接受的上限——更高时间压缩在快动作场景会出抖动
|
|
884
|
+
- 各家具体配置不同:CogVideoX 用 $4{\times}8{\times}8$;Hunyuan-Video 用 $4{\times}8{\times}8$;Mochi-1 在时间维更激进(约 $6{\times}8{\times}8$,见 Mochi blog);LTX-Video 走极端高压缩 + 实时
|
|
885
|
+
- 即使主架构相同,VAE 选择仍是 active design choice
|
|
886
|
+
|
|
887
|
+
把所有模型都归到 $4{\times}8{\times}8$ 同一档——Mochi-1 / LTX-Video 走的是更激进时间压缩。
|
|
888
|
+
|
|
889
|
+
</details>
|
|
890
|
+
|
|
891
|
+
<details>
|
|
892
|
+
|
|
893
|
+
<summary>Q14. logit-normal $t$ 采样在 video FM 训练中为什么有用?</summary>
|
|
894
|
+
|
|
895
|
+
- SD3 (Esser 2024) 发现 $t \sim \mathcal{U}[0,1]$ 不最优:中间区域 $t \approx 0.5$ 的 noise/signal ratio 最难学
|
|
896
|
+
- 改成 $t = \sigma(\tau), \tau \sim \mathcal{N}(m, s^2)$,让 $t$ 集中在 0.5 附近
|
|
897
|
+
- 视频中也观察到同样现象(Hunyuan / Mochi 都默认 logit-normal)
|
|
898
|
+
- 直觉:远离 $t=0$ 和 $t=1$ 时模型需要在 mixed noise/signal 上学,正是 hardest 区域
|
|
899
|
+
|
|
900
|
+
说"loss 加权"——logit-normal 不是 loss reweighting 而是改 $t$ 采样分布。
|
|
901
|
+
|
|
902
|
+
</details>
|
|
903
|
+
|
|
904
|
+
<details>
|
|
905
|
+
|
|
906
|
+
<summary>Q15. RoPE-3D 怎么编码 (time, height, width)?</summary>
|
|
907
|
+
|
|
908
|
+
- 把 $d$ 维 query/key 切成 3 段 $q = [q^{(t)} \,|\, q^{(h)} \,|\, q^{(w)}]$(disjoint subspace),每段对应 (t, h, w)
|
|
909
|
+
- 每段用 1D RoPE(频率 $\theta_d = 1 / 10000^{2k/d}$ 类似 Transformer)
|
|
910
|
+
- 结果是 block-diagonal 旋转 concat:$\text{RoPE}_{3D}(q) = [R_t(\theta_t) q^{(t)} \,|\, R_h(\theta_h) q^{(h)} \,|\, R_w(\theta_w) q^{(w)}]$
|
|
911
|
+
- 对每个 head 独立做;attention 后自然得到**相对时空位置**信息
|
|
912
|
+
- CogVideoX / Hunyuan-Video 都用类似方案
|
|
913
|
+
|
|
914
|
+
把它当成 absolute embedding——RoPE 本质是相对位置编码。
|
|
915
|
+
|
|
916
|
+
</details>
|
|
917
|
+
|
|
918
|
+
<details>
|
|
919
|
+
|
|
920
|
+
<summary>Q16. Stable Video Diffusion (SVD) 与 AnimateDiff 的区别?</summary>
|
|
921
|
+
|
|
922
|
+
- **SVD** (Blattmann 2023):finetune 整个 SD2.1 UNet,加 temporal layers;I2V 主,14 帧 / 25 帧两版;新模型整体训练
|
|
923
|
+
- **AnimateDiff** (Guo 2024 ICLR):**冻结 SD-T2I**,只训 plug-in temporal motion module;T2V 主
|
|
924
|
+
- SVD 质量更好但失去 SD T2I 生态;AnimateDiff 牺牲质量换 plug-and-play
|
|
925
|
+
- 都是 2023 的早期方法,2024 被 DiT-based 大模型超越
|
|
926
|
+
|
|
927
|
+
只说"两者都是 video diffusion"——区别是 finetune vs plug-in。
|
|
928
|
+
|
|
929
|
+
</details>
|
|
930
|
+
|
|
931
|
+
<details>
|
|
932
|
+
|
|
933
|
+
<summary>Q17. DiT 用 AdaLN 与 cross-attn 的对比?为什么 DiT-Video 也偏好 AdaLN?</summary>
|
|
934
|
+
|
|
935
|
+
- **AdaLN**(DiT 默认):把 condition pool 成单向量 $c$,预测 LayerNorm 的 scale + shift + gate
|
|
936
|
+
- **Cross-attn**:condition token 作 K/V, video token 作 Q
|
|
937
|
+
- AdaLN 简单 / 计算少 / 训练稳;但**全局 condition**——每 token 看到同一个 modulation
|
|
938
|
+
- Cross-attn 允许 token-level 选择性看 condition;token 多时贵
|
|
939
|
+
- MM-DiT(SD3 / Hunyuan / Mochi)实际把两者**结合**:MM 部分 share attention,AdaLN 调制 norm
|
|
940
|
+
- 单纯 video DiT 用 AdaLN 起家是 Latte / OpenSora 思路;后续被 MM-DiT 取代
|
|
941
|
+
|
|
942
|
+
把 AdaLN 当过时——MM-DiT 仍内嵌 AdaLN modulation。
|
|
943
|
+
|
|
944
|
+
</details>
|
|
945
|
+
|
|
946
|
+
<details>
|
|
947
|
+
|
|
948
|
+
<summary>Q18. CFG 在视频生成里的特殊点?</summary>
|
|
949
|
+
|
|
950
|
+
- 与 image 完全同公式:$v_\text{CFG} = v_\theta(\emptyset) + s \cdot (v_\theta(c) - v_\theta(\emptyset))$
|
|
951
|
+
- **每帧都做 CFG**,所以两倍 forward 成本 $\times$ T 帧
|
|
952
|
+
- **guidance scale 通常 5-7.5**(与 SDXL / SD3 接近)
|
|
953
|
+
- 视频中过大 $s$ 容易导致**帧间闪烁 / 颜色饱和** —— 比图像更敏感
|
|
954
|
+
- 部分实现用 **temporal-aware CFG**(不同时间步 / 不同帧用不同 $s$)
|
|
955
|
+
|
|
956
|
+
说 "CFG 在视频里和图像一样"——通常对,但闪烁更敏感是 video specific。
|
|
957
|
+
|
|
958
|
+
</details>
|
|
959
|
+
|
|
960
|
+
<details>
|
|
961
|
+
|
|
962
|
+
<summary>Q19. Hunyuan-Video 的 dual-stream → single-stream 设计是什么?</summary>
|
|
963
|
+
|
|
964
|
+
- **Dual-stream blocks**(前段 layers):text token + video token 共享 attention 矩阵,但 QKV / FFN / AdaLN 各 stream 独立——让两个模态先精炼自己的表征
|
|
965
|
+
- **Single-stream blocks**(后段 layers):完全 share 参数,相当于 unified Transformer
|
|
966
|
+
- 直觉:早期需要保留模态特异性(text 是 sequential,video 是 spatiotemporal),后期可以统一处理
|
|
967
|
+
- Mochi 的 AsymmDiT 类似思路但更激进——video stream 比 text stream 宽 4 倍
|
|
968
|
+
|
|
969
|
+
只说"都是 self-attn 同序列"——遗漏了 stream-specific 参数 / 早晚不同的 design。
|
|
970
|
+
|
|
971
|
+
</details>
|
|
972
|
+
|
|
973
|
+
<details>
|
|
974
|
+
|
|
975
|
+
<summary>Q20. Mochi-1 的 AsymmDiT (asymmetric MM-DiT) 是什么?</summary>
|
|
976
|
+
|
|
977
|
+
- 两个 stream(text / video)的 hidden dim 不一样:video 比 text 宽 4 倍(如 video $D{=}3072$ / text $D{=}768$)
|
|
978
|
+
- 直觉:视频信息量远超文本,应分配更多参数给 video stream
|
|
979
|
+
- Attention 时 text 和 video 投影到共同 head dim,做 self-attention
|
|
980
|
+
- FFN 各 stream 独立,按各自宽度
|
|
981
|
+
- 比标准 MM-DiT 用更少 text-side 参数,省显存又不损质量
|
|
982
|
+
|
|
983
|
+
把 "asymmetric" 当成两个 stream 不交互——错,它们仍同 attention。
|
|
984
|
+
|
|
985
|
+
</details>
|
|
986
|
+
|
|
987
|
+
### L3 顶级 lab 题(深度 — diffusion / video specialist)
|
|
988
|
+
|
|
989
|
+
<details>
|
|
990
|
+
|
|
991
|
+
<summary>Q21. 3D Causal VAE vs 标准 3D VAE:除了 streaming,还有什么本质差别?(必考)</summary>
|
|
992
|
+
|
|
993
|
+
- **标准 3D VAE**:时间 kernel center 对齐,需 symmetric padding,**output[t] 依赖 input[t-\lfloor k_t/2 \rfloor \ldots t+\lfloor k_t/2 \rfloor]**——看了未来
|
|
994
|
+
- **3D Causal VAE**:时间 kernel 因果对齐,左侧 pad $k_t - 1$,右侧不 pad,**output[t] 只依赖 input[t-k_t+1 \ldots t]**
|
|
995
|
+
|
|
996
|
+
**本质差别**:
|
|
997
|
+
|
|
998
|
+
- **Streaming / 自回归推理**:causal 允许 chunk-wise encoding,每来一段视频立即编码;标准 VAE 要等完整 clip 才能算(kernel center 需未来帧)
|
|
999
|
+
- **图像视频同空间**:两者 $T{=}1$ 时其实都能"退化到 2D"(zero pad 让其他时间片不起作用),但 causal 设计是"过去全见 + 未来全 0",与训练时大 $T$ 的子集行为一致;symmetric pad 在 $T{=}1$ 时让 kernel 左右各看 $\lfloor k_t/2 \rfloor$ 个 padding,行为与训练时 $T \gg 1$ 的 boundary 行为不同——**一致性更差**
|
|
1000
|
+
- **训练 + inference 一致性**:causal VAE 训练(完整 clip)与推理(AR chunk)共用一套 padding 规则;标准 3D VAE 在 AR chunk 推理时缺右侧未来 frame,需要特殊 pad
|
|
1001
|
+
- **与 AR video 兼容**:causal 是 AR video 生成 (VAR-Video / Cosmos) 的必要前提
|
|
1002
|
+
- **训练数据 utilization**:image-only batch 在 causal VAE encoder 里行为与训练时一致;标准 3D VAE 需要 dummy symmetric padding,与正常训练分布有 gap
|
|
1003
|
+
|
|
1004
|
+
> 💡 **加分**:解释 causal VAE 的 downsample 层怎么做(time stride 2 时仍保 causal);解释训练 batch 里 image + video 混合的 implementation 细节。
|
|
1005
|
+
|
|
1006
|
+
只说"causal 是 mask 未来"——这是必要不充分;要展开"为何这件事让生态闭环(image + video 同 stack, AR 兼容, streaming)"。
|
|
1007
|
+
|
|
1008
|
+
</details>
|
|
1009
|
+
|
|
1010
|
+
<details>
|
|
1011
|
+
|
|
1012
|
+
<summary>Q22. 用 spacetime patches 处理任意 resolution / duration / aspect ratio 的工程实现?</summary>
|
|
1013
|
+
|
|
1014
|
+
- **Patchify token 数 $N = (t/p_t)(h/p_h)(w/p_w)$ 随输入 shape 变**;Transformer 对 $N$ 不敏感(self-attn 是 set-like)
|
|
1015
|
+
- **RoPE-3D**:相对位置编码,不与最大长度绑定;任意 $(t, h, w)$ 三元组都可旋转
|
|
1016
|
+
- **Packing**:一 batch 内 mixed shape sample concat 到同 seq + segment attention mask(同 sample 内可见、跨 sample 屏蔽)+ pad 到 max length
|
|
1017
|
+
- **Aspect ratio / duration 作为 condition**:额外 token / scalar 经 AdaLN 注入,让模型学不同比例的合理构图
|
|
1018
|
+
- Sora 首次 production 化;社区复刻见 OpenSora-Plan / OpenSora 1.2+
|
|
1019
|
+
|
|
1020
|
+
只说"transformer 不挑长度"——要展开 packing + segment mask + RoPE-3D + aspect ratio condition 这一整套工程组件。
|
|
1021
|
+
|
|
1022
|
+
</details>
|
|
1023
|
+
|
|
1024
|
+
<details>
|
|
1025
|
+
|
|
1026
|
+
<summary>Q23. Factorized 2+1D vs Full 3D attention 复杂度对比的精确公式 + 何时选哪个?</summary>
|
|
1027
|
+
|
|
1028
|
+
- 记每帧 spatial token $S = (h/p_h)(w/p_w)$,时间 token $T_t = t/p_t$,总 token $N = S T_t$
|
|
1029
|
+
- **Factorized 2+1D**:
|
|
1030
|
+
- Spatial attn (每帧内独立): $T_t \cdot S^2 \cdot d$
|
|
1031
|
+
- Temporal attn (每空间位置内独立): $S \cdot T_t^2 \cdot d$
|
|
1032
|
+
- 合计 $O\!\left(d \cdot (T_t S^2 + S T_t^2)\right) = O\!\left(d \cdot S T_t (S + T_t)\right)$
|
|
1033
|
+
- **Full 3D**: $O(d \cdot N^2) = O\!\left(d \cdot S^2 T_t^2\right)$
|
|
1034
|
+
- 比值 = full / factorized = $\frac{S^2 T_t^2}{S T_t(S + T_t)} = \frac{S T_t}{S + T_t}$,等于 $\min(S, T_t)$ 量级
|
|
1035
|
+
- $S \approx 10^3$(720p latent)、$T_t \approx 30$(5s)时:full 比 factorized 贵 $\approx 30\times$(被 $\min$ 主导)
|
|
1036
|
+
|
|
1037
|
+
**何时选哪个**:
|
|
1038
|
+
|
|
1039
|
+
- **算力充足 + 高质量目标**:Full 3D(Sora / Hunyuan / Mochi)
|
|
1040
|
+
- **预算受限 / 快速迭代**:Factorized 2+1D(Latte / OpenSora / AnimateDiff)
|
|
1041
|
+
- **质量与速度折中**:大部分块 factorized + 几块 full 3D(OpenSora-Plan 思路)
|
|
1042
|
+
- 显存敏感时 factorized + recompute 是更经济选择
|
|
1043
|
+
|
|
1044
|
+
只给定性回答"full 更贵"——L3 题要给精确公式 + 工程选择 trade-off。
|
|
1045
|
+
|
|
1046
|
+
</details>
|
|
1047
|
+
|
|
1048
|
+
<details>
|
|
1049
|
+
|
|
1050
|
+
<summary>Q24. 长视频 (>30s) 现阶段最 promising 的路线是什么?为什么 chunk AR 容易 drift?</summary>
|
|
1051
|
+
|
|
1052
|
+
- **Drift 数学解释**:每 chunk 从 $p(x | \hat{z}_\text{prev})$ 采样,$\hat{z}_\text{prev}$ 本身是模型生成(非真实数据),多步条件后误差累积(类似 RNN exposure bias)
|
|
1053
|
+
- **缓解**:overlap + clamp 已知部分;多帧 ref(不只末尾 1 帧);global learned motif token
|
|
1054
|
+
- **更 promising 路线**:
|
|
1055
|
+
- **Hierarchical**:先生 low-fps keyframe,再 temporal super-resolution 插中间帧
|
|
1056
|
+
- **Long-context full attention**:直接长视频 + sparse / sliding / hierarchical 控制成本
|
|
1057
|
+
- **Diffusion Forcing 等 hybrid**
|
|
1058
|
+
- Sora 公开 demo 60s 内部细节未披露;Movie Gen 多阶段 keyframe + interp + super-res
|
|
1059
|
+
|
|
1060
|
+
只说"AR drift"——要给具体 drift 数学解释 + 当前 SoTA 应对。
|
|
1061
|
+
|
|
1062
|
+
</details>
|
|
1063
|
+
|
|
1064
|
+
<details>
|
|
1065
|
+
|
|
1066
|
+
<summary>Q25. Hunyuan-Video / Mochi-1 / Wan 都用 Rectified Flow,比 DDPM ε-pred 强在哪?</summary>
|
|
1067
|
+
|
|
1068
|
+
- **Target 平稳**:RF 的 $u_t = x_1 - x_0$ 给定 $(x_0, x_1)$ 后是常数,跨 $t$ 量级变化比 $\epsilon$-pred 小
|
|
1069
|
+
- **少步采样**:path 是直线(理想),少步 ODE 误差小;Reflow 后 1-4 步可生成
|
|
1070
|
+
- **Loss conditioning 自然**:不像 DDPM 需 SNR / VLB / EDM-preconditioning 等显式 reweighting
|
|
1071
|
+
- **与 SD3 共享 stack**:image / video 同一套 recipe(v-pred + logit-normal $t$)
|
|
1072
|
+
- DDPM ε-pred 需 noise schedule 设计 + 不同 $t$ 处 target 尺度差大,训练 reweighting 复杂;RF 更"一招吃遍"
|
|
1073
|
+
|
|
1074
|
+
只说"RF 路径更直"——要展开训练目标 / 数值稳定性 / sampler 兼容多角度。
|
|
1075
|
+
|
|
1076
|
+
</details>
|
|
1077
|
+
|
|
1078
|
+
## §A 附录:完整 from-scratch 视频生成模型骨架
|
|
1079
|
+
|
|
1080
|
+
### A.1 总体类图
|
|
1081
|
+
|
|
1082
|
+
```
|
|
1083
|
+
|
|
1084
|
+
VideoGenModel
|
|
1085
|
+
├── encoder: CausalVAEEncoder (3D Causal VAE)
|
|
1086
|
+
├── decoder: CausalVAEDecoder
|
|
1087
|
+
├── text_encoder: T5Encoder / MLLM (frozen)
|
|
1088
|
+
├── patchify: SpacetimePatchify (3D patch -> token)
|
|
1089
|
+
├── unpatchify: SpacetimeUnpatchify
|
|
1090
|
+
├── time_embed: SinusoidalTimeEmbed (timestep τ)
|
|
1091
|
+
├── transformer:
|
|
1092
|
+
│ ├── MMDiTVideoBlock × N_dual (dual-stream)
|
|
1093
|
+
│ └── SingleStreamBlock × N_sing (single-stream)
|
|
1094
|
+
└── i2v_adapter: FirstFrameI2VAdapter (optional, for I2V mode)
|
|
1095
|
+
```
|
|
1096
|
+
|
|
1097
|
+
### A.2 训练 forward + A.3 Euler RF sampler
|
|
1098
|
+
|
|
1099
|
+
```python
|
|
1100
|
+
def run_dit(model, z, text, tau, ref_full=None, ref_mask=None):
|
|
1101
|
+
""" DiT forward: noisy latent z -> predicted vector field. """
|
|
1102
|
+
if ref_full is None:
|
|
1103
|
+
tokens, grid = model.patchify(z)
|
|
1104
|
+
else:
|
|
1105
|
+
tokens, grid = model.i2v_adapter(z, ref_full, ref_mask)
|
|
1106
|
+
text_tok = model.text_encoder(text)
|
|
1107
|
+
cond = model.time_embed(tau) + text_tok.mean(dim=1) # [B, D]
|
|
1108
|
+
for blk in model.transformer.dual_stream:
|
|
1109
|
+
text_tok, tokens = blk(text_tok, tokens, cond)
|
|
1110
|
+
for blk in model.transformer.single_stream:
|
|
1111
|
+
cat = torch.cat([text_tok, tokens], dim=1)
|
|
1112
|
+
cat = blk(cat, cond)
|
|
1113
|
+
text_tok, tokens = cat[:, :text_tok.size(1)], cat[:, text_tok.size(1):]
|
|
1114
|
+
return model.unpatchify(tokens, grid) # [B, C, t, h, w]
|
|
1115
|
+
|
|
1116
|
+
|
|
1117
|
+
def video_gen_forward(model, video_clean, text, ref_image=None):
|
|
1118
|
+
""" RF v-prediction MSE loss. video_clean: [B,3,T,H,W]; ref_image: optional [B,3,H,W]. """
|
|
1119
|
+
B = video_clean.size(0); device = video_clean.device
|
|
1120
|
+
mu, logvar = model.encoder(video_clean)
|
|
1121
|
+
z1 = model.encoder.reparameterize(mu, logvar)
|
|
1122
|
+
z0 = torch.randn_like(z1)
|
|
1123
|
+
tau = torch.sigmoid(torch.randn(B, device=device)) # SD3 logit-normal
|
|
1124
|
+
tau_b = tau.view(-1, 1, 1, 1, 1)
|
|
1125
|
+
z_tau = (1 - tau_b) * z0 + tau_b * z1
|
|
1126
|
+
u_target = z1 - z0
|
|
1127
|
+
ref_full, ref_mask = None, None
|
|
1128
|
+
if ref_image is not None:
|
|
1129
|
+
mu_r, _ = model.encoder(ref_image.unsqueeze(2)) # 走 T=1 path
|
|
1130
|
+
ref_full = torch.zeros_like(z1); ref_full[:, :, :1] = mu_r
|
|
1131
|
+
ref_mask = torch.zeros(B, 1, *z1.shape[2:], device=device); ref_mask[:, :, :1] = 1.0
|
|
1132
|
+
# I2V trick: 参考帧保持 clean (不加噪), 训练分布与推理一致
|
|
1133
|
+
ref_mask_C = ref_mask.expand_as(z_tau).bool()
|
|
1134
|
+
z_tau = torch.where(ref_mask_C, z1, z_tau)
|
|
1135
|
+
v_pred = run_dit(model, z_tau, text, tau, ref_full, ref_mask)
|
|
1136
|
+
# I2V: 只对待生成帧算 loss
|
|
1137
|
+
if ref_mask is not None:
|
|
1138
|
+
gen = (1 - ref_mask).expand_as(v_pred)
|
|
1139
|
+
return ((v_pred - u_target).pow(2) * gen).sum() / gen.sum().clamp(min=1.0)
|
|
1140
|
+
return F.mse_loss(v_pred, u_target)
|
|
1141
|
+
|
|
1142
|
+
|
|
1143
|
+
@torch.no_grad()
|
|
1144
|
+
def video_gen_sample(model, text, t_lat=12, h_lat=90, w_lat=160, steps=50,
|
|
1145
|
+
ref_image=None, guidance_scale=6.0, C=16):
|
|
1146
|
+
""" 端到端推理: t_lat/h_lat/w_lat 直接指定 latent 形状(避开 T/4 整除陷阱). """
|
|
1147
|
+
device = next(model.parameters()).device
|
|
1148
|
+
z = torch.randn(1, C, t_lat, h_lat, w_lat, device=device)
|
|
1149
|
+
ref_full, ref_mask = None, None
|
|
1150
|
+
if ref_image is not None:
|
|
1151
|
+
mu_r, _ = model.encoder(ref_image.unsqueeze(2))
|
|
1152
|
+
ref_full = torch.zeros_like(z); ref_full[:, :, :1] = mu_r
|
|
1153
|
+
ref_mask = torch.zeros(1, 1, t_lat, h_lat, w_lat, device=device); ref_mask[:, :, :1] = 1.0
|
|
1154
|
+
# 推理初始即把参考帧位 clamp 到 clean latent (与训练一致), 不然首步 DiT 看到的是 noise
|
|
1155
|
+
z = torch.where(ref_mask.bool().expand_as(z), ref_full, z)
|
|
1156
|
+
taus = torch.linspace(0, 1, steps + 1, device=device)
|
|
1157
|
+
for i in range(steps):
|
|
1158
|
+
tau_i = taus[i].expand(1)
|
|
1159
|
+
v_cond = run_dit(model, z, text, tau_i, ref_full, ref_mask)
|
|
1160
|
+
v_uncond = run_dit(model, z, [""], tau_i, ref_full, ref_mask)
|
|
1161
|
+
v = v_uncond + guidance_scale * (v_cond - v_uncond)
|
|
1162
|
+
z = z + (taus[i + 1] - taus[i]) * v
|
|
1163
|
+
if ref_mask is not None: # I2V: 每步后 clamp 参考帧
|
|
1164
|
+
z = torch.where(ref_mask.bool().expand_as(z), ref_full, z)
|
|
1165
|
+
return model.decoder(z)
|
|
1166
|
+
```
|
|
1167
|
+
|
|
1168
|
+
> ✅ **Sanity checks 视频生成模型常做的** —
|
|
1169
|
+
|
|
1170
|
+
- **Reconstruction-only**:先 VAE encode 后 decode,PSNR / SSIM / LPIPS 看是否能复原原视频
|
|
1171
|
+
- **Random latent decode**:从 $\mathcal{N}(0, I)$ 采 latent decode,看 VAE 是否退化(应该出"自然 looking" 但语义不一定连贯的视频)
|
|
1172
|
+
- **Class / prompt overfit**:单一 prompt 训练 1000 步看模型能不能 memorize
|
|
1173
|
+
- **VBench 局部维度**:训练中段先评 Subject Consistency / Motion Smoothness 看时序是否稳定
|
|
1174
|
+
- **CFG sweep**:scale = 0/1/3/6/10 看影响(过高会饱和 / 闪烁)
|
|
1175
|
+
|
|
1176
|
+
### A.4 当前 SoTA 一览
|
|
1177
|
+
|
|
1178
|
+
| 维度 | 当前 SoTA | 备注 |
|
|
1179
|
+
| --- | --- | --- |
|
|
1180
|
+
| 开源最强 T2V | Hunyuan-Video 13B | 2024-12,质量逼近闭源 |
|
|
1181
|
+
| 开源 I2V | Wan 2.2 I2V / Hunyuan-Video I2V | 中文 prompt 友好 |
|
|
1182
|
+
| 闭源最强 | Veo 2 / Sora / Kling | 4K / 长时长 |
|
|
1183
|
+
| 实时 | LTX-Video 2B | RTX 4090 实时 |
|
|
1184
|
+
| 视频 + 音频 | Movie Gen (闭源) | 30B 联合生成 |
|
|
1185
|
+
| 控制类 | AnimateAnyone / MotionCtrl | 人物 / 相机控制 |
|
|
1186
|
+
|
|
1187
|
+
---
|
|
1188
|
+
|
|
1189
|
+
**Video Generation Quick Reference** · 主要参考:Sora technical report (OpenAI 2024), Hunyuan-Video tech report (Tencent 2024), Mochi-1 blog (Genmo 2024), CogVideoX (Yang et al. arXiv 2024-08 → ICLR 2025), Wan tech report (Team Wan / Ang Wang et al. arXiv 2025), Movie Gen tech report (Meta 2024), VBench (Huang et al. CVPR 2024), AnimateDiff (Guo et al. arXiv 2023-07 → ICLR 2024), SVD (Blattmann et al. arXiv 2023-11), Latte (Ma et al. arXiv 2024-01 → TMLR 2025), MotionCtrl (Wang et al. 2023 → SIGGRAPH 2024), AnimateAnyone (Hu et al. CVPR 2024), SD3 (Esser et al. ICML 2024)
|