Commit Graph

10620 Commits

Author SHA1 Message Date
Vijay Janapa Reddi
261578bfa2 Merge feature/tinytorch-core: fix TITO reference docs 2026-02-16 14:30:54 -05:00
Vijay Janapa Reddi
9f2cce16d2 fix(docs): update TITO reference docs to match actual CLI commands
- Fix setup flow across all docs (activate.sh → source .venv/bin/activate,
  setup-environment.sh → tito setup)
- Add missing commands to overview (tito setup, system update/reset,
  module list/view/test, milestone test/demo, nbgrader commands)
- Add module list, view, and test sections to modules.md
- Fix phantom AlexNet milestone → XOR Crisis in data.md
- Fix Module 10 name (Normalization → Tokenization) in data.md
- Fix milestones.md prereq check output (missing Module 08)
- Fix troubleshooting.md paths, permission fix, and quick-reference table
2026-02-16 14:30:44 -05:00
github-actions[bot]
2706c70854 Update contributors list [skip ci] 2026-02-16 17:46:52 +00:00
Vijay Janapa Reddi
afcb4b3d7a Merge dev: navbar version badge with CI auto-update 2026-02-16 12:43:44 -05:00
Vijay Janapa Reddi
c2ed4a92a9 Merge feature/tinytorch-core: add navbar version badge with CI auto-update 2026-02-16 12:43:28 -05:00
Vijay Janapa Reddi
53066bf5af feat(site): add version badge to navbar with auto-update on release
Display version number and release date (e.g., "v0.1.8 · Feb 7, 2026")
next to the "Under Construction" badge in the top nav bar. Version and
date are declared as top-of-file constants in wip-banner.js for easy
CI sed updates. Publish workflow now bumps 6 files instead of 5.
2026-02-16 12:43:09 -05:00
Vijay Janapa Reddi
67b4d48470 Clarifies notation for units and precision
Refines the notation section to explicitly state the use
of decimal SI prefixes for data, memory, and compute.

Updates wording for clarity and consistency, specifically
addressing units, storage, and compute contexts.

Ensures that the book uses only decimal SI prefixes and
specifies the formatting of numbers and units.
2026-02-16 10:39:14 -05:00
Vijay Janapa Reddi
dcc8afb4cc Parallel builds: add HTML/EPUB format picker, clearer reporting
- debugCommands: prompt for format (PDF, HTML, EPUB) in Build All Chapters (Parallel)
- parallelDebug: clearer success/fail messages, Open Reports Folder, REPORT.md header
- README: document volume + format selection for parallel builds
2026-02-15 17:41:10 -05:00
Vijay Janapa Reddi
09de699545 fix(exports): add missing #| export directives across 10 modules
Systematic audit of all 20 modules against module-developer agent rules
found 9 standalone helper functions missing #| export — these are called
by exported code at runtime but were excluded from the generated package,
causing NameError/AttributeError in CI.

Modules fixed:
- 05_dataloader: _pad_image, _random_crop_region (used by RandomCrop)
- 06_autograd: _stable_softmax, _one_hot_encode (prior session)
- 07_optimizers: 5 mixin classes + monkey-patches (prior session)
- 08_training: 7 monkey-patched Trainer methods (prior session)
- 10_tokenization: _count_byte_pairs, _merge_pair (used by BPETokenizer)
- 11_embeddings: _compute_sinusoidal_table (prior session)
- 12_attention: _compute_attention_scores, _scale_scores, _apply_mask (prior)
- 15_quantization: _collect_layer_inputs, _quantize_single_layer (used by quantize_model)
- 18_memoization: _cached_generation_step, _create_cache_storage, _cached_attention_forward (used by enable_kv_cache)
- 19_benchmarking: rename TinyMLPerf→MLPerf, fix monkey-patch naming (prior)

Also includes: vscode-ext icon refactor (ThemeIcon migration).

All 789 tests pass (unit, integration, e2e, CLI).
2026-02-15 17:38:03 -05:00
Vijay Janapa Reddi
e6051001b1 Parallel builds: track callout PDFs, fix extension errors, remove copy step
- .gitignore: allow book/quarto/assets/images/icons/callouts/*.pdf
- Add missing callout PDFs (takeaways, pitfall, fallacy) so worktrees have them
- Extension: runtime repo-root check and clearer errors for parallel debug
- Extension: remove copyCalloutPdfsToWorktree (PDFs now in repo by default)
- README: document parallel build requirements; drop callout copy note
2026-02-15 16:50:25 -05:00
Vijay Janapa Reddi
37d26f6def Book volumes: content, VS Code ext, CLI debug, and build updates 2026-02-15 16:02:54 -05:00
Vijay Janapa Reddi
a6bd9496e3 style(vscode-ext): increase indentation for action tree rows
Offset action labels in the sidebar tree so child commands are visually nested more clearly under each category across all views.
2026-02-15 14:12:03 -05:00
Vijay Janapa Reddi
58a1391431 Merge remote-tracking branch 'origin/dev' into feature/tinytorch-core 2026-02-15 14:09:07 -05:00
Vijay Janapa Reddi
73a956a09b chore(volumes,vscode-ext): batch volume updates and tooling improvements
Checkpoint the branch-wide content/config revisions together with workbench enhancements so chapter rendering and developer workflows stay aligned. This captures the current validation-driven formatting and parallel build/debug improvements in one commit.
2026-02-15 14:03:27 -05:00
Vijay Janapa Reddi
d33e61b8cc chore(vscode-ext): ignore generated extension artifacts
Ignore extension build outputs and packaged artifacts so the branch stays clean after local development and commit hooks only evaluate source files.
2026-02-15 14:02:41 -05:00
Vijay Janapa Reddi
910240a3f6 chore(tinytorch): add VS Code extension and sync module updates
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.
2026-02-15 14:02:09 -05:00
Vijay Janapa Reddi
cac84290df feat(vscode-ext): auto-open PDF in editor after build completes
Use a file watcher to detect when the PDF is created/modified during
build, then automatically open it in VS Code. Build still runs in the
visible terminal so users see progress. Also fix LaTeX comma-in-title
bug in foldbox.tex by bracing the title argument inside tcolorbox options.
2026-02-15 12:13:04 -05:00
Vijay Janapa Reddi
1db2dacfe7 style(vol2): fix lowercase x multiplication notation across all chapters
Convert all remaining lowercase 'x' used as multiplication (e.g.,
"1000x faster") to $\times$ across 17 vol2 chapters. These were
flagged by the new lowercase_x_multiplication validator check.

Simplifies the validator regex from a fragile word-list approach to a
broader pattern matching digit-x-lowercase (e.g., \dx\s+[a-z]) which
naturally excludes hardware counts (8x A100) and hex literals (0x61).
Includes the conversion script in _archive.
2026-02-15 11:53:51 -05:00
Vijay Janapa Reddi
5d68f0a2e0 style: standardize multiplication notation to $\times$ across all chapters
Convert all Unicode × (U+00D7) to LaTeX $\times$ in prose, tables, and
math contexts across both volumes. Unicode × is preserved only inside
fig-alt text for accessibility screen readers. One instance inside a
plain markdown backtick code span (frameworks.qmd) was reverted to
Unicode × since LaTeX doesn't render in code spans.

Updates validate.py with a new lowercase-x-as-multiplication check and
refines the latex_adjacent warning to distinguish _str variables (safe)
from raw inline Python. Updates validate_inline_refs.py comments to
reflect the new convention. Includes the conversion script in _archive.
2026-02-15 11:43:45 -05:00
Vijay Janapa Reddi
fd7cab5c75 refactor(modules): decompose oversized solution blocks for pedagogical consistency
Break down large BEGIN/END SOLUTION blocks (45+ lines) into smaller,
unit-testable pieces following the one-concept-per-block principle:

- Module 08: train_epoch (58 lines) -> _process_batch + _optimizer_update + train_epoch
- Module 09: BatchNorm2d.forward (70 lines) -> _validate_input + _get_stats + forward
- Module 11: Embedding (62 lines) -> __init__ + forward; PositionalEncoding (82 lines) -> __init__ + forward
- Module 19: generate_report (108 lines), generate_compliance_report (86 lines),
  _run_accuracy_test (52 lines) each decomposed into helper + composition

Each new helper has its own unit test, all test_module() functions updated,
naming conventions enforced (_prefix for private monkey-patch targets).
2026-02-15 10:37:39 -05:00
Vijay Janapa Reddi
f65e68222a fix(vol1): correct stale backward references across 3 chapters
Audited all 52 backward-looking prose references ("recall", "as we saw",
"introduced earlier") across all 16 Vol I chapters. Found 46 valid and
6 with issues; fixed the 4 actionable ones:

- benchmarking: fix dual attribution for energy-movement claim
- hw_acceleration: fix imprecise "100x" energy gap to "orders-of-magnitude"
- hw_acceleration: change "introduced in" to "mentioned in" for HBM ref
- conclusion: correct invariant attribution from data_engineering to Part I

Audit report: .claude/_reviews/2026-02-15_backward-reference-audit.yaml
2026-02-15 09:52:32 -05:00
Vijay Janapa Reddi
9c1ca3e441 style(tinytorch): standardize formatting and conventions across all 20 modules
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)
2026-02-15 09:37:25 -05:00
Vijay Janapa Reddi
81cdbba67b refactor(tinytorch): function decomposition, naming conventions, and progressive disclosure
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.
2026-02-14 16:52:15 -05:00
Vijay Janapa Reddi
b03c32b67a docs(paper): add intra-module scaffolding subsection to progressive disclosure
Add new subsection describing function decomposition pattern used within
modules. Documents how complex operations (attention, convolution, training)
are split into focused helper functions with individual unit tests before
composition into exported functions. Updates pedagogical justification to
cover both inter-module and intra-module progressive disclosure.
2026-02-14 16:51:57 -05:00
Vijay Janapa Reddi
577b5d3cc7 feat(vscode-ext): add health status bar and validation checks
Add a persistent health indicator to the extension: a status bar item
that shows pass/warn/error at a glance, plus a health summary node at
the top of the Pre-commit tree view. Fast in-process TypeScript checks
run on file save, editor switch, and startup (<100ms per file).

Checks: duplicate labels, unclosed div fences, missing figure alt-text,
and unresolved in-file cross-references.

- Add src/validation/qmdChecks.ts with four pure check functions
- Add src/validation/healthManager.ts with central status tracker
- Wire HealthManager into extension.ts with status bar and event hooks
- Add expandable health summary node to PrecommitTreeProvider
- Register showHealthDetails command in package.json
2026-02-14 16:18:16 -05:00
Vijay Janapa Reddi
97118ba0d8 style(vol1): fix remaining multiplication notation violations
Second pass catching ~37 additional instances missed in the initial
cleanup, including prose in frameworks, glossary definitions, footnotes,
fig-caps, fig-alts, table cells, and callout content.

All remaining `Nx` patterns are now exclusively inside Python code
blocks (comments, docstrings, f-strings) or are mathematical variable
expressions (e.g., derivative = 2x), which are correct as-is.
2026-02-14 15:46:57 -05:00
Vijay Janapa Reddi
d74a485cfc Merge pull request #1172 from harvard-edge/fix-google-login-iframe
fixed google auth allow iframe, slow index.html
2026-02-14 15:39:52 -05:00
Vijay Janapa Reddi
c9d21b768b feat(binder): add render plots command for matplotlib figure gallery
Integrate figure rendering into the binder CLI so plots can be previewed
without a full Quarto build. Extracts Python code blocks with fig-* labels
from QMD files, renders them to PNG, and outputs a browsable gallery at
_output/plots/<chapter>/. Also fixes the package import chain so `binder`
works correctly as an installed entry point.

- Add book/cli/commands/render.py with RenderCommand class
- Wire into main.py with help table entry and command dispatch
- Add matplotlib>=3.7.0 to pyproject.toml dependencies
- Add book/quarto/_output/ to .gitignore
- Archive standalone render_figures.py to _archive/
2026-02-14 12:43:23 -05:00
Vijay Janapa Reddi
a03ce064ec style(vol1): standardize multiplication notation across all chapters
Replace ~115 inconsistent multiplication symbols with the codified
standard from book-prose.md:

- Multiplier/ratio: N× (Unicode ×, no space) — e.g. "4× speedup"
- Dimensions: M × N (Unicode ×, spaces) — e.g. "224 × 224"
- Math mode: $\times$ only inside LaTeX expressions

Fixes applied across 20 files:
- Lowercase x → Unicode × in prose (~80 instances)
- Standalone $\times$ → Unicode × for multipliers (~32 instances)
- Dimension spacing corrections (3 instances)
- Hyphen → en dash in ranges (e.g. "2-4×" → "2–4×")

Protected content (code blocks, TikZ, display math) left untouched.
2026-02-14 12:09:32 -05:00
Vijay Janapa Reddi
40fcce9955 content(vol1): add thesis-driven titles to all Key Takeaways callouts
Every callout-takeaways block across Vol 1 now has a title attribute
that captures the chapter's core insight rather than repeating the
chapter name. Titles are drawn from each chapter's purpose question
or central thesis, answering "what should a student remember six
months from now?" Examples: "Constraints Drive Architecture" (Intro),
"Perfectly Available, Perfectly Wrong" (ML Ops), "Architecture Is
Infrastructure" (Network Architectures).
2026-02-14 11:23:29 -05:00
github-actions[bot]
170dcfb3db docs: add @harishb00a as tinytorch contributor for doc 2026-02-14 14:59:20 +00:00
Vijay Janapa Reddi
f652692f58 fix(tinytorch): fix broken paths and references in CONTRIBUTING.md and INSTRUCTOR.md
- Fix clone path: cd TinyTorch → cd cs249r_book/tinytorch
- Remove all CLAUDE.md references (internal AI config, not contributor-facing)
- Fix docs/INSTRUCTOR_GUIDE.md → INSTRUCTOR.md (actual file location)
- Remove phantom docs/development/ references (directory doesn't exist)
- Fix *_dev.py → src/NN_name/NN_name.py (actual source file convention)
- Fix *_dev.ipynb → modules/NN_name/name.ipynb (actual notebook convention)
- Fix test commands to use pytest and actual test directory structure
- Replace nonexistent examples/ references with milestones/ scripts

Closes #1173
2026-02-14 09:54:11 -05:00
Vijay Janapa Reddi
6bca8ef9b0 fix(vscode-ext): fix typed reference colors and simplify settings
Typed references (@tbl-, @fig-, @sec-, @lst-, @eq-) and label
definitions ({#tbl-...}, {#fig-...}) were all rendering in generic
blue because overlapping decorations overrode the typed colors.
Fix by collecting typed matches first and excluding them from
generic/structural buckets. Also fix label-definition regexes to
match labels with trailing attributes (e.g. {#fig-foo fig-env=...}).

Change footnote colors from invisible slate-gray to distinct pink/rose
for clear visual separation from other reference types.

Remove all 27 individual color-override settings (mlsysbook.color*)
since only the preset picker (subtle/balanced/vivid) is needed.
2026-02-13 18:21:25 -05:00
Vijay Janapa Reddi
99b0eb1387 fix(tinytorch): correct INT8 zero-point values in Module 15 quantization docs
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
2026-02-13 17:06:29 -05:00
Vijay Janapa Reddi
f4391ce26f refactor(vscode-ext): remove diagnostics system and clean up highlighter
Remove QmdDiagnosticsManager and WorkspaceLabelIndex which caused
false-positive blue squiggles during workspace index loading. Pre-commit
hooks already validate cross-references and inline Python at commit time.

Also remove div fence marker highlighting (Quarto handles natively),
add !inFence guards to label line checks, remove broken reference
decoration, and change footnote colors from gold to muted slate-gray
to convey their marginal/supplementary nature.
2026-02-13 16:54:42 -05:00
kai
ed39f89d5a fixed google auth allow iframe, slow index.html 2026-02-13 16:13:53 -05:00
Vijay Janapa Reddi
a9c2ba0180 fix(tinytorch): enforce progressive disclosure and move EmbeddingBackward to Module 11
Audit all 20 modules for progressive disclosure violations and fix ~50 issues:

- Module 01: Replace "neural network" framing with "linear transformation" in
  ASCII tables, docstrings, test names, and reflection questions
- Modules 02-04: Remove gradient/neural-network terminology before M06 teaches it
- Module 06: Remove EmbeddingBackward (moved to Module 11 where embeddings are taught)
- Module 11: Add EmbeddingBackward with pedagogical gather/scatter ASCII diagram,
  remove runtime import from autograd, fix "Attention-Ready" forward references
- Modules 12-13: Replace FlashAttention references with generic efficiency language
- Module 17: Fix profiler module number (15 → 14)
- Module 19: Remove Module 20 forward dependency from OlympicEvent
- Module 20: Fix pipeline diagram module numbering and demo ordering

Zero changes to executable logic — all edits target docstrings, comments,
ASCII art, class placement, and test descriptions.
2026-02-13 13:15:24 -05:00
Vijay Janapa Reddi
af2214eede Merge pull request #1171 from harvard-edge/feature/tinytorch-core
TinyTorch: progressive disclosure + Windows install cleanup
2026-02-13 12:54:24 -05:00
Vijay Janapa Reddi
173f28f88d fix(tinytorch): clean up Windows install fix comments from PR #1169
Polish the contributor's Windows fix with proper comments explaining
the Microsoft Store alias issue and WinError 32 file lock. Move
is_windows check closer to usage site for clarity.
2026-02-13 11:39:28 -05:00
Vijay Janapa Reddi
a26ee9fff1 Merge dev into feature/tinytorch-core (includes PR #1169 Windows fix) 2026-02-13 11:38:52 -05:00
Vijay Janapa Reddi
8d8ff38399 Merge pull request #1169 from adil-mubashir-ch/fix/windows-install-issues
Merging Windows install fixes from first-time contributor @adil-mubashir-ch. Follow-up cleanup patch incoming.
2026-02-13 11:38:25 -05:00
github-actions[bot]
8dd73eebd6 Update contributors list [skip ci] 2026-02-13 16:28:11 +00:00
Kristian Radoš
09f4d0a71e Fix typo in SocratiQ introduction (#1170) 2026-02-13 11:22:39 -05:00
Vijay Janapa Reddi
e3cc9f7af3 refactor: rename ml_ml_workflow files, consolidate CLI, and clean up scripts
Remove redundant ml_ prefix from ml_workflow chapter files and update all
Quarto config references. Consolidate custom scripts into native binder
subcommands and archive obsolete tooling.
2026-02-13 11:06:28 -05:00
Vijay Janapa Reddi
3947b2defa fix(tinytorch): enforce progressive disclosure across 9 modules
Audit found docstrings/comments revealing concepts from later modules.
All edits are docstring/comment-only — no code, imports, or tests changed.

Module 01: Replace neural network terminology with generic math examples
Module 02: Remove gradient flow references, reframe layer terminology
Module 05: Remove optimizer/backward from pipeline diagrams
Module 06: Replace transformer/embedding references with general patterns
Module 07: Replace embedding/transformer terminology with generic terms
Module 10: Replace detailed embedding analysis with brief Module 11 teaser
Module 13: Fix swapped dependency numbers, trim KV-cache explanation
Module 14: Remove quantization/compression references from docstrings
Module 17: Fix factually wrong Module 18 teaser description

231 tests pass across all modified modules.
2026-02-13 10:00:50 -05:00
Vijay Janapa Reddi
acd571095a fix(binder): include all label types by default, enable pattern checks
- Default label types now include Equation (was missing from default set)
- --check-patterns now defaults to True for inline-refs
- Removed redundant --all-types from VSCode extension command

All five label types (Figure, Table, Section, Equation, Listing) are
now always checked unless explicitly filtered with --figures/--tables/etc.
2026-02-12 23:46:58 -05:00
Vijay Janapa Reddi
e41c2af2b7 fix(binder): update fix command prog name in argparse 2026-02-12 23:44:55 -05:00
Vijay Janapa Reddi
a0a7f7c658 feat(binder): restructure CLI into check/fix/format hierarchy
Reorganize binder commands into a clean three-verb quality system:

  check   — grouped validation (refs, labels, headers, footnotes,
            figures, rendering) with --scope for granularity
  fix     — content management (headers, footnotes, glossary, images)
  format  — auto-formatters (blanks, python, lists, divs, tables)

Key changes:
- validate → check (with backward-compat alias)
- maintain → fix (with backward-compat alias)
- 17 flat checks grouped into 6 semantic categories
- --scope flag narrows to individual checks within a group
- New FormatCommand with native blanks/lists + script delegation
- Updated pre-commit hooks, VSCode extension, and help output
2026-02-12 23:37:56 -05:00
Vijay Janapa Reddi
8caeac9cc7 refactor(binder): rename validate/maintain subcommands for clarity
Rename verbose compound names to clean, noun-based names:
- section-ids → headers
- forbidden-footnotes → footnote-placement
- footnotes → footnote-refs
- figure-completeness → figures
- figure-placement → float-flow
- index-placement → indexes
- render-patterns → rendering
- dropcap → dropcaps
- part-keys → parts
- image-refs → images

Updated in: validate.py, maintenance.py, pre-commit hooks, VSCode extension.
2026-02-12 23:26:17 -05:00
Vijay Janapa Reddi
755e4cc6a6 feat(binder): consolidate 18 custom scripts into native binder subcommands
Port all custom validation and maintenance scripts into the binder CLI
as native subcommands, eliminating the need for standalone scripts.

New `binder validate` subcommands (10):
- section-ids: verify all headers have {#sec-...} IDs
- forbidden-footnotes: check footnotes in tables/captions/divs
- footnotes: validate footnote refs/defs (undefined, unused, duplicate)
- figure-completeness: check figures have captions and alt-text
- figure-placement: audit figure/table proximity to first reference
- index-placement: check LaTeX \index{} placement
- render-patterns: detect problematic rendering patterns
- dropcap: validate drop cap compatibility
- part-keys: validate \part{key:...} against summaries.yml
- image-refs: validate image references exist on disk

New `binder maintain` subcommands (2):
- section-ids (add/repair/list/remove): full section ID lifecycle
- footnotes (cleanup/reorganize/remove): footnote management

Updated 11 pre-commit hooks to use binder commands instead of scripts.
Updated VSCode extension commands to use binder CLI.
All validators verified against original script output (parity confirmed).
2026-02-12 23:20:54 -05:00