- Adds standardized callout-definition blocks with bold term + clear definition
to all Vol.2 chapters (distributed training, inference, network fabrics, etc.)
- Fixes caption_inline_python errors: replaces Python inline refs in table
captions with static text in responsible_engr, appendix_fleet, appendix_reliability,
compute_infrastructure
- Fixes undefined_inline_ref errors: adds missing code fence for PlatformEconomics
class in ops_scale.qmd; converts display math blocks with Python refs to prose
- Fixes render-pattern errors: moves inline Python outside $...$ math delimiters
in conclusion, fleet_orchestration, inference, introduction, network_fabrics,
responsible_ai, security_privacy, sustainable_ai, distributed_training
- Fixes dropcap errors: restructures drop-cap sentences in hw_acceleration and
nn_architectures to not start with cross-references
- Fixes unreferenced-label errors: removes @ prefix from @sec-/@tbl- refs inside
Python comment strings in training, model_compression, ml_systems
- Adds clientA to codespell ignore words (TikZ node label in edge_intelligence)
- Updates mlsys constants, hardware, models, and test_units for Vol.2 calculations
- Updates _quarto.yml and references.bib for two-volume structure
- Fix Pareto diagram: swap A/C so line has positive slope (latency vs accuracy)
- Add missing Image Classification writeup to Standard Benchmark Tasks
- Treat anomaly_detection as binary classification (np.rand(2))
- Convert MLPerf inputs to Tensors + transpose HWC→CHW for TinyTorch models
Fixesharvard-edge/cs249r_book#1196
Refines the explanation of K,V computation savings in the memoization module,
quantifying redundant computations and highlighting the efficiency gain.
The paper and module now specify that generating 100 tokens requires 5,050
total K,V computations, but only 100 are necessary, resulting in 4,950
redundant calculations.
Notebooks use short names (tensor.ipynb, not 01_tensor.ipynb) but docs
and Binder postBuild scripts used the prefixed form. This caused broken
Binder links and incorrect paths in troubleshooting guides.
Fixes: harvard-edge/cs249r_book#1176
Replace hardcoded numerical values across all module ABOUT.md files with
Python-computed values using myst_nb glue() references. Each file is now a
MyST Markdown Notebook that executes inline code cells to compute memory
sizes, FLOPs, compression ratios, and other quantitative values.
Key changes:
- Add file_format: mystnb frontmatter and code-cell blocks to all 20 files
- All arithmetic (memory calculations, speedups, ratios) now computed inline
- Fix multiple arithmetic errors discovered during conversion
- Enable execute_notebooks: "cache" in PDF config for glue resolution
- Fix jupyter-book version constraint in Makefile
Mermaid diagrams were oversized in PDF output. Reduced viewport width
from 800→600 and added LaTeX preamble to cap mermaid figures at
0.75\linewidth. Also fixed 7 admonition blocks across 5 ABOUT.md files
where nested triple-backtick code fences broke the MyST parser, causing
raw markdown to render in PDF output.
Add the TinyTorch VS Code extension source package and align module code/docs references so APIs, milestones, and progression notes remain consistent across the curriculum.
Audit and fix consistency issues across all module source files:
- Standardize ML Systems header to "ML Systems Reflection Questions" (01, 13)
- Fix section ordering: test_module before ML Systems in modules 16, 17
- Rename demo_spatial() to demo_convolutions() to match module name (09)
- Rename demo_*_with_profiler() to explore_*_with_profiler() (15, 16, 17)
- Fix test naming to use test_unit_* prefix consistently (03, 05, 11, 12)
- Add missing emojis in test_module/demo patterns (02, 15)
- Standardize tito command format to number-only (01, 03, 06, 07, 18)
- Fix implementation headers: hyphen to colon separator (09, 12)
- Add missing "Where This Code Lives" package section (13)
- Fix export command in module summary (05, 06)
Three categories of changes across 17 modules:
1. Function decomposition (Modules 01,03,05-15,18-19): Break large
monolithic functions into focused _helper + orchestrator pattern.
Each helper teaches one concept with its own unit test.
2. Naming convention fixes (Modules 08,09,11,18,19): Ensure underscore
convention is consistent — standalone _func in export cells renamed
to func (public API), monkey-patched method names match target
visibility, removed unnecessary #| export from internal helpers.
3. Progressive disclosure (Modules 02-05,08,11-15): Remove forward
references to future modules. Replace "you'll learn in Module N"
with concrete descriptions. Trim connection maps to only show
current and prior modules. Keep end-of-module "Next" teasers
as motivational breadcrumbs.
All 17 modified modules pass their test suites.
Documentation examples were computed using UINT8 (0-255) zero-point
formula but the code implements signed INT8 (-128 to 127). Fixed all
hardcoded diagram values and docstring examples to match the actual
code output. The code logic was always correct; only the documentation
numbers were wrong.
Fixes: zero-point 88 -> -39, 64 -> -64, 42 -> -43
Fixes: quantized result [-128, 12, 127] -> [-128, -27, 127]
Fixes: dequantize docstring example with correct parameters
Ref: https://github.com/harvard-edge/cs249r_book/issues/1150
The formula sqrt(1/fan_in) is actually LeCun initialization (1998),
not Xavier/Glorot. True Xavier uses sqrt(2/(fan_in+fan_out)).
- Rename XAVIER_SCALE_FACTOR → INIT_SCALE_FACTOR
- Update all comments to say "LeCun-style initialization"
- Add note explaining difference between LeCun, Xavier, and He init
- Keep the simpler formula for pedagogical clarity
Fixes#1161
Show the exact definition, tanh approximation, and sigmoid approximation
side by side so students understand where 1.702 comes from and why we
chose the sigmoid form. Avoids erf notation in favor of plain-language
description of Φ(x) appropriate for Module 2 students.
Related to harvard-edge/cs249r_book#1154
The hint claimed 1.702 comes from √(2/π) ≈ 0.798, which is incorrect.
The 1.702 constant is empirically fitted so that sigmoid(1.702x) ≈ Φ(x),
the Gaussian CDF. The √(2/π) constant appears in the separate tanh-based
GELU approximation, not the sigmoid approximation used here.
Fixesharvard-edge/cs249r_book#1154
- Clarify that attention time complexity is O(n²×d), not O(n²), since each
of the n² query-key pairs requires a d-dimensional dot product
- Fix Total Memory column in analyze_attention_memory_overhead() which was
duplicating the Optimizer column instead of summing all components
- Update KEY INSIGHT multiplier from 4x to 7x to match corrected total
Fixesharvard-edge/cs249r_book#1150
Replace the slide download card with an inline PDF viewer using PDF.js:
- Change grid layout from 4 cards (2x2) to 3 cards in a row
- Add embedded slide viewer with navigation, zoom, and fullscreen
- Load slides from local _static/slides/ for reliable CORS handling
- Add "· AI-generated" subtitle to match audio card pattern
- Use 🔥 icon consistently across all viewers
Affected: 20 module ABOUT.md files + big-picture.md
- Convolution: Position(1,1) result 8→7, final output corrected
- Pooling: Fix element lists and average values for bottom windows
- Matrix multiplication: Fix docstring results 13→16, 37→49
- Neural network layer: Fix matmul results in forward pass example
Fixesharvard-edge/cs249r_book#1144
Position (1,1) with region [[6,7],[0,1]] and kernel [[1,0],[0,1]]
correctly computes to 6×1 + 7×0 + 0×0 + 1×1 = 7, not 8.
Fixesharvard-edge/cs249r_book#1144
- Update 08_training and 20_capstone with 2x2 card layout
- Add slide deck download links to GitHub release
- Standardize card order and colors across all modules
The reshape error message was updated to the 3-part educational
pattern, but the integration test was still checking for the old
message text. Updated to use case-insensitive matching.
Improve ~43 error messages across 12 modules to follow the
What/Why/Fix pattern (❌💡🔧) that teaches students at the
moment they hit an error:
- ❌ What failed (with actual tensor shapes/values)
- 💡 Why it failed (conceptual insight)
- 🔧 How to fix (concrete code using their data)
Key improvements:
- Add anticipatory checks for common mistakes (e.g., 3D input
to Conv2D when 4D expected suggests adding batch dimension)
- Dropout error now explains p is DROP probability, not KEEP
- Shape mismatch errors show both dimensions and suggest fixes
- Abstract method errors provide implementation templates
Modules updated: tensor, layers, dataloader, optimizers,
convolutions, tokenization, embeddings, attention, quantization,
acceleration, memoization, benchmarking
All 20 module tests pass.
Update unit test markers across all 20 modules for consistency:
- Changed header emoji from microscope to test tube
- Maintains visual consistency across module test sections
Module 07 (optimizers):
- Fixed bug where param.grad was set before optimizer creation
- Optimizer.__init__ resets param.grad to None for all parameters
- Moved all gradient assignments to occur AFTER optimizer creation
- Fixes GitHub issue #1131
Module 10 (tokenization):
- Made BPETokenizer.train() vocab_size parameter optional with default None
- Fixes test failure when calling train() without explicit vocab_size
All 20 inline tests pass (verified via tito dev test --inline --ci)
- Restore Conv2dBackward class removed in commit 23c5eb2b5
- Restore MaxPool2dBackward class for pooling gradient routing
- Update Conv2d/MaxPool2d forward() to attach _grad_fn
- Set requires_grad=True on Conv2d weights and bias
- Add enable_autograd() to Module 11 (Embeddings) for progressive disclosure
- Remove skip markers from convolution gradient tests
CNN training now works correctly - conv weights receive gradients and update
during training. All 40 convolution tests pass.
- Standardize test emoji usage (🔬 for unit tests, 🧪 for module tests)
- Restore missing NBGrader solution blocks in Module 15 (quantization)
- Fix missing #| default_exp directives in modules 05, 12, 13, 15, 17
- Remove duplicate #| default_exp directives
- Ensure all exports are only for core functionality (no tests/demos)
- Apply consistent styling across all 20 modules via module-developer agent