Neural Modeling Foundations
-
Tensor Axes and Shapes
A tensor shape records how many positions lie along each axis. Name axes separately so equal lengths do not hide different roles.
-
A Single Weighted Unit with a Bias
A unit can compute a weighted sum plus a bias, then apply an activation according to the layer definition.
-
The Rectified Linear Unit at Its Boundary
A rectified linear unit outputs zero for negative inputs and preserves nonnegative inputs.
-
Shapes in a Dense Layer
A dense layer computes several weighted output scores per example. Its weight matrix pairs input features with those output units.
-
Tracing a Forward Pass Through Two Layers
A forward pass composes layer calculations to produce a prediction from one input and a fixed set of parameters.
-
Logits Before Normalization
A multiclass prediction can begin with real-valued scores called logits. Softmax converts them to nonnegative probabilities with total one.
-
Softmax on Two Scores
Softmax assigns probabilities proportional to exponentiated scores. The common denominator normalizes them across the chosen class axis.
-
Negative Log Probability as a Classification Loss
For a known correct class, negative log loss increases as the assigned probability falls. The logarithm base should be consistent with the stated metric.
-
The Chain Rule Through Two Scalar Operations
When one differentiable operation feeds another, the chain rule multiplies their relevant local derivatives along the composition.
-
Adding Gradient Contributions Along Two Paths
When an intermediate quantity contributes to a result through several paths, its derivative includes a contribution from each path.
-
One Gradient Descent Update
A gradient descent step subtracts a positive step size times the gradient at the current parameters.
-
A Step Size Can Overshoot a Minimum
A learning rate sets how far a gradient update moves. The curvature of the loss helps determine a useful range.
-
Examples, Batches, and Training Epochs
A batch groups examples for one update under the training loop. An epoch commonly refers to one complete pass over a training set.
-
Mean and Sum Reductions of Training Loss
A training objective can sum or average losses across examples. The reduction changes gradient scale and batch-size dependence.
-
Training and Evaluation Modes of a Model
Some neural layers use different rules during fitting and scoring. Evaluation should apply the intended inference behavior explicitly.
-
Dropping Activations During Training
Dropout randomly masks selected activations during training. An implementation can adjust retained values so the expected activation under that rule is preserved.
-
Choosing an Axis for Normalization
Normalization estimates a center and scale over a selected set of positions. The axis choice changes which values share those statistics.
-
A Skip Connection Adds an Earlier Representation
A residual block can add its input representation to a calculated change when dimensions and semantics permit.
-
A One-Dimensional Convolution-Style Layer
A neural layer can reuse the same small weights across positions, operating on a moving window under its stride and boundary conventions.
-
Max Pooling over Two Windows
Max pooling outputs the largest value from each window. The window shape, stride, and padding determine which input values are considered.
-
A Receptive Field Through Stacked Windows
A unit's receptive field comprises positions in the input that can influence its computed value under the layer layout.
-
Embedding Vectors as Row Lookups
An embedding table assigns a learned vector to each supported ID. Looking up a sequence preserves the number and order of those IDs.
-
Padding and Masks for Different Sequence Lengths
Batching sequences of different lengths can add padding positions. A mask can tell operations which positions count as actual input.
-
An Attention Output as a Weighted Sum
An attention operation can combine value vectors using weights computed from query and key relationships.
-
A Causal Mask Limits Which Positions Can Contribute
An autoregressive sequence position can use earlier positions under a causal visibility rule. A mask enforces that dependency before attention weights are chosen.
-
Producing a Sequence One Element at a Time
An autoregressive model predicts a next element from the available prefix and can reuse the chosen result as part of the next prefix.
-
Temperature Changes a Softmax Distribution
A positive temperature can divide logits before softmax, controlling how strongly score differences affect the resulting probabilities.
-
Loading a Model Checkpoint with Its Configuration
A checkpoint can record parameters or a fuller training state. The required configuration depends on whether the next operation is scoring or resuming training.
-
Checking Shapes Through a Small Neural Model
A shape trace states which axis each layer transforms, preserves, or aggregates, allowing errors to be found before comparing results.
-
Checking a Gradient with a Finite Difference
An independent finite difference can estimate how a small change in one parameter affects loss and can be compared with the computed gradient.