If you want to work with an AI tutor to learn how transformers work at a granular level, these files will get you started.
matrix.js // Basic matrix operations and tensor manipulations embedding.js // Positional and token embedding implementations attention.js // Core attention mechanism multihead.js // Multi-head attention implementation
feedforward.js // Feed-forward neural network component layernorm.js // Layer normalization implementation sublayer.js // Sublayer with residual connections
encoder.js // Complete encoder block decoder.js // Complete decoder block transformer.js // Full transformer architecture
masking.js // Padding and future masking utilities vocabulary.js // Token handling and vocabulary management optimizer.js // Basic gradient descent implementation
train.js // Training loop and loss calculation inference.js // Inference and generation utilities config.js // Model configuration and hyperparameters
example.js // Simple translation example visualization.js // Attention visualization helpers