Full-Pipeline Text-to-Image Training on Domestic Compute: Architecture, Engineering, and Evaluation

    This article examines how to run the full text-to-image training pipeline—from data preprocessing and large-scale pretraining to supervised fine-tuning and reinforcement-learning alignment—on domestic AI accelerators. It explains the trade-offs between autoregressive semantic planning and diffusion-based pixel generation, discusses training engineering for graph dispatch, multi-stream execution, operator fusion, and observability, and outlines practices for arbitrary resolutions, Chinese text rendering, evaluation, deployment, and cost control.

    As generative AI expands from language models to multimodal systems, image generation must not only understand semantics accurately but also produce stable compositions, readable text, and business-ready sizes for posters, covers, and similar formats. At the same time, the training pipeline places higher demands on compute, communication, and framework affinity. Completing data preprocessing, large-scale pretraining, supervised fine-tuning, and reinforcement-learning alignment entirely on domestic accelerators requires systematic engineering in operator fusion, pipeline parallelism, and stability—not simply migrating an existing recipe. This article provides a reusable technical explanation across problem definition, architecture choice, training engineering, resolution and text capability, evaluation, and deployment.

    1. Problem Essence: Understanding Semantics and Writing Correct Pixels

    The core tension in text-to-image generation is that reasoning on the language side and detail on the pixel side are not naturally isomorphic. Language models are good at global composition, subject relationships, and style constraints, but they often struggle with stroke-level text, small icons, and edge alignment. Pure diffusion models are finer in texture, but they are prone to typos, missing characters, or layout drift in long text and complex typography. A practical industry route is to separate the two: an autoregressive module handles semantic understanding and global layout, while a diffusion decoder handles high-fidelity rendering. A dedicated glyph-related encoder is introduced to reduce the probability of “forgetting how to write a character.” This division can be summarized as: the former handles understanding, and the latter handles writing correctly.

    For Chinese scenarios, the challenge is more pronounced. Chinese characters are stroke-dense and structurally nested, and posters often contain vertical text, artistic fonts, and multi-line mixed layouts. If only generic text conditioning is used, the model may render characters as “text-like textures.” Therefore, text consistency must be strengthened through condition injection, loss design, and data mix, rather than pursuing aesthetic scores alone.

    2. What Full-Pipeline Training on Domestic Accelerators Means

    A full pipeline typically covers data cleaning and sharding, tokenization and image encoding, large-scale pretraining, instruction fine-tuning, preference or reinforcement-learning alignment, and checkpoint saving and recovery. On domestic accelerators, common bottlenecks include excessive graph dispatch overhead, failure to overlap communication with computation, normalization and optimizer kernels that are not well matched to the hardware, and memory fragmentation at long sequence lengths or high resolutions.

    Several neutral and widely validated engineering approaches can be used. First, dynamic-graph multi-level pipeline dispatch decouples compilation, scheduling, and execution to reduce host-side bottlenecks. Second, multi-stream parallelism allows collective communication and matrix computation to cover each other and improve accelerator utilization. Third, fuse accelerator-friendly operators, such as combining adaptive optimizers, exponential moving average, and normalization with adjacent computations to reduce memory access. Fourth, maintain observability of the data pipeline and training loop at the framework level, using logging and monitoring alerts to track loss spikes, gradient norms, and communication timeouts. These are not tied to any vendor-specific interface; they are general methodologies for large-scale distributed training.

    The data side is equally important. Image-generation data requires image-text alignment quality, text-region annotation, resolution and aspect-ratio distribution, and poster-style layout samples. Preprocessing should use tiered storage on object storage and elastically launch cleaning jobs on a container platform to avoid saturating training-cluster I/O. For Chinese posters, it is advisable to build a separate “text readability” subset containing multiple font sizes, fonts, and complex backgrounds; otherwise, the model may look good on natural landscapes but fail on posters.

    3. Hybrid Architecture: Autoregressive Base Plus Diffusion Decoder

    A clear module division is as follows: a medium-sized autoregressive network handles condition understanding, object relationships, and overall composition; a diffusion transformer structure performs iterative denoising in latent space to generate the final image. The text path can add a glyph encoder that injects character-level shape priors into the decoding process, so stroke structure can be constrained rather than relying only on natural-language descriptions such as “write several characters.”

    In training, the usual approach is first to ensure that the autoregressive base converges stably on domestic accelerators, then to train the decoder jointly or in stages. In the alignment stage, human preferences or automatic evaluation metrics can be used for targeted optimization of text correctness, layout usability, and subject completeness. It should be emphasized that a hybrid architecture increases system complexity: two losses, two resolution strategies, and two checkpoints. Engineering should unify the configuration center, random seeds, and data shards to avoid reproducibility difficulties.

    Consistent with the direction of connecting language-model reasoning to image generation is cognitive generation: first parse the prompt into an executable visual plan—subject, hierarchy, whitespace, and text regions—and then hand it to the pixel model for rendering. For developers, prompt design should move from adjective stacking to a layout specification that explicitly states alignment, character limits, and safe margins.

    4. Non-Standard Resolutions: From Preset Ratios to Native Arbitrary Width and Height

    Traditional approaches often restrict generation to a few aspect ratios and then crop on the business side, which can easily cut off titles or damage composition. A more reasonable approach is to improve visual tokenization and positional encoding so that the model natively supports arbitrary width and height within a pixel budget—for example, from around one million pixels to a higher tier—including vertical sizes close to common print formats. Implementation points include variable-grid positional encoding, normalization by area rather than fixed side length, sufficient aspect-ratio sampling during training, and latent-space shape alignment to the target canvas during decoding.

    For posters, social covers, and infographics, custom sizes are almost mandatory. The application layer should pass the target width and height as first-class parameters rather than generating first and resizing afterward. At the same time, the minimum and maximum side lengths should be constrained to avoid extreme elongated ratios that dilute attention or squash text.

    5. Evaluation Should Cover Both Aesthetics and Text

    When comparing open-source and in-house models, beyond subjective visual quality, attention should be paid to tasks such as complex visual text generation and long-text rendering. Metric design should be separated into semantic compliance, text accuracy (including typos and missing characters), layout usability, and stability across different aspect ratios. For Chinese, evaluation should also cover simplified and traditional characters, punctuation, and mixed digits. The evaluation set should include real business noise, such as low-contrast backgrounds, small fonts, and slanted decorative text; otherwise, ranking first on a leaderboard does not mean production readiness.

    6. Practical Deployment and Cost Control: Neutral Recommendations

    On the inference side, batching and resolution tiers can be scheduled separately, prioritizing the short side to ensure text clarity. For high-concurrency cover generation, a message queue can smooth peaks, results can be written back to object storage, and monitoring alerts can track failure rates and timeouts. For security, copyright, portrait, and prohibited-content filtering are needed; text generation especially needs to prevent sensitive-word bypass.

    The value of an open-source release lies in a reproducible training recipe and inference interface, not in binding to a specific code-hosting service or model community. For enterprise deployment, weights, configurations, and data-processing scripts should be included in the same versioning system, with licenses and data-source documentation completed. On the cloud, general capabilities—object storage, container platform, logging, and monitoring alerts—can be combined to support a closed loop from experiments to small-traffic operation.

    7. Summary

    Running a full multimodal image-generation pipeline on domestic accelerators depends not on slogans but on whether the architecture split is clear, whether operators and parallelism fully utilize the hardware, and whether Chinese text and arbitrary resolution are treated as first-class requirements. By connecting autoregressive “understanding” with diffusion “drawing,” and adding observable training engineering and layout-oriented evaluation, it is possible to form stable production capability for posters, illustrations, covers, and similar scenarios. Developers should start from four areas—data mix, aspect-ratio sampling, text loss, and pipeline parallelism—to gradually turn a lab model into a serving generation system.