Hello World - Learning Mechanism’s

Published on 15 February 2025 at 14:35

"Did you ever stop to think and never start again?" A. A. Milne


This article is likely to be less heavy on visualisation and focus on writing and theory.

I set myself the slightly preposterous challenge of trying to simulate a brain on my computer. Then I got hold of some formulas for the Hodgkin and Huxley model first for the squid and then modified with a calcium ion for humans and I've kind of just gone with it and tried to build a useable piece of compute on my PC first in Python then in C++.

So the above quote for me is embletic of the need to try wierd things like this as even if this project is a total failure it is very interesting, I've learned a lot and I think it really is timely thing to think about what are the limitations of standard neural networks and the transformer architecture with a comparision with the original and still the best the brain.

I wanted to do this project to see what it could tell us about how AGI would develop.

 

A all too brief history of the ANN

 

A lot of what I put into my project ended up coming from the blue brain project which was a Swiss biophasic simulation of the mouse brain that finished in 2024. Similarly the brain of a house fly was mapped fully down to individual connections of a fruit fly. Links both in references.

I think this is often an over looked solution to the problem of Artificial General Inteligence (AGI) in that as time goes on the number of and level of detail of the brains we have mapped and simulated is only going to increase.

Therefore while it might sound outlandish for me to say I'm trying to simulate a brain I am definitely not the first and the initial Hodgkin and Huxley models where developed in the 1960s as a model of the differential equations involved in biological neurones.

Artificial Neural networks a prior branch to this with Frank Rosenblatt (1958) created the perceptron, an algorithm for pattern recognition. Several things stopped the effective development of ANNs at the time being that the first tests only arranged them in single layers and as we know now they benefit from layering and the back propagation algorithm the Modern backpropagation was first published by Seppo Linnainmaa as "reverse mode of automatic differentiation in 1970.

Its from this line of development that most AI developments come. The transformer architecture that underpins moder chat GPT still utilises back propagation but changes from the perceptron sigmoid activation function to a more simpler Relu, and softmax for the attention mechanism that was introduced in the 2017 paper "Attention is all you need". The architecture uses things like layer norms, and skip neurones but if your not aware of the processes of a ANN more resemble linear algebra than the processes of the brain.

The transformer an architecture behind GenAI like chat GPT has been presented as capable of AGI like qualities by some.

The transformer differs from the brain in a number of ways. It's neurones have no differential equations and from what was found in the 2018 paper on Neural Differential equations is that individual artificial neurones do not need substantial layering  if they are differential equations with the  learning taking place with the differential equations timing. This is likely similar to the brain that it is not a series of layered neurones like transformers and a lot of the brains capabilities likely lie in how powerful each individual neurone is and how they network.

These differential equations more resemble the behaviours of brain neurones though with biological neurones firmly being spike neurones which fire and spike then decay. It turns out gradient descent is either not good for this or at least insufficient because to be simple it mainly models for the connection weight and not the timing of a neurone firing in the network.

This is all to say if you look broadly and speak similarly broadly then there has been two directions of thought about AI; one driven to understanding the brain to greater granularity and simulation and the other to derive the best commercial use case of similar and inspired mathematics. The present blue brain project where a mouse brain was simulated and ended in 2024 shows you the type of breakthroughs that happen when people are paying attention to stable difussion and transformers.

 

Proposed models of how the brain learn


At a very high level a brain is very oriented to learning timings and does not increase the stregnth of its outputs or reduce them like a artificial neural network.

If we go to the brain on the other hand there are a variety of learning methods unique to it and with nothing similar in the transformer architecture. Learning is very different in the brain and it is hard to find how the chain rule and back propagation feature in the brain. 

For what I did in my project was to try and take each part of the way a human neurone learns and at least ensure some crude facsimile existed and then tested in a Watsh T hypothesis test between identically sized populations of AI and tried to pick the one which was better. I did this to have a crude facsimile of evolution but also did not have time to build a genetic algorithm to express all the possibilities which I think would have taken me too long.

Brains and ANNs differ substantially the biologists term learning in the brain as long term potentiation (LTP) and Long Term Depression for the strengthening and weakening of a connection between synapses. Modelling this is not just one learning system but several.

This is because really there is no back propagation of a exact "error" in the brain. Instead various neurotransmitters modulate and cause changes in brain structure as they diffuse in the network. These are all produced at different sites in the brain dedicated to these neurotransmitters and look like a point of central control within the brain.

This is startling as the brain therefore has both local learning on each neurone but centralised systems that manage how it learns across the whole network. Too complicated for me to try all of it but I would have a system for that.

I tried to copy this for my project and used something simple and called this reward diffusion and sort of took a middle ground of only having one reinforcement signal and propagated it similarly to backpropogation with a host of changes. Again broadly in brains when rewarded are not doing maths. 

When rewarded the synaptic connections between two neurones increase in stregnth. A reinforcement learning scoring system keeps track of AIs performance when it's doing something of its own accord that performs better than its average score it receives that reward and the synaptic connections grow very slightly; and if it does something and it's worse than its average score it's synaptic connections will lower till they dissolve and then become negative and actually impeded the other neurone firing.

This is one of the ways that the brain is deeply different to ANN in that largely there is no chain rule to simulate and emulate and some of the other things biologists have showed is that neurones in the brain factor into what fired before it and caused it's own firing which likely rules out back propagation as a option. Therefore modern ANN can't be doing anything simmilar to the brain in order to be regarded as AGI.

The fact that AI is intelligent at all seems unrelated in many ways to how the brain is intelligent (if in fact ANN are).

In my simulations: These reward criteria are representing reductions in error for the AI and therefore serve similar purposes to back propagation in neural networks; but I think the distinction is important that the AI doesn't learn in any sense a mathematical function like how a ANN works such that if it's 50% wrong it's not any worse or better than 10% wrong. All we are dealing with is reinforcing behaviour I like and reducing behaviour I don't.

I think this is likely the same for the mammalian brain and it's why I assert I can't find anything that says brains learn like ANN do but importantly brains focus on Spike Timing Dependent plasticity and it's that which makes me think they are radically different.

Learning in biological neurones shows Spike-Timing-Dependent Plasticity (STDP): STDP is often modeled using a mathematical function that describes how the change in synaptic strength depends on the relative timing of pre- and postsynaptic spikes. And to be reductive it's to say that biological neurones know and strengthen connections with the neurone that fired before them and not after them and therefore constantly strengthen the timing systems in the network.

In my experiments I found some small improvements by implementing rules that make the network only do a form of tree based back propagation along parts of the network both fired and fired before the current neurone. This also meant I only had to simulate a small section of the network.

Calcium Dynamics: Synaptic plasticity is often linked to intracellular calcium levels. The dynamics of calcium can be modeled using differential equations that describe calcium influx, buffering, and removal. I have some very basic attempts at implementing something inspired by this and seen some improvements. The main chemical contents of a neurone simulation in response to error. I have concerns this might "deflate a neurone" by too much calcium leaving but it's been ok so far.

This being said I don't think in my experiments I got even close to really understanding this fully. It does seem that the content of the neurone cell (especially calcium) really controls the spiking nature of the cell. The brain does this really well by neurotransmitters that modulate cells contents dynamically by opening and closing ion channels.

This modulation of ion channels seems to modulate the timing in the cell. I have done my best through some trial and error but if that's the key to AGI then it's going to be hard as neurones have a lot of these. It's in this area that the brain really is a marvel different cells respond differently to dopamine and some are rewarded by receiving it and become more excited and others do the opposite.

A problem here is that system of modulators are very much a evolved system. X does Y because it is evolved that way and building an AI that way requires huge ammount of trial and error and large sample sets to work out what worked and what did not. Currently regular ANN do neither.

Bienenstock-Cooper-Munro (BCM) Rule: This is another model of synaptic plasticity that incorporates a sliding threshold for synaptic modification. It does this by making the post firing output subject to a non linear function and then multiplying it during training by the voltage level in the neurone cell.

Again saw small improvements but I note this modification meant I really wasn't doing back propagation anymore. This was the point where I really realised if AI needs to be like the human brain to progress it's really going to be different.

Homeostatic Plasticity: To maintain stable network activity, homeostatic mechanisms are modeled using equations that adjust synaptic strengths or neuronal excitability based on average activity levels. This was very hard to research and really all I got came from the blue brain project; My research on this says that when calcium levels are too high neurones are stimulated to grow new connections and when it gets too low prune the neurones connected too that have too low calcium levels.

I think this one is really fun in that in the Neurones I built they will re-architecture the brain connecting to new neurones when calcium levels are too high and pruning them when too low. This also means they seek to self stabilise because the numbers can explode computationally (Biological neurones literally die) when calcium levels aren't controlled. I have not really spent to long really investigating how what I wrote functions and what new designs and patterns it builds except it worked at all.

Though I do not think the brain could completely re-architecture itself in this manner. It seems amazing to me that individual neurones seem completely able to require themselves but at the macro level there are clearly sub networks in set places.

Though it's kind of interesting to think in the future AI could do something simmilar. This was a key feature about easy adding and dissolving new connections for me so the AI was expressly designed to do this with little issues.

Finally in mammalian brains rewards that strengthen connections or weaken them are not generated at output sites but dedicated reward centres and so my neural network was modified to have dedicated neurones that serve this purpose and when the AI is doing good reinforcement is diffused through the network based on the connections of the reward centres and this strengthens connections between neurones and when getting worse . I don't want to go into the details but I was surprised this works at all but it kind of makes sense when you think a spiking neurone is not like a transformer trying to map inputs to outputs and probably cannot because when it spikes it in no way resembles something you can do maths with. I would suggest that spiking neurones are about timing and therefore a reward difussion rewarding or requiring that network might be the route to improvement.

 

What did I just build..

 

So I did all that after a lot of research into the differences between brains and neural networks and the activation is directly taken from human neurone differential equations.

it has a first draft of a neural plasticity algorithm meaning it's architecture gets rewritten as it learns. It's neurones will reorganise and that sounds really cool but I think that alone needs a lot of study because ANNs don't do that and I'm not remotely sure what I built was optimal.

During testing I connected output to speakers to make sure it was not just oscillating when trying to teach it and it wasn't and it sounded ordered enough and creepily sounded better with bigger networks. I might try and do a post on that at some point because it's fun.

Testing with does really big networks reduce error and I have a very small number of tests that confirm they do. Though the change is minute.

Looking at does repeat training reduce error so to encode sequential timings that could be explained as solely down to internal network processes (ie not input) and again very limited information that yes it does.

Finally I note if it's clearly wrong sometimes it can make surprising changes to its behaviour just around the point it's reward centres will kick in.

I say all the above with the reservation that I have not done enough testing. That each test type probably deserves it's own tests to confirm and blog post to discuss; and the increases are often small enough to conclude that in order to get really impressive results you'd need a lot of neurones (like maybe a human brains worth). That owing to the computational cost while promising transformers might give more buck for the computational cost.

The way reward centres works in the brain sort of suggest that they just fundamentally do not work the same. They just could never learn the same way we train transformers if AGI requires closer resemblance with brains a lot of what AI is will change and it will likely be a wholly different field of study to the one that exists today.

I haven't had it working that long either meaning I'm sure there's a lot to learn.

 

This is not the AGI you are looking for

 

And that is all well and good but sort of to come back to the important thing is it useful to try a higher granularity simulation of the brain like this.

Well it could really only work with one user at a time as it is more closer to a "thinking machine" all those neurones have their own data and hidden states. It could not work with lots of people like chat GPT over the whole internet.

Ram in and out of GPUs is a big bottleneck in GPU design all those hidden states mean it probably could not be ran on GPUs of TPUs. This would stop a lot of the AI acceleration working if a greater level of emulation of the human mind was needed for AGI.

Neural plasticity and having it constantly rewrite itself is also computationally expensive and would not work on GPUs as it would require the linear algebra to be continuously rewritten.

These two issues likely mean if you built a genuine AGI they'd be CPU bound, RAM heavy. You'd need probably a multi core data science PC to do one of these AGI and then would need to get over hurdle of replicating it across multiple users which would likely need multiple instances unless you figured away or architecting it for this.

Therefore in the current web the trabsforner is probably still going to be important even if someone created AFI.

A AI like this its timing neurones are computationally expensive they only spike about 7% of the time and following some Bayesian logic you'd need 64 times the number of them to be certain one would fire on a given stimulus. That might anecdotally mean that a AI built this way might have incredible timing and uses but might be 64th as effective as doing it as a traditional ANN.

it probably has use cases in reinforcement learning and it's reward centres probably make it ideal for this. Though that brings me onto another point you can see in this the mammalian neurone seems to encode timings and not clean mapped outputs and work on different principles. That's useful If they where to learn by reinforcement learning, self play and trial and error but we don't train AI by leaving them to make mistakes. You would therefore need a similarly interesting environment to learn by self play and trial and error like say reality. Building a human inspired AI of AGI level may require simulating the rest of reality with it just to have a suitably engaging environment to learn those things by self play.

The timing capabilities may make it useful for a small subset of tasks but it is interesting take away is just because you can build it does not mean it's useful. I found this really interesting as a side project huge education on the brain simply wonderful in that regard; but it's kind of ought to be a talking point the LinkedIn pundits on AGI or ASI it never really gets answered if you built a human level intelligence then what now?

That to me is the problem with the AI memes can broadly be split into two forms one is where scientist makes a super AI in their basement they are praised and the world marvels. It becomes super intelligent leading into the next meme. The other is skynet it rebels kills lots of people because it wasn't well treated by humans. Maybe the AI that are going to be important will be radically different than us precisely because by being different they will be useful in places we struggle with.

I note that in the section on a brief history on ANN we have been writing about differential equation based AI for some time and what seems to be most effective is the AI markedly different than us in design and function. So to a certain extent AI could have always gone the way of ever increasing simulation until we hit AGI but curiously no one does it that way.

Maybe we should be more optimistic and embrace more and different forms of AI than just the dream of AI that are exactly like us.

I genuinely think I'm going to run with these strange human derived simulated neuron's and their timing systems; I'm sure I will find a use for them somewhere but it's not going to be "AGI" when I do and even if they did manage that well there only (simulated) humans anyway...

 

References

 

On Neural Differential equations

https://arxiv.org/abs/2202.02435

Blue brain project

https://portal.bluebrain.epfl.ch

Fly brain mapped

https://www.nih.gov/news-events/nih-research-matters/complete-wiring-map-adult-fruit-fly-brain

History of artificial neural networks

https://en.m.wikipedia.org/wiki/History_of_artificial_neural_networks#:~:text=Farley%20and%20Wesley%20A.,an%20algorithm%20for%20pattern%20recognition

Attention is all you need

https://arxiv.org/abs/1706.03762

Add comment

Comments

There are no comments yet.

Create Your Own Website With Webador