Neural network (the foundation of modern AI)
At a glance
Definition
A neural network is a computational model composed of interconnected units called neurons, organized into layers. Each neuron computes a weighted sum of its inputs, adds a bias, and applies a non-linear activation function. Neurons pass their output to the next layer, and the final layer produces the network's answer. The 'learning' happens by adjusting the weights and biases so the network's outputs match the desired outputs on training examples.
The core learning algorithm is backpropagation, published by Rumelhart, Hinton, and Williams in 1986. Backprop uses the chain rule of calculus to compute how much each weight contributed to the error, and gradient descent then updates weights to reduce that error. Repeat this on millions of examples and the network learns to map inputs to outputs even for tasks that resist explicit programming.
Modern neural networks are 'deep' — they have many layers (hence 'deep learning'). A modern large language model is a neural network with 60-100+ layers and hundreds of billions of parameters. An image generation model like Stable Diffusion is a neural network. Every specialized architecture — Transformer, CNN, RNN, Mamba — is a specific pattern of neural network structure.
What makes neural networks powerful is universal approximation: given enough width and depth, they can approximate any continuous function. What makes them practical is that gradient descent finds surprisingly good solutions even in enormous parameter spaces. What makes them dominant in 2026 is the combination of scale (billions to trillions of parameters), massive training data, and specialized hardware (GPUs, TPUs) — the perfect confluence that produced the current era of AI.
Real-world example
A minimal neural network — classifying handwritten digits
The classic first neural network task is MNIST — classifying 28×28 pixel images of handwritten digits (0-9). A simple network takes 784 input pixels (flattened), passes them through a hidden layer of, say, 128 neurons with ReLU activation, then outputs 10 numbers (one per digit class). Softmax turns those numbers into probabilities. Trained on 60,000 examples with backpropagation, this simple architecture reaches about 98% accuracy on unseen digits. From here, everything scales up — bigger networks, more data, deeper layers, better architectures.
# Minimal neural network in PyTorch
import torch
import torch.nn as nn
import torch.nn.functional as F
class SimpleNN(nn.Module):
def __init__(self):
super().__init__()
# 784 input pixels → 128 hidden neurons → 10 output classes
self.fc1 = nn.Linear(784, 128)
self.fc2 = nn.Linear(128, 10)
def forward(self, x):
# Flatten input
x = x.view(-1, 784)
# First layer with ReLU activation
x = F.relu(self.fc1(x))
# Output layer (logits — softmax applied in loss)
x = self.fc2(x)
return x
# Training loop (simplified)
model = SimpleNN()
optimizer = torch.optim.Adam(model.parameters(), lr=1e-3)
for images, labels in train_loader:
# Forward pass
logits = model(images)
loss = F.cross_entropy(logits, labels)
# Backward pass (backpropagation happens here)
optimizer.zero_grad()
loss.backward()
optimizer.step()
# After enough epochs: ~98% accuracy on MNIST test setWhen you'll encounter this
- You're using any AI product — every one is a neural network under the hood.
- You're reading AI research — neural network vocabulary is assumed throughout the field.
- You're building AI features — understanding the foundation helps you reason about capabilities and limitations.
- You're training models — every training decision (learning rate, batch size, architecture) is a neural network hyperparameter.
- You're debugging model behavior — understanding that models 'learn from examples' rather than 'know rules' explains many failure modes.
How it works
Neuron computation
Each neuron computes a weighted sum of its inputs plus a bias: z = w₁x₁ + w₂x₂ + ... + b. Then applies a non-linear activation: a = σ(z). Without the non-linearity, stacking layers would collapse into a single linear operation.
Layer stacking
Neurons are organized into layers. Each layer's outputs become the next layer's inputs. Deeper networks can learn more complex functions but are harder to train.
Forward pass
Given an input, activations flow through the network layer by layer. At the output layer, the network produces its prediction.
Loss computation
The prediction is compared with the ground-truth label using a loss function: cross-entropy for classification, mean squared error for regression. Loss is a single number measuring how wrong the network is.
Backpropagation
The chain rule of calculus computes how much each weight contributed to the loss. This produces a gradient vector — one number per weight — pointing in the direction of increasing loss.
Gradient descent
The optimizer (usually Adam) uses the gradient to update weights in the opposite direction: subtracting a fraction of the gradient scaled by the learning rate. Over many updates, the network learns to reduce loss.
Epochs and iterations
Training runs many epochs (passes through the entire dataset). Each epoch consists of many mini-batches. Modern LLM pretraining does one pass over trillions of tokens; fine-tuning may do multiple passes on smaller data.
Regularization
Techniques like dropout, weight decay, and early stopping prevent the network from overfitting — memorizing training data rather than learning generalizable patterns.
Common misconceptions
The name and inspiration are biological, but modern deep learning is very different from biological neural computation. Real neurons spike; artificial ones output continuous values. Real brains use complex chemistry; artificial networks are pure math. The name stuck for historical reasons, but 'brain-like' is misleading.
Not without care. Deep networks can be harder to train (vanishing gradients), overfit more easily, and require more compute. Techniques like residual connections, batch norm, and layer norm made very deep networks trainable, but 'add more layers' isn't a universal solution.
Partially true, mostly overstated. Interpretability research at Anthropic, OpenAI, and elsewhere has made real progress understanding what specific neurons and circuits compute. Full mechanistic understanding remains hard, but 'utterly opaque' is not the whole story.
Related terms
Related in Foundational ML
Narrower / specific concepts
Head-to-head comparisons
Where you'll see this in practice
Related tools
Related models
Learn more
- Read the deep-dive: How a Neural Network Works
- Take the AI from Zero learning path
- Read: Understanding Gradient Descent
- Browse Foundational ML category
Sources & further reading
- Learning representations by back-propagating errors — Rumelhart, Hinton, Williams, 1986 (foundational backprop paper). Read →
- Deep Learning — Goodfellow, Bengio, Courville, 2016 (standard textbook). Read →
- Universal Approximation Theorem — Hornik et al., 1989. Read →
- ImageNet Classification with Deep Convolutional Neural Networks — Krizhevsky et al., 2012 (AlexNet — start of deep learning era). Read →
Frequently asked about Neural Network
To use AI products, no. To build with AI APIs, understanding the high-level concepts (parameters, training, layers) helps. To build custom AI systems or fine-tune models, deeper understanding is essential. Our AI from Zero path takes you through the essentials at any comfort level.
Deep learning is a subset of neural networks — specifically neural networks with many layers. All deep learning uses neural networks; not all neural networks are deep. Modern AI is essentially all deep learning.
An LLM is a specific kind of neural network — a Transformer-based network trained on massive text data with the objective of predicting the next token. All LLMs are neural networks. Not all neural networks are LLMs — image models, speech models, and countless others aren't.
Because they learn from examples rather than rules. To learn patterns that generalize, you need enough examples covering the space. Larger networks have more parameters to fit and thus want more data. Modern LLMs train on 10-20 trillion tokens — roughly the entire filtered internet.
Yes — decision trees, random forests, gradient boosting (XGBoost, LightGBM), support vector machines, and classical statistical models are all still used and often better for tabular data. Neural networks dominate perceptual tasks (vision, speech) and language, but 'AI' is a bigger field than neural networks alone.
Technically reviewed by the AI Terms Guide editorial team on August 6, 2026. Last updated: August 6, 2026. Spotted an error? Let us know — corrections ship within 24 hours.
Building with AI? Try our sister sites
Deep coverage of AI errors, code patterns, and pricing you won't find in the reference.
AI Terms Weekly
One deep term, three new models, one comparison — every Tuesday.