Skip to content

feat: HiDream-I1 diffusion indexing — first cross-domain MoE validation#61

Merged
AdaWorldAPI merged 2 commits into
masterfrom
claude/hidream-diffusion
Mar 30, 2026
Merged

feat: HiDream-I1 diffusion indexing — first cross-domain MoE validation#61
AdaWorldAPI merged 2 commits into
masterfrom
claude/hidream-diffusion

Conversation

@AdaWorldAPI
Copy link
Copy Markdown
Owner

What

Session prompt + test functions for indexing HiDream-I1-Full, a 17B DiT+MoE diffusion model (MIT license, ungated).

This is the first cross-domain validation: do image generation MoE experts show the same structural redundancy as LLM MoE experts?

Tests added

Test Data Purpose
test_stream_index_hidream_transformer 35 GB, 7 shards DiT+MoE transformer core
test_stream_index_hidream_text_encoders 13 GB CLIP-L + CLIP-G + Llama-3.1-8B
test_stream_index_llama31_8b_base 16 GB, 4 shards Base Llama via unsloth (ungated)
test_hidream_llama_diff reads bgz7 Vision-grounding attention diff

Cross-domain hypothesis

  • Maverick LLM: 128 MoE experts compress at 123,000×
  • HiDream diffusion: MoE experts compress at ???×
  • If similar → structural redundancy is MoE-fundamental, not domain-specific

Bonus: what seeing adds to reading

HiDream uses Llama-3.1-8B as text encoder 3, fine-tuned for image conditioning.
Diffing against base Llama-3.1-8B reveals which attention heads re-routed when
the model learned to condition image generation. Same NARS pipeline as the
Qwen3.5 reasoning diff, different capability injection.

Files

  • .claude/prompts/SESSION_HIDREAM_DIFFUSION.md — session prompt
  • src/hpc/safetensors.rs — added index_safetensors_shards() helper + 5 test functions

Adds 5 test functions for the first diffusion model indexing:
- test_stream_index_hidream_transformer (7 shards, 35 GB DiT+MoE)
- test_stream_index_hidream_text_encoders (CLIP-L + CLIP-G + Llama-3.1-8B)
- test_stream_index_llama31_8b_base (4 shards, ungated via unsloth)
- test_hidream_llama_diff (cross-domain: language→vision attention shift)

Adds index_safetensors_shards() helper that handles HEAD size detection,
HTTP range reading, shard iteration, and skip-if-exists logic.

Syntax verified with rustc 1.94.1.
@AdaWorldAPI AdaWorldAPI merged commit 9aa3ba3 into master Mar 30, 2026
@AdaWorldAPI AdaWorldAPI deleted the claude/hidream-diffusion branch March 30, 2026 10:17
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5bf4d45d82

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/hpc/safetensors.rs
Comment on lines +437 to +439
if std::fs::metadata(&out_path).is_ok() {
eprintln!("SKIP {} (exists)", out_path);
continue;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve stats when cached shard outputs are reused

When an output shard file already exists, this branch continues without adding any IndexStats, but test_stream_index_hidream_transformer later sums stats and asserts total_tensors > 50. On a rerun where all /tmp/hidream_transformer_shard*.bgz7 files already exist, stats is empty and the assertion fails even though indexing already succeeded, making the test non-idempotent.

Useful? React with 👍 / 👎.

Comment thread src/hpc/safetensors.rs
Comment on lines +552 to +555
let pairs = [
("/tmp/llama31_8b_base_shard01.bgz7", "/tmp/hidream_llama_enc_shard01.bgz7", "shard 1"),
("/tmp/llama31_8b_base_shard02.bgz7", "/tmp/hidream_llama_enc_shard02.bgz7", "shard 2"),
];
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include all base shards in HiDream-vs-base diff

The base index test writes four shard files (model-...-of-00004), but this diff pair list compares only shard 1 and shard 2, so tensors that land in base shards 3 and 4 are never analyzed. That means the reported aggregate shift metrics are computed from a partial model and can materially skew the cross-domain conclusions.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant