ML formula reader
Papers and library docs write the maths in one line and assume you can read it. This page takes nineteen formulas you meet constantly in machine learning, from softmax and cross-entropy to attention, Adam and LoRA, and reads each one slowly.
The formulas
Softmax: turn scores into probabilities
Symbols
Hover or focus a row to highlight that symbol in the equation.
| Symbol | Meaning | Shape or range |
|---|---|---|
| x | The raw scores (logits) the model produces, one per class. | vector of C real numbers |
| xᵢ | The score for class i. | scalar |
| exp | e raised to the score. It makes every value positive and widens gaps between scores. | scalar, above 0 |
| Σ | Add up the exponentiated scores of all C classes, so the outputs share one total. | sum over classes |
| C | The number of classes. | integer |
In plain words
Softmax exponentiates every score so all values are positive, then divides by their total so they add up to 1. The largest score gets the largest share, and a one-point gap between two scores multiplies their odds by e, about 2.72. Adding the same number to every score changes nothing.
Common mistake
Computing exp directly overflows for large scores. Subtract the largest score from every xᵢ first: the result is identical and safe. Also avoid feeding softmax output into a loss that applies softmax itself, such as PyTorch’s cross-entropy, or it is applied twice.
Source: PyTorch documentation, torch.nn.Softmax. The formula under the class description.
Softmax with temperature: sharpen or flatten a distribution
Symbols
Hover or focus a row to highlight that symbol in the equation.
| Symbol | Meaning | Shape or range |
|---|---|---|
| qᵢ | The probability the softmax gives to class i. | scalar between 0 and 1 |
| zᵢ | The logit (raw score) for class i. | scalar |
| T | The temperature. 1 gives the ordinary softmax, above 1 flattens, below 1 sharpens. | positive scalar |
| Σ | Add up over every class so the probabilities total 1. | sum over classes |
In plain words
Dividing the logits by T before the softmax changes how peaked the result is. A high T pushes the distribution towards uniform; a low T pushes it towards the single largest logit. In distillation a high T lets the small model see how the teacher ranks the wrong answers too.
Common mistake
T changes confidence, not ranking: the largest logit stays the largest. Libraries differ in convention, so check whether a “temperature” setting divides the logits (as here) or multiplies them. T = 0 is undefined; samplers treat it as picking the top token.
Source: Hinton, Vinyals and Dean (2015), Distilling the knowledge in a neural network. Section 2, equation (1).
Sigmoid: squash a score into a 0 to 1 probability
Symbols
Hover or focus a row to highlight that symbol in the equation.
| Symbol | Meaning | Shape or range |
|---|---|---|
| σ(x) | The output: read it as the probability of a yes. | scalar between 0 and 1 |
| x | The input score (logit). | any real number |
| exp(−x) | Large when x is very negative, close to 0 when x is very positive. | scalar, above 0 |
In plain words
Sigmoid squashes any real number into the range 0 to 1. Zero maps to 0.5, large positive inputs approach 1 and large negative inputs approach 0. Its slope is σ(x)(1 − σ(x)), never more than 0.25, which is one reason stacks of sigmoids train slowly.
Common mistake
A naive exp(−x) overflows for large negative x, so library versions branch on the sign of x. Saturated outputs, close to 0 or 1, have almost no gradient, and a unit stuck there stops learning.
Source: PyTorch documentation, torch.nn.Sigmoid. The formula under the class description.
Cross-entropy loss: how surprised the model is by the answer
Symbols
Hover or focus a row to highlight that symbol in the equation.
| Symbol | Meaning | Shape or range |
|---|---|---|
| L | The loss for one example. Lower is better. | scalar, 0 or above |
| yc | The target probability of class c. For a hard label it is 1 for the right class and 0 elsewhere. | vector of C, sums to 1 |
| xc | The model’s logit (raw score) for class c. | vector of C real numbers |
| log softmax | The log of the probability the model gives class c: always 0 or below. | scalar, 0 or below |
| C | The number of classes. | integer |
In plain words
Cross-entropy measures how surprised the model is by the true answer. With a hard label only the right class’s term survives, so the loss is minus the log of the probability the model gave it: 1.0 costs 0, 0.5 costs 0.69 and 0.01 costs 4.6.
Common mistake
Pass raw logits, not probabilities. PyTorch’s loss applies the softmax itself, and applying it twice flattens the gradients. Frameworks use the natural log, so the loss is in nats, not bits.
Source: PyTorch documentation, torch.nn.CrossEntropyLoss. The class-probabilities form of lₙ, written here for one example with the class weights set to 1.
Binary cross-entropy: loss for a yes or no label
Symbols
Hover or focus a row to highlight that symbol in the equation.
| Symbol | Meaning | Shape or range |
|---|---|---|
| L | The loss for one example. Lower is better. | scalar, 0 or above |
| y | The target: 1 for yes, 0 for no. Soft targets between 0 and 1 are allowed. | scalar between 0 and 1 |
| x | The model’s predicted probability of yes, for example a sigmoid output. | scalar between 0 and 1 |
| log x | The penalty term used when the target is 1: large when x is small. | scalar, 0 or below |
| log(1 − x) | The penalty term used when the target is 0: large when x is close to 1. | scalar, 0 or below |
In plain words
Binary cross-entropy is cross-entropy for two classes. If the label is 1 only the −log x term counts; if it is 0 only −log(1 − x) counts, so confident wrong answers are punished hard. Averaged over examples it is the negative log-likelihood of independent yes or no labels.
Common mistake
x must already be a probability. For stability, prefer the with-logits version (BCEWithLogitsLoss in PyTorch) that takes raw scores. PyTorch clamps each log to −100 or above, so a prediction of exactly 0 or 1 gives a large finite loss instead of infinity.
Source: PyTorch documentation, torch.nn.BCELoss. The formula for lₙ, with the weight set to 1.
Mean squared error: average squared miss
Symbols
Hover or focus a row to highlight that symbol in the equation.
| Symbol | Meaning | Shape or range |
|---|---|---|
| L | The loss, averaged over all N elements. | scalar, 0 or above |
| N | The number of elements being compared. | integer |
| xₙ | The model’s prediction for element n. | scalar |
| yₙ | The target value for element n. | scalar |
| (xₙ − yₙ)² | The squared miss: always positive, and four times larger when the miss doubles. | scalar, 0 or above |
In plain words
Mean squared error averages the squared gaps between predictions and targets. Squaring makes every gap positive and makes big misses count far more: an error of 3 costs nine times an error of 1. It is the loss behind least-squares regression.
Common mistake
Because large errors dominate, a few outliers can drag the fit; for noisy targets consider an absolute-error or Huber loss. The units are the square of the target’s units, so take the square root (RMSE) to report an error in the original units. Some libraries sum instead of averaging, which changes the learning rate you need.
Source: PyTorch documentation, torch.nn.MSELoss. The formula for lₙ and the default “mean” reduction.
KL divergence: the cost of using the wrong distribution
Symbols
Hover or focus a row to highlight that symbol in the equation.
| Symbol | Meaning | Shape or range |
|---|---|---|
| P | The true (target) distribution, for example the teacher’s probabilities. | vector, sums to 1 |
| Q | The model’s distribution that is being compared against P. | vector, sums to 1 |
| P(i) | The probability P gives outcome i. It weights how much each outcome matters. | scalar between 0 and 1 |
| Q(i) | The probability Q gives outcome i. | scalar between 0 and 1 |
| Σ | Add up over every outcome. | sum over outcomes |
In plain words
KL divergence is the extra surprise you pay for using Q to describe data that really follows P, in nats when the log is natural. It is zero only when Q equals P and is never negative. It is not symmetric: swapping P and Q gives a different number.
Common mistake
PyTorch’s KLDivLoss takes the model’s log-probabilities as input and the target as probabilities, the reverse of the textbook roles of P and Q. Its default “mean” reduction is not the true KL divergence; use “batchmean”. If Q(i) is 0 where P(i) is not, the divergence is infinite.
Source: PyTorch documentation, torch.nn.KLDivLoss. The pointwise term y_true · log(y_true / y_pred); summing it over outcomes is the “batchmean” KL(P ∥ Q).
Scaled dot-product attention: weigh values by query–key match
Symbols
Hover or focus a row to highlight that symbol in the equation.
| Symbol | Meaning | Shape or range |
|---|---|---|
| Q | The queries: what each position is looking for. | n × dₖ matrix |
| K | The keys: what each position offers to be matched against. | m × dₖ matrix |
| V | The values: the content that gets mixed into the output. | m × dᵥ matrix |
| dₖ | The length of a query or key vector. | integer |
| QKᵀ | Every query dotted with every key: one match score per pair. | n × m matrix |
| softmax | Turns each row of scores into weights that add up to 1. | applied row by row |
In plain words
Each query is compared with every key by a dot product, and a softmax turns those scores into weights that sum to 1. The output for a query is the weighted average of the value vectors. Dividing by √dₖ stops the dot products growing with the vector length, which would push the softmax into regions with tiny gradients.
Common mistake
The softmax runs along the keys, one row at a time, not down the queries; get the axis wrong and the weights stop summing to 1 per query. The √dₖ uses the key size of one head, not the model width. Causal models also add −∞ to the scores of future positions before the softmax.
Source: Vaswani et al. (2017), Attention is all you need. Section 3.2.1, equation (1).
Multi-head attention: several attentions side by side
Symbols
Hover or focus a row to highlight that symbol in the equation.
| Symbol | Meaning | Shape or range |
|---|---|---|
| h | The number of attention heads. | integer |
| headᵢ | The output of head i: ordinary attention run on its own projections of the input. | n × dᵥ matrix |
| Wᵢ^Q | Projects the queries into head i’s smaller space. | d_model × dₖ matrix |
| Wᵢ^K | Projects the keys into head i’s smaller space. | d_model × dₖ matrix |
| Wᵢ^V | Projects the values into head i’s smaller space. | d_model × dᵥ matrix |
| Concat | Joins the h head outputs side by side along the feature axis. | n × (h·dᵥ) matrix |
| W^O | Mixes the joined heads back to the model width. | (h·dᵥ) × d_model matrix |
In plain words
Instead of one attention over full-width vectors, the model projects the input into h smaller spaces and runs attention in each. Each head can follow a different relationship, such as the previous word or a matching name. Their outputs are joined end to end and mixed by W^O back to the model width.
Common mistake
Heads are not separate models: they share one input and train together, and some turn out redundant. In the original setup dₖ = dᵥ = d_model / h, so more heads make each head narrower rather than the layer bigger. Concatenate along the feature axis, not the sequence axis.
Source: Vaswani et al. (2017), Attention is all you need. Section 3.2.2, the unnumbered MultiHead equations.
Layer normalisation: rescale each token’s features
Symbols
Hover or focus a row to highlight that symbol in the equation.
| Symbol | Meaning | Shape or range |
|---|---|---|
| x | The features of one token (or one example) entering the layer. | vector of d numbers |
| E[x] | The mean of those d features. | scalar |
| Var[x] | The variance of those d features, dividing by d (the biased estimator). | scalar, 0 or above |
| ε | A tiny constant that keeps the division safe when the variance is near 0. PyTorch defaults to 1e-5. | small positive scalar |
| γ | A learned scale for each feature. | vector of d numbers |
| β | A learned shift for each feature. | vector of d numbers |
| ⊙ | Element-wise multiplication (written ∗ in the PyTorch docs). | operator |
In plain words
Layer norm rescales each token’s feature vector to zero mean and unit variance across its own features, then lets the model learn a new scale γ and shift β. It uses no statistics from other examples, so it behaves the same in training and at inference and works with any batch size.
Common mistake
The statistics are taken over the feature axis of one token, not over the batch or the sequence. The variance divides by d, not d − 1, and ε goes inside the square root. Use the same ε as the checkpoint you load; small differences shift outputs in half precision.
Source: PyTorch documentation, torch.nn.LayerNorm. The formula under the class description and the note on the biased variance estimator.
RMSNorm: normalise by size only, with no mean
Symbols
Hover or focus a row to highlight that symbol in the equation.
| Symbol | Meaning | Shape or range |
|---|---|---|
| aᵢ | Feature i of the input to the layer. | scalar; a is a vector of n numbers |
| āᵢ | Feature i of the normalised output. | scalar |
| RMS(a) | The root mean square: the typical size of the features, ignoring sign. | scalar, 0 or above |
| gᵢ | A learned gain for feature i. | vector of n numbers |
| n | The number of features. | integer |
In plain words
RMSNorm drops layer norm’s mean subtraction and only divides by the root mean square of the features. The paper’s argument is that re-centring contributes little, so skipping it saves computation. The output keeps its direction and is rescaled to a fixed typical size, then multiplied by the learned gain.
Common mistake
There is no mean subtraction and no bias, so layer-norm weights do not drop into an RMSNorm layer. Implementations add a small ε inside the square root (PyTorch’s RMSNorm does) which this equation omits; keep it to avoid dividing by zero.
Source: Zhang and Sennrich (2019), Root mean square layer normalization. Equation (4).
SGD with momentum: keep rolling in a steady direction
Symbols
Hover or focus a row to highlight that symbol in the equation.
| Symbol | Meaning | Shape or range |
|---|---|---|
| pₜ | The parameters at step t. | tensor, same shape as the weights |
| gₜ₊₁ | The gradient of the loss on the current batch. | same shape as p |
| vₜ | The velocity: a running sum of past gradients. It starts at zero. | same shape as p |
| μ | The momentum coefficient: how much of the old velocity is kept. Often 0.9. | scalar between 0 and 1 |
| η | The learning rate (called lr in PyTorch). | positive scalar |
In plain words
Momentum keeps a running sum of past gradients, so the update carries on in directions that have been consistently downhill and cancels out directions that keep flipping sign. Think of a ball rolling downhill rather than a fresh step each time. With μ = 0.9 the effective step on a steady slope is up to ten times larger than plain SGD.
Common mistake
Frameworks disagree on where the learning rate goes. PyTorch applies η after accumulating v, as here; the other common form multiplies the gradient by η inside v. They only match while η is constant, so changing the learning rate mid-run behaves differently.
Source: PyTorch documentation, torch.optim.SGD. The two-line update in the Notes section, with lr written as η.
Adam optimiser: per-weight step sizes from gradient history
Symbols
Hover or focus a row to highlight that symbol in the equation.
| Symbol | Meaning | Shape or range |
|---|---|---|
| gₜ | The gradient of the loss at step t. | same shape as θ |
| mₜ | A running average of the gradient: its direction. It starts at zero. | same shape as θ |
| vₜ | A running average of the squared gradient: its size. It starts at zero. | same shape as θ |
| β₁ | How slowly m forgets. The paper’s default is 0.9. | scalar between 0 and 1 |
| β₂ | How slowly v forgets. The paper’s default is 0.999. | scalar between 0 and 1 |
| m̂ₜ | m with the pull towards zero corrected. | same shape as θ |
| v̂ₜ | v with the pull towards zero corrected. | same shape as θ |
| α | The step size (learning rate). The paper’s default is 0.001. | positive scalar |
| ε | A tiny constant that stops a division by zero. The paper’s default is 10⁻⁸. | small positive scalar |
| θₜ | The parameters after step t. | tensor, same shape as the weights |
| t | The step number, counting from 1. | integer |
In plain words
Adam keeps two running averages of the gradient: mₜ for its direction and vₜ for its squared size. It divides one by the square root of the other, so each weight takes a step of roughly α whatever the scale of its gradients. The bias corrections undo the pull towards zero caused by starting m and v at zero.
Common mistake
Without the bias correction the first steps are far too small, especially with β₂ = 0.999. ε sits outside the square root, and a value like 10⁻⁸ can underflow in half precision. Adding an L2 penalty to gₜ is not weight decay in Adam; see the AdamW entry.
Source: Kingma and Ba (2015), Adam: a method for stochastic optimization. Algorithm 1; the paper’s m̂ₜ and v̂ₜ are written there as mₜ and vₜ after the correction.
L2 regularisation: a penalty added to the gradient
Symbols
Hover or focus a row to highlight that symbol in the equation.
| Symbol | Meaning | Shape or range |
|---|---|---|
| gₜ | The gradient the optimiser actually uses at step t. | same shape as θ |
| ∇fₜ(θₜ₋₁) | The gradient of the loss on batch t at the current parameters. | same shape as θ |
| λ | The weight-decay coefficient: how hard weights are pulled to zero. | non-negative scalar |
| θₜ₋₁ | The parameters before this step. | tensor, same shape as the weights |
In plain words
An L2 penalty adds λθ to the gradient, pulling every weight towards zero in proportion to its size. In plain SGD that is the same as shrinking the weights by a constant factor each step. Inside Adam the extra term is then divided by √v̂ along with the rest of the gradient, so weights with large gradients are shrunk less.
Common mistake
The weight_decay argument of PyTorch’s Adam is this form, L2 added to the gradient, not the decoupled decay in AdamW. The two only coincide for plain SGD.
Source: Loshchilov and Hutter (2019), Decoupled weight decay regularization. Algorithm 2, line 6 (Adam with L2 regularisation); PyTorch’s Adam documentation uses the same update.
AdamW: weight decay applied outside the adaptive step
Symbols
Hover or focus a row to highlight that symbol in the equation.
| Symbol | Meaning | Shape or range |
|---|---|---|
| θₜ | The parameters after step t. | tensor, same shape as the weights |
| ηₜ | A schedule multiplier, for example warm-up or decay. It can be fixed at 1. | scalar |
| α | The step size (learning rate). | positive scalar |
| m̂ₜ | The bias-corrected running average of the gradient, as in Adam. | same shape as θ |
| v̂ₜ | The bias-corrected running average of the squared gradient, as in Adam. | same shape as θ |
| ε | A tiny constant that stops a division by zero. | small positive scalar |
| λ | The weight-decay coefficient. | non-negative scalar |
In plain words
AdamW applies the decay straight to the weights instead of through the gradient. Every weight shrinks by the same fraction each step whatever its gradient history, and the adaptive scaling only acts on the loss gradient. The paper reports that this separates the best weight decay from the best learning rate.
Common mistake
In the paper λ is scaled by the schedule multiplier ηₜ but not by α, whereas PyTorch’s AdamW multiplies the decay by the learning rate (θ ← θ − lr · λ · θ). Values quoted in papers and in library defaults are therefore not interchangeable; check how each implementation scales λ.
Source: Loshchilov and Hutter (2019), Decoupled weight decay regularization. Algorithm 2, line 12 (AdamW), with the highlighted decay term inside the brackets.
Cosine similarity: compare direction, ignore length
Symbols
Hover or focus a row to highlight that symbol in the equation.
| Symbol | Meaning | Shape or range |
|---|---|---|
| x₁, x₂ | The two vectors being compared, such as two embeddings. | vectors of the same length d |
| x₁ · x₂ | The dot product: multiply matching entries and add them up. | scalar |
| ‖x‖₂ | The length (Euclidean norm) of a vector. | scalar, 0 or above |
| similarity | 1 means the same direction, 0 right angles, −1 opposite directions. | scalar between −1 and 1 |
In plain words
Cosine similarity compares the direction of two vectors and ignores their length. It is 1 when they point the same way, 0 when they are at right angles and −1 when they are opposite. Embedding search often uses it so that a vector does not score higher just because it is longer.
Common mistake
A zero vector has no direction, so the ratio is undefined; PyTorch guards with max(‖x₁‖‖x₂‖, ε), which this version leaves out. If both vectors are already unit length, cosine similarity equals the dot product, which is cheaper. A score of 0.95 is not “95% similar”: the scale is not a percentage.
Source: PyTorch documentation, torch.nn.CosineSimilarity. The formula under the class description, shown without the max(…, ε) guard.
Bayes’ rule: update a belief with evidence
Symbols
Hover or focus a row to highlight that symbol in the equation.
| Symbol | Meaning | Shape or range |
|---|---|---|
| P(x | y) | The posterior: how likely x is once you have seen y. This is what you want. | probability between 0 and 1 |
| P(x) | The prior: how likely x was before seeing y. | probability between 0 and 1 |
| P(y | x) | The likelihood: how likely y is if x is true. | probability between 0 and 1 |
| P(y) | The evidence: how likely y is overall. It equals the sum of P(y | x) P(x) over all x. | probability between 0 and 1 |
In plain words
Bayes’ rule turns a probability you know, how likely the evidence is under each explanation, into the one you want, how likely each explanation is given the evidence. The prior says how plausible x was to begin with, and the likelihood reweights it. The denominator only rescales so the results add up to 1.
Common mistake
P(x | y) and P(y | x) are different numbers. A test that is 99% sensitive does not make a positive result 99% likely to be right, because the prior matters: ignoring the base rate is the classic mistake.
Source: Goodfellow, Bengio and Courville (2016), Deep Learning, chapter 3. Section 3.11, equation (3.42).
LoRA update: a low-rank change to frozen weights
Symbols
Hover or focus a row to highlight that symbol in the equation.
| Symbol | Meaning | Shape or range |
|---|---|---|
| h | The layer’s output. | vector of d numbers |
| x | The layer’s input. | vector of k numbers |
| W₀ | The pretrained weights. They are frozen and get no gradient updates. | d × k matrix |
| ΔW | The learned change to the weights, never stored in full: it equals BA. | d × k matrix |
| B | The “up” factor. It starts at zero, so training starts at the pretrained model. | d × r matrix |
| A | The “down” factor. It starts with random Gaussian values. | r × k matrix |
| r | The rank: how many directions the update may use. Much smaller than d and k. | integer |
In plain words
LoRA freezes the pretrained weights and learns the change as the product of two thin matrices. For a 4096 × 4096 layer with r = 8, the update has 2 × 4096 × 8 = 65,536 trainable numbers instead of about 16.8 million. Because B starts at zero, training begins exactly at the pretrained model.
Common mistake
The paper also scales ΔWx by α / r, which this equation leaves out; libraries expose it as lora_alpha, and changing r without it changes the effective learning rate. After training, BA can be added into W₀, so inference costs the same as the base model.
Source: Hu et al. (2022), LoRA: low-rank adaptation of large language models. Section 4.1, equation (3), and the α / r scaling in the paragraph after it.
Perplexity: how many tokens the model is torn between
Symbols
Hover or focus a row to highlight that symbol in the equation.
| Symbol | Meaning | Shape or range |
|---|---|---|
| X | The tokenised text being scored. | sequence of t tokens |
| xᵢ | Token i of the sequence. | token id |
| x<i | All the tokens before position i: the context the model sees. | sequence of i − 1 tokens |
| pθ | The probability the model gives the real next token. | scalar between 0 and 1 |
| t | The number of tokens scored. | integer |
| PPL | The result. Lower is better; 1 means every token was predicted with certainty. | scalar, 1 or above |
In plain words
Perplexity is the exponential of the average negative log-likelihood per token. Read it as the number of equally likely tokens the model is choosing between at each step: a perplexity of 10 means it is as unsure as picking at random from ten options.
Common mistake
Perplexities are only comparable when the tokeniser, the text and the context length match; a different vocabulary can move the number without any change in quality. It is also not well defined for masked language models such as BERT.
Source: Hugging Face Transformers documentation, Perplexity of fixed-length models. The definition of PPL(X) at the top of the page.
Every formula was checked against its cited source on 2026-10-24.
What it shows
Every formula comes with a table of its symbols: what each one means and what shape or range it has. After that come a short reading in plain words and one common mistake, usually where a library does something slightly different from the textbook.
Each formula was checked against the equation in the paper or documentation it cites, and the exact section is named under it. Where a library writes the same thing differently, the notes say how.
How to read it
- Pick a formula from the list at the top. Each has its own link, such as #adam.
- Hover or focus a row in the Symbols table to light up that symbol in the equation.
- Check the Shape or range column first when something does not add up. Most bugs in ML code are a shape or an axis, not an idea.
- “In plain words” gives the meaning. “Common mistake” shows what goes wrong in practice.
- Symbols follow the cited source. Another paper may use different letters, and the source note says when a library does.
Questions
How do I read a formula in an ML paper?
First find the symbol list or the sentence that defines each letter, then work out the shape of every term. Next read the equation from the inside out: the innermost brackets first, then the sums, then what is applied to the result. Compare the shapes at each step and the equation usually explains itself.
Why do the same formulas look different in different sources?
Authors choose their own letters and sometimes their own conventions. For example, PyTorch writes element-wise multiplication as ∗ where this page uses ⊙, and some sources put the learning rate inside the momentum buffer while PyTorch applies it after. The source note under each formula points out differences that change behaviour.
How do I know the formulas are right?
Each one was compared with the equation in the paper or official documentation named under it, and the section or equation number is given so you can check. Entries that have not been checked are not shown.
Are these formulas images or text?
They are MathML, the web’s standard for maths, drawn on the server. That means they are real text that screen readers, search engines and copy and paste can use, and they need no extra scripts or fonts to display.
Learn it properly
Sources
- PyTorch documentation, torch.nn.Softmax
- Hinton, Vinyals and Dean (2015), Distilling the knowledge in a neural network
- PyTorch documentation, torch.nn.Sigmoid
- PyTorch documentation, torch.nn.CrossEntropyLoss
- PyTorch documentation, torch.nn.BCELoss
- PyTorch documentation, torch.nn.MSELoss
- PyTorch documentation, torch.nn.KLDivLoss
- Vaswani et al. (2017), Attention is all you need
- PyTorch documentation, torch.nn.LayerNorm
- Zhang and Sennrich (2019), Root mean square layer normalization
- PyTorch documentation, torch.optim.SGD
- Kingma and Ba (2015), Adam: a method for stochastic optimization
- Loshchilov and Hutter (2019), Decoupled weight decay regularization
- PyTorch documentation, torch.nn.CosineSimilarity
- Goodfellow, Bengio and Courville (2016), Deep Learning, chapter 3
- Hu et al. (2022), LoRA: low-rank adaptation of large language models
- Hugging Face Transformers documentation, Perplexity of fixed-length models
Last updated
More tools
All tools- explorerVector similarity explorerDrag vectors to see cosine, dot product and distance agree and disagree, or paste embeddings of any length.Open tool
- explorerMatrix transform visualiserSee a 2×2 matrix stretch, turn, flip or squash the plane, with its determinant and eigenvectors.Open tool
- explorerProbability distribution explorerPlot six common distributions, with mean, variance, mode and the probability of any interval.Open tool