Home-made Diffusion Model from Scratch to Hatch

Shih-Ying YeharXiv 2025 · DOI

Abstract

The Home-made Diffusion Model (HDM) demonstrates that high-quality 1024×1024 text-to-image generation is achievable on consumer-grade hardware. By combining the Cross-U-Transformer (XUT) architecture with efficient training recipes like TREAD and Shared adaLN, the model achieves competitive results for a total training cost under $620.

Introduction: Breaking the Scaling Barrier

Current state-of-the-art text-to-image (T2I) models, such as Stable Diffusion 3 or FLUX, are defined by a "scaling paradigm" that requires massive industrial compute clusters. This creates a significant accessibility gap, where only well-funded labs can innovate. HDM tackles this "pay-to-play" barrier by optimizing a model from the ground up for consumer-grade hardware (e.g., 4x RTX 5090s) without sacrificing the compositional quality or resolution expected from modern AI.

Methodology

HDM introduces several architectural and procedural innovations designed to squeeze maximum performance out of limited compute resources.

Overview of the HDM training pipeline and internal architecture.

Cross-U-Transformer (XUT)

Traditional U-Net-style transformers often use simple concatenation or addition for skip connections. HDM replaces these with cross-attention mechanisms in the XUT backbone. This allows the decoder to selectively "attend" to specific features from the encoder, leading to significantly better compositional consistency.

The XUT Backbone structure illustrating the encoder-decoder flow and skip connections.

Shifted Square Crop

To handle varying aspect ratios without the complexity of "bucketing," HDM utilizes a Shifted Square Crop strategy. The model is trained on square crops but is provided with a "position map" indicating where that crop sits in the original image. At inference, providing a full-size position map for the desired aspect ratio allows the model to generate non-square images naturally.

Efficiency Innovations: TREAD and Shared adaLN

The model integrates Token Routing for Efficient Architecture-agnostic Diffusion (TREAD), which selectively processes a fraction of tokens during training to speed up convergence. Additionally, to save parameters, HDM uses Shared Adaptive Layer Normalization (shared adaLN), employing a single MLP to generate modulation parameters across all layers rather than unique ones for every block. This results in a lean "base" version with only 343M parameters.

Datasets and Training

The primary training set was Danbooru2023 (~7.6 million images). To improve user experience, raw tags were converted into natural language captions using Pixtral-11M. Training was conducted in four progressive resolution stages (256² → 512² → 768² → 1024²), with the final stage utilizing a curated subset of 3.6 million high-quality images.

Key Insights and Results

  • Cost-Efficiency: The total training cost for the 1024x1024 model was approximately $535–$620 on rented RTX 5090s over 385 hours.
  • Emergent Camera Control: Because the model was trained with position maps, it learned implicit "camera" controls. By manipulating the position map at inference (shifting or scaling coordinates), users can pan or zoom the "camera" without extra training or ControlNets.
  • Compositional Consistency: Qualitative results indicate that the model is exceptionally good at maintaining scene structure during minor prompt modifications, suggesting that architectural improvements like XUT can compensate for lower parameter counts.

Limitations and Future Work

While qualitative results are strong, the project currently lacks extensive quantitative benchmarking (e.g., FID or CLIP scores) due to resource constraints. Future work will focus on scaling to larger datasets (40M+ images) and investigating high-resolution refinement approaches to push beyond 1024x1024.

Summary updated

BibTeX
@misc{yeh2025home,
  author = {Shih-Ying Yeh},
  title = {{Home-made Diffusion Model from Scratch to Hatch}},
  year = {2025},
  eprint = {2509.06068},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.06068},
}
Figure