Training Image Generation Models on Domestic AI Chips: A Technical Breakdown
This article examines a technical approach to training an image generation model from scratch on domestic AI chips and releasing it as open source. It breaks down the hybrid autoregressive plus diffusion decoder architecture, the role of fused operators in adapting to the hardware, native support for arbitrary non-standard resolutions, engineering techniques for Chinese text rendering, and a practical checklist for moving from validation to production. The focus is on a replaceable full stack spanning framework, operators, model structure, and inference deployment, rather than a single benchmark score.
1. Introduction: Why a Fully Domestic Training Stack Deserves Attention
For a long time, training image generation models has been tied by default to a specific accelerator ecosystem, with operator libraries, communication libraries, and mixed-precision strategies all tuned around it. Migrating to a different hardware stack is not just a question of whether the code runs; the real challenge is preserving training stability, throughput, and convergence quality at the same time. A recent signal is that a team completed an image generation model trained from scratch on domestic AI chips and chose to open source it. Its value lies not in a single benchmark result, but in validating an engineering path where the framework, operators, model structure, and inference deployment can all be replaced.
For developers and enterprise users, the significance is direct: more supply chain options, room to optimize compute cost per unit, and easier private deployment and data compliance. The discussion below covers five dimensions: architecture, operator adaptation, resolution strategy, Chinese text rendering, and engineering deployment.
2. Architecture Breakdown: Autoregression for Understanding, a Diffusion Decoder for Rendering
The model uses a hybrid architecture of autoregression plus a diffusion decoder, with roughly a 9B autoregressive backbone and a 7B diffusion decoding backbone. The division of labor is clear:
- The autoregressive backbone handles semantic understanding and global composition. It organizes image semantics, object relationships, and layout as discrete token sequences, with strengths in long-range dependency modeling and instruction following.
- The diffusion decoder handles pixel-level reconstruction and fine texture, and renders text regions more stably, mitigating common problems such as missing strokes and glyphs blurring together.
This split makes sense because semantic planning is a discrete, symbolic task suited to language-model-style modeling, while pixel synthesis is a continuous, high-dimensional task suited to a diffusion process. Chaining the two is like separating the director from the cinematographer, each using the most appropriate tool.
A schematic inference flow can be abstracted as:
# Pseudocode: expresses data flow only, not any specific interfacesemantic_tokens = ar_model.encode(prompt, layout_hint) # semantic and layout planningglyph_tokens = glyph_encoder.encode(text_spans) # text content and glyph constraintslatent = dit_decoder.decode(semantic_tokens, glyph_tokens) # pixel-level synthesisimage = vae.decode(latent)
The engineering difficulty of a hybrid architecture is not in stitching the parts together, but in the training objectives and data mixture. The next-token prediction loss in the autoregressive stage and the denoising loss in the diffusion stage have different scales, so staged training or a scheduling strategy is needed to prevent one branch from dominating the gradients.
3. Operator Adaptation: Fused Operators as the Key Lever on Domestic Chips
The most common bottlenecks when training on domestic chips are insufficient operator coverage and low memory access efficiency. The approach here starts at the operator layer, using a set of fused operators that are friendlier to domestic accelerator architectures, including fused AdamW and EMA updates, condition- and channel-related fused modules, and normalization implementations such as RMS Norm.
Why do fused operators matter so much? Take the optimizer as an example. The momentum, second moment, and weight decay in AdamW are element-wise operations. If every step dispatches a large number of small operators individually, launch overhead and the number of memory accesses rise significantly. Fusing them combines multiple reads and writes and reduces intermediate tensor materialization:
# Conceptual illustration: fused update reduces intermediate tensors# Unfused: m, v, and p are each read and written once, producing several temporary tensors# Fused: one read in, one write backm = beta1 * m + (1 - beta1) * gradv = beta2 * v + (1 - beta2) * grad * gradp = p - lr * (m / (sqrt(v) + eps) + wd * p)ema = decay * ema + (1 - decay) * p
Compared with normalization that centers on the mean, RMS Norm skips the mean statistic and removes one reduction, which helps maintain bandwidth utilization on highly parallel hardware while preserving training stability. Three points are worth attention in practice: first, the operator precision mode, such as accumulation precision under mixed precision; second, overlapping communication with computation; third, a checkpoint strategy that allows recovery from failures, because long training runs fear nothing more than crashing on the last step.
4. Arbitrary Non-Standard Resolutions: Practical Value from Tokenizer Improvements
Traditional image generation models usually have resolutions preset to a few fixed aspect ratios, because positional encodings, token grids, and training resolutions are tightly coupled. By improving the tokenizer strategy, this model natively supports arbitrary aspect ratios in the range from 1024x1024 to 2048x2048, including non-standard sizes such as 1240x1600.
This is practical for posters, social media covers, and e-commerce main images, where canvas sizes are typically dictated by the business rather than the model. Previously, the workflow was to generate first and then crop or stretch, which easily damaged composition and text integrity. With native support for arbitrary aspect ratios, layout can be modeled correctly during generation.
Practical recommendations:
- Pass the target aspect ratio as an explicit conditioning input rather than cropping in post-processing;
- Set upper and lower bounds for extreme aspect ratios to avoid excessive token grid stretching that degrades detail;
- Reserve safe margins around text regions to reduce semantic loss caused by cropping.
5. Direct Chinese Poster Output: Engineering Text Rendering
Chinese text rendering is difficult because of high glyph density, fine stroke detail, and heavy interference from homophones and visually similar characters. Pairing a glyph encoder with the diffusion decoder essentially injects “what to write” (text content) and “what it looks like” (visual glyph) as additional conditions into the pixel synthesis stage, so the model sees both during rendering.
General practices that can be added include layout region masks, text line direction constraints, font size and weight conditions, and super-resolution post-processing for small text. For evaluation, it is better to look at three metrics together: text recognizability, glyph completeness, and overall composition consistency, rather than visual impression alone.
6. Deployment Checklist: From Validation to Production
- Training side: prioritize fused operators and communication optimization, and set up small-scale convergence comparison experiments to confirm the migration does not lose quality.
- Inference side: treat resolution and layout as first-class inputs, and inject structured conditions for text regions.
- Deployment side: use a container platform for elastic scaling, object storage for models and assets, and logging and monitoring with alerts to track latency and failure rates.
- Cost side: account for cost per thousand usable images rather than per GPU hour, and include the rework rate as a metric.
- Compliance side: both training data and generated content should be traceable, and private deployments should favor a stack that can be fully replaced.
7. Conclusion
Training and open sourcing an image generation model on domestic AI chips marks a shift for a fully domestic generative vision stack from “it runs” to “it is reproducible and extensible.” The takeaway for developers is that focusing on architecture division of labor, operator adaptation, and real business constraints such as resolution and text often pays off more than chasing a single metric.
