Training Multimodal Image Generation Models End-to-End on Domestic AI Chips: Architecture and Engineering Analysis

    This article breaks down what it takes to train a multimodal image generation model entirely on domestic AI chips, from data preprocessing and large-scale pretraining through SFT and RL. It explains the hybrid autoregressive-plus-diffusion-decoder architecture, strong glyph conditioning for text rendering, native support for arbitrary resolutions, and the scheduling, communication, operator, and stability optimizations that keep domestic accelerators fully utilized. It also covers how to evaluate text rendering quality and practical guidance for deployment, memory planning, prompt design, and compliance.

    1. Technical Background: Why End-to-End Training on Domestic Compute Matters

    Over the past two years, the capability frontier of multimodal image generation has been pushed forward quickly. Yet a long-standing problem remains: the training-side engineering stack depends heavily on a small number of hardware and framework combinations. This creates more than supply risk. It also hardens engineering habits. Parallelism strategies, operator implementations, and memory-sharding schemes all grow around the specific characteristics of particular hardware, so switching platforms often means rewriting large amounts of low-level code.

    The significance of completing training end-to-end on domestic chips lies in validating that an alternative path is viable. Here “end-to-end” is a strict definition: not deploying inference on domestic hardware only, and not migrating a single fine-tuning stage, but running data preprocessing, large-scale pretraining, supervised fine-tuning (SFT), and reinforcement learning (RL) all on the same domestic compute and its supporting frameworks.

    For developers and enterprise users, this kind of practice delivers value on three levels:

    • Supply chain resilience: training resources are no longer dependent on a single source, so there is a portable fallback when quotas or policies shift.
    • Cost structure optimization: the per-unit compute cost and service responsiveness of domestic compute are typically more controllable, which suits long-running, large-scale pretraining.
    • Accumulated engineering capability: once adaptation experience is captured in a training suite, the migration cost for subsequent models drops significantly.

    One point deserves objective framing: hardware adaptation does not change the upper bound of model capability. What it changes is whether that capability can be produced stably and repeatably.

    2. Architecture: Autoregression for Understanding, Diffusion Decoding for Rendering

    These models generally adopt a hybrid architecture of “autoregressive backbone plus diffusion decoder,” with the two modules cleanly separated by responsibility.

    The autoregressive backbone (typically below roughly ten billion parameters, commonly around 9B) handles semantic understanding and global composition. It reads the text instruction, resolves intent, reasons about entity relationships, plans the layout, and outputs a high-level semantic representation of the image (a token sequence or a latent-space condition). The diffusion decoding module (commonly a DiT structure around 7B) restores that semantic representation to pixels and, when needed, invokes a dedicated text encoding path to handle glyph shapes.

    This division of labor resolves a core tension: autoregressive models are strong at long-range dependencies and logical consistency but weak at fine-grained control when generating pixels directly; diffusion models are strong at local texture and high-frequency detail but lack global semantic reasoning. Chaining the two means letting the module that “thinks” do the planning and the module that “draws” do the rendering.

    For text rendering, the industry has a vivid phrase for the failure mode: the model knows there should be a sign in the scene but writes characters with missing strokes and broken structure. A common solution is to introduce an independent glyph encoding path that injects the glyph features of the target text into the decoding stage as a strong condition, rather than expecting the backbone to “memorize” thousands of glyph shapes on its own. Mixed Chinese-English text, vertical text, and stylized or deformed lettering are all stress tests for this path.

    Illustrative inference call logic (pseudocode, expressing structure only, not any specific API):

    1. # 1) Semantic planning: text -> high-level semantic representation
    2. semantic = autoregressive_backbone.encode(prompt) # entities, layout, style
    3. # 2) Text conditioning: target text -> glyph features
    4. glyph_cond = glyph_encoder(target_text) # stroke/structure constraints
    5. # 3) Pixel decoding: semantics + glyphs -> image
    6. image = diffusion_decoder.decode(
    7. semantic,
    8. cond=glyph_cond,
    9. height=H, width=W # arbitrary aspect ratios
    10. )

    3. Non-Standard Resolutions: An Underrated Practical Capability

    Traditional image generation models constrain output sizes to a few preset aspect ratios (such as 4:3, 16:9, 1:1). This stems from training that cuts images into fixed grids and binds positional encodings tightly to resolution. Ask for a non-standard size like 1240x1600 and the model either refuses or generates first and then crops or stretches, breaking the composition.

    Native support for arbitrary aspect ratios comes down to reworking the tokenizer and positional encoding strategy: letting the token grid change dynamically with the target width and height, and making the positional representation extrapolate smoothly as resolution changes rather than looking up fixed preset tiers. The engineering payoff is direct:

    • Posters, social media covers, and e-commerce main images come in fragmented sizes, so no secondary cropping is needed.
    • Batch production can output multiple sizes from one unified prompt template, with better layout consistency.
    • The manual rework loop of “generate, crop, inpaint” is eliminated.

    Practical advice: even when a model supports arbitrary aspect ratios, keep width and height within the range covered by the training distribution (for example, between 1024x1024 and 2048x2048). Extreme aspect ratios can still produce stretched composition and deformed text.

    4. Training-Side Engineering Optimization: Keeping Domestic Compute Fully Utilized

    The difficulty of adaptation usually lies not in whether the workload runs, but in whether it runs fast and stays stable. Common industry optimization approaches fall into four categories:

    1. Scheduling layer: use dynamic-graph multi-level pipeline dispatch, splitting per-card operator dispatch into multiple queues to remove the host-side dispatch bottleneck; this is the most common reason dynamic-graph training throughput stalls.
    2. Communication layer: use multi-stream parallelism to stagger the compute stream and the communication stream, so tensor-parallel communication overhead is hidden behind computation and efficiency decay is reduced as you scale out.
    3. Operator layer: use hardware-affine fused operators such as AdamW with EMA and RMS Norm to reduce memory round trips for intermediate tensors.
    4. Stability layer: pair mixed precision with loss scaling and numerical stability handling; long pretraining runs need checkpoint resume and metric monitoring.

    A simplified training loop skeleton:

    1. for step, batch in enumerate(loader):
    2. with no_sync(model):
    3. loss = model(batch) # forward + compute stream
    4. loss.backward()
    5. all_reduce_async(grads) # communication stream, overlapped with later compute
    6. optimizer.step() # fused AdamW + EMA
    7. ema.update(model)
    8. if step % log_interval == 0:
    9. metrics.log(loss=loss, lr=scheduler.get_lr())

    In practice, track three kinds of metrics: per-card throughput (samples/s), scaling efficiency (linearity of multi-card relative to single-card), and long-run stability (frequency of loss spikes). A long training job without monitoring, alerting, and logging will cost far more to diagnose failures than the compute itself.

    5. Evaluating Text Rendering Quality

    Complex visual text generation and long-text rendering are two different tests. The former looks at the accuracy and aesthetics of short text against complex backgrounds; the latter looks at glyph consistency, line spacing, and layout order across large blocks of text. Evaluation should cover at least character accuracy, missing and extra character rates, mixed Chinese-English text, vertical text and line wrapping, and stylized or perspective-deformed lettering.

    To validate on your own business, build a small but realistic evaluation set (tens to hundreds of cases), fix prompts and random seeds, and run A/B comparisons rather than relying only on public leaderboards. Leaderboards reflect general capability; business results depend on your layout distribution.

    6. Engineering Deployment Recommendations

    • Deployment shape: training and inference can sit on a container platform and elastic compute resources respectively, with object storage for data and weight management, and logging plus monitoring and alerting to cover long-running jobs.
    • Memory and parallelism: the memory peak of high-resolution inference in the DiT decoder is usually higher than that of the backbone, so plan parallel sharding and caching strategies in advance.
    • Prompt engineering: writing layout, font-size hierarchy, and whitespace ratio into the prompt costs less than repeated resampling.
    • Compliance and copyright: commercial assets, font licensing, and generated-content labeling must be handled according to the requirements of your region.

    7. Conclusion

    The real value of training a multimodal image generation model end-to-end on domestic chips is not a single benchmark run. It is turning a once-fragile engineering chain into a reusable method: division of labor in a hybrid architecture, strong glyph conditioning, a dynamic-resolution tokenizer, and scheduling and operator optimization targeting domestic hardware. For developers, understanding these four pieces keeps delivery on schedule when compute supply fluctuates. For enterprises, it determines whether multimodal capability is a one-off demo or a sustainable production line.