Neural Network Layer
A layer, in a neural network, is a group of neurons that all receive the same set of inputs and run in parallel, with their combined outputs passed forward to the next layer — not to be confused with a fab's patterned silicon layers, though the two share a surprising structural parallel: both are repeating units stacked to build something far more capable than any single unit alone. A network's "depth" is literally its layer count, and depth is what separates shallow machine learning from deep learning: a single-layer network (a plain linear or logistic regression) can only separate data with a straight line, while stacking dozens or hundreds of layers lets a network build up increasingly abstract representations, layer by layer. At a high level, data moves through a stack of layers like this:
Different layer types exist because different data shapes need different connection patterns, not because of arbitrary variety. A fully connected (dense) layer connects every input to every neuron, which works for small feature vectors but becomes impossibly expensive for images (a million-pixel image fully connected to a million neurons is a trillion weights). Convolutional layers instead slide a small shared filter across an image, dramatically cutting the parameter count by reusing the same weights at every spatial position — the core insight that made CNNs practical for vision. Transformer layers (self-attention followed by a feed-forward block) instead let every position attend to every other position, which is what lets a language model relate the start and end of a long sentence regardless of distance between them.
Layer depth and layer width are two separate knobs, and both run into real hardware limits. Width (neurons per layer) sets how much a single layer can represent at once and scales the matrix-multiply size directly; depth (layer count) sets how many sequential transformations the data passes through and directly sets how many sequential GPU kernel launches a forward pass requires. Very deep networks historically suffered from vanishing or exploding gradients during backpropagation — the chain rule multiplies many small or large numbers together across layers, and that product can shrink toward zero or blow up — which is exactly the problem residual connections (skip connections that let gradients bypass layers) were invented to fix, enabling the jump from roughly 20-layer networks to the 100+ layer ResNets and the 96-layer GPT-3-scale transformers common today.
A layer's memory footprint during training, not just its parameter count, is often the real constraint on how deep a model can go. Every layer's intermediate activations have to be stored for the backward pass unless specifically discarded and recomputed (activation checkpointing, a real technique used to trade extra compute for lower memory), so a model's total layer count times its per-layer activation size has to fit inside whatever HBM a training cluster's GPUs actually have — this is a direct, physical reason model depth can't simply scale without bound even when more parameters would help.
Read "layer" as the unit that turns neural-network depth from a metaphor into an actual hardware bill: every layer added is another sequential matrix multiply, another chunk of activation memory to store, and another link in the gradient chain that has to stay numerically stable — a network's depth is a direct trade against GPU memory and training stability, the same way a chip's 60-100+ patterned layers are a direct trade against yield and fab cycle time.