Expand description
Constants and default hyper-parameters common in machine learning.
Optimizer defaults follow the original papers / PyTorch conventions.
Constants§
- ADAGRAD_
EPS - Adagrad ε
- ADAMW_
WEIGHT_ DECAY - AdamW default weight decay (PyTorch)
- ADAM_
BETA1 - Adam β₁
- ADAM_
BETA2 - Adam β₂
- ADAM_
BETA2_ LLM - Adam β₂ for large-LM training (GPT-3 / LLaMA style)
- ADAM_
BETA2_ TRANSFORMER - Adam β₂ and ε used in the original Transformer paper
- ADAM_
EPS - Adam ε (original paper)
- ADAM_
EPS_ TRANSFORMER - ADAM_LR
- Adam default learning rate
- ADAM_
LR_ KARPATHY - “Karpathy constant”: commonly good Adam learning rate
- BATCHNORM_
EPS - BatchNorm ε (PyTorch / Keras ≈ 1e-5 / 1e-3)
- BATCHNORM_
MOMENTUM - BatchNorm running-stat momentum (PyTorch convention)
- BITS_
TO_ NATS - Convert bits → nats: ln(2)
- CIFA
R10_ MEAN - CIFAR-10 RGB mean
- CIFA
R10_ STD - CIFAR-10 RGB standard deviation
- CIFA
R100_ MEAN - CIFAR-100 RGB mean
- CIFA
R100_ STD - CIFAR-100 RGB standard deviation
- DROPOUT_
FC - Typical dropout rate for fully-connected layers (Srivastava et al.)
- DROPOUT_
TRANSFORMER - Typical dropout rate for transformers
- ELU_
ALPHA - ELU default α
- FRAC_
1_ SQRT_ 2 - 1/√2 for exact GELU via erf: x·½·(1 + erf(x/√2))
- GAIN_
LINEAR - Gain for linear / sigmoid layers
- GAIN_
RELU - He/Kaiming gain for ReLU: √2
- GAIN_
SELU - Gain for SELU (LeCun normal init): 3/4
- GAIN_
TANH - Recommended gain for tanh: 5/3
- GELU_
TANH_ COEFF - GELU tanh-approximation cubic coefficient: 0.044715
- GRAD_
CLIP_ NORM - Default gradient-clipping norm
- IMAGENET_
MEAN - ImageNet RGB mean
- IMAGENET_
STD - ImageNet RGB standard deviation
- INIT_
STD_ TRANSFORMER - Truncated-normal init standard deviation used by BERT / GPT-2
- LABEL_
SMOOTHING - Typical label-smoothing factor
- LAYERNORM_
EPS - LayerNorm ε (PyTorch)
- LAYERNORM_
EPS_ TRANSFORMER - LayerNorm ε (original Transformer / BERT)
- LEAKY_
RELU_ SLOPE - Leaky-ReLU default negative slope (PyTorch)
- LEAKY_
RELU_ SLOPE_ GAN - Leaky-ReLU slope commonly used in GANs
- LOG_
FLOOR - log(ε) floor used to avoid −∞ in log-probabilities
- LUMA_
BT601 - ITU-R BT.601 luma weights (R, G, B)
- LUMA_
BT709 - ITU-R BT.709 luma weights (R, G, B)
- LUMA_
BT2020 - ITU-R BT.2020 luma weights (R, G, B)
- MASK_
NEG_ INF - Large negative number used for attention masking
- MNIST_
MEAN - MNIST mean
- MNIST_
STD - MNIST standard deviation
- NATS_
TO_ BITS - Convert nats → bits: log₂(e)
- NATS_
TO_ HARTLEYS - Convert nats → hartleys (bans): log₁₀(e)
- NORMALIZE_
EPS - ε for cosine similarity / L2 normalization (PyTorch)
- POS_
ENC_ BASE - Sinusoidal positional-encoding base (Vaswani et al.)
- PROB_
CLIP_ EPS - Keras backend epsilon for clipping probabilities
- RMSNORM_
EPS - RMSNorm ε (LLaMA)
- RMSPROP_
ALPHA - RMSprop smoothing constant α (PyTorch)
- RMSPROP_
EPS - RMSprop ε
- RMSPROP_
RHO - RMSprop ρ (Hinton / Keras)
- ROPE_
BASE - RoPE base θ (original RoFormer / LLaMA 1-2)
- ROPE_
BASE_ LLAM A3 - RoPE base θ (LLaMA 3)
- SELU_
ALPHA - SELU α (Klambauer et al. 2017)
- SELU_
SCALE - SELU scale λ (Klambauer et al. 2017)
- SGD_
MOMENTUM - SGD momentum (classic)
- SIGMOID_
DERIV_ MAX - Maximum of the sigmoid derivative σ’(0) = 1/4
- SOFTPLUS_
THRESHOLD - Softplus linearisation threshold (PyTorch default)
- SQRT_
2_ OVER_ PI - √(2/π): GELU tanh-approximation prefactor
- STD_
NORMAL_ ENTROPY - Differential entropy of N(0,1) in nats: ½·ln(2πe)
- TRANSFORMER_
WARMUP_ STEPS - Original Transformer LR warm-up steps