Formula reference

Mathematics you can check.

The formulas the Kaons engine knows, from sample variance to attention. Each comes with its notation, worked examples solved exactly, the mistakes implementations make, and the source it is quoted from.

Attention(Q, K, V) = softmax(QKᵀ/√dₖ)V

Machine learning building blocks

Scaled dot-product attention

Open Scaled dot-product attention

Each query row of Q takes a weighted average of the rows of V, weighted by the softmax over keys of its scaled dot products with the rows of K. The softmax runs along each row (over keys).

Statistics

Means, variances, covariance and correlation, regression error measures and standard scores.

Probability distributions

Densities and mass functions of standard distributions, and the normal distribution function.

Information theory

Entropy, divergences and mutual information of discrete distributions, in nats.

Linear algebra

Norms, distances, cosine similarity, determinants and the Mahalanobis distance.

Numerical methods

Stable log-sum-exp and hypotenuse, trapezoid and Simpson quadrature, polynomial evaluation and central differences.

Machine learning building blocks

Activations, classification and regression losses, normalization layers and attention.

Special functions

Gamma, digamma, Riemann zeta and Bessel functions from their defining integrals and series.

Signal processing

The discrete Fourier transform, with complex coefficients.