The Network

What the middle layers of a neural network learn — and can't explain to anyone.

Architectures 14 min Intermediate June 1, 2026

A single neuron can draw a dividing line. But the world is not made of straight lines — it's made of faces in photos, meaning in text, and patterns in sound. To go from one neuron to intelligent pattern recognition, you need layers of neurons that work together, each building on the last.

These Hidden Layers are where the actual computation happens — invisible from the outside, but essential for everything a neural network can do.

Hidden Layer

AnalogyDefinition
Imagine a factory. Raw materials arrive at the entrance (Input Layer). At each station inside, workers transform the material — cutting, shaping, painting. These stations are the Hidden Layers. You never see the intermediate products from outside. At the end, the finished product rolls out (Output Layer). Each worker's skill (weight) is refined through practice (training).

From Neuron to Network

A neural network organizes neurons into layers. The Input Layer receives the raw data — no computation happens here. The Hidden Layers perform the actual processing. The Output Layer delivers the final result.

MNIST Network Architecture

Handwriting recognition: 784 pixels → 10 digits

Input Layer 784 neurons (28×28 pixels)
784
Hidden Layer 1 128 neurons (Dense)
128
Hidden Layer 2 64 neurons (Dense)
64
Output Layer 10 neurons (digits 0-9)
10

As soon as a network has more than one Hidden Layer, it's considered "deep" — hence the name Deep Learning. Modern architectures push this depth to extremes: GPT-4 consists of roughly 120 Transformer blocks, functioning as an enormous sequence of Hidden Layers.

784
Input Neurons 28×28 pixels of an MNIST image
~109,000
Parameters Trainable weights and biases
~120
Transformer Blocks GPT-4 architecture (estimate)

Where do the ~109,000 parameters come from? Each connection between two neurons has a weight, and each neuron has a bias:

  • Layer 1 → 2: 784 × 128 weights + 128 biases = 100,480
  • Layer 2 → 3: 128 × 64 weights + 64 biases = 8,256
  • Layer 3 → Output: 64 × 10 weights + 10 biases = 650

Total: 100,480 + 8,256 + 650 = 109,386 parameters

The Forward Pass

How does data flow through the network? The Forward Pass is the computation step where input data is passed layer by layer until a prediction emerges at the end.

Step 1: Linear Combination
z = W · x + b
Step 2: Activation
a = ReLU(z) = max(0, z)
Entire Network
output = f3(f2(f1(input)))

At each layer, the same thing happens: First, the input vector is multiplied by the weight matrix and the bias is added (z = Wx + b). Don't panic: a vector is just a list of numbers, a matrix is a table of numbers. Then an activation function is applied (a = ReLU(z)). The output of one layer becomes the input of the next — mathematically, a function composition.

Unlike a relay race where the baton is passed unchanged, the data is actively transformed at each handoff.

Batch Processing

In practice, individual data points are never processed alone — entire batches are. Hundreds of examples flow through the network simultaneously. Since this is essentially matrix multiplication, GPUs can parallelize these computations extremely efficiently.

This is how you define this Forward Pass in PyTorch. Calling netz(batch) sends the data through all layers:

netz = nn.Sequential(
    nn.Linear(784, 128),
    nn.ReLU(),
    nn.Linear(128, 64),
    nn.ReLU(),
    nn.Linear(64, 10)
)

Feature Hierarchies — What Hidden Layers Learn

The fascinating question: What do the millions of parameters actually store? Deep networks automatically learn so-called feature hierarchies — they decompose the world into different levels of abstraction.

1
Pixels Raw input data: color values and brightness
2
Edges Layer 1 detects edges and simple textures
3
Shapes Middle layers combine edges into geometric patterns
4
Objects Deep layers recognize complex concepts: faces, dog breeds, buildings

Zeiler and Fergus (2014) visualized CNN layers and demonstrated exactly this: Layer 1 detects edges in all directions. Layer 2 responds to textures and patterns. Layer 5 identifies highly specific concepts like faces or church towers. These visualizations partially debunk the myth that Hidden Layers are a "black box."

The decisive advantage over classical Machine Learning: Instead of painstakingly defining features by hand (Feature Engineering), the network discovers relevant features automatically.

Interactive: Explore Network Architecture

Click on the individual layers of the MNIST network and observe how the neuron count shrinks from 784 input pixels through the hidden layers to 10 output classes. Note the enormous connection counts between layers — they explain why training a network is so computationally intensive.

7841286410

Click on a layer to see details.

"Deeper Is Always Better" — Not So Fast

A common misconception: More layers mean a better model. The reality is more complex.

Shallow (1 Hidden Layer)

Fast to train. Few parameters. Good for tabular data and small datasets. Random Forest and SVM are often better.

Deep (Many Hidden Layers)

Learns complex patterns. Needs lots of data and compute. Risk: Vanishing Gradient and Overfitting.

Wrong Assumption: "More Layers = Better Model"

Networks that are too deep suffer from two problems: First, the Vanishing Gradient — gradients shrink through many layers during training, causing early layers to stop learning. Second, Overfitting — too many parameters memorize training data instead of generalizing. For many tasks with tabular data, classical models like Random Forest or SVM are the better choice.

Key Takeaways

  1. A neural network has three layer types: Input (raw data), Hidden (computation), Output (result). Hidden Layers are named so because their outputs are never directly visible.
  2. "Deep" means more than one Hidden Layer. Modern networks have hundreds of layers (GPT-4: ~120 Transformer blocks).
  3. The Forward Pass repeats at each layer: matrix multiplication (z = Wx + b), then activation (a = ReLU(z)). The output of one layer becomes the input of the next.
  4. Hidden Layers automatically learn feature hierarchies: edges → shapes → objects. This replaces manual Feature Engineering.
  5. More depth is not always better — Vanishing Gradient and Overfitting set limits. For many problems, simpler models are more appropriate.

Quiz: Hidden Layers

Question 1 / 5
Not completed

Why are Hidden Layers called "hidden"?

Select one answer
Answer Key: 1) B · 2) C · 3) B · 4) C · 5) B

Checkpoint: Hidden Layers

  • Why are Hidden Layers actually called 'hidden', and what exactly is a Dense Layer?
  • How would you explain the Forward Pass to someone with no technical background?
  • Why does a network fail when you skip layers in the feature hierarchy?