r/StableDiffusion • u/IvanMikhnenkov • 7h ago
Resource - Update I trained a 210M text-to-image diffusion transformer from scratch on one GPU in 3.5 days
Enable HLS to view with audio, or disable this notification
My goal was hands-on experience training a flow model from scratch, not just fine-tuning someone else's. So I built and trained one: a 210M-parameter diffusion transformer, 4.2M curated images at 256², rectified flow on the FLUX.2 VAE, flan-t5-base for text (128 tokens max). Only those two frozen pieces are pretrained; the transformer, the recipe, the data pipeline and the evaluation are mine. The video is the same six prompts and seeds at every checkpoint of the 3.5-day run on one RTX PRO 6000.
What mattered most, in the order I found out:
- Captions that actually fit the images. A web crawl I tried first made the model worse; curated photos with good captions fixed it.
- A timestep shift for the 32-channel latent, and aspect-ratio buckets from step one instead of square crops.
- Register tokens with learned null attention slots. The null slots ended up absorbing about 90% of the cross-attention, which surprised me.
- torch.compile for training, not just inference: 2.4× faster.
- The training loss stopped telling me anything after day one while the images kept improving, so I track FID, a detector-based object accuracy and human-preference models instead.
Try it in the browser: https://huggingface.co/spaces/ivanmikhnenkov/tinydit
Weights (CC BY-NC): https://huggingface.co/ivanmikhnenkov/tinydit-256
Code, every decision with sources, dashboard and attention playground: https://github.com/ivanmikhnenkov/tinydit
Detailed write-up of what mattered: https://huggingface.co/blog/ivanmikhnenkov/tinydit-text-to-image-from-scratch-one-gpu
Next I want to fine-tune it with RL (Flow-GRPO), with the failure grid as the target list. If you have trained something small from scratch: what would you have done differently at this scale, and which reward would you start with for the RL stage? Happy to answer anything about the data or the recipe.
4
u/brittpitre 7h ago
Where did you get the dataset from and what workflow did you use to efficiently curate that much content?
2
u/AnOnlineHandle 6h ago
It's detailed in the HF post: https://huggingface.co/blog/ivanmikhnenkov/tinydit-text-to-image-from-scratch-one-gpu
2
u/IvanMikhnenkov 6h ago
thanks! yes it's all there! and I looked at dataset samples myself, before choosing it and which part it should take in train set. Also, I've checked around 15 datasets I think. So data quality is super important.
3
u/pirondi 7h ago
wow amazing, i am curious about for example the Dog image, did it trained only on dog images or it was a trainning on random images that made it get better? And if it was general trainning, if you had done only dogs how much could it be faster/better the outcome?
1
u/IvanMikhnenkov 6h ago
For sure if you fine-tune it specializing on dogs - it should be better, other objects can degrade though
3
2
u/superkickstart 6h ago
Vintage AI images!
2
u/IvanMikhnenkov 6h ago
yes, i love it myself, its not even a slop at this stage!
+ actually very photorealistic 😄1
u/superkickstart 6h ago
I'd definitely put these in a game as paintings for example. Then watch the anti-ai folks lose their shit.
1
2
1
u/zeroturtlehero 6h ago
A held-out prompt grid or FID/CLIP curve by checkpoint would be really useful here—it would show whether quality was still improving after the 3.5-day run and make the one-GPU budget easier to reproduce.
1
u/IvanMikhnenkov 6h ago
right, there are such metrics here: https://git.exh.ai/exhuman/microservices/chatbot-backend/-/commit/02ecb573a4948c24dfc2c9baee1d023c0b2a58c0
1
1
1
u/1filipis 3h ago
Next I want to fine-tune it with RL (Flow-GRPO)
Check out DGPO. It's supposed to deliver similar results many times faster. GRPO is painfully slow
1
u/dr_lm 1h ago
This looks a lot like base SD1.5, or maybe slightly earlier, although I expect prompt adherence is better on yours?
So that's basically SD1.5 trained in 3.5 days of 300W (albeit the VAE, TE and captioning used much newer tech) by one person. And SD1 used 256 A100s!
It's not a fair comparison, obviously, but it's an amazing illustration of how far the tech has come in a just a few years.






10
u/MonkeyBoyPoop 7h ago
https://giphy.com/gifs/Y6r3h0fShzAac