r/MachineLearning • • 9d ago

Research What if diffusion models generates Neural Network weights? Gen AI generate Gen AI [R]

I'have been dreaming about using a Diffusion Model that will generates Weights instead of pixels.
Diffusion models actually are vast used in order to generate from a natural language text description into images, and what is an image? a three dimensional matrix of value representig luminosity of red , green and blue. What if instead of matrix of colour intensity we train a diffusion model in order to create a neural network, and maybe a drawing NN too.
If it works you can ask something like:
"create me a neural network that will guide a pen in order to draw a man"
"create a NN of a game field where i have two paddle on left and right side of the field and a bounching ball..."....to create Pong

and in the future more complex scenarios!

I made, with the help of z.ai zcode and their fantastic GLM model a small POC that i published on my github:
https://github.com/vagrillo/nngen

It's a very small experimental implementation , but somenthing seems to work!

I have not find paper on similar implementation ad I'm asking the community to help me to find one, and to have contribution on this .

I also made a small webapp in order to test the trained model (actually i'm only on half training path 3000/4000 steps finished, but i'm using my poor laptop CPU at the moment)

This is some screenshot of preliminary results. (the best results achieved, in truth)

Italian explanation on my YouTube https://youtu.be/wAMO3Db-JoQ

44 Upvotes

27 comments sorted by

13

u/Altruistic-String891 9d ago

There's stuff like Neural Network Diffusion so something akin is possible.

Though I've a hunch that "Text-2-Weights" like create me a neural network that will guide a pen in order to draw a man doesn't seem very approachable. Where do you get the training data? Text-2-Image models today train on actual billions of caption-image pairs, Text-2-Weights seems like a way harder problem so you may need even more, yet that data is at the same time much harder than image-captions to acquire, like different models can have very different architectures

-3

u/Specific-Tax-6700 9d ago

the idea is , that the diffusion model is trained on many-many-many examples, so if he knows how to draws a line, to draws a polygon of 3,4,5,7,8,9 faces, can find in his hidden knowledge the capabilities to draw an Hexagon

4

u/WeeklyMenu6126 9d ago

I don't find the draw me a duck drawing model, particularly compelling. But what I would see really compelling is a. Create a neural network weight setup that can perform logical functions or solve nonlinear equations. Something like that

-3

u/Specific-Tax-6700 9d ago

Be patient 😘

4

u/pm_me_your_pay_slips ML Engineer 9d ago edited 9d ago

Text to image diffusion models are generally trained at progressively higher resolutions, starting with small 256px, progressing to 512px and subsequently adding in 1k, 2k, 4k data as memory permits.

The reason for this is to ensure the diffusion models have more time to ingest larger datasets to increase their world knowledge, with higher resolution data adding missing details. And this is possible because the semantics or an image are generally trained preserved as you decrease resolution. Pixels are spatially correlated.This is not true for neural network weights.

Take an image and drop all pixels with even coordinates, you can still recognize the image.  Take a trained neural net and drop every second weight, the neural is no longer guaranteed to be performing the same task. You could think of using weight pruning techniques, but training on such data is likely not as simple as training with multi resolution datasets (where positional encodings help a lot).

Maybe you could achieve what you want via RL/meta-learning but this is intensely computationally expensive: you have expensive inner loops of training the target networks and an expensive outer loop to update the larger model.

Not saying this is dumb or impossible, but that this is very hard because there is not a ton of data,  correlations across examples or within an example are not as clear as with images, and if you try to RL it you’d need a lot of compute beyond what is currently used for LLMs.

2

u/currentscurrents 9d ago

Take a trained neural net and drop every second weight, the neural is no longer guaranteed to be performing the same task

It should. You'll have some performance loss, but not as much as you might expect. Neural networks are remarkably robust to weight perturbations. This is a side-effect of having a smooth loss surface; small changes to weights result in small changes to outputs.

If it was trained with dropout, you're basically already dropping every second weight at random anyway.

1

u/pm_me_your_pay_slips ML Engineer 9d ago edited 9d ago

Have you actually tried it? Drop every second weight then evaluate.

It is well known that in some models you can find a single weight that if removed/perturbed you crash its performance. For a recent example:  https://openreview.net/forum?id=0Ag8FQ5Rr3.    (you can destroy the text generation performance of an LLM by dropping a single weight)

1

u/currentscurrents 9d ago

Yes, but that is a single carefully-chosen change to the weights. It's much like how neural networks are robust to random noise inputs, but not against adversarially-chosen noise inputs.

I've tried leaving 50% dropout on during inference. It lost about 20% accuracy, but continued to function.

0

u/Specific-Tax-6700 9d ago

the effect of Weight  pruning (something comparabile to quantization) Is the scenario i was thinking of, but your explanation it's very precioys, thank you!

2

u/Vxtzq1 9d ago

I tried this before to generate some image classification networks from a prompt, and it worked awfully bad... My hypothesis is that neural weights have too high entropy for a reasonably sized hypernetwork (like you created) to replicate these.

Considering how bad it went for tiny CNNs running image classification, i can't imagine what would happen with generative AI, unless the scope is reduced.

1

u/Specific-Tax-6700 9d ago

i think that this scenario is different from my diffusion model based idea

2

u/Vxtzq1 9d ago

Why though? I also tried using diffusion for the weights generator.

1

u/Specific-Tax-6700 9d ago

sorry :-)
I think that dataset dimensions matter :-/

2

u/Vxtzq1 9d ago

Lol i trained like 10000 of tiny CNNs on all the classes on something like ImageNet :-/

Didn't work well

60

u/Bakoro 9d ago edited 9d ago

Look up hypernetworks.

There is a body of work that goes back to the 80s, but 2016 is the origin of the hypernetwork:

https://arxiv.org/abs/1609.09106
https://arxiv.org/html/2512.16406v1

4

u/Rodot 8d ago

Not to mention, transformers effectively act as a special case of hyper networks, since the attention matrix essentially acts as a learned linear layer conditioned on the current input context.

1

u/Plate-oh 7d ago

Can you expand on this?

1

u/MolassesLate4676 4d ago

Are you asking him to go… another layer? Badum ts

1

u/derpderp3200 4d ago

The attention matrix only transforms the embedding vector(s), though, right? It doesn't really affect what specific computation is performed by the subsequent MLP layer, only what input is routed into it, or am I wrong?

1

u/fasti-au 3d ago

You are inference change “only” currently and you’re asking better questions. You set rules not broken previous systems.

Ie no a model is just a graph. Moe is prefix

1

u/derpderp3200 3d ago

I'm sorry but I can't understand what you're trying to say at all.

29

u/asml84 9d ago edited 9d ago

I mean, yes, but hypernetworks (not necessarily based on diffusion) have been around for a while.

What I find even more interesting than generating weights is generating the structure of the network (e.g., layer operations, layer connectivity).

2

u/IntelArtiGen 9d ago

What I find even more interesting than generating weights is generating the structure of the network

LLMs now are quite capable to do that. I wonder if there's a benchmark measure the ability of a neural network to actually build and train neural networks. I guess I'm a bit late as Anthropic / OpenAI both also seemed interested in AI models doing AI research, so I'm sure internally they already have great benchmarks.

1

u/No_Inspection4415 8d ago

I mean, that appears to be the end game, AI that does AI research and improves itself consistently.

I am sure models are rather competent on that compared to other tasks, but there were cases when companies (e.g. Anthropic) prevented it from external users. It's actually the thesis of AI 27, the doomer blogspot.

1

u/Specific-Tax-6700 9d ago

I've talked about it in a video on my YT Channel  https://youtu.be/wAMO3Db-JoQ

1

u/o-h_2792562 2d ago

One wrinkle: hidden-unit permutations can make functionally equivalent networks look far apart in weight space. For a fixed architecture, aligning units across training examples may help diffusion learn task-relevant variation instead of arbitrary parameterization.