Articles

What Is a Neural Network? The Basics Explained

A neural network is layers of weighted connections that learn patterns from data. How neurons, activation functions, and training actually work.

Chisato Chisato · · 4 min read
Abstract purple neural fiber network

A neural network is a machine learning model made of layers of simple units — called neurons — connected by weighted links that are adjusted during training until the network’s output matches the patterns in its data. No single neuron “understands” anything; the network’s behavior emerges from millions (sometimes billions) of small, adjustable numbers working together.

The basic unit: a neuron

A single artificial neuron does three things:

  1. Takes a set of inputs, each multiplied by a weight.
  2. Sums those weighted inputs and adds a bias term.
  3. Passes the result through an activation function, which decides how much signal the neuron passes forward.

That’s it — one neuron is just a weighted sum plus a nonlinearity. The power comes from stacking thousands of them into layers and connecting those layers together.

Layers: input, hidden, output

A network is organized into layers:

  • Input layer. Receives the raw data — pixel values, token embeddings, numeric features. No computation happens here; it just represents the data.
  • Hidden layers. One or more layers of neurons that transform the input step by step. “Deep learning” simply means a network with many hidden layers.
  • Output layer. Produces the final prediction — a class label, a probability distribution, a number.

Data flows forward through these layers in what’s called a forward pass: each layer’s output becomes the next layer’s input, until the output layer produces a result.

Why activation functions matter

If every neuron only computed a weighted sum, stacking layers would be pointless — a chain of linear operations collapses into a single linear operation, no matter how many layers you add. Activation functions introduce nonlinearity, which is what lets networks approximate complex, curved relationships instead of just straight lines.

Common choices include ReLU (which zeroes out negative values and passes positive ones through unchanged) for hidden layers, and softmax (which turns a set of numbers into a probability distribution) for classification outputs. The choice of activation function affects both how well a network trains and how quickly.

How a network learns

Training a neural network means finding the weights and biases that make its outputs match the training data as closely as possible. That happens in a loop:

  1. Forward pass. Feed a batch of examples through the network and get predictions.
  2. Loss calculation. Compare predictions to the correct answers with a loss function — a single number that’s low when predictions are good and high when they’re bad.
  3. Backward pass. Use backpropagation to compute how much each weight contributed to the error.
  4. Update. Adjust every weight slightly in the direction that reduces the loss, using gradient descent (or a variant of it, like Adam).

Repeat this over many batches and many passes through the dataset (epochs), and the loss generally trends downward as the network’s weights settle into values that capture real patterns in the data.

Common architectures

Not all neural networks are built the same way — the layer structure is chosen based on the kind of data involved.

ArchitectureTypical useKey idea
Feedforward (MLP)Tabular data, simple classificationFully connected layers, data flows one direction
Convolutional (CNN)Images, spatial dataSmall filters slide across the input to detect local patterns
Recurrent (RNN/LSTM)Sequences, time seriesMaintains a hidden state that carries information across steps
TransformerText, and increasingly images and audioUses self-attention to weigh relationships between all elements at once

Most modern large language models are built from transformer blocks rather than the recurrent architectures that came before them — see what a transformer is for how that mechanism works. Generative adversarial networks, another architecture family, pit two networks against each other to produce realistic synthetic data; see our explainer on GANs for how that setup works.

What can go wrong: overfitting

A network with enough capacity can memorize its training data instead of learning generalizable patterns — it performs great on data it’s seen and poorly on new data. This is called overfitting, and it’s one of the central challenges in training any model. Techniques like dropout, regularization, and holding out validation data all exist to catch and reduce it; see overfitting vs underfitting for the full picture of that trade-off.

Where this shows up in practice

You don’t need to train a network from scratch to work with one. Most practical AI work today involves taking an existing pretrained model — often a large language model — and adapting or prompting it rather than building the underlying architecture. Still, understanding the mechanics matters: it explains why models need large, diverse training data, why they can fail in surprising ways on inputs unlike anything they’ve seen, and why bigger models generally need more compute and data to train well. If you’re working with LLMs specifically, what an LLM is builds on these same neuron-and-weight fundamentals at a much larger scale.

The takeaway

A neural network is layers of weighted, adjustable connections that transform an input into an output through repeated linear combinations and nonlinear activations. Training is just an optimization loop: measure the error, compute how each weight contributed to it, and nudge every weight to reduce that error, over and over, across a large dataset. Everything more advanced — convolutions, attention, recurrence — is a variation on where those connections point and how information flows between them, not a departure from this core loop.