Generating Neural Network Weights with Diffusion Models: An Early Attempt at Using AI to Build AI

Developer attempts to directly generate neural network weights with diffusion models, releasing an open-source POC whose effectiveness is unverified.
A Reddit developer proposed a bold idea: replacing the diffusion model's output from a pixel matrix with a neural network weight matrix, and released an open-source proof-of-concept project called nngen using z.ai tools. The project is conditioned on natural language and attempts to generate small networks for tasks like drawing and Pong, with a web app for testing. However, training is only 3000/4000 steps complete on a laptop CPU, the showcased results are best samples, and the method's effectiveness remains unverified. The developer found no similar papers, and the lack of a comparable baseline is the main shortcoming. The article analyzes the two core challenges of high-dimensional strong coupling in weight space and the high cost of verification, and points out that ideas such as low-rank decomposition to reduce sensitivity may be the future breakthrough.
From Generating Pixels to Generating Weights
Diffusion models are now widely used for "text-to-image" generation—fundamentally, an image is just a three-dimensional matrix where each value represents the brightness of red, green, and blue. A developer on Reddit proposed a bold idea: what if we replaced the diffusion model's output from a pixel matrix with a neural network's weight matrix?
The subtext of this question is straightforward: if Gen AI can "denoise" a reasonable image from random noise, can it also "denoise" a usable neural network from noise? In the post, he wrote that he had always dreamed of using diffusion models to directly generate weights instead of pixels.

How the POC Works
This developer didn't stop at speculation. Using z.ai's zcode tool and GLM models, he published a small proof-of-concept project (POC) on GitHub called nngen. According to his description, it's "a very small experimental implementation, but it seems like something works."
The training objectives were designed to be specific, such as posing the following requirements to the model:
- "Give me a neural network that can guide a pen to draw a person"
- "Give me a neural network for a game field with a paddle on each side and a bouncing ball in the middle..."—in other words, generate a Pong game
In other words, users describe a task in natural language, and the diffusion model attempts to directly produce the network weights capable of completing that task.
The project also includes a small web app for testing the trained models. However, the developer admits that training is only halfway complete (3000/4000 steps) and was done on his laptop's CPU, so compute was quite limited. The screenshot he showed is "the best result achieved"—that qualifier itself suggests that most samples may not perform well.
Why This Direction Deserves Serious Attention
Drawing an analogy between "generating images" and "generating network weights" is not just wordplay. The two do share similarities in mathematical structure: an image is a three-dimensional tensor, and network weights are likewise a set of high-dimensional tensors; diffusion models learn the score function of a data distribution, and in theory any high-dimensional continuous distribution can be incorporated into this framework.
The real problem lies in dimensionality and constraints. A 512×512 image has roughly hundreds of thousands of parameters, while even a small policy network has tens of thousands to hundreds of thousands of weights, and these weights are strongly coupled—a tiny perturbation to any single weight can cause the entire network to fail. If a pixel in an image is wrong, it just "looks weird"; if a weight is wrong, "the function is completely broken." This means the diffusion model must maintain consistency in an extremely high-dimensional, extremely sensitive space, which is far more difficult than generating pixels.
Another practical obstacle is the cost of verification. Generating an image can be judged good or bad by the human eye in a second; generating a network requires actually deploying it, running the task, and calculating returns to know whether it works. This makes obtaining training signals expensive and sparse.
Score Function is the core mathematical object of diffusion models. Simply put, it points toward "the direction of fastest probability density growth" in the data space—that is, given a noisy sample, the model learns to predict how to adjust it slightly to get closer to the true data distribution. During training, the model is asked to estimate the score function at different noise levels; during sampling, it starts from pure noise and repeatedly denoises along the direction indicated by the score function, eventually landing back on the data manifold. Since the score function depends only on the data distribution itself, in theory any continuous high-dimensional distribution—whether image pixels or network weights—can be incorporated into this framework as long as it can be represented by enough samples. This is precisely the starting point that makes "generating weights" mathematically not absurd, but it also means the model needs a massive number of weight samples to learn a meaningful distribution.
Hypernetwork is important background for understanding "generating network weights." It refers to a class of neural networks specifically designed to output the weights of another network: input a task description or condition vector, and output the complete or partial parameters of the target network. Hypernetworks have been studied for years in meta-learning, continual learning, and multi-task learning, and their core advantage is the ability to dynamically generate adapted weights based on the task without training separately for each task. The difference from the diffusion model path is that hypernetworks are typically trained end-to-end through task loss, and the generation process is a deterministic forward computation; whereas diffusion models treat weight generation as sampling from a noise distribution, emphasizing diversity and distribution coverage. Combining the two—using a diffusion model as a hypernetwork—is precisely the potential positioning of experiments like nngen.
Low-Rank Decomposition is a common technique to mitigate the sensitivity of high-dimensional weight generation. A weight matrix can be approximately decomposed into the product of two low-rank matrices, thereby compressing the number of parameters that need to be generated from millions to tens of thousands. In the context of diffusion models generating weights, generating low-rank factors first rather than full weights is equivalent to restricting the search space to a smoother, less coupled submanifold, where the impact of arbitrary perturbations on network function is also more controllable. Parameter-efficient fine-tuning methods such as LoRA leverage exactly this idea. The mention at the end of the original article of "generating weights after low-rank decomposition first" points to this path, at the cost of sacrificing some expressive power in exchange for controllability and verification efficiency of the generation process.
Community Questions and Gaps
The developer explicitly states that he has not found any papers on similar implementations, and is therefore soliciting related research and contributions from the community. This is worth noting: using generative models to directly produce network weights is not an entirely new concept (for example, there is already research on hypernetworks and weight-generating networks), but the combination of "using a diffusion model as the main body, conditioned on natural language, and end-to-end generating executable weights" is indeed rarely seen in public work.
This also means the current POC lacks a comparable baseline. Halfway training at 3000/4000 steps, laptop CPU, and showing only the best results—these conditions combined make it difficult to judge whether the method itself is effective or whether it merely happened to produce some seemingly reasonable outputs on a few samples.
From a broader perspective, this experiment touches on an interesting question: Will Gen AI generating Gen AI become a path for automated model design? If diffusion models can synthesize small networks on demand, then perhaps in the future they could be used to batch-generate specialized small models, or even customize policy networks for specific tasks. But based on current evidence, this remains an open question rather than a validated conclusion.
Takeaways for Practitioners
For developers who want to follow this direction, this POC offers several points worth learning from: using natural language as the conditional input for network generation lowers the barrier to task description; choosing games like Pong with small state spaces and clear rules as the validation environment makes it easy to quickly judge whether the generated network is usable; and openly acknowledging the limitations of compute and training progress makes the interpretation of results more honest.
The real breakthrough may lie in reducing the sensitivity of the generation space—for example, generating weights after low-rank decomposition first, or generating the network's structural hyperparameters and then filling in weights with traditional methods, rather than generating all parameters at once. These ideas are not elaborated in the original post, but they are precisely the questions this direction needs to answer next.
One-line Summary
A developer attempts to directly generate neural network weights with diffusion models, releasing an open-source POC whose effectiveness remains unverified.
Paragraph Summary
A Reddit developer proposed a bold idea: replacing the diffusion model's output from a pixel matrix with a neural network weight matrix, and released an open-source proof-of-concept project called nngen using z.ai tools. The project is conditioned on natural language and attempts to generate small networks capable of tasks such as drawing and Pong, with a web app for testing. However, training is currently only 3000/4000 steps complete and used a laptop CPU, the showcased results are best samples, and the method's effectiveness has not been verified. The developer found no similar papers, and the lack of a comparable baseline is the main shortcoming. The article analyzes the two core challenges of high-dimensional strong coupling in weight space and the high cost of verification, and points out that ideas such as low-rank decomposition to reduce sensitivity may be the future breakthrough.
Related articles
Tech FrontiersEdge AI on Microcontrollers: When Is It Actually Worth Deploying?
Drawing on Reddit discussions and Arm case studies, this article analyzes the real-world use cases for edge AI on microcontrollers: when each device needs independent inference, when a gateway or cloud is more reasonable, and the costs and boundaries of specialized hardware.
Tech FrontiersPushing the Limits of Extreme Sudoku on a 16GB GPU: Insights from Depth and Flow Matching
A researcher trained a 16.54M-parameter model on a 16GB GPU to solve extreme Sudoku, finding effective depth breaks the 60% plateau and flow matching with improved sampling pushes accuracy past 99% with ~50× lower layer-evaluation budget.
Tech FrontiersAI Agent Approval Workflows: Why Human Confirmations Always Get Mindlessly Clicked
Why do AI agent approval workflows always get mindlessly clicked? A Reddit discussion shows that separating rules from keys, low-frequency high-risk approvals, and GitHub Environments-style gates are the keys to effective approvals.