How naklecha/llama3-from-scratch works
This repository is an educational Llama 3 inference implementation presented as a notebook. Its documented workflow loads Meta’s tokenizer and model assets, tokenizes a prompt, maps tokens to embeddings, normalizes them, and begins implementing transformer attention from tensor operations. The README excerpt ends during first-layer attention, so later inference stages and their relationships are not represented. The notebook is the only runtime source file shown; component paths therefore point to that notebook, while downloaded assets are external inputs.
Main entry points: llama3-from-scratch.ipynb Weight and config loading
Components 9
Inputs and setup
- Llama 3 notebook
llama3-from-scratch.ipynb - Model assets
Text encoding
- Tokenizer setup
llama3-from-scratch.ipynb - Prompt encoding
llama3-from-scratch.ipynb
Model computation
- Weight and config loading
llama3-from-scratch.ipynb - Token embeddings
llama3-from-scratch.ipynb - RMS normalization
llama3-from-scratch.ipynb - Transformer attention
llama3-from-scratch.ipynb
Other components
- Notebook user
Connections 11
- Notebook user → Llama 3 notebook: runs
README.md - Model assets → Tokenizer setup: provides tokenizer model
README.md - Model assets → Weight and config loading: provides weights and config
README.md - Llama 3 notebook → Tokenizer setup: sets up
README.md - Tokenizer setup → Prompt encoding: encodes prompt
README.md - Prompt encoding → Token embeddings: provides token IDs
README.md - Weight and config loading → Token embeddings: provides embedding weights
README.md - Token embeddings → RMS normalization: normalizes
README.md - Weight and config loading → RMS normalization: provides norm weights
README.md - RMS normalization → Transformer attention: feeds attention
README.md - Weight and config loading → Transformer attention: provides attention weights
README.md