Component Gallery
A showcase of all available academic components in this project.
Educational Callouts
Custom callouts designed for academic contexts with distinct semantic types.
Math & Equations
Integrated LaTeX support via KaTeX with block and inline formatting.
Block Equations
Inline Equations
Proof Blocks
Interactive Graphs
Image Blocks
Use markdown image syntax or the explicit MDX image component for figures with optional captions.
Statistical Charts
Algorithm Performance Comparison (ms)
Energy Consumption Breakdown
System Trade-offs
ML Plot Suite
Training Curves
Epoch-wise train/validation loss with an overfitting marker.
Embedding Projection
Cluster separation in 2D projection.
Confusion Matrix
Normalized class-level classification accuracy.
| Row | Cat | Dog | Bird |
|---|---|---|---|
| Cat | 0.92 | 0.07 | 0.01 |
| Dog | 0.08 | 0.85 | 0.07 |
| Bird | 0.03 | 0.11 | 0.86 |
Algorithms & Code
Mini-batch Gradient Descent
- 1InitializeInitialize parameters θ and optimizer state.Random init or pretrained
- 2ForwardFor each mini-batch, compute predictions and loss.Cross-entropy or MSE
- 3BackwardBackpropagate gradients with respect to θ.Autodiff graph
- 4UpdateApply optimizer update rule using η and gradients.SGD/Adam step
- 5RepeatRun for E epochs and monitor validation metrics.Early stopping optional
Training Step (PyTorch)
1def train_step(model, batch, optimizer, criterion):2model.train()3x, y = batch4optimizer.zero_grad()5logits = model(x)6loss = criterion(logits, y)7loss.backward()8optimizer.step()9return loss.item()
Exercise Blocks
Bias-Variance Check
Training loss keeps decreasing, but validation loss starts increasing after epoch 12. What is happening and what should you change first?
Tensor Shapes
Tensor Shapes
| Layer | Operation | Shape | Note |
|---|---|---|---|
| Input Tokens | Embedding Lookup | [B, T, d_model] | Token + position embedding |
| Self-Attention | QK^T / sqrt(dk) | [B, H, T, T] | Attention scores |
| Context | softmax(scores) * V | [B, T, d_model] | - |
| MLP | Linear -> GELU -> Linear | [B, T, d_model] | - |
| Logits | Projection to vocab | [B, T, V] | Pre-softmax output |
Model Diagrams
Encoder-Decoder Overview
Simple sequence-to-sequence model with cross-attention bridge.
System Architecture
Declarative diagrams for distributed systems and cloud topologies.
3-Tier Distributed Web Architecture
Sequence Diagrams
Visualize message passing and distributed protocols over time.
Raft Leader Election (Successful)
Math Tables
| Operator | Meaning | LaTeX |
|---|---|---|
| ∇ | Gradient / Nabla | \nabla |
| Σ | Summation | \sum |
| ∏ | Product | \prod |
| ∂ | Partial Derivative | \partial |