r/MachineLearning • u/cpldcpu • Aug 28 '26
Project I implemented a very tiny image generation model (latent flow transformer) on a RP2350 microcontroller - it can generate 128x128 images of faces [P]
Its a 2.4-4 million parameter model, quantized to int8, that can be fully executed on the microcontroller in ~20s with the longest generation. The generated image will then be displayed on a monitor or transferred via usb.
Its a latent flow transformer with 12 layers using AdaLN-Zero for conditioning. CFG is also supported and boosted the image quality a lot. The inference engine streams the weight via DMA from the flash while the previous layer is computed. Relu² activation was used to increase sparsity, which the engine can use to skip calculations.
Took a lot of ablations to get it right and I am quite astonished I got so far with so few parameters. Will post the repo below




41
u/cpldcpu Aug 28 '26
Repo is here: https://github.com/cpldcpu/pico-faces
15
u/CheapThaRipper Aug 28 '26
Very neat. Is there a why? "Because I wanted to" is a valid answer but I'm curious if you have a use case in mind for something like this
3
u/Necessary-Put-2245 Aug 28 '26
What did you use for creating the diagrams?
2
u/much_longer_username Aug 29 '26
Frankly, I'm impressed enough when people manage to do pretty much anything after giving up enough memory for a framebuffer on a hobby MCU, much less a notoriously memory hungry thing -- this is cool as hell.
7
u/No_Pop_4726 Aug 28 '26
very cool!!!
1
u/Bora_Horza_Kobuschul Aug 29 '26
Whaat, that is actually insane. Very cool. Are you planning to up the resolution at some point?
1
u/road_laya Aug 29 '26
Can this repair a lower resolution or noisy photo of a face?
8
u/abaybektursun Aug 28 '26
Great use of free will
1
u/No-Communication-765 Aug 29 '26
Watch face on a clock?
1
u/hurrdurrmeh Aug 29 '26
That is an immense result!
1
u/AWiselyName Aug 29 '26
interesting it can generate that quality image with this small model!
1
u/dsmack6 Aug 29 '26
Size of exported model
1
u/NoenD_i0 Sep 02 '26
Well I made my own rectified optimal transport flow matching model that I can train on a 2012 ivy bridge cpu
0
u/BountyMakesMeCough Aug 28 '26
Woaa
0
u/Evening_Rooster_6215 Aug 29 '26
sick
77
u/[deleted] Aug 28 '26
[removed] — view removed comment
0
u/[deleted] Aug 29 '26
[deleted] — view deleted comment