PyTorch Re-implementation of Stable Diffusion: A Manual Implementation and Efficiency Analysis of Text-to-Image Synthesis
This paper presents an in-depth exploration of the Stable Diffusion pipeline for text-to-image synthesis, emphasizing a comparative analysis between the Latent Diffusion Model (LDM) and the Denoising Diffusion Probabilistic Model (DDPM). Our implementation introduces a hardcoded architecture which fully reflects the underlying structure of the original Stable Diffusion architecture. Through manual implementation of all layers and samplers, we guarantee not only the architectural interpretability and the deepness of learning in Stable Diffusion. This method not only permits fine-grained customizability, but also keeps the compatibility to already-trained weights via a custom weight transfer scheme. Fundamental building blocks of our approach including the CLIP encoder, Variational Autoencoder (VAE) and U-Net architecture have been implemented from scratch. Leveraging pretrained weights via weight transfer ensures that our implementation achieves comparable performance metrics while enabling enhanced control over network structure and operations. Experimental results reveal that the hardcoded DDPM implementation offers superior memory efficiency compared to LDM while delivering comparable image quality. This work highlights the stability and generalizability of diffusion-based models for artistic text-to-image generation, and offers significant incrementals for how these architectures can be implemented and tailored from scratch.
Authors
- Deepak Parmar
- S. Sridhar
- B. Sai Reddy
- S. S. Shylaja
- Shreya Chaurasia
Institutions
- PES University (IN)
Publication Details
- Published
- 2025-05-21
- DOI
- https://doi.org/10.1109/iccta65425.2025.11166164
- Primary Topic
- Image Processing and 3D Reconstruction
- Type
- article
- Field-Weighted Citation Impact
- 0.00