Mokabyte

Dal 1996, architetture, metodologie, sviluppo software

  • Argomenti
    • Programmazione & Linguaggi
      • Java
      • DataBase & elaborazione dei dati
      • Frameworks & Tools
      • Processi di sviluppo
    • Architetture dei sistemi
      • Sicurezza informatica
      • DevOps
    • Project Management
      • Organizzazione aziendale
      • HR
      • Soft skills
    • Lean/Agile
      • Scrum
      • Teoria della complessità
      • Apprendimento & Serious Gaming
    • Internet & Digital
      • Cultura & Società
      • Conferenze & Reportage
      • Marketing & eCommerce
    • Hardware & Tecnologia
      • Intelligenza artificiale
      • UX design & Grafica
  • Ultimo numero
  • Archivio
    • Archivio dal 2006 ad oggi
    • Il primo sito web – 1996-2005
  • Chi siamo
  • Ventennale
  • Libri
  • Contatti
  • Argomenti
    • Programmazione & Linguaggi
      • Java
      • DataBase & elaborazione dei dati
      • Frameworks & Tools
      • Processi di sviluppo
    • Architetture dei sistemi
      • Sicurezza informatica
      • DevOps
    • Project Management
      • Organizzazione aziendale
      • HR
      • Soft skills
    • Lean/Agile
      • Scrum
      • Teoria della complessità
      • Apprendimento & Serious Gaming
    • Internet & Digital
      • Cultura & Società
      • Conferenze & Reportage
      • Marketing & eCommerce
    • Hardware & Tecnologia
      • Intelligenza artificiale
      • UX design & Grafica
  • Ultimo numero
  • Archivio
    • Archivio dal 2006 ad oggi
    • Il primo sito web – 1996-2005
  • Chi siamo
  • Ventennale
  • Libri
  • Contatti

Nel numero:

nonumber
, anno 2025

LLMs models: how do they work?

Part 2: BNN vs ANN, an OO View

Luca Vetti Tagliati
Luca Vetti Tagliati

Luca è un professionista esperto che ha ricoperto ruoli di alto profilo a Londra, New York e in Svizzera per banche di primo livello, tra cui UBS, Credit Suisse, Goldman Sachs, Lehman Brothers, Deutsche Bank e HSBC.

È pienamente qualificato per lavorare come Enterprise Architect, CTO e Technical Program Manager riuscendo a gestire i progetti con un'ottica multiruolo. La profonda comprensione della tecnologia, combinata con mirate strategie di gestione, ha permesso a Luca di gestire brillantemente programmi complessi con tempistiche aggressive.

La sua strategia di pensiero è un mix di visione e pragmatismo. Il suo background accademico, che include un dottorato di ricerca, è solidamente integrato da una vasta esperienza pratica, avendo completato tutti i suoi percorsi universitari mentre lavorava a tempo pieno nell'industria.

Negli ultimi anni, Luca ha riscoperto la sua passione per l'intelligenza artificiale, grazie alla sua posizione di Global Head for AI for Data Analytics and Innovations.

È anche autore di numerose pubblicazioni, tra cui

  • UML e l’ingegneria del software: dalla teoria alla pratica (2004)
  • Java Best Practices (2008)
  • Verso Java SE 8: Note per lo sviluppatore in Java 7 (2013)

Luca ha anche pubblicato numerosi articoli sull'IA e altri argomenti disponibili in riviste IT e sul web.

 

Artificial Intellgence, Large Language Models

LLMs models: how do they work?

Part 2: BNN vs ANN, an OO View

Immagine di Luca Vetti Tagliati

Luca Vetti Tagliati

  • Questo articolo parla di: Intelligenza artificiale, Internet & Digital

Introduction

This paper is part of the series of articles dedicated to explaining the functioning of LLM models. Specifically, it focuses on the use of Object-Oriented modeling to present and subsequently compare Biological Neural Networks (BNNs) and Artificial Neural Networks (ANNs). The goal is to provide readers with formal models to represent these domains using the Unified Modeling Language (UML), particularly the Class Diagram notation. The models will be presented without applying traditional software optimization steps, to more accurately reflect these structures as they exist in reality. Within the context of traditional software development, they may be considered business models.

Biological (BNN) and Artificial (ANN) Neural Networks: several differences

From the analysis of these two domains, we can immediately observe how they differ, despite their underlying concepts being similar. To fully understand this paper, it is essential to have a grasp of the Object-Oriented paradigm and class diagram notation, although diagrams are also explained in plain English. As the saying goes, each of the presented diagrams is worth a thousand words, and the standard UML language, especially class diagram notation, is a well-established language that can be learned through extensive literature.

Finally, this paper can be regarded as a kind of appendix; understanding it is not necessary for comprehending the model and subsequent papers.

 

Biological Neural Networks (BNN)

A BNN consists of several synapses (see Figure 1, top left corner), with each synapse (represented by the Synapse class) serving as a junction between two or more neurons. Neurons are specialized types of cells; in fact, the Neuron class inherits from the Cell class. In OO terms, neurons are not just a role played by normal cells; they represent a true specialization of the Cell class. This design arises because, in addition to sharing the fundamental structure and behavior of a cell, neurons have specific structures such as dendrites (see composition with the Dendrite class) and axons (see composition with the Axon class), and perform specialized tasks such as receiving and transmitting signals.

Figure 1 – A UML class diagram showing a Biological Neural Network (BNN).
Figure 1 – A UML class diagram showing a Biological Neural Network (BNN).

 

The Neuron is an abstract class (abstract elements are highlighted in UML using italics for the name) and includes three specialized subclasses: SensoryNeuron, Interneuron, and MotorNeuron.

Sensory Neurons

Instances of SensoryNeuron receive information commonly referred to as stimuli. These stimuli can be various types of physical or chemical changes in the environment that sensory neurons detect, including:

  • Environmental stimuli: such as light, sound, heat, pressure, and chemical substances, which are detected by sensory receptors
  • Internal stimuli: information about the body’s internal state, including changes in temperature, pH, and the presence of certain metabolites, which are detected by internal receptors

 

Therefore, the Stimuli class is abstract and should be further specialized. This part was not added to the model to avoid cluttering it.

These stimuli are converted into neural signals by sensory receptors, enabling sensory neurons to transmit the information to the central nervous system (CNS) for interpretation.

Interneurons

Interneurons connect neurons with one another and are only found in the CNS; they primarily retransmit information.

The model does not precisely represent the real situation. In fact, the class Interneuron is associated with the parent class Neuron through two relationships: sources and destinations. This could lead to incorrect configurations of the model. For example, a MotorNeuron could be a source of an Interneuron, or vice versa, a SensoryNeuron could be a destination neuron. The current model encompasses a broader, and incorrect, semantic scope than the actual domain. To correct this, the following two constraints should be added:

  • sources can only be of type #SensoryNeuron or #Interneuron
  • destinations can only be of type #SensoryNeuron or #MotorNeuron

Motor neurons

From a nervous system perspective, muscles, organs, and glands can be collectively referred to as effectors. Effectors are body components that execute commands sent by motor neurons, resulting in responses such as movement, secretion, or changes in organ function. In this context, the Effector class is also abstract and should be further specialized. This has not been implemented in the current model to prevent clutter.

Regarding behaviour, the functions performed by the various methods should be sufficiently clear from the diagram and the explanations provided so far. It may be helpful to elaborate on the evaluateThreshold() method of the abstract Neuron class, which checks whether all incoming signals meet or exceed a predefined threshold to determine if the neuron should fire an action potential.

The reasons of a model

Finally, it is important to consider how methods are allocated among the different neuron classes. For example, only sensory neurons can receive stimuli, while only motor neurons can trigger actions, and so on.

This paragraph demonstrates a real-world or complex system in a formal way using UML notation, showcasing the elegance and power of object-oriented models. Moreover, being formal and based on rigorous semantics, it can be easily understood by a broad audience without additional explanation, further proving that a diagram like this holds the value of thousands of unambiguous words in natural language—especially considering that natural language is inherently ambiguous.

 

Artificial Neural Networks (ANN)

The primary objective of this model is to explain ANNs and their key components. Therefore, modelling solutions have been made to enhance clarity and intuitiveness at the expense of implementation details. As a consequence, the model is not ready for direct implementation; it would require refinement driven by optimization of calculations. As mentioned in the Introduction, this model needs to be viewed as a Business Model.

The model is organized into two packages (see Figure 2), which reflect two key perspectives:

  • the Model view
  • the Artificial Neural Network view

The former depends on the latter.

Figure 2 –  Conceptual Object-Oriented Model of the ANN.
Figure 2 –  Conceptual Object-Oriented Model of the ANN.

Model

The Model (top part of the diagram) comprises three Layer instances:

  1. one Input layer
  2. one Output layer
  3. one Hidden layer

There can only be one instance of the Input layer and one instance of the Output layer. However, the Hidden layer differs, as typically, each model includes several Hidden layers. All layers inherit from the same parent class, Layer, which manages the composition with the class NeuronNode.

This aspect of the model could have been elegantly represented using a Composite Pattern (see [Gamma et al., 1995]); however, this approach would have obscured the semantic meaning of the model and would have increased its complexity. Therefore, it has not been used.

Each layer has a name and an ID (see layer). For example: name = “Output”, ID = “O1”; name = “Internal 1”, ID = “I1”; name = “Internal 2”, ID = “I2”, etc.

Artificial Neural Networks (ANN)

In the second package, the independent one, depicted in the lower part of the diagram, the root is ArtificialNeuralNetwork. Its instance owns all nodes and includes direct links to input nodes. Although this is somewhat redundant (as it can be derived by analysing all owned nodes), it clarifies and simplifies navigation. Each NeuronNode has a bias (which belongs to the Neuron, see getBiasValue()) and is associated with an Activation Function. Weights are attributes that belong to connections between neurons. This “synapse” is modelled by the Connection class, which links a source node to a destination node.

In this case as well, the model is not strict enough. In fact, the Connection class would permit all sorts of communications between neuron nodes across different layers, which is incorrect. Therefore, the model should include constraints to limit the types of allowed connections—for example, for each node belonging to the Input layer must:

  1. Never serve as the «destination» in any Connection
  2. Only act as the «source» of a Connection with a node belonging to the Hidden layer

And so on.

Further details

Each neuron has an Activation Function, and multiple functions can be configured.

This part of the diagram has been modeled following the Command pattern (see [Gamma et al., 1995]).

Finally, each NeuronNode instance can evaluate its input set (which involves multiplying each input value by the corresponding weight and then adding the bias). It can invoke the execution of the configured ActivationFunction, and the result will determine whether the node should send its output or not.

Moreover, this diagram aims to formally yet simply represent and describe the complex world of ANNs. By reading this diagram, people should be able to grasp the full structure without having to read lengthy pages of a textbook. This is yet another proof that OO modelling is a truly powerful tool.

 

Conclusions

In this paper, we investigated the domain of Biological Neural Networks (BNNs) and Artificial Neural Networks (ANNs) from an Object-Oriented (OO) perspective, leveraging the class diagram part of the UML notation. The core concept of the two models is the same: the neuron. However, the surrounding structure is significantly different. This highlights, once again, that although ANNs have been designed by drawing inspiration from BNNs, their design fundamentally differs. At least for the time being.

Nevertheless, what Large Language Models (LLMs) can achieve is impressive, and each day seems to mark another step forward in the evolution of artificial intelligence. The capabilities of LLMs continue to expand, demonstrating remarkable advancements in understanding and generating human-like contents, which underscores the rapid progress in the field of AI.

 

 

References

[McCulloch, Pitts, 1943]   McCulloch, W.S., Pitts, W. “A logical calculus of the ideas immanent in nervous activity”. Bulletin of Mathematical Biophysics 5, 115–133 (1943).
https://doi.org/10.1007/BF02478259

 

[Rosenblatt, 1958]   Frank Rosenblatt, “The perceptron: A probabilistic model for information storage and organization in the brain”
https://psycnet.apa.org/record/1959-09865-001

 

[Gamma et al., 1995]   E. Gamma, R. Helm, R. Johnson, and J. Vlissides, Design Patterns : Elements of Reusable Object-Oriented Software. Reading, Mass. :Addison-Wesley, 1995.

 

[Rumelhart, et al. 1986]   David E. Rumelhart, Geoffrey E. Hinton & Ronald J. Williams, “Learning representations by back-propagating errors”. Nature 323, 533–536 (1986).
https://doi.org/10.1038/323533a0

 

[Hochreiter et al., 1997]   Sepp Hochreiter, Jürgen Schmidhuber; Long Short-Term Memory. Neural Comput 1997; 9 (8): 1735–1780.
doi: https://doi.org/10.1162/neco.1997.9.8.1735

 

[LeCun et al., 1998]   LeCun, Y., Bottou, L., Bengio, Y., & Haffner, P. (1998). “Gradient-Based Learning Applied to Document Recognition.” Proceedings of the IEEE
https://ieeexplore.ieee.org/document/726791

 

[Nicholls et al., 2001]   Principles of signaling and organization. In From neuron to brain. Sunderland, MA: Sinauer Associates.

 

[Reece et al., 2011]   Neuron structure and organization reflect function in information transfer. Campbell biology. San Francisco, CA: Pearson.

 

[Hanani, M., 2005]   “Satellite glial cells in sensory ganglia: From form to function”. Brain Research Reviews, 48, 457-476.
https://www.sciencedirect.com/science/article/abs/pii/S0165017304001274

 

[Khan Academy, 2012]   The neuron and nervous system. Overview of neuron structure and function. Introduction to neurons and glia. How the structure of a neuron allows it to receive and transmit information.
https://www.khanacademy.org/science/biology/human-biology/neuron-nervous-system/a/overview-of-neuron-structure-and-function

 

[Goodfellow et al. 2014]   Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville and Yoshua Bengio (2014). “Generative Adversarial Networks.”
https://arxiv.org/abs/1406.2661

 

[LeCun et al., 2015]   Yann LeCun, Yoshua Bengio & Geoffrey Hinton. (2015). “Deep Learning.” Nature.
https://www.nature.com/articles/nature14539

 

[Solomon, 2016]   Sensory receptors. In Introduction to human anatomy and physiology. Maryland Heights, MO: Saunders.

 

[Rye et al, 2016]   Connie Rye, Robert Wise, Vladimir Jurukovski, Jean DeSaix, Jung Choi, Yael Avissar, Biology, OpenStax, 2016
https://openstax.org/books/biology/pages/1-introduction
https://openstax.org/books/biology/pages/35-1-neurons-and-glial-cells#fig-ch35_01_04

 

[Byrne, 2016]   “Introduction to Neurons and Neuronal Networks”.  Neuroscience.
https://nba.uth.tmc.edu/neuroscience/s1/introduction.html.

 

[Vaswani et al., 2017]   Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin, 2017, “Attention is All You Need.” Advances in Neural Information Processing Systems (NeurIPS)”
https://arxiv.org/abs/1706.03762

 

[Drug Target R., 2019]   Scientists discover unique imaging technique to view synapse proteins, Drug Target Review, 27 September 2019
https://www.drugtargetreview.com/news/50185/scientists-discover-unique-imaging-technique-to-view-synapse-proteins/

 

 

Facebook
Twitter
LinkedIn
Luca Vetti Tagliati
Luca Vetti Tagliati

Luca è un professionista esperto che ha ricoperto ruoli di alto profilo a Londra, New York e in Svizzera per banche di primo livello, tra cui UBS, Credit Suisse, Goldman Sachs, Lehman Brothers, Deutsche Bank e HSBC.

È pienamente qualificato per lavorare come Enterprise Architect, CTO e Technical Program Manager riuscendo a gestire i progetti con un'ottica multiruolo. La profonda comprensione della tecnologia, combinata con mirate strategie di gestione, ha permesso a Luca di gestire brillantemente programmi complessi con tempistiche aggressive.

La sua strategia di pensiero è un mix di visione e pragmatismo. Il suo background accademico, che include un dottorato di ricerca, è solidamente integrato da una vasta esperienza pratica, avendo completato tutti i suoi percorsi universitari mentre lavorava a tempo pieno nell'industria.

Negli ultimi anni, Luca ha riscoperto la sua passione per l'intelligenza artificiale, grazie alla sua posizione di Global Head for AI for Data Analytics and Innovations.

È anche autore di numerose pubblicazioni, tra cui

  • UML e l’ingegneria del software: dalla teoria alla pratica (2004)
  • Java Best Practices (2008)
  • Verso Java SE 8: Note per lo sviluppatore in Java 7 (2013)

Luca ha anche pubblicato numerosi articoli sull'IA e altri argomenti disponibili in riviste IT e sul web.

 

Immagine di Luca Vetti Tagliati

Luca Vetti Tagliati

Luca è un professionista esperto che ha ricoperto ruoli di alto profilo a Londra, New York e in Svizzera per banche di primo livello, tra cui UBS, Credit Suisse, Goldman Sachs, Lehman Brothers, Deutsche Bank e HSBC. È pienamente qualificato per lavorare come Enterprise Architect, CTO e Technical Program Manager riuscendo a gestire i progetti con un'ottica multiruolo. La profonda comprensione della tecnologia, combinata con mirate strategie di gestione, ha permesso a Luca di gestire brillantemente programmi complessi con tempistiche aggressive. La sua strategia di pensiero è un mix di visione e pragmatismo. Il suo background accademico, che include un dottorato di ricerca, è solidamente integrato da una vasta esperienza pratica, avendo completato tutti i suoi percorsi universitari mentre lavorava a tempo pieno nell'industria. Negli ultimi anni, Luca ha riscoperto la sua passione per l'intelligenza artificiale, grazie alla sua posizione di Global Head for AI for Data Analytics and Innovations. È anche autore di numerose pubblicazioni, tra cui
  • UML e l’ingegneria del software: dalla teoria alla pratica (2004)
  • Java Best Practices (2008)
  • Verso Java SE 8: Note per lo sviluppatore in Java 7 (2013)
Luca ha anche pubblicato numerosi articoli sull'IA e altri argomenti disponibili in riviste IT e sul web.  
Tutti gli articoli
Nello stesso numero
Loading...

I meetup di MokaByte: L’AI riscrive le regole dello sviluppo prodotto

LLMs models: how do they work?

Part 1: Artificial Neural Networks

Containers and other new technologies in IT Operations

An Overview

Cookie Policy

Nella stessa serie
Loading...

Modelli LLM: Come funzionano?

II parte: BNN e ANN, una visione OO

Modelli LLM: Come funzionano?

I parte: ANN (Artificial Neural Network), reti neurali artificiali

LLMs models: how do they work?

Part 1: Artificial Neural Networks

Mokabyte

MokaByte è una rivista online nata nel 1996, dedicata alla comunità degli sviluppatori java.
La rivista tratta di vari argomenti, tra cui architetture enterprise e integrazione, metodologie di sviluppo lean/agile e aspetti sociali e culturali del web.

Imola Informatica

MokaByte è un marchio registrato da:
Imola Informatica S.P.A.
Via Selice 66/a 40026 Imola (BO)
C.F. e Iscriz. Registro imprese BO 03351570373
P.I. 00614381200
Cap. Soc. euro 100.000,00 i.v.

Privacy | Cookie Policy

Contatti

Contattaci tramite la nostra pagina contatti, oppure scrivendo a redazione@mokabyte.it

Seguici sui social

Facebook Linkedin Rss
Imola Informatica
Mokabyte