How stacks of simple artificial neurons learn to see, listen, read and write, and why they're changing cybersecurity.
Start with a neuron Explore architecturesDeep learning is a branch of machine learning that uses artificial neural networks with many layers. That depth is where the name comes from.
Classic machine learning needs a human to decide which features matter. A deep network learns its own features: early layers detect simple patterns like edges or character sequences, and deeper layers combine them into whole concepts like faces, words or a malware family. Given enough data and computing power (usually GPUs), this layered learning beats hand-built approaches at vision, speech and language.
Every network is built from one simple unit, loosely inspired by brain cells. A neuron:
Training a network simply means finding good values for millions, or even billions, of these weights and biases.
Repeated millions of times, these four steps turn random weights into a useful model.
Feed a batch of examples through the network, layer by layer, to get predictions.
A loss function scores how wrong the predictions are compared to the true labels.
Work backwards through the network to find how much each weight contributed to the error.
Nudge every weight a small step (the learning rate) in the direction that reduces the loss.
Without them, any stack of layers would collapse into a single linear equation and couldn't learn complex patterns.
f(x) = max(0, x)
The default for hidden layers: simple, fast, and it keeps gradients healthy in deep networks.
f(x) = 1 / (1 + e-x)
Squashes any value into 0–1, so it suits output layers that give a probability, such as "malicious or benign".
f(x) = tanh(x)
Like sigmoid but centred on zero (−1 to 1). Common in older recurrent networks.
Different network shapes for different kinds of data.
Convolutional Neural Network. Slides small filters across the input to detect local patterns such as edges, textures and shapes.
Security use: classifying malware binaries rendered as images, CAPTCHA and screenshot analysis.Recurrent networks keep a memory of earlier steps, so order matters. LSTMs add "gates" to remember longer.
Security use: modelling log sequences, network flows over time, and detecting DGA domains.Uses self-attention to weigh every part of the input against every other part, in parallel. It powers today's LLMs.
Security use: phishing email detection, log summarisation, and AI assistants for SOC analysts.Learns to squeeze data into a small representation and rebuild it. Inputs it can't rebuild well are unusual.
Security use: unsupervised anomaly detection in traffic and user behaviour.Generative Adversarial Network. A generator and a discriminator compete until the fakes look real.
Security angle: deepfakes, and also synthetic training data for rare attacks.Learns to reverse a gradual noising process, turning random noise into detailed images, audio or video.
Security angle: realistic fake media that makes verifying content harder.import torch from torch import nn # 20 features in (e.g. URL / traffic stats) -> 1 probability out model = nn.Sequential( nn.Linear(20, 64), nn.ReLU(), # hidden layer 1 nn.Linear(64, 32), nn.ReLU(), # hidden layer 2 nn.Linear(32, 1), nn.Sigmoid(), # output: P(malicious) ) loss_fn = nn.BCELoss() optimizer = torch.optim.Adam(model.parameters(), lr=1e-3) for epoch in range(10): for x, y in train_loader: pred = model(x) # 1. forward pass loss = loss_fn(pred, y) # 2. measure the loss optimizer.zero_grad() loss.backward() # 3. backpropagation optimizer.step() # 4. gradient descent
The four commented lines in the loop are the training loop shown above. train_loader stands for your own labelled dataset.
Neural networks are powerful but have their own attack surface, and security teams need to understand it.
Tiny, invisible changes to an input, like a few pixels or bytes, that flip the model's answer, for example making malware look benign.
Slipping crafted samples into training data to plant blind spots or hidden backdoor triggers.
Querying a model's API repeatedly to build a copy of it, or to find inputs that slip past it.
Membership-inference and inversion attacks can reveal whether specific, possibly sensitive, records were in the training set.