Image making · Research feature

New AI Model Unifies Image and Text Understanding in a Single Discrete Space

A new diffusion model processes images, video, and 3D data using a shared discrete space, improving multimodal understanding and generation.

Adapted from research by Qian Yu, Zongyang Qiu, Juncheng Yan and colleagues.

arXiv preprint revision · 2026-10-14 · Attribution & reuse
In this article
Editorial illustration of a color study.

Editor’s introduction

The study introduces Intern Lumina U2, a diffusion language model that represents visual inputs through multi-codebook tokens in a fully discrete space. It combines discrete visual tokens with text in a unified backbone, enabling joint training and optimization across image, video, and 3D content. The model uses a concatenated embedding approach at input and a lightweight autoregressive head at output to predict visual codes sequentially. Results show strong performance in image understanding, generation, and editing across modalities. The researchers compare two versions of the model—trained on Huawei Ascend 910B NPUs and NVIDIA GPUs—finding consistent performance, with the model achieving leading results in unified multimodal tasks. The study establishes Intern Lumina U2 as the first diffusion model to use multi-codebook visual tokens in a fully discrete space, supporting cross-modal understanding within a single framework.

Introduction

Unified multimodal models integrate visual understanding and generation within a single model. However, architectural sharing alone does not constitute complete unification, since understanding and generation may still rely on separate representations and training objectives. To go beyond architectural unification, we identify two principles for unifying understanding and generation more comprehensively. First, text and visual content should be mapped into a shared optimization space under a single objective. Although hybrid designs can achieve high visual fidelity by retaining continuous visual states and delegating synthesis to a continuous decoder, they optimize visual generation with a continuous objective distinct from the text objective and often adopt separate visual encoders for understanding and generation, leading to optimization difficulties. Second, the generation process should respect the intrinsic structure of each modality. Text follows a natural sequential order, whereas visual content has no canonical generation order: each region depends on both its local neighborhood and long-range global context. The generation process should therefore decode text sequentially while refining visual content in parallel with bidirectional context.

Discrete masked diffusion provides a natural basis for satisfying the requirements above. It applies a masked-prediction objective to discrete text and visual tokens, thereby optimizing both modalities within a common discrete space. Under this formulation, each task is specified by partitioning the token sequence into observed conditioning tokens and masked prediction targets. Understanding and generation are thereby cast as distinct conditional queries to the same model, rather than as separate tasks with task-specific objectives. Moreover, masked diffusion decodes tokens in parallel through iterative refinement without imposing a fixed generation order, allowing each spatial position to be refined with bidirectional access to both local and global context. However, existing discrete unified models remain limited in visual representation capacity, as single-codebook tokenization compresses the visual information at each position into a single discrete code. Such a compact representation is insufficient both for faithful reconstruction and for covering the full range of visual tasks. This motivates us to design a unified discrete framework that carries a high-capacity visual representation in a shared space under a single training objective, while modeling it efficiently with a unified backbone.

Unified multimodal understanding and generation

One line of work models image generation as discrete visual-token prediction within the backbone. Chameleon and Emu3 use a shared vocabulary for text and visual codes under next-token prediction, whereas MMaDA and Lumina-DiMOO use masked prediction for both modalities. Related discrete-generation designs include Janus and Janus-Pro, which decouple the understanding encoder from the generation tokenizer; VAR and OneCAT, which use coarse-to-fine next-scale prediction; and Emu3.5, which converts next-token image decoding to bidirectional parallel prediction for faster inference. A second line models image generation in a continuous space with a diffusion or flow objective. Transfusion combines text next-token loss with image diffusion in one Transformer, UniFluid models each position with a diffusion head, BAGEL and InternVL-U use ViT features for understanding and VAE-space flow matching for generation, and SenseNova-U1 moves flow matching to pixel space. A third, hybrid route predicts discrete semantic visual tokens in the backbone and reconstructs images with a separate continuous generator. LLaDA2.0-Uni follows this design: its backbone models text and visual tokens under a shared masked-prediction objective, while a diffusion decoder synthesizes images conditioned on the predicted visual tokens. Single-codebook discrete representations constrain the detail and semantics carried at each visual position. Continuous and hybrid designs support richer image synthesis, but retain a continuous generative objective distinct from text-token classification, either within the backbone or in a separate generator. Intern Lumina U2 instead uses multi-codebook discrete representations for image, video, and 3D inputs, while training text prediction and image generation under a shared objective.

Diffusion language models

LLaDA showed that masked diffusion language models trained from scratch can match strong AR baselines, replacing left-to-right decoding with parallel iterative recovery, and LLaDA2.0 converts a pretrained AR Mixture-of-Experts model into a block-wise diffusion LM, preserving its knowledge while enabling parallel decoding. This family has been extended to vision in several ways: LLaDA-V feeds features from a vision encoder into the diffusion LM for understanding, and LLaDA-o pairs discrete masked diffusion for text with continuous diffusion for images. Among the unified models discussed above, MMaDA and Lumina-DiMOO extend masked prediction to both text and image tokens, while LLaDA2.0-Uni adopts the converted LLaDA2.0 backbone with block-wise masked prediction. Intern Lumina U2 also starts from LLaDA2.0-mini and extends this family along two axes: the visual state becomes a multi-codebook visual token, and the same model covers image, video, and 3D inputs.

Accelerating masked-diffusion decoding

Acceleration methods for masked generation follow two routes. Learning-based methods train an auxiliary model so that few large jumps replace many refinement steps; a recent representative learns latent controlled dynamics for masked image generation. Training-free methods instead reshape the sampler: MaskGIT-style schedules fix how many positions commit per round, Fast-dLLM commits every position whose probability clears an absolute threshold, low-discrepancy reveal orders improve which positions commit, and cached sampler state with fixed-interval refresh removes redundant backbone work. Our sampler follows the training-free route. Because visual-token confidence sits far below the absolute thresholds of Fast-dLLM-style commit rules (Section 6.2.2), it adapts both the commit schedule and the cache refresh from temporal signals, confidence plateaus and measured hidden-state drift (Section 6.2).

Unified Visual Tokenizer

The visual tokenizer serves as the interface between raw visual data (images, videos, and 3D assets) and the model, and therefore constrains both generation and understanding. As discussed in the previous section, Intern Lumina U2 places two requirements on its visual tokenizer: (1) it must produce discrete visual tokens that can be modeled in the same way as text tokens, so that all tasks can share a single masked-diffusion objective; and (2) these tokens must preserve both the low-level detail for generation and the high-level semantics needed for understanding. However, existing tokenizers are typically specialized for either low-level detail or high-level semantics. For example, tokenizers trained for reconstruction, such as VQGAN, keep fine detail but are not trained to align with language, whereas semantic encoders such as SigLIP align well with text but are not trained to reconstruct pixels.

Unified Data Format with Data Packing

Having specified the representation of a single visual position, we now describe the organization of complete samples into training sequences. All tasks, from text-only dialogue to image generation and editing, share a unified packed sequence format. Moreover, to determine the attention mask and calculate loss, each token in this format is annotated with five metadata fields: type (text condition, visual condition, structural token, text answer, or visual answer), turn index, noise state (clean or noisy), block index, and position ID.

Multimodal Understanding Data

Image understanding is the largest of the three understanding categories. Its data are drawn mainly from the public instruction-tuning collection LLaVA-OneVision and the private instruction data of InternVL, which includes image captioning, document understanding, and chart data. To balance the mixture across skills, we organize these data by capability rather than by source dataset. This yields three capability groups: perception (image captioning, general visual question answering, grounding, and counting), text-rich image understanding (OCR, documents, charts, and GUI or web screenshots), and knowledge-intensive reasoning (science questions and mathematics).

The video and 3D understanding data are limited in scale, but are constructed in the same manner as the image understanding data. The video data comprise captioning and question-answering datasets built on public video corpora, together with temporal reasoning datasets covering event ordering, counting, and temporal localization tasks (see Appendix C for the full list of sources). The 3D data consist of object-centric assets paired with captions and question-answering annotations, drawn from Objaverse (with Cap3D captions ), GAPartNet, and Sketchfab.

Text-to-Image Data

Text-to-image generation requires training images that span a broad range of concepts and domains, contain rich details, exhibit high aesthetic quality, and are accurately described by their captions. These requirements fall into three aspects: concept coverage, caption quality, and image quality. We therefore organize the construction of the text-to-image corpus into three steps, each addressing one aspect: (i) source coverage and domain-specific expansion, which broaden the range of concepts and domains; (ii) caption reconstruction and prompt expansion, which improve caption quality; and (iii) filtering, deduplication, and balancing, which raise image quality and reduce redundancy.

Filtering, deduplication, and balancing

This step consists of three stages: rule-based filtering and deduplication, model-based quality filtering, and data balancing. In the first stage, every sample must pass validity checks that require a decodable image, a minimum side length, and a non-empty prompt with the length limit. In the second stage, every sample is scored by a vision-language judge (Qwen3-VL-30B-A3B-Instruct ) for aesthetics, image quality, structural richness, and prompt following under the UniPercep protocol. Filtering then applies three rules in order, discarding samples with illegible or missing required text, samples below the prompt-following threshold, and samples outside the top range of aesthetic scores; the thresholds and filtering statistics are given in Appendix C. In the final stage, we balance the remaining data by adjusting the sampling multiplicity of each subset according to its content domain, language, and caption complexity.

Image Editing Data

Image editing is an image-to-image (I2I) task in which the model generates a target image conditioned on one or more source images with an editing instruction. A valid editing sample must therefore satisfy two requirements: the target image reflects the requested change, while leaving unmentioned subjects, identities, layouts, and backgrounds unchanged. Our editing data consist of two parts: public datasets, namely OmniEdit, ImgEdit, SEED-Data-Edit, X2Edit, and additional in-house synthetic data. The resulting editing corpus covers ten edit types: addition, removal, replacement, adjustment, extraction, background change, style transfer, hybrid editing, action editing, and in-image text rendering. Quality control follows directly from this definition, supplemented by a check on image quality. Specifically, for each sample we verify that (i) the target differs visibly from the source; (ii) the observed change matches the instruction; (iii) regions not referenced by the instruction remain consistent between the source and target images; and (iv) the target image is of adequate visual quality.

Sequence packing and distributed training

We apply dynamic sequence packing in all training stages. The data collator concatenates training samples until a predefined packing length limit is reached. This removes only the padding inserted between samples, while retaining the padding within a single sample. The data collator also records the cumulative sequence lengths of the packed samples, which mark the sample boundaries to confine attention and loss computation to each sample. Therefore, this packing strategy reduces sequence-level padding overhead while retaining sample-internal padding, without altering the objective for any individual sample. On both platforms, we use FSDP2 with full parameter sharding in a hybrid sharded data parallel (HSDP) layout. Gradient checkpointing is enabled, while parameter and activation offloading are disabled. This configuration keeps long packed sequences within the per-device memory budget, while preserving identical model and loss definitions across hardware platforms.

Ascend and NVIDIA implementations

We train Intern Lumina U2 on both Huawei Ascend and NVIDIA platforms to evaluate the cross-platform effectiveness of our model. The Ascend implementation is built on the CANN runtime, the VeOmni distributed training framework, and HCCL for collective communication. The attention and MoE layers are implemented with platform-native fused kernels; the Ascend-specific operator adaptations and memory constraints are detailed in Appendix D. Both implementations follow the same five-stage schedule, unified training objective, and data proportions, while differing in hardware-specific settings, including device counts, parallelization meshes, and token budgets. Because Ascend training uses a larger cluster and a larger token budget, we use the resulting checkpoint as the primary model for evaluation and deployment. The model trained on NVIDIA GPUs serves as a cross-platform reference for the same training recipe.

Evaluation

We evaluate Intern Lumina U2 on image understanding and reasoning, video and 3D understanding, text-to-image generation, scientific-diagram generation, and image editing. We report results for two models with the same architecture, tokenizer, and five-stage training schedule: the primary model, trained on 1,024 Huawei Ascend 910B NPUs (Appendix D), and a reference model trained on NVIDIA GPUs. We then present ablations of the visual input interface, the multi-codebook AR head, and the inference-sampling configuration.

Setup

All benchmarks use the official evaluation sets and scoring protocols. Understanding benchmarks use 1024-pixel inputs, with chain-of-thought prompting on reasoning-heavy benchmarks such as MMMU, MathVista, and MathVision; video benchmarks use 64 frames selected by segment-based random sampling. Generation and editing benchmarks follow their official multi-sample protocols and judges, namely GenEval, DPG-Bench, UniGenBench, TIIF-Bench, WISE, OneIG-Bench, ImgEdit, and GEdit-Bench. Baselines include understanding-only models (Qwen2.5-VL and LLaDA-V ) and unified models (Janus-Pro, Show-o2, BAGEL, InternVL-U, OmniGen2, MMaDA, Lumina-DiMOO, LLaDA-o, and LLaDA2.0-Uni ); their numbers are taken from the sources listed in each table caption.

Conclusion

We have presented Intern Lumina U2, to our knowledge the first unified understanding-and-generation diffusion language model that models multi-codebook visual states in a fully discrete space and extends visual understanding across images, videos, and 3D assets. Its visual input interface preserves codebook identity by assigning each codebook an independent embedding table and merging the resulting embeddings into a single backbone token through concatenation and projection. Its visual output interface uses a multi-codebook AR head to predict the codes at each visual position autoregressively along the codebook dimension, while masked diffusion refines all spatial positions in parallel. Ablation studies confirm the contribution of both design choices. Codebook-specific input embeddings improve next-code top-1 accuracy, with the largest gains on later codebooks. The multi-codebook AR head captures inter-code dependencies and achieves the best results on all four generation benchmarks, with the most pronounced gains in counting, position, and attribute binding.

Despite these advances, several limitations remain. First, the multi-codebook autoregressive head introduces additional decoding overhead, and high-resolution generation produces long visual sequences. Second, the current system covers image generation and editing, but has not yet been extended to video or 3D generation. In future work, we plan to extend generation to videos and 3D assets, explore more tightly interleaved multimodal generation, investigate post-training with reinforcement learning, and scale up the backbone.

Data validation

Before training, the annotations and sequence lengths of each data mixture are precomputed offline, and sources unchanged from a previous mixture are reused after their first sample is checked for consistency, while changed or new sources are processed again. The precomputed data pass four checks before use: (i) the numbers of sources and samples match the mixture definition; (ii) randomly drawn samples are non-empty and can be parsed; (iii) on a random subset, recomputed sequence lengths equal the stored ones; and (iv) a random subset can be converted into packed training sequences without error.

Execution path

Every entry point imports torch_npu.contrib.transfer_to_npu before any model code. This remaps torch.cuda onto the NPU runtime, so no ’cuda’ literal in the model files has to be rewritten. Each rank is given its own HF_MODULES_CACHE directory; otherwise the ranks sharing a node write the same dynamically imported module files at the same time. The AToken decoder ships with a flash_attn dependency that does not exist on this platform, so its attention modules are rebuilt on the native kernels. That rebuild covers the image-decoding path; the understanding and text paths never reach that code.

Fused mixture-of-experts

We rebuild the fused MoE path on torch_npu.npu_grouped_matmul, since the fused path of the GPU stack is a Triton kernel. The forward pass permutes tokens into expert order with npu_moe_token_permute, then runs one grouped matrix multiplication against the merged first projection, npu_swiglu, and a second grouped matrix multiplication against the second projection. The routing weights are applied as the result is unpermuted. The kernel provides no backward pass, so we write one as an explicit autograd function. It uses two further grouped matrix multiplications: one against the transposed weights for the input gradient, and one against the transposed activations, under a different grouping mode, for the weight gradient. An expert-parallel variant wraps the same kernel in all-to-all dispatch and combine.

Memory

Per-NPU memory is the binding constraint of the training configuration, which makes activation allocation a first-order target rather than a detail absorbed by spare capacity. The allocator runs with PYTORCH_NPU_ALLOC_CONF=expandable_segments:True and MULTI_STREAM_MEMORY_REUSE=2. Three further settings determine the usable ceiling. The data-parallel shard group size is 24 or 32 depending on the size of the job, which trades parameter and optimizer residency against communication volume. Gradient checkpointing is enabled on the backbone blocks. The cache-release interval is 20 steps rather than 100, which keeps fragmentation from accumulating across the long tail of packed sequence lengths. Together they lower peak memory and raise the longest sequence one NPU can hold, which is the quantity that sets training efficiency at fixed hardware.