Training Multimodal Image Generation Models End-to-End on Domestic AI Chips: An Architecture and Optimization Breakdown

    This article analyzes how a multimodal image generation model can be trained end-to-end on domestic AI accelerators, from data preprocessing to large-scale pretraining, with open weights and inference code. It explains the hybrid architecture of an autoregressive backbone plus a diffusion decoder, the role of glyph conditioning in text rendering, and the tokenizer strategies that enable arbitrary aspect ratios. It also covers optimization across the framework, operator, parallelism, and data layers, along with evaluation criteria and a reusable adoption path for teams pursuing a fully self-controlled training stack.

    1. Background: Why a Full-Stack Training Pipeline Matters

    Two recent industry signals are worth reading together. On one hand, export policies on some high-end accelerators have loosened. On the other, a domestic team completed end-to-end multimodal image generation training on domestic accelerators—covering everything from data preprocessing to large-scale pretraining—and open-sourced both the weights and the inference code.

    These two developments may seem unrelated, but they point to the same engineering question: when the training framework, operator libraries, parallelism strategies, and model architecture all have to be adapted to the same hardware, the ceiling on model capability is no longer determined by algorithms alone. It is determined by how deeply the algorithm, framework, and hardware are co-optimized. Policy changes are a short-term variable on the supply side; a self-controlled full-stack training pipeline is the long-term, high-certainty investment.

    For developers, the value of this work is not that it adds another image generation model. It is that it lays out a reusable path for training on domestic hardware: how to clean and package data, how to optimize graph execution and scheduling in the framework, how to fuse operators, and how to design model structures that balance semantics and fine detail.

    2. Overall Architecture: Autoregressive Backbone + Diffusion Decoder

    This class of models typically uses a hybrid architecture that splits generation into two modules with distinct responsibilities.

    2.1 Autoregressive Backbone: Understanding and Composition

    The backbone is on the scale of billions of parameters (9B in the original work) and models visual token sequences autoregressively. It handles three tasks:

    • Semantic understanding: parsing the subject, attributes, relationships, and constraints in a prompt;
    • Global layout: deciding composition, element placement, and visual focus;
    • Cross-modal alignment: mapping language representations into the visual token space.

    Autoregressive modeling naturally offers strong global consistency and controllability, making it well suited to cognitive generation tasks that follow a “think first, then draw” pattern.

    2.2 Diffusion Decoder: Getting the Details Right

    The decoder uses a DiT structure (7B in the original work). It takes the semantic conditions produced by the backbone, outputs continuous pixels or high-dimensional features, and then reconstructs the image through a VAE-style decoder. It addresses two weaknesses of generating images directly with an autoregressive model: insufficient high-frequency detail and blurry local textures.

    2.3 Text Rendering: How Glyph Conditioning Fits In

    The core difficulty in Chinese posters is that glyph structures are complex and strokes are dense, which makes missing or malformed characters a common failure. A common approach is to inject glyph-level condition encoding at the decoding stage, feeding character or glyph features of the target text as an additional condition into cross-attention so the decoder has strong constraints when generating strokes.

    The following is an illustrative sketch of how the conditions are organized (pseudocode that expresses only the data flow and does not represent any specific API):

    1. # 1) Parse the prompt and prepare glyph conditions
    2. parsed = parse_prompt(prompt) # subject, attributes, layout constraints
    3. glyph_feat = glyph_encoder(parsed.text) # glyph-level condition
    4. # 2) Autoregressive backbone generates visual semantic tokens
    5. visual_tokens = ar_backbone(parsed.semantic, glyph_feat)
    6. # 3) Diffusion decoder reconstructs pixels under the conditions
    7. latent = dit_decoder(visual_tokens, glyph_feat, timestep=t)
    8. image = vae_decode(latent)

    3. Arbitrary Aspect Ratios: The Tokenizer Strategy Is Key

    Traditional image generation models only support preset options such as 4:3 and 16:9 because positional encodings are tightly coupled to a fixed token grid with fixed width and height. To natively support arbitrary aspect ratios between 1024×1024 and 2048×2048 (for example, 1240×1600), the engineering work usually starts in three places:

    1. Continuous positional encoding: replacing fixed grid indices with extrapolatable position representations;
    2. Width-height decoupled patchification: letting the token count vary with the actual width and height instead of using a lookup table;
    3. Aspect ratio jitter during training: mixing multiple aspect ratios into the data so the model does not overfit to a few preset options.

    The engineering payoff is direct: for non-standard sizes such as posters, social media covers, and e-commerce main images, there is no longer a need to generate first and crop later, which reduces the loss from a second round of composition.

    4. End-to-End Training on Domestic Accelerators: Four Layers of Optimization

    The original work emphasizes that the entire pipeline runs on domestic accelerators. In engineering terms, this means adaptation holds across four layers at the same time.

    4.1 Framework Layer: Unified Compute Graph and Pipeline Dispatch

    A self-developed training suite built on a domestic deep learning framework covers four stages: data preprocessing, pretraining, supervised fine-tuning, and reinforcement learning. Key optimizations include multi-level pipeline dispatch for dynamic graphs to relieve single-point dispatch bottlenecks, and multi-stream parallelism that overlaps communication with computation to improve cluster utilization.

    4.2 Operator Layer: Hardware-Affinity Fused Operators

    Hardware-affinity fused implementations are used for operators such as AdamW with exponential moving average, channel-folding operators, and RMS normalization. These reduce the overhead of writing intermediate tensors to memory and of memory access. The gains typically show up in single-card throughput and peak memory usage.

    4.3 Parallelism: Hybrid Data, Tensor, and Pipeline Parallelism

    With a billion-scale backbone and a billion-scale decoder, training requires hybrid parallelism: data parallelism to scale sample throughput, tensor parallelism to split individual layer weights, pipeline parallelism to split inter-layer dependencies, and activation recomputation to control memory usage.

    4.4 Data Layer: Image-Text Pairs and Text Annotations

    Text rendering capability depends heavily on data: image-text pairs with precise text annotations, glyph masks, and layout information. During data cleaning, mislabeled and low-resolution samples must be filtered out, and samples must be bucketed by ratio to support arbitrary-resolution training.

    5. Evaluation and Selection Guidance

    On public leaderboards, this class of models ranks among the top open-source entries in two evaluations: complex visual text generation and long-text rendering. When selecting a model, focus on four points:

    • Text accuracy: stroke completeness and error rate for long Chinese strings;
    • Layout controllability: support for region constraints and element placement;
    • Resolution coverage: native support for the non-standard sizes your use case requires;
    • Deployment cost: inference memory, per-image latency, and batch throughput.

    6. Adoption Practice: A Reusable Path on Domestic Hardware

    For teams that want a fully self-controlled stack, the following order is a practical reference:

    1. Start with a small model to get the data–training–evaluation loop working end to end;
    2. Fix the evaluation set, then replace operators and parallelism strategies layer by layer and compare against the baseline;
    3. Break text rendering out as a separate evaluation item so it is not masked by overall image quality;
    4. On the inference side, apply quantization and operator fusion to bring down per-image cost.

    Overall, the significance of training a multimodal image generation model end-to-end on domestic chips is that it turns “can we train it” into an engineering question of “how do we train it better.” For developers, what is truly reusable is this adaptation methodology, not any specific set of weights.