r/neuralnetworks • • 33m ago

I made a library that combines your devices' memory to train or fine-tune large models (open source)

2 Upvotes

most machines cant train or fine-tune the bigger models on their own, but a few of them together usually have enough memory. it splits the model by layers across them and trains it like its one model.

works for LoRA, QLoRA, full fine-tuning and training from scratch, and your training code stays the same.

they connect over the internet, and if one drops out the others take over its layers and training goes on.

https://github.com/abdallah-swe/layerpool

feedback welcome


r/neuralnetworks • • 2h ago

I'm surprised a model is training at all

3 Upvotes

I made a ternary (BitNet b1.58-style), bidirectional masked-diffusion, byte-level RDT model, with 8-bit activations that drop to 4-bit for the last 10% of training, and somehow it's training.

It's ~109M params on 61B bytes (~560 bytes/param), currently at step 113,000 of 929,577 on free Kaggle T4s plus some Modal credit. Val loss (masked-diffusion, per byte) is ~1.37 and still slowly going down, and the ternary weights are stable. Samples are still mostly gibberish, but for how experimental this is, it's surprisingly healthy.


r/neuralnetworks • • 20h ago

I built a lossless text compressor that stores a small neural model inside each archive

27 Upvotes

I’ve been experimenting with using a neural model to compress text and packaged the result as Neuralzip.

The model learns from the input text and supplies byte probabilities to an arithmetic coder. The archive contains both the saved model and the encoded stream, allowing the decoder to recover every original byte.

On a five-book collection, one completed research model produced:

3,120,899 bytes → 791,134 bytes, including the model weights.

For comparison, gzip-9 produced 1,191,527 bytes on the same input, making the Neuralzip archive 33.6% smaller.

The interesting constraint is that a better model only helps if its prediction savings outweigh the bytes needed to store its weights.

There are clear limitations: training and decoding are slow, small files can grow, and stronger conventional compressors can still win. PPMd beat this checkpoint, and gzip beat the saved Alice checkpoint.

I’ve released a Python library and a browser demo where you can watch a saved model reconstruct text chunk by chunk.

GitHub · Demo

I’d like feedback on improving the balance between model size, prediction quality, and decoding cost.


r/neuralnetworks • • 1d ago

What about the parallelism transformer enable during training?

Post image
39 Upvotes

r/neuralnetworks • • 1d ago

Language Models Can Rewrite Their Own Weights

9 Upvotes

This paper tests whether a language model can improve itself by editing its weights, rather than relying on gradients or a separate training run. A 27B model can inspect its own activations and weights, run candidate edits through code, and keep an edit only when its own evaluation supports it. The best accepted edit gained 6.6 percentage points on 490 held-out math problems; edits were persistent, so they added no inference-time cost.

The repair experiment is especially unusual: after eight rows of a layer matrix were replaced with large random values, the model located the corrupted matrix and clipped outliers without access to the intact weights. A repair found using text-math tasks raised performance on six unseen image benchmarks, reaching 83% of the intact model’s accuracy.

The evidence is narrow: one model family, controlled corruption, and a small set of evaluations. Self-editing also failed at smaller scales, and some attempted edits were withdrawn or damaged performance. Still, it raises a concrete question for neural-network research: under what conditions can a model’s internal representations guide reliable weight updates without gradient-based training?

Full summary on AIModels.fyi

Original paper

Disclosure: AIModels.fyi is my site.


r/neuralnetworks • • 2d ago

I made a 5-minute explainer of a single artificial neuron for complete beginners (a party decision, no maths needed)

3 Upvotes

I'm making a short series that explains how AI works for people who aren't developers. The first episode builds one artificial neuron that decides whether to go to a party: inputs, weights, a bias, and a yes/no. Then three neurons decide whether to buy a phone, and at the end we look at how real neural networks differ.

https://youtu.be/Qe13Q_BV5_o

Every claim is sourced in the description. I'd love feedback, especially from anyone who teaches this: what was unclear, too slow, or too fast?


r/neuralnetworks • • 2d ago

PhiloLM: a 112M language model trained only on philosophy texts [P]

73 Upvotes

I trained PhiloLM, a 112M-parameter language model from scratch using only openly available philosophy texts.

The training corpus, PhiloText, contains 0.5B tokens from philosophy encyclopedias (SEP, IEP), public-domain books, reviews, textbooks, and educational resources.

The model was trained on 1.5B tokens in 15 hours on a single Intel Arc A770 (16 GB). The architecture uses grouped-query attention, sliding-window attention, bigram embeddings.

Model and technical details: https://huggingface.co/gustavecortal/PhiloLM

Try it in your browser!


r/neuralnetworks • • 2d ago

Vulnerability detecter using GNN

4 Upvotes

I’m currently working on a project in which we’re trying to build an end to end system for code security using graph neural networks, but i’m new to this neural network and don’t know it very well.
So, i wanna ask if there’s any who can guide me how to train a graph neural network well like the resources we need and how much data should be required and any other optimisations related, anyone?


r/neuralnetworks • • 3d ago

I built a Graph HyperNetwork that generates weights for unseen Vision, Text, and Time-Series architectures in one forward pass [P]

12 Upvotes

I've been working on a multimodal Graph HyperNetwork that predicts the weights of an unseen target neural network (WideResNet2D, MLPMixer, ResMLP, CNN1D, Transformer) for a completely unseen dataset in a single forward pass.

Results

  • Unseen Architectures on Trained Datasets: 81.22% mean zero-shot accuracy..
  • Unseen Datasets + Unseen Architectures: 71.57% mean zero-shot accuracy.

I would like to hear your opinion on it (positive and negative) and if you find a way to improve it or you have a question, just comment. And yes, i used ai for bug fixes, code improvements, plots, ...


r/neuralnetworks • • 4d ago

We built interactive graphs of models from recent papers, with tensor shapes from real runs

Thumbnail
tensorviz.dev
8 Upvotes

We've been working on tensorViz for a while. When we read a model paper, we often want to see what actually goes into a block and what comes out. So we built a Model Explorer where you can open a graph in your browser, expand a block, and follow the tensor shapes recorded during a forward pass.

Try Model Explorer: https://tensorviz.dev/explore/

If you want to graph your own PyTorch model, try the VS Code extension or the plugin for Claude Code, Codex, and Cursor.

GitHub and setup instructions : https://github.com/tensorviz-org/tensorviz

I'd love to hear which model on Hugging Face you'd want us to add next.


r/neuralnetworks • • 5d ago

Prompt Engineering and LLM-as-a-Judge (2026)

Thumbnail
youtube.com
0 Upvotes

r/neuralnetworks • • 7d ago

A Higher Target Leading to a Lower Fire

1 Upvotes

Is this a normal possibility? My ANN takes in 115 inputs, has 80 hidden nodes and 3 outputs.

The output fire rates are calculated normally, but when the "rules" override the calculation, it will zero the outputs out (and the inputs).

When two of the outputs are zeroed out, it appears that the fire rate after the backpropagation is lower than before the backprop. Is this normal in some cases?

Extra bit of context, there are 5 versions of the ANN running and when one output of one of the ANNs is selected, it backpropagates as normal for the one selected, but the other 4 back propagate by the delta of inputs compared to the one selected [if this is not the right way to do this, please tell me]. I guess the effects of the other four could negatively effect the selected ones new outputs.

Should i keep it as is, because it appears to be learning and selecting as appropriate. Its just the few times this scenario happens, i get concerned.


r/neuralnetworks • • 9d ago

Seeking collaborators on representation learning and generalization

2 Upvotes

I am a published ML researcher and engineer looking for collaborators on neural representation learning. My background includes neural models, privacy-focused ML, fine-tuning and GPU experiments, and I can contribute experiment design, implementation, baselines, analysis and writing.

One direction I would like to investigate is how learned versus structured representations behave under distribution shift: compare models with matched capacity and training data, then test robustness and representation ablations across datasets. I am also open to an existing agent or representation-learning research project.

I am looking for a team or lab that can fund GPU resources and LLM API benchmarking where needed. If this fits your work, please comment or message me with your research direction and available resources. I can share relevant work privately.


r/neuralnetworks • • 9d ago

Neuro-symbolic AI for ARC AGI 2

4 Upvotes

I have developed a neuro-symbolic AI applied to ARC AGI 2, based on Hodel’s DSL in Python: https://github.com/Julien-Livet/arc-dsl. The method is explained here: https://julien-livet.github.io/aicpp/. I am not an expert in neural networks, and I have not yet received any technical or scientific feedback on my work. Do you have any observations or insights you could share with me?


r/neuralnetworks • • 9d ago

Siamese Network

45 Upvotes

A Siamese Neural Network is a type of neural network designed to measure the similarity between two inputs. For example, suppose we provide two handwritten digits as inputs. The Siamese Network determines whether these two digits belong to the same class or are dissimilar.

It consists of two identical neural network branches that share the same weights and biases. Each branch takes one input and produces an output vector (embedding). These two output vectors can have any dimensionality, depending on the architecture of the network.

We then calculate the Euclidean distance between these two output vectors. If the distance is close to zero, the two inputs are considered similar. If the distance is sufficiently large (above a predefined threshold), they are considered dissimilar.

Note: A Siamese Network is fundamentally different from a traditional classification network. Its primary purpose is not to classify an input into a particular class but to learn a meaningful representation (embedding) that allows us to measure similarity between inputs.

Contrastive Loss

A Siamese Network commonly uses a loss function called Contrastive Loss, defined as:

L = Y × D² + (1 − Y) × max(0, m − D)²

Where:

D is the Euclidean distance between the two output vectors.

Y is the given label (either 0 or 1).

Y = 1 indicates that the two inputs are similar.

Y = 0 indicates that the two inputs are dissimilar.

m is the margin, which defines the minimum desired distance between dissimilar pairs.

L is the contrastive loss.

The objective is to minimize the distance between similar pairs and push dissimilar pairs at least m units apart.

We pass two inputs through the network, obtain two output embeddings, calculate their Euclidean distance, and then calculate the contrastive loss. Finally, we use backpropagation to update the network parameters and minimize the loss.

Notice that we do not use a Softmax activation function in the output layer because we are learning embeddings rather than class probabilities.

Training the Model

To train a Siamese Network effectively, we construct pairs of inputs:

Positive pairs: Two inputs belonging to the same class (Y = 1).

Negative pairs: Two inputs belonging to different classes (Y = 0).

A balanced dataset containing an equal number of positive and negative pairs is a useful starting point for training.

My Implementation: Neural Canvas (Model 5)

I developed an interactive Siamese Network as the fifth model in my Neural Canvas project. I used the MNIST handwritten digits dataset to train the network.

The architecture consists of three hidden layers, each containing 40 neurons, followed by an output layer containing 32 neurons. Therefore, each input is transformed into a 32-dimensional embedding.

I used Mini-Batch Gradient Descent with the Adam optimizer to train the model. The training process was relatively straightforward because JAX provides automatic differentiation (autograd), which handles the gradient calculations.

For training, I constructed two input matrices, Ma and Mb, each having dimensions of (784, 80000).

The rows represent features, while the columns represent individual samples. Why two matrices? Because a Siamese Network requires two inputs to learn the similarity between them.

I also constructed a label vector Y with dimensions of (1, 80000). Each element of Y indicates whether the corresponding pair is similar or dissimilar.

I used my own matrix multiplication convention:

Z = WX + bC

Where:

W represents the weight matrix.

X represents the input matrix.

b represents the bias vector.

C is a broadcasting matrix of ones.

I prefer this notation because it makes the mathematical operations and dimensions easier to understand.

I trained the model in Python using JAX and exported the learned parameters to JavaScript using JSON. For inference, I used Math.js, while p5.js handles the visualization, animation, and interactivity.

Try it yourself:

GitHub Repository: https://github.com/MuhammadEssa2002/neural_canvas

Live Demo: https://muhammadessa2002.github.io/neural_canvas/

This is the fifth model in my Neural Canvas project.


r/neuralnetworks • • 9d ago

[P] I trained a single Graph HyperNetwork that generates zero-shot weights for unseen ResNets, MLP-Mixers, MobileNets, and Transformers for Vision, Text, and Waveforms. (Open source)

18 Upvotes

Disclaimer: I used AI for bug fixes, to make the plots better and to simplify the code and make it more readable.

I built a Graph HyperNetwork (GHN) that has the computational graph of an target architecture and a dataset embedding as input and predicts all weights in a single forward pass. It is meant to serve as a head start to reduce number of steps required for training.

Zero-Shot Results:

ModelResMLPResNet2DMLP-MixerMobileNet2DMLPCNN1DTransformer
MNIST93.96%93.66%89.58%74.53%///
FashionMNIST83.99%75.88%78.59%////
KMNIST78.10%62.15%//62.15%//
Waveforms1D/////99.84%89.38%
20Newsgroups/////71.30%48.34%

My next objectives:

  1. Using a encoder to encode a random dataset and to replace the dataset embedding with it. So it can handle most unseen datasets.
  2. I want to scale it up, but I don't really have the recources for it (free kaggle for now).

I will paste my kaggle link in the comments.


r/neuralnetworks • • 10d ago

Does temperature 0 really mean deterministic? I made 100 calls to an LLM using the exact same prompt and temperature 0 but I got 33 different answers.

Thumbnail
youtu.be
29 Upvotes

So... isn't temperature 0 supposed to make llms deterministic?

Not quite. There's actually more going on under the hood than most people think, and temperature 0 doesn't necessarily guarantee identical outputs.

I made a video exploring why this happens and what's going on behind the scenes.

I thought it was a pretty interesting experiment, so I wanted to share it here. Curious to hear what you think!


r/neuralnetworks • • 10d ago

Tool-calling LLM Agents

Thumbnail
youtube.com
1 Upvotes

r/neuralnetworks • • 11d ago

Inside Gemma 3: it builds a map of the scene, then answers without looking at it

7 Upvotes

When Gemma 3 reads "A is 3 north of B, C is 2 east of A", you can read an accurate map of all positions from its activations. But deleting that map doesn't change its answers. They come from a tiny code on each sentence, and the model only half-uses the chain of sentences, so reading answers off its own unused map would actually be more accurate (80% vs 73%).

There's an interactive demo where you can edit the model's "map" yourself; link in the comments.


r/neuralnetworks • • 12d ago

5-4-3 Neural Network Example (Verify Please)

Post image
16 Upvotes

This example shows how weights and biases are updated across 10 iterations of subjecting it to the same scenario. The weight and calculation equations are at the bottom. The new outputs for each iteration is at the top-right. Can anyone verify my work? Im not confident on my bias back propagation equation.


r/neuralnetworks • • 13d ago

Implemented a full KAN network from scratch and tested against micrograd

4 Upvotes

I was always hyped about 'Neural Networks made from scratch' videos. Then, I came across the Zero to hero course by Andrej Karpathy, and saw him make the micrograd from scratch. So I thought of making a neural network like it but different. And I came across KAN; went through the research paper, and ngl it was amazing.

I named it mircrokan. I built the whole architecture from scratch in C++, implemented B-splines from scratch, and made the layers according to G and k values given and the starting number of params.

Did a comparison between microkan and micrograd on a simple function - y=3x^2+7x+2, and here are the result -

  microkan       learning_rate=0.01  loss=0.01226  test mse=0.01070  time=0.149s
  micrograd MLP  learning_rate=0.01  loss=0.06189  test mse=0.07265  time=1.642s

The loss is less than micrograd, and also it takes less time to compute (though the other one is made of python 🤷‍♂️)

Making a full KAN NN from scratch and testing it against micrograd was surely amazing for me. I would request all of you to visit the github and give it a star if you like it 🙏

https://github.com/spyke7/microkan

More technical details are shared in the github; I just wanted to share my findings and wanted to test KANs against MLP


r/neuralnetworks • • 13d ago

Introducing Usul - an easier way to express your NN using maths? [P]

10 Upvotes

SO, Usul-cpp is a library I've written in C++, it is based around allowing data scientists to create their models without heavy libraries such as tensorflow, and just express their models using maths, and Usul will handle the rest. There is builtin tensor support, auto-grad, back-prop and its quite fast.

I wrote it because, it seemed less mystifying to read maths instead of a random class that supposedly does something. I wrote it from scratch in cpp (23) due to the fact that I wanted to emphasise on precision, however it's subtly built on top of `xtensor`.

check it out in action

#include <usul.hpp>
using namespace std;


int main() {
  double LR = 0.1;
  int EPOCH = 5000;
  // lets write the forward pass
  Tensor X = {
      {0.0, 0.0}, // this is what we're feeding it
      {0.0, 1.0},
      {1.0, 0.0},
      {1.0, 1.0},
  };

  // this is what we're after
  Tensor Y_true = {
      0.0, // xor{0.0, 0.0} = 0.0
      1.0, // xor{0.0, 1.0} = 1.0
      1.0, // xor{1.0, 0.0} = 1.0
      0.0  // xor{1.0, 1.0} = 0.0
  };

  Y_true.reshape({4, 1});

  // we are now going to create a single layer, double neuron network
  // each layer will have a bias and weights tensor.
  auto W1 = generate_random_matrix({2, 4}, -1.0, 1.0);
  auto B1 = generate_random_matrix({1, 4}, -1.0, 1.0);
  auto W2 = generate_random_matrix({4, 1}, -1.0, 1.0);
  auto B2 = generate_random_matrix({1, 1}, -1.0, 1.0);

  // this is the training loop
  for (int i = 0; i < EPOCH; i++) {
    // so lets do one forward pass
    // first layer
    auto Z1 = X % W1 + B1;
    auto A = Z1.ReLU();
    // second layer
    auto Z2 = A % W2 + B2;

    // activation
    // should be - auto S = Z2.activate(Activate::Sigmoid);
    auto S = Z2.Sigmoid();
    // Loss
    // should be - auto Loss = S.loss(Loss::MSE);

    auto loss = (S - Y_true) * (S - Y_true);
    loss = loss.mean();

    cout << "Loss: " << loss << "\n";
    cout << "guesses: " << "\n"
         << S << "\n";
    cout << "should be: " << Y_true << "\n";

    loss.backwards();

    W1.step(LR);
    B1.step(LR);
    W2.step(LR);
    B2.step(LR);
  }
}

which will output

Guesses: 
Tensor({{ 0.027546},
 { 0.963592},
 { 0.964138},
 { 0.038964}}, shape=(4,1))

should be: Tensor({{ 0.},
 { 1.},
 { 1.},
 { 0.}}, shape=(4,1))

Loss: Tensor( 0.001222, shape=())

Just write the maths, and Usul-cpp will handle the rest, it is extremely lightweight, and the entire library is memory safe. And its called Usul, because I'm a huge dune fan.

You can view the project at

https://github.com/crushr3sist/Usul-cpp

Any ideas for what to do next are all welcome, you can also pull and implement features that you think could improve this project. (no vibecoded prs please, this project is not vibe-coded)

BACKGROUND INFO BELOW

i'd like to share a bit of a background. maths has always stood in the way between me and finally learning how to write neural networks, I've always been fascinated by them ever since i saw that diagram of a deep neural network with all the node edges interconnecting with others.

Well I stopped letting highschool math class trauma stop me from understanding these concepts, i took a pen and paper out, taught myself numerical descent, analytical descent, backwards propagation, what a compute graph is, all of these subjects, taught myself, until I was manually backwards propagating the loss between a few arithmetics, until that moved into scalar level neural networks and doing simple calculus and being able to do xor gate problem with scalar, and then I taught myself matrix calculus, and well...

I taught myself neural networks, taught myself the maths, until I hand written the xor gate problem in matrix syntax using xtensor, and manually, by hand, no AI, did the xor gate problem manually backwards propagating error, automatically differentiating. This was also a kind of detox from LLM dependency, I don't tend to use it for code, but because its so central in my daily life and a migration from google to gemini, using LLMs for immediate information access had started to affect my mind and my ability to intake information. I really hope some of you find this library useful, as i did spend a pretty decent amount of time on it, and I would love it if any of you had any ideas on what to do next with this library.

Thank you for reading, I really appreciate it.


r/neuralnetworks • • 14d ago

Need partner

Post image
138 Upvotes

Hi,I read this book these days

I really wanna some one who read it as well ,to share some idea or even help each other I'm at regularization chapter

So,if you are interested pls DM

And thanks 😊


r/neuralnetworks • • 16d ago

Using Logic to Improve LLM Performance

Thumbnail
youtube.com
6 Upvotes

r/neuralnetworks • • 17d ago

Feasibility of mamba and LNN for higher fidelity audio generation?

3 Upvotes

So With the audio generators like you see with suno, you get regressive drift after 2 minutes always mathematically. One little slip up and it's a snowball effect and before you know it by the end of whatever it generates it sounds all airy and fuzzy and crappy.

Now like at the beginning of this year I had wrote an article about using Mamba and liquid neural networks, but at the time what I was looking at for its use case was a little different than completely generating audio,

It was more so Mamba for long-term and the liquid neural for short-term recall.

Is anyone here more familiar with Mamba? Is the concept of running Mamba with a fast LNN for audio synthesis possible?