Expand description
Weight initialization utilities (C-INIT-001).
Provides rand_normal_seeded for proper random normal initialization,
matching HuggingFace LLaMA’s normal(0, initializer_range).
Replaces the legacy sinusoidal sin(i * const) * scale placeholder
that caused a 16x convergence gap vs PyTorch (entrenar#309).
References:
- Touvron et al. (2023) LLaMA: arxiv 2302.13971
- He et al. (2015) Kaiming init: arxiv 1502.01852
- HuggingFace LlamaPreTrainedModel._init_weights
Constants§
- INITIALIZER_
RANGE - Default initializer range matching HuggingFace LLaMA config.
Functions§
- get_
init_ seed - Get the current initialization seed.
- lock_
init_ seed - Lock the init-seed critical section and set the seed atomically.
- rand_
normal_ seeded - Generate
nrandom normal values with mean=0 and std=INITIALIZER_RANGE. - set_
init_ seed - Set the global initialization seed (called from training config).