Ashish Vaswani 2026-11-05
Ashish Vaswani is a machine learning researcher and coauthor of the 2017 paper introducing the Transformer model. The paper's shared-contribution statement credits him with jointly designing and implementing the first Transformer models. It explicitly states that author order is random, so his first position should not be read as sole credit for the architecture.[ref]
The Transformer model uses self-attention to combine information from different positions in a sequence. In scaled dot-product attention, a query is compared with keys using dot products, then the softmax function supplies weights for combining the corresponding values. The model connects this mechanism to a complete neural network for tasks such as machine translation.[ref]
An original one-dimensional example makes the weighting concrete. Choose query , keys , , and values , . With key dimension , the scaled scores are and . The softmax function gives weights and , so the output is . The input values are mixed according to the query–key comparison; this invented example is not a learned translation result.
The original evaluation reported 28.4 BLEU for its large model on the English-to-German newstest2014 test. That is a result under a specific training and evaluation setup, rather than a universal score for all Transformer models.[ref]
Causal self-attention 2026-10-25
Self-attention whose output at sequence position may depend only on positions at or before . In a score matrix, set forbidden future-position scores to negative infinity before applying the softmax function; the corresponding weights become zero. This permits parallel computation over a known training sequence without allowing future tokens to influence earlier predictions.
For the negative-flux viscous Burgers equation , set . A sum of exponentials in the initial heat data evolves into , giving the displayed softmax function average. Two terms produce a traveling tanh shock from the lower to the higher state, with speed minus their mean.
Label smoothing 2026-11-05
Label smoothing replaces a sharply concentrated training target with a mixture that assigns some probability to alternative labels. For a -class example whose observed label is , a common uniform version uses
Here is the predicted probability vector and controls smoothing. The target still sums to one. This is a regularization of the training objective, not a statement that the example is known to have several simultaneously correct labels.[ref]
With three classes and , the observed class receives and each other class . This convention differs from assigning to the observed class and splitting only among the incorrect classes. State the convention when reporting a smoothing parameter.
For a softmax function applied to logits , the categorical cross-entropy loss has gradient . With fixed smoothed targets and unconstrained probabilities, the loss is minimized at . The three-class example consequently has optimum true-versus-other logit gap , rather than requiring an unbounded gap to approach a one-hot target.[ref]
The changed objective can discourage extreme training predictions. Its effect on generalization, calibration or another downstream task is an empirical question; the derivation alone does not guarantee improvement on every dataset. Evaluation should therefore retain the distinction between a training regularizer and the true, unknown distribution of labels.
Neural network logit 2026-11-05
A neural network logit is a real-valued class score produced before a probability transformation such as the softmax function. The vector of scores determines the class probabilities jointly; an isolated score is not itself a probability. Negative scores and scores larger than one are permitted.[ref]
For scores , the softmax function gives
Adding one common scalar to every coordinate leaves all probabilities unchanged:
Consequently the absolute offset of a logit vector cannot be recovered from these probabilities.
For example, scores and both give first-class probability . The difference between the two scores, rather than the first coordinate alone, determines this binary probability. Indeed,
This connects the binary score difference with the logit link function. It does not make every coordinate of a multiclass score vector a separately defined binary log-odds.
A common shift also differs from rescaling. Dividing by two gives and first-class probability . This is the transformation used in temperature scaling with temperature two. Positive scaling preserves the selected class within an example while changing confidence.[ref]
When interpreting a neural network logit, state its score vector and probability transformation. Comparing raw coordinates from independently shifted parameterizations can otherwise suggest a confidence change where the actual probability vector is identical.
A transformer block has two principal sublayers: multi-head attention and a positionwise feedforward neural network. Each sublayer has a residual connection and layer normalization. To make the components explicit, let contain the representations of sequence positions. For head , learned projections form
The scaled dot-product attention output is
where the softmax function acts along each row and is an optional attention mask. For causal self-attention, disallowed future positions receive before the softmax function, giving zero attention weights. In self-attention, queries, keys, and values all come from the same input sequence. The multi-head attention output concatenates the heads and projects them:
A standard post-normalization transformer block can then be written
Here layer normalization normalizes the feature coordinates of each position separately, within each example, and applies learned scales and shifts. The positionwise feedforward neural network applies the same two affine maps and activation function at every position, for example
Thus attention mixes information between positions, while the feedforward sublayer transforms each position's features. The residual connections support propagation through a deep stack, and dropout is often used during training. Pre-normalization variants move layer normalization before the sublayer. A model's positional encoding supplies order information to the sequence representation or attention mechanism; a decoder in an encoder-decoder model also has a cross-attention sublayer between its self-attention and feedforward neural network sublayers.
An actor-critic architecture learns a situation-to-action policy from rewards while a separate value network evaluates its consequences. It is a concrete reinforcement learning architecture: no supervisor supplies the correct action on each trial. In a finite Markov decision process, let encode the current situation, be the reward after action , and discount future rewards. The objective is expected return, . For an episodic undiscounted task, termination can instead make the return finite. State representation matters: if the sensory input does not identify the relevant situation, a memory of previous observations must be added.
The actor has preferences and selects actions using a softmax function,
Sampling from this policy supplies exploration. The critic predicts , an estimate of future discounted reward under the current policy. Its temporal-difference learning signal is
with at a terminal state. The update changes the present prediction toward a reward-plus-next-prediction target. It is a semi-gradient update: it does not differentiate through the bootstrapped target. The temporal-difference principle assigns credit using successive predictions rather than waiting for a complete episode to end.[ref]
A corresponding actor update is
The bracketed term is the gradient of the log policy with respect to the preference for action . A positive reward prediction error increases the probability of the selected action; a negative one decreases it. With an accurate critic, the conditional mean of given is the advantage of that action over the policy's average at that state. This motivates the update, while approximate values, changing policies and limited exploration can compromise learning. It is not a guarantee of the globally best behaviour for every choice of features and learning rates.
For an illustrative one-step calculation, start with two equally preferred actions, scalar feature , critic value , and a chosen first action followed by reward . Then . With actor learning rate , its two preference changes are and , so the next probability of the rewarded action is . These are chosen model values. A delayed reward can also modify recently active connections through an eligibility trace, for example for the critic, followed by . The actor needs its own policy-gradient eligibility. Traces must be reset or otherwise handled at episode boundaries.
The key biological hypothesis is a three-factor plasticity rule: presynaptic activity, postsynaptic or action-selection activity, and a modulatory reward prediction error. Cortical inputs to the striatum can provide situation features, action-related populations can supply the actor, and dopamine can modulate plasticity. This is a functional correspondence, not a one-to-one identification of all actor units with one anatomical compartment. The critic itself must be learned; delivering reward directly to every active connection would not explain prediction-dependent changes.
Recordings in monkeys trained through successive delayed-response tasks provide relevant primary evidence. Phasic responses of putative dopamine neurons to liquid reward were more common during learning than after task performance had become established, while significant stimuli continued to elicit responses. This is compatible with a learning signal sensitive to predictability rather than a permanent readout of reward consumption, but the study also emphasizes attentional and motivational interpretations.[ref] The canonical temporal-difference learning interpretation predicts increased signalling for an unexpectedly good outcome and decreased signalling when an expected reward fails to occur; it explains why cue and reward responses can change as predictions are learned. This is a quantitative interpretation of physiological evidence, not an assertion that all dopamine activity equals one scalar critic error.[ref]
The model also explains classical conditioning phenomena such as blocking. If an established cue already predicts the reward, adding another cue leaves little positive prediction error, so the new cue acquires little value. More causally informative experiments in rats stimulated dopamine neurons at reward delivery in blocking and extinction procedures. The stimulation, timed to mimic a positive prediction error, produced lasting increases in cue-elicited reward seeking. This supports a teaching role for phasic dopamine, rather than merely a correlation with successful behaviour. It does not identify every synapse or prove that a complete actor-critic algorithm is the only explanation.[ref]
The simplest model-free actor-critic is consistent with important aspects of learning, but it does not exhaust animal behaviour. It gradually caches action preferences. It cannot immediately change an unvisited action's value after an outcome is devalued unless the state or reward representation supplies an additional route to that change. In an instrumental conditioning experiment in rats, lever pressing trained on interval schedules became insensitive to sucrose devaluation in sham controls, whereas dorsolateral-striatal lesions preserved sensitivity to devaluation. Consumption controls showed that devaluation itself was effective, and testing in extinction limited new reward learning. This dissociation supports a distinction between habitual and goal-directed control, rather than one universal cached policy.[ref]
In humans, a two-stage task with common and rare state transitions separated simple reward-driven repetition from choices sensitive to the transition model. Behaviour and striatal prediction-error-related imaging signals showed both model-free reinforcement learning and model-based reinforcement learning influences. The imaging signal is not a direct measurement of individual dopamine spikes, and task performance alone does not uniquely identify a circuit, but it argues against treating every striatal value signal as purely model-free.[ref]
A stronger architecture can combine the learned actor-critic with a model of action–outcome transitions and current outcome value, and arbitrate between cached action selection and planning. The model's strength is its explicit account of exploration, delayed credit and prediction-dependent plasticity; its limits become visible in devaluation, latent learning and rapid replanning.
Write and , with . Direct differentiation gives
Thus the Cole-Hopf transformation with this negative-flux convention maps the heat equation to the stated viscous Burgers equation. Conversely its residual is independent of and can be removed by multiplying by a function of .
Convolving each initial exponential with the Gaussian heat kernel gives
The resulting finite-exponential Cole-Hopf solution is
It is a softmax function average of the constant states, so and .
For , put and . Equality of the two exponents occurs at
Therefore
This is an increasing viscous shock from to , moving at speed and with transition width of order . That speed agrees with the Rankine-Hugoniot condition for flux ; its concavity makes the increasing jump the entropy shock.
For general , use the shock frame . The leading coefficient in is . The endpoint coefficients coincide, and every interior coefficient is smaller by . The extremal-state asymptotics of exponential Burgers solutions therefore reduce the large- profile to the same tanh shock with states and centre
At a fixed , rather than in the moving frame, the endpoint of largest dominates. If , both endpoint rates coincide and the limiting shock is stationary. Intermediate plateaus disappear in the moving-frame limit.
Figure 1.
Intermediate states disappear from the finite-exponential Burgers solution in the moving shock frame
. Details.
The equal-variance form of Slepian's lemma is the following. If are centered vectors with multivariate normal distributions, for every , and whenever , then
for every threshold vector . In particular . No nonsingularity of the covariance matrices is required.
Here the pointwise variances and differ. To make the comparison rigorous, use the increment form, namely the Sudakov-Fernique inequality: if centered multivariate normal distributions satisfy for every pair, then . Unlike the preceding form of Slepian's lemma, this statement has no equal-pointwise-variance hypothesis.
For completeness, the increment form follows by Gaussian integration by parts. Make independent, define for , and let
The are softmax function weights, with and . Direct differentiation gives and . The Gaussian integration by parts identity therefore yields
The last summands are nonnegative because . Since
integration in and the limit prove the Sudakov-Fernique inequality. All derivatives needed here are bounded for a fixed . Singular covariance matrices can be handled by adding small independent centered normal noise with the same variance to both vectors, proving the identity for the nonsingular vectors, and letting the noise variance decrease to zero.
Use the printed normalization of fractional Brownian motion, which omits the conventional factor . Its increment variance is
For and , . Enumerate by increasing finite subsets whose union is , with . The Sudakov-Fernique inequality gives
Both Gaussian processes vanish at zero almost surely. Thus these maxima are nonnegative and increase with ; monotone convergence theorem gives
Their continuous modifications agree with the original Gaussian processes simultaneously on the countable set , after discarding a single null event. Continuity and density of the rational parameters make each rational supremum equal to the supremum over for these modifications.
The expected suprema are finite. Indeed, the canonical distance of is . A Euclidean grid supplies a closed-ball metric covering number bound for . The Dudley entropy integral bound for an anchored centered separable Gaussian process is
The integral is finite since its integrand grows at most like a constant times near zero. The same argument applies to .
For any real path vanishing at zero,
A centered Gaussian process has the same probability law as its negative. Combining this symmetry with the increment comparison gives the stronger bound
In particular the requested comparison is
The common normalization factor affects both sides equally. The comparison is valid for every , including the equality cases or in the increment bounds.
The feedforward neural network has three input coordinates, two hidden sigmoid function units and two output softmax function units. Every input is connected to each hidden unit, and each hidden unit to each output unit; each hidden and output unit also has a bias. A layer diagram is
Algebraically, with ,
with responses conditionally independent. The fourteen displayed weight and bias parameters comprise six input weights, two hidden biases, four output weights and two output biases. The one-hot encoding supplies targets , , and the categorical cross-entropy loss is the negative of . There is softmax non-identifiability under a common shift of both output logits, but the predicted probabilities are well defined.
For one observation, let and define . Differentiating the softmax function and its log-likelihood gives . The sigmoid-softmax network gradients are
These equations are backpropagation: use the chain rule through the output affine map, then through the hidden units, then the input affine map.
For a learning rate , select one observation and update every parameter by , computing all entries of the gradient from the old parameters before applying the update. A uniformly selected observation gives an unbiased gradient of the average log-likelihood; multiplying by 3000 would instead estimate the gradient of the sum. Equivalently perform stochastic gradient descent on the negative log-likelihood. Batch size one makes one update per observation, and five epochs make five passes through the data, typically with a fresh random ordering on each pass.
For hidden layers with , the output logits are and the softmax function gives
With and , the model-matrix input is
The feedforward neural network has three inputs, a fully connected layer of two ReLU units, and a fully connected two-class softmax output. Algebraically,
where , , , and . The coding is for no click and for a click. There are
parameters.
Define the softmax weights
They obey and . The gradient is their weighted mean,
Differentiating once more gives the covariance-form Hessian matrix
For every unit vector ,
where . The Hessian is a covariance matrix, so it is positive semidefinite; the displayed upper bound also gives in the Loewner order. Consequently has a Lipschitz gradient with
Encode the two classes by the standard basis vectors of . With rectified linear unit applied coordinatewise and softmax function , the fitted feedforward neural network is
where , , , , , and . The number of trainable parameters is
For standardized , model1 computes
followed by logits and softmax function probabilities
The parameter count is
For one-hot labels , the categorical cross-entropy loss is
This is the negative conditional log-likelihood of independent categorical labels, equivalently Bernoulli labels in the two-class case.
With query and key dimension , form the score matrix , apply the softmax function row by row, and multiply by the values . If query and key coordinates have independent unit variance, their dot product has variance ; division by keeps that score scale of order one. Optional additive masks exclude forbidden keys before the softmax function.
Sudakov-Fernique inequality Created 2026-10-06 Updated 2026-11-05
For centered multivariate normal distributions, if for every pair, then the displayed comparison holds. For a quick proof, make independent and set . Apply Gaussian integration by parts to . With softmax function weights and , the derivative of is . Since , let . Singular covariance matrices follow by adding identical small independent normal noise to both vectors and taking a limit.
Temperature scaling 2026-11-05
Temperature scaling is a method of probability calibration that divides a model's neural network logits by one fitted positive scalar before applying the softmax function. The temperature is selected after model training, using labels in a held-out validation set to minimize the negative log-likelihood. It adjusts reported probabilities without retraining all model weights.[ref]
For class scores and ,
For the synthetic two-class scores , the first-class probability is
The selected class remains the first while its reported confidence decreases.
The preservation of the selected class follows directly: dividing by positive preserves every score ordering and equality, and exponentiation is strictly increasing. Thus the set of classes attaining the largest score is unchanged. This concerns ordering between classes within one example; it does not assert preservation of confidence ordering between different examples.
A motivating measurement in the original study compares reliability diagrams for a 110-layer image-classification network. Its reported expected calibration error changes from before calibration to after temperature scaling. This is a result for that experimental setup and binned metric, not a guarantee for every classifier or input distribution.[ref]
Use separate data for fitting the temperature and for final evaluation. One scalar can improve an overall confidence mismatch but cannot represent every class-specific or input-dependent error. The name refers to this probability transformation; no physical temperature is being measured.