--- license: other license_name: minimax-h3-image-community-license-agreement license_link: LICENSE base_model: MiniMaxAI/MiniMax-H3-Image base_model_relation: adapter pipeline_tag: image-to-image language: - en tags: - lora - image-generation - reference-to-image - token-pruning - distillation - minimax-h3 ---
CodecOPSD

GitHub Project Page Paper Space Models

# CodecOPSD-H3-Image **On-Policy Codec Distillation for Efficient All-in-One Video Generation** Sequence-wise generators (MiniMax-H3 Ref2VA, MiniMax-H3-Image, Qwen-Image 2.1, FLUX 3 Image Klein) append every reference picture or video to the input token sequence, so the token cost grows sharply as more references are added. 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. This repo holds the CodecOPSD LoRA for **MiniMax-H3-Image** (reference-to-image generation). ⭐ **If you like CodecOPSD, please help ⭐⭐star⭐⭐ the [GitHub repo](https://github.com/Kiteretsu77/CodecOPSD). Thanks!** 🤗 ## Model Variants | Variant | Base model | Task | Weights | |---|---|---|---| | **CodecOPSD-H3-Ref2VA** | [MiniMax-H3](https://huggingface.co/MiniMaxAI/MiniMax-H3) Ref2VA | Reference-to-video generation | [HikariDawn/CodecOPSD-H3-Ref2VA](https://huggingface.co/HikariDawn/CodecOPSD-H3-Ref2VA) | | **CodecOPSD-H3-Image** (this repo) | [MiniMax-H3-Image](https://huggingface.co/MiniMaxAI/MiniMax-H3-Image) | Reference-to-image generation | [HikariDawn/CodecOPSD-H3-Image](https://huggingface.co/HikariDawn/CodecOPSD-H3-Image) | | CodecOPSD on Cosmos 3 Nano | Cosmos 3 Nano | | Coming soon | | CodecOPSD on Qwen-Image 2.1 | Qwen-Image 2.1 | | Coming soon | | CodecOPSD on FLUX 3 Image Klein | FLUX 3 Image Klein | | Coming soon | ## Gallery CodecOPSD MiniMax-H3-Image gallery Click the gallery to open it on the project page. ## Run it Install the [CodecOPSD code](https://github.com/Kiteretsu77/CodecOPSD) and download the base models into `models/`: ```bash git clone https://github.com/Kiteretsu77/CodecOPSD.git && cd CodecOPSD pip install -e ".[app]" python -m codecopsd.download minimax_h3_image --no-examples python app.py ref2image # Gradio demo ``` The CodecOPSD pipeline is a diffusers `DiffusionPipeline` on diffusers' own MiniMax-H3 modules, with codec pruning in front of the transformer: ```python import torch from PIL import Image from codecopsd import MiniMaxH3ImageCodecOPSDPipeline pipe = MiniMaxH3ImageCodecOPSDPipeline.from_minimax_h3_image( "models/MiniMax-H3-Image", text_encoder_fp8="fp8", text_encoder_path="models/MiniMax-H3-ModelOpt-Mixed9-Dynamic-FP8/Ref2VA/text_encoder") pipe.load_condition_lora("HikariDawn/CodecOPSD-H3-Image", weight_name="codecopsd_minimax_h3_image.safetensors") pipe.enable_model_cpu_offload() image = pipe( prompt="Put the lamp on the desk in .", images=[Image.open("lamp.jpg"), Image.open("desk.jpg")], generator=torch.Generator().manual_seed(42), ).images[0] image.save("output.png") ``` ## Weights | File | Base trunk | Format | |---|---|---| | `codecopsd_minimax_h3_image.safetensors` | MiniMax-H3-Image `transformer_diffusers` | FP32 LoRA, rank / alpha 128, 2.6 GB | | `config.json` | | Base model, LoRA rank and alpha, version | | `LICENSE`, `NOTICE` | | The MiniMax-H3-Image Community License Agreement and its required notice | ## License These LoRA weights are Model Derivatives of MiniMax-H3-Image and are distributed under the [MiniMax-H3-Image Community License Agreement](https://huggingface.co/MiniMaxAI/MiniMax-H3-Image/blob/492fd8c4eca666f1085f57e30738c1e0d86b3439/LICENSE). See [NOTICE](NOTICE) for the required MiniMax notice and the CodecOPSD authors' copyright statement. The CodecOPSD code is on [GitHub](https://github.com/Kiteretsu77/CodecOPSD) under its own license. ## Citation ```bibtex @article{wang2026codecopsd, title = {On-Policy Codec Distillation for Efficient All-in-One Video Generation}, author = {Wang, Boyang and Blackburn-Matzen, Kevin and Saha, Oindrila and Gadelha, Matheus and Cheng, Zezhou}, journal = {arXiv preprint arXiv:2611.31184}, year = {2026} } ```