Skip to content
Tencent-HunyuanPublic

About

[NeurIPS 2026] HYDRA: Representation Harmonized Tokenization for Multimodal Generation and Understanding

Resources

Stars

9 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

HYDRA

Representation Harmonized Tokenization for Multimodal Generation and Understanding

NeurIPS 2026 arXiv License

Website Code Models Training Logs

Model Zoo Β· Quick Start Β· Training Β· Results Β· Citation

HYDRA teaser


πŸ“° News

  • [2026-10] πŸŽ‰ HYDRA is accepted by NeurIPS 2026!
  • [2026-10] πŸ”₯ Model weights released on HuggingFace β€” HYDRA-1.5B, HYDRA-7B and both HYDRA-TOK tokenizers.
  • [2026-10] πŸ”₯ Inference, training and evaluation code released.

πŸ’‘ Highlights

Unified multimodal models (UMMs) struggle to bridge the fundamental gap between the abstract representations needed for visual understanding and the detailed primitives required for generation. HYDRA closes this gap with a single representation.

  • 🧩 HYDRA-TOK β€” one pure-ViT tokenizer, no quantization. The backbone transitions from a Gen-ViT (structure-preserving primitives for synthesis) to a Sem-ViT (semantic encoding), mediated by a Generation-Semantic Bottleneck (GSB) that compresses features to 64 channels, filters noise for robust synthesis, then restores dimensionality for comprehension.
  • πŸ”— HYDRA β€” a native unified framework. A dual-head decoder (autoregressive for text, rectified flow matching for images) over a single shared parameter space.
  • πŸ† State-of-the-art on both halves of the problem β€” strong reconstruction, generation and understanding from one model. See the paper for the full benchmark tables.

Representation-harmonized ViT

Representation-harmonized ViT: Gen-ViT + GSB + Sem-ViT + Pixel Flow Decoder.

HYDRA unified framework

HYDRA unified framework: dual-head (AR + flow matching) on a shared Qwen backbone.


πŸ€— Model Zoo

All weights live in a single HuggingFace repo: Xuerui123/HYdra

  • HYDRA-1.5B and HYDRA-7B β€” the unified models (MMU + T2I), built on Qwen2.5-1.5B-Instruct and Qwen2.5-7B-Instruct.
  • HYDRA-TOK β€” two tokenizer variants: the GAN-finetuned one (hydra_tok_gan, use this for generation) and the base stage-2 one (hydra_tok_base, for reconstruction and training init).
  • hydra_tok_latent_stats.pt β€” the latent normalization statistics.

Tip

No download step is required. configs/inference.yaml ships with hf://Xuerui123/HYdra/... paths, so every command in Quick Start fetches exactly the weights it needs into the standard HuggingFace cache on first run and reuses them afterwards. Qwen2.5 is pulled the same way via from_pretrained.

To pre-stage everything instead (offline machines, shared cluster caches):

pip install -U huggingface_hub
huggingface-cli download Xuerui123/HYdra --local-dir ckpt

then override the path with model_path=../ckpt/hydra_1.5b. HYDRA_HF_SKIP_DOWNLOAD=1 disables hf:// resolution entirely.

Note

hydra_tok_latent_stats.pt is not optional β€” the flow-matching head consumes normalized latents, so every T2I entry point needs it alongside the tokenizer. See ckpt/README.md for the full layout.


πŸš€ Quick Start

Installation

# tokenizer (HYDRA-TOK)
cd hydra_tok && pip install -r requirements.txt

# unified model (HYDRA)
cd hydra && pip install -r requirements.txt

Important

transformers must be 4.x (>=4.45,<5) β€” v5 removed cache_utils.SlidingWindowCache, which the Qwen2 backbone imports.

Multimodal Understanding (MMU)

cd hydra
python evaluation/inference_mmu.py \
    config=configs/inference.yaml \
    mmu_image_path=./test.jpg \
    question='Describe this image.'

mmu_image_path also accepts a directory (every image inside is processed), and several questions can be asked in one pass by separating them with ***:

    question='What object is in this image? *** What is the surface made of?'

MMU examples

Text-to-Image Generation (T2I)

inference_t2i.py is launched with torchrun β€” prompts are sharded across ranks internally. Accepts .txt, .csv and WISE-style .json prompt files.

cd hydra
torchrun --nproc_per_node=8 evaluation/inference_t2i.py \
    config=configs/inference.yaml \
    t2i_prompts_file=prompts/t2i_prompts.txt \
    output_dir=samples

Using the 7B

Override the three fields that differ from the 1.5B default:

python evaluation/inference_mmu.py config=configs/inference.yaml \
    model_path=hf://Xuerui123/HYdra/hydra_7b \
    model.llm.llm_model_path=Qwen/Qwen2.5-7B-Instruct \
    model.llm.hidden_size=3584 \
    mmu_image_path=./test.jpg question='Describe this image.'

For T2I with the 7B, also pass transport.time_shifting_factor=3.0 β€” the 7B was evaluated with a shift of 3.0, while the config default of 5.0 is the 1.5B setting.

Sampling protocol

Every sampling knob lives under transport.; a bare guidance_scale=... is rejected rather than silently ignored. configs/inference.yaml ships the HYDRA-1.5B GenEval/WISE setting.

Setting HYDRA-1.5B HYDRA-7B
transport.guidance_scale 5.0 5.0
transport.time_shifting_factor 5.0 3.0
transport.num_inference_steps β€” GenEval / WISE 50 200
transport.num_inference_steps β€” DPG-Bench 100 100

Bold entries differ from the shipped defaults (5.0 / 5.0 / 50). time_shifting_factor is the only timestep shift affecting generation β€” it reshapes the sampling grid as t β†’ t / (t + f βˆ’ fΒ·t). The do_shift flag is training-only and has no effect at inference.


πŸ”§ Training

HYDRA β€” three-stage progressive pipeline

Stage What happens Data ratio (TU:IU:IG) Steps Frozen
I Image-text alignment, flow-head training 0:1:3 150K LLM
II Joint training, all parameters 0:2:2 100K β€”
III Quality refinement, instruction tuning 1:2:2 20K β€”
cd hydra

# Stage I -> II -> III
bash scripts/train.sh configs/hydra_1.5b_stage1.yaml
bash scripts/train.sh configs/hydra_1.5b_stage2.yaml
bash scripts/train.sh configs/hydra_1.5b_stage3.yaml

# multi-node
bash scripts/train_multinode.sh configs/hydra_1.5b_stage1.yaml

Note

Dataset paths in the shipped stage configs are /path/to/... placeholders. Fill in dataset.params.* with your own sources β€” the configs are templates for the recipe, not byte-exact reproductions of the released checkpoints.

HYDRA-TOK β€” tokenizer

cd hydra_tok

# Stage 1: distillation from the InternViT teacher
bash scripts/train.sh stage1 --config configs/stage1.yaml

# Stage 2: large-scale refinement + GAN
bash scripts/train.sh stage2_gan --config configs/stage2_gan.yaml

Evaluation

cd hydra_tok
bash tools/eval_all.sh <experiment_name> hydra_tok

Reconstruction metrics follow the paper protocol: 448 β†’ 256 with PIL LANCZOS, written as lossless PNGs, then rFID over the two directories.


πŸ“Š Results

SOTA comparison

HYDRA outperforms previous native UMMs and several task-specific models.

Generation comparison

Generation comparison with other unified models.

Reconstruction comparison

Reconstruction quality on ImageNet.


πŸ“ Repository Layout

HYdra/
β”œβ”€β”€ hydra_tok/                  # HYDRA-TOK tokenizer
β”‚   β”œβ”€β”€ train_stage1.py         #   Stage 1: InternViT distillation
β”‚   β”œβ”€β”€ train_stage2_gan.py     #   Stage 2: + GAN refinement
β”‚   β”œβ”€β”€ scripts/                #   launch scripts
β”‚   β”œβ”€β”€ tools/                  #   evaluation (eval_top12 / eval_fid / eval_all.sh)
β”‚   β”œβ”€β”€ configs/                #   stage1.yaml / stage2_gan.yaml / datasets_example
β”‚   β”œβ”€β”€ hydra_tok/              #   model definition (Gen-ViT + GSB + Sem-ViT)
β”‚   └── disc/                   #   discriminators (DINO / PatchGAN / DiffAug)
β”‚
β”œβ”€β”€ hydra/                      # HYDRA unified multimodal model
β”‚   β”œβ”€β”€ train.py                #   entry point (stage routing)
β”‚   β”œβ”€β”€ train_stage.py          #   unified trainer (Stages I/II/III)
β”‚   β”œβ”€β”€ scripts/                #   train.sh / train_multinode.sh
β”‚   β”œβ”€β”€ configs/                #   hydra_{1.5b,7b}_stage{1,2,3}.yaml + inference.yaml
β”‚   β”œβ”€β”€ evaluation/             #   inference_mmu.py + inference_t2i.py
β”‚   β”œβ”€β”€ models/                 #   HydraQwen2_5 + HYDRA-TOK vision towers
β”‚   β”œβ”€β”€ datasets/               #   MMUDataset (LLaVA) + ImageTextDataset (T2I)
β”‚   β”œβ”€β”€ transport/              #   flow matching (path, sampler, CFG tricks)
β”‚   └── tools/                  #   utils, convert_showo_prefix, etc.
β”‚
β”œβ”€β”€ ckpt/                       # checkpoints (not in git; see ckpt/README.md)
└── assets/                     # figures from the paper

πŸ“¦ Data Format

T2I (generation)

dataset_root/
β”œβ”€β”€ data_info.json       # [{"image": "img_0.jpg", "annotation": "img_0.json"}, ...]
β”œβ”€β”€ local_folder/        # images
β”‚   └── img_0.jpg
└── cap_folder/          # captions
    └── img_0.json       # {"caption": "a red sports car..."}

MMU (understanding) β€” LLaVA format

[{"id": "0",
  "image": "images/img_0.jpg",
  "conversations": [
    {"from": "human", "value": "<image>\nDescribe this image."},
    {"from": "gpt",   "value": "The image shows an ostrich..."}
  ]}]

See hydra/datasets/example_mmu_datasets.yaml for the multi-dataset config.


πŸ™ Acknowledgements


πŸ“„ License

This project is released under the MIT License.


πŸ“– Citation

If you find HYDRA useful in your research, please consider citing:

@article{qiu2026hydra,
  title={{HYDRA}: Representation Harmonized Tokenization for Multimodal Generation and Understanding},
  author={Qiu, Xuerui and Cui, Yutao and Zhang, Guozhen and Li, Junzhe and Zhao, Yaqi and Zhang, Xiao and Li, Yang and Liu, Songtao and Yang, Miles and Shi, Yu and Zhong, Zhao and Bo, Liefeng},
  journal={arXiv preprint arXiv:2603.15228},
  year={2026}
}

About

[NeurIPS 2026] HYDRA: Representation Harmonized Tokenization for Multimodal Generation and Understanding

Resources

Stars

9 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages