r/StableDiffusion • • 3d ago

News CodecOPSD for faster H3v & H3I

"Sequence-wise generators (MiniMax-H3 Ref2VA, MiniMax-H3-Image, Qwen-Image 2.1, FLUX 3 Image Klein) append every reference to the sequence, where computation cost grows dramatically. We propose CodecOPSD to prune the redundant condition tokens with a video codec, and we train a small LoRA on the kept tokens via on-policy self-distillation.

On average, CodecOPSD drops about 70% of the condition tokens on MiniMax-H3 Ref2VA with almost unchanged quality and 1.87x faster denoising, and up to 8.4x faster with more conditions (three reference videos, higher-resolution references, more frames, and a higher drop rate).

On MiniMax-H3-Image, it drops about 65% of the reference tokens and makes denoising about 2x faster. More cases are on the project page."

CodecOPSD logo

https://huggingface.co/collections/HikariDawn/codecopsd

https://github.com/Kiteretsu77/CodecOPSD

Comfy: https://github.com/search?q=comfy+CodecOPSD&type=repositories

posted 6 or so days ago, code has some PRs merged so still under development.
Looks neat, but I'm about to go nap; comment with your results please.

30 Upvotes

11 comments sorted by

2

u/swagerka21 3d ago

Comfy when

1

u/Neuer_Djarra 2d ago

probably by the weekend knowing how fast people port these over

1

u/DietAshamed2246 3d ago

I am getting 10s H3 videos (0.3 mp pass-1, 1 mp pass-2) using LokkenJP's version of 10Eros-Max-Turbo in under 3 minutes and 16 mp H3-Image under 1 minute with ComfyUI stock Int8 model. How much faster can it possibly get?! Also, what does "almost unchanged quality" mean - is that an euphemism for "with some degradation"?

2

u/reeight 2d ago

Sounds like you're better at H3 than I... here are 2 nodes for Comfy:

https://github.com/search?q=comfy+CodecOPSD&type=repositories

2

u/tomakorea 3d ago

'almost unchanged quality' is a bit concerning because even the original H3 isn't really good at fast motion and small details

2

u/Apprehensive_Sky892 2d ago

They are modifying the conditional tokens that go into the DiT. So it should have no effect on fast motion and small details.

By "almost unchanged quality" they most likely meant that the conditional tokens's effects on the output (like character likeness, fidelity of movement, voice likeness, etc) are kept.

1

u/Enshitification 3d ago

Does the time to train the LoRA on the kept tokens offset the faster denoisng time much?

1

u/Memestonks2020 3d ago

Really interesting.

Does this result in bit-wise identical output in seeds or differences due to the codec?

1

u/Apprehensive_Sky892 2d ago

Very interesting project. Currently, there are two ComfyUI implementations.

The first one is for making faster ref2va with video references: https://github.com/aaalll12322/ComfyUI-MiniMaxH3-CodecPrune and it claims a 1.8x speed up

ReferenceSequenceWall clock
One picture (1,032 → 407 tokens)19,902 → 19,277 (−3.1%)30 → 30 s/it, below resolution
One 5 s video (37,296 → 11,189 tokens)56,166 → 30,059 (−46.5%)85 → 47 s/it (1.81×)

Both rows use a 0.4–0.5 MP, 124-frame output. The second row was measured with SolAttn sparse attention enabled in both runs. The first row's 625-token reduction is real, but too small to register above run-to-run variation, which is why it is listed as no measurable change rather than as a gain.

1

u/Apprehensive_Sky892 2d ago

The 2nd project handles both images and videos: https://github.com/DrakenZA/ComfyUI-H3-CodecOPSD

No benchmark is given but there is detailed instruction on how to install and use it.