Training Multimodal Image Generation Models End-to-End on Domestic Chinese AI Chips: Architecture and Engineering Analysis
This article examines how a multimodal image generation model was trained end-to-end on domestic Chinese AI accelerators, and what that means for teams evaluating hardware and software stack sustainability. It breaks down the hybrid autoregressive plus diffusion decoder architecture, the three-layer approach to accurate Chinese text rendering, tokenizer and position-encoding changes that enable non-standard resolutions, and the engineering work behind operator affinity, mixed precision, memory control, and fault-tolerant training. It also outlines a four-dimension evaluation framework and practical adoption advice.
1. Why End-to-End Training on Domestic Chips Matters
Two pieces of news surfaced around the same time: export policies for high-end overseas accelerators toward China were adjusted, and a domestic team released and open-sourced a multimodal image generation model trained end-to-end on domestic chips. Read together, they point to one question: can the full training pipeline for large multimodal models run on a non-mainstream hardware ecosystem?
The key phrase is “end-to-end.” Many so-called domestic chip adaptations only move inference over, or swap out a subset of operators, while training still depends on the original ecosystem. End-to-end means data preprocessing, tokenization and encoding, mixed-precision strategy, optimizer state management, large-scale pretraining, and post-training all run stably on domestic accelerators and their software stacks. This is not just an engineering porting problem; it also involves operator coverage, communication library efficiency, memory management, and fault tolerance and recovery.
For developers and enterprise users, the practical value is that training and deploying multimodal generation models now has an additional verifiable path of hardware-software co-design, which strengthens the sustainability of both the supply chain and the technology stack.
2. Architecture: Autoregressive Backbone for Understanding, Diffusion Decoder for Rendering
This class of models typically uses a hybrid “autoregressive + diffusion decoder” architecture that decouples semantic understanding from pixel generation.
- Autoregressive backbone (roughly 9B parameters): handles semantic understanding, instruction following, and global layout planning, producing an intermediate representation that carries layout and content constraints. It is essentially an extension of language model design, well suited to long contexts and complex instructions.
- Diffusion decoder (a DiT structure of roughly 7B): takes the intermediate representation and performs step-by-step denoising from noise to image, using a dedicated text encoder to reinforce glyph shapes and typography, mitigating problems like missing strokes and text that blurs into an unreadable mass.
The engineering value of this split is that the semantic layer can be trained with mature parallelism strategies and long-sequence optimizations, while the visual layer can use techniques such as resolution bucketing and timestep sampling to control memory and throughput. The two sides align through the intermediate representation, avoiding the need to load all the pressure onto one oversized network.
Illustrative pseudocode showing how the two stages call each other:
# Stage 1: autoregressive backbone produces a structured intermediate representationlayout = ar_model.encode(prompt, reference_image=None) # semantic tags, region layout, text content# Stage 2: diffusion decoder denoises into pixels following the intermediate representationimage = dit_decoder.sample(cond=layout,height=1600, width=1240, # non-standard resolutionsteps=30,guidance_scale=4.5,glyph_cond=layout.text_slots # text slot conditioning)
3. Chinese Text Rendering: From Drawing to Writing Correctly
An early weakness of image generation models was text, Chinese in particular. Chinese characters have dense strokes and complex glyph structures, and mixed Chinese-English text, vertical writing, punctuation, and letter spacing add further typographic rules. Even a small deviation in the diffusion process produces missing strokes or wrong characters.
A workable optimization approach usually has three layers:
- Data layer: when building image-text pairs, preserve the original layout information (font size, position, color, hierarchy) so the model sees a design file rather than a screenshot.
- Structure layer: introduce a separate text encoding branch that injects text content, glyph features, and region masks into the decoder as additional conditioning, forming a two-step constraint of “place the frame first, then write the text.”
- Sampling layer: apply stronger conditioning weights to text regions during inference, or run a second refinement pass on local regions, reducing the smoothing of detail caused by global denoising.
In engineering practice, encoding consistency for mixed Chinese-English text and region overflow caused by long-text line wrapping also need attention; these often affect real-world usability more than model size does.
4. Non-Standard Resolutions: Tokenizer Strategy Determines Flexibility
Traditional generation models preset resolution to a few fixed aspect ratios (such as 4:3, 16:9, 1:1), so changing the canvas requires retraining or forced stretching. Native support for arbitrary aspect ratios comes down to changes in tokenization and position encoding:
- Adopt a chunking scheme that decouples width and height more cleanly, so the token grid maps naturally onto different aspect ratios.
- Support extrapolation in position encoding, keeping semantics stable as resolution varies between 1024x1024 and 2048x2048.
- Apply resolution bucketing and random cropping during training so the model sees a sufficiently diverse set of canvas shapes.
This capability is practical for custom sizes such as posters, social media covers, and e-commerce main images, eliminating the composition damage caused by “generate first, crop later.”
5. Engineering: Operators, Precision, and Training Stability
Completing end-to-end training on domestic accelerators requires solving three classes of problems:
- Operator affinity: use fused operators matched to hardware characteristics (such as AdamW with exponential moving average, channel scaling, and fused normalization) to reduce memory access and kernel launch overhead.
- Precision and memory: combine mixed precision with activation recomputation, sequence parallelism, and tensor parallelism to control peak memory from long sequences and high resolutions.
- Fault tolerance and recovery: periodically save optimizer state and random number state during large-scale training to support fast resumption after node-level failures; also apply skip and rollback policies for loss spikes.
A simplified training loop skeleton:
for step, batch in enumerate(loader):with autocast(dtype="bfloat16"):loss = model(batch).lossloss.backward()optimizer.step() # fused AdamW with EMA shadow weightsema.update(model)if is_spike(loss):optimizer.skip_and_rollback()if step % save_every == 0:save(model, optimizer, ema, rng_state)
6. Evaluation: How to Judge Whether an Image Generation Model Is Usable
Build an evaluation matrix across four dimensions rather than judging by a single sample image:
- Instruction following: whether multiple objects and multiple constraints (count, position, color, style) are all satisfied at once.
- Text accuracy: glyph correctness for long Chinese text, layout neatness, and consistency in mixed Chinese-English text.
- Resolution robustness: whether non-standard aspect ratios introduce stretching, abnormal padding, or composition drift.
- Inference cost: per-image latency, memory usage, concurrent throughput, and actual utilization on domestic cards.
When deploying in a general cloud environment, container platforms can freeze images and dependencies, object storage can host model weights and datasets, and logging services with monitoring alerts can track throughput, failure rate, and memory levels, enabling observable batch inference and canary releases.
7. Trends and Practical Recommendations
Fusing an autoregressive model with a diffusion decoder essentially brings the reasoning and planning ability of language models into visual generation, moving models from “drawing something similar” toward “thinking clearly and writing correctly.” As end-to-end training pipelines on domestic chips mature, three points deserve attention when selecting a stack: whether training and inference are transferable within the same stack, avoiding dual maintenance; whether Chinese and typography-heavy requirements have dedicated optimization; and whether resolution and batch cost match the business use case.
For adoption, start by validating text rendering and instruction following on a small dataset, then scale up resolution and concurrency gradually. Also fix the evaluation set into the continuous integration process, letting data rather than visual impression drive iteration.
