Skip to content

Pillar 03 · Applied Technology

Dictionary

Neural Networks

12 min read
Download article as Markdown (.md) Verify version and integrity

TL;DR

Neural networks are computing systems inspired by neurons in the brain that learn patterns from data and power modern AI, from image recognition to ChatGPT. Here I go from the perceptron and activation functions to feed forward, recurrent, convolutional (CNN), GAN, and Transformer architectures behind LLMs.

Neural Networks

Introduction to Neural Networks

Neural networks are computing systems inspired by the structure and functioning of the human brain.

I explore the opposite direction, copying a real human brain onto a computer, in digital immortality (in Portuguese).

These systems are designed to simulate how biological neurons process information, enabling machines to “learn” from data and improve their performance on specific tasks over time.

This learning process is the foundation of modern artificial intelligence (AI), particularly in areas such as image recognition, natural language processing, and medical diagnostics.

Still do not know what Artificial Intelligence is? Click here.

The idea behind neural networks is not new; it dates back to the 1940s, when researchers like Warren McCulloch and Walter Pitts proposed a mathematical model for artificial neurons.

However, it was only in recent decades that major breakthroughs in computing power and training techniques made neural networks practical and widely adopted.

Neural networks play a fundamental role in AI because they can identify complex patterns across massive datasets, something traditional programming rules simply cannot do.

That capability allows neural networks to power a broad range of applications, from building algorithms that predict diseases to developing autonomous vehicles.

Fundamentals of Neural Networks

Basic Structure

Neural networks are built from units called neurons, or nodes, arranged in layers.

The main layers include the input layer, where initial data enters the network; one or more hidden layers, where intermediate processing takes place; and the output layer, where the final decision or prediction is generated.

Nodes and Units: Each neuron in a neural network receives inputs, performs a mathematical operation on them, and passes the result to the next neuron in the network. These nodes are the basic building blocks that process information.

Links and Weights: The connections between neurons are called links, and each link carries an associated weight. Weights determine the importance of the incoming signal. During network training, these weights are adjusted to minimize output error, allowing the network to learn.

Activation Functions

Activation functions are critical components in neural networks because they decide whether a neuron should fire based on the weighted sum of inputs it receives.

Concept of f(x): The activation function takes the weighted sum of inputs and transforms it into an output that can feed the next neuron or serve as the network’s final output.

Basically, it introduces non-linearity into the model, enabling the network to learn and represent complex relationships in the data.

Common types of activation functions

Sigmoid: Transforms the input into a value between 0 and 1, widely used in binary classification problems.

ReLU (Rectified Linear Unit): Outputs zero for negative values and keeps the original value for positive inputs, making it very popular in deep networks due to its simplicity and efficiency.

Tanh: A scaled version of the sigmoid function that maps inputs to values between -1 and 1, frequently used in recurrent neural networks.

These fundamentals form the basis of how neural networks operate, allowing these computing structures to mimic, to some degree, how information is processed in the human brain.

The Perceptron: The Fundamental Building Block

The perceptron is the basic and historical building block of artificial neural networks.

Developed by Frank Rosenblatt in 1958, the perceptron was the first computational unit capable of performing a simple form of supervised learning.

Its design mimics a biological neuron by taking multiple inputs, weighting them, summing the values, and applying an activation function to produce a binary output such as 0 or 1.

Simple Perceptron

The simple perceptron operates on a linear model, meaning it can separate data into two distinct classes using a straight line (in two dimensions), a plane (in three dimensions), or a hyperplane (in higher dimensions).

It consists of a series of inputs (x₁, x₂, .., xₙ) paired with weights (w₁, w₂, .., wₙ).

The output is determined by taking the weighted sum of those inputs plus a bias term, which then passes through an activation function, typically a step function.

If the resulting value is greater than or equal to a threshold, the output is 1; otherwise, it is 0.

Sigmoid Perceptron

To overcome the limitations of the simple perceptron, such as its inability to handle problems that are not linearly separable, researchers introduced perceptrons using smoother activation functions like the sigmoid.

The sigmoid function maps any real number into a range between 0 and 1, allowing a smooth transition between output classes.

This is essential in applications that require a probabilistic output or when passing signals to subsequent layers in more complex networks, such as multilayer neural networks.

Limitations of the Perceptron

While revolutionary for its time, the simple perceptron has major limitations.

It cannot solve problems that cannot be separated linearly, such as the famous XOR problem.

That happens because a simple perceptron cannot draw a single hyperplane that properly separates target outputs for non-linearly separable inputs.

This limitation was one of the main reasons behind the initial slowdown in neural network research during the 1970s, until multilayer neural networks and algorithms such as backpropagation overcame those barriers.

Neural Network Architectures

Neural networks have evolved dramatically since the introduction of the perceptron, giving rise to several complex architectures designed for a wide variety of problems.

Each architecture is tailored to different types of data and tasks, ranging from pattern recognition to processing temporal sequences.

Artificial Neural Networks (ANN)

Artificial Neural Networks (ANNs) are the most basic form of neural networks.

They consist of layers of artificial neurons organized in a feedforward architecture, where connections between neurons do not form cycles.

ANNs apply to a variety of tasks, from classification to regression, and often serve as the starting point for more advanced architectures.

Feed Forward Networks

Feed Forward Networks are the simplest neural network architecture, where information flows strictly in one direction: from the input layer, through one or more hidden layers, to the output layer.

There are no cycles or loops in the connections, making them stable and straightforward to train.

These networks work well on classification and regression tasks where data points are independent and carry no time dependency.

Recurrent Networks

Recurrent Neural Networks (RNNs), unlike feed forward networks, contain cycles in their connections, which allows information to persist across steps.

That property is essential for processing sequences, such as in time-series analysis or natural language processing.

However, RNNs can suffer from vanishing or exploding gradient problems, which can be mitigated by variants such as LSTM (Long Short-Term Memory) and GRU (Gated Recurrent Unit).

Convolutional Neural Networks (CNN)

Convolutional Neural Networks (CNNs) are especially effective for tasks involving grid-structured data, such as images.

They use convolutional layers that apply filters to detect local features, like edges and textures, across different positions in the input.

This makes them highly efficient for visual pattern recognition and widely used in computer vision, from image classification to object detection.

Generative Adversarial Networks (GANs)

Generative Adversarial Networks (GANs) represent one of the most exciting innovations in AI in recent years.

They consist of two competing models: a generator, which tries to create synthetic data resembling real data, and a discriminator, which tries to tell real data apart from generated data.

GANs have revolutionized the generation of images, videos, and even music, opening new possibilities for AI-assisted creativity.

Despite their power, GANs are also notoriously difficult to train and often require careful fine-tuning to produce realistic results.

Architectures Used in LLMs Like ChatGPT, Gemini, and Claude

The neural network architectures behind modern language models like ChatGPT, Gemini, and Claude are based primarily on the Transformer architecture.

First introduced in 2017 by Vaswani et al. in the paper “Attention Is All You Need,” the Transformer architecture revolutionized artificial intelligence, especially in natural language processing (NLP) tasks.

Want to read the original paper in English? Click here.

The Transformer Architecture

The Transformer architecture consists of two main parts: the encoder and the decoder.

In many language models, such as GPT (Generative Pre-trained Transformer), the focus is placed primarily on the decoder.

Self-Attention Mechanism: The core of the Transformer is the self-attention mechanism, which lets every word in a sentence attend to all other words regardless of position. This differs from RNNs, which process words sequentially, making Transformers far better at capturing long-range dependencies in text.

Parallelization: Unlike RNNs, which process data sequentially, Transformers allow data to be processed in parallel, speeding up training and boosting performance on complex tasks.

Why Are Transformers So Effective?

Scalability: The ability of Transformers to handle massive volumes of data and take full advantage of parallelism on GPUs and TPUs makes them ideal for training large language models that can contain billions of parameters. This is what allows models like ChatGPT to understand and generate text with high coherence and accuracy.

Generalization Capacity: Thanks to massive datasets and unsupervised pre-training, Transformer-based LLMs absorb a vast range of knowledge and context. That makes them extremely versatile across diverse language tasks, such as translation, summarization, content generation, and more.

Fine-Tuning: The Transformer architecture lets these models be fine-tuned on specific tasks after pre-training. That sharpens performance even further in specialized domains, such as conversation, assisted writing, or technical areas like programming code.

These architectures underpin the strong performance of modern LLMs, enabling them to generate coherent replies, understand complex context, and adapt to a wide range of natural language tasks.

That highlights the ongoing importance of innovations in the Transformer architecture for advancing the field of AI.

Deep Learning

Deep Learning is a subfield of artificial intelligence focused on neural networks with many layers, known as deep neural networks.

Unlike traditional neural networks, which might have one or two hidden layers, Deep Learning networks can contain dozens or even hundreds of layers, enabling the network to learn data representations across multiple levels of abstraction.

The strength of Deep Learning lies in its ability to process and learn from massive volumes of data, making it ideal for complex tasks such as image recognition, natural language processing, and big data analysis.

These models are trained on GPUs due to their intensive compute demands and leverage architectures like Transformers to tackle problems that used to be impossible or prohibitively difficult.

A defining trait of Deep Learning is its ability to perform both unsupervised and supervised learning, adapting to different data types and tasks.

With the explosion of data and advances in training techniques, Deep Learning has become the foundation for many recent AI breakthroughs, including language models like GPT and computer vision systems.

Layers in Neural Networks

Neural networks are made up of multiple layers, each playing a crucial role in processing and transforming data.

Layers allow neural networks to learn increasingly abstract representations of data as information flows from the input layer toward the output layer.

Single Layer Networks

A Single Layer Network consists of a single layer of neurons between the input layer and the output layer.

A classic example is the simple perceptron, which, as discussed earlier, can solve linear classification problems.

These networks are limited in capacity and cannot solve problems that require capturing non-linear relationships across the data.

Multilayer Networks

Multilayer Networks have one or more hidden layers between the input and output.

These intermediate layers allow the network to capture more complex relationships in the data, solving problems that single-layer networks cannot.

Multilayer networks are the backbone of deep neural networks, where multiple hidden layers work together to abstract high-level features from the data.

Hidden Units and Their Importance

Hidden Units in a neural network are the neurons located inside the hidden layers.

They play a crucial role in processing information because it is inside the hidden layers that the network transforms raw data into representations more useful for the task at hand.

For example, in a neural network trained to recognize objects in images, early hidden layers may detect simple edges and textures, while deeper layers can recognize complex shapes or even whole objects.

The importance of hidden layers cannot be overstated: they are what give neural networks the ability to generalize from training data to brand-new, unseen data.

The more hidden layers (and therefore hidden units) a network has, the more complex the representations it can learn, which is essential for solving sophisticated tasks like speech recognition, machine translation, and AI-assisted medical diagnosis.

The Learning Process

The learning process in neural networks is how those networks tune their internal parameters to improve performance on a specific task.

This happens through an optimization process, where the network tries to minimize the difference between its predictions and actual ground-truth values using a training dataset.

This process is essential for turning a neural network into an effective machine learning tool.

Basic Machine Learning Concepts in Neural Networks

Machine learning in neural networks involves exposing the network to a large number of examples (training data), allowing it to adjust its weights and biases to cut down prediction errors. There are three main learning paradigms:

Supervised Learning: Where the network learns from labeled examples, tuning its parameters to minimize the difference between the network’s predictions and the actual labels.

Unsupervised Learning: Where the network attempts to spot patterns or groupings in data without needing labels.

Reinforcement Learning: Where the network learns through trial and error, receiving rewards or penalties based on its actions.

I have a complete guide on Machine Learning; click here to read it.

Backpropagation

Backpropagation is the central algorithm in training neural networks.

It works by computing the gradient of the error with respect to the network’s weights, propagating that gradient backward through the network from the output layer to the inputs.

That gradient is then used to adjust the weights, shrinking the error on the next iteration.

Backpropagation, paired with optimization algorithms like gradient descent, allows neural networks to learn efficiently even across deep, complex architectures.

Learning Challenges: Overfitting and Underfitting

One of the biggest challenges in training neural networks is balancing the model so that it is neither too complex (causing overfitting) nor too simple (causing underfitting):

Overfitting: Happens when a neural network fits the training data so tightly that it loses the ability to generalize to new data. In other words, the network “memorizes” the training set instead of “learning” generalizable patterns.

Underfitting: Happens when a neural network fails to capture the underlying complexity of the training data, leading to poor performance on both the training set and test data.

Regularization and Optimization

To mitigate issues like overfitting, regularization techniques are applied.

One of the most common is Dropout, which randomly deactivates a fraction of neurons during training, forcing the network not to over-rely on specific paths.

That makes the model more robust and improves its ability to generalize.

Optimization is another critical aspect, with methods such as Stochastic Gradient Descent (SGD), Adam, and RMSprop widely used to tune network weights efficiently, keeping the training process fast and effective.

Conclusions

Neural networks are the backbone of many recent breakthroughs in artificial intelligence, from spotting patterns in complex data to generating text and images.

This guide explored everything from core fundamentals like the perceptron to advanced architectures like Transformers, which power modern language models.

The learning process, driven by techniques such as backpropagation and regularization, is what lets these networks learn and adapt to new data, making them powerful tools for a wide range of applications.

As neural networks continue to evolve, we will see even more impressive innovations in AI, propelled by architectures and training methods that make full use of the massive datasets available today.

Understanding these fundamentals is essential for anyone looking to tap into the potential of neural networks in the future of technology.

Subscribe below to stay up to date with guides, news, and opportunities in this new universe of Artificial Intelligence.

References

MIT, IBM, AWS and Cloudflare.

Direct Advisory

Shall we talk about your project?

Share your context and let's see which path makes sense for your current stage.

Chat on WhatsApp