Commit Graph

10620 Commits

Author SHA1 Message Date
Vijay Janapa Reddi
6b4af17b8f feat(vscode-ext): workspace-wide cross-reference validation and section ID commands
- Add WorkspaceLabelIndex: scans all .qmd files on activation, updates
  incrementally on save, provides hasLabel() for cross-file validation
- Extend QmdDiagnosticsManager to validate references against workspace
  index (not just current file); triggered on save only, not keystrokes
- Add broken reference decoration (red wavy underline) in chunk
  highlighter for refs that don't resolve to any label in the workspace
- Add commands: Add Missing Section IDs, Verify Section IDs,
  Validate Cross-References (command palette)
- Enable diagnostics by default (save-triggered, not noisy)
- Support YAML-style label definitions (#| label:, #| fig-label:, etc.)
2026-02-12 22:53:50 -05:00
Vijay Janapa Reddi
d39ff325c0 feat(content): add missing section IDs across Vol 1 and enforce via pre-commit
- Run manage_section_ids.py to add 294 missing section IDs and
  standardize 62 non-conforming IDs to hierarchy-based format
- Fix 12 double-hash bugs (e.g., -cbb8-cbb8 -> -cbb8) from script
- All cross-references updated to match new IDs (19 refs across files)
- Verified clean: check_unreferenced_labels.py and check_duplicate_labels.py pass
- Add book-verify-section-ids pre-commit hook (runs --verify mode, ~1.5s)
2026-02-12 22:53:13 -05:00
Vijay Janapa Reddi
f75bd2e490 fix(vscode-ext): force matplotlib Agg backend more aggressively
Use force=True, switch_backend(), and close("all") after execution
to prevent plot windows from appearing during Python value resolution.
2026-02-12 21:57:31 -05:00
Vijay Janapa Reddi
1995a17d6b feat(vscode-ext): add inline Python value resolution and reduce visual noise
- Add Python value resolver that executes QMD code blocks and resolves
  inline `{python} var` references to their actual values
- Display resolved values as ghost text, hover tooltips, and CodeLens
- Unwrap IPython.display.Markdown objects (.data) and display_value dicts
  for readable output instead of object reprs
- Suppress matplotlib plot windows during resolution (Agg backend)
- Split inline Python highlighting into keyword + variable decorations
- Disable callout/div body and table region background highlights by
  default (too noisy); fence markers and cross-references still colored
- Add settings: showInlinePythonValues, showInlinePythonCodeLens,
  highlightCalloutBackground, highlightTables (default: false)
2026-02-12 21:53:39 -05:00
Vijay Janapa Reddi
df8c3174e5 Refactor: centralize Quarto shared config and streamline PDF build fragments.
Moves common diagram and PDF title/build settings into shared metadata layers, simplifies per-volume configs to keep only volume-specific values, and carries related chapter figure text/asset updates needed in the current working set.
2026-02-12 20:14:31 -05:00
Vijay Janapa Reddi
2390c3ab31 Refactor: consolidate Quarto config layers and content reorganization.
Unifies Quarto metadata into shared base/format/volume fragments while carrying through chapter path, asset, and tooling updates to keep the repository consistent and easier to maintain.
2026-02-12 15:38:55 -05:00
Vijay Janapa Reddi
b3e86c5cc6 Removes image backup files.
Deletes image backup files from different timestamps.
These files are no longer needed and are removed
to clean up the repository.
2026-02-12 06:32:59 -05:00
Adil Mubashir Chaudhry
f2975daa67 Fix Windows install issues
- Prefer python over python3 in Git Bash to avoid Microsoft Store alias and incorrect venv paths
- Skip TinyTorch self-reinstall on Windows if already installed (prevents WinError 32 file lock)
2026-02-12 14:47:35 +05:00
Vijay Janapa Reddi
d9cb03cf38 Refactor: Systematic Goal/Show/How header audit for Volume 1
- Completed full standardization of 150+ calculation headers across all 16 Volume 1 chapters.
- Replaced legacy 'Why:' blocks with the 'Goal/Show/How' documentation pattern.
- Finalized P.I.C.O. class refactors for complex cells in frameworks and serving.
- Verified header consistency across introduction, ml_systems, training, and optimizations.
- Performed minor stabilization in book/vscode-ext logic.
2026-02-11 21:33:27 -05:00
Vijay Janapa Reddi
c015b9d80a Refactor: stabilize non-PDF build workflows and semantic editor cues.
Standardize Quarto config/style handling for HTML/EPUB volume builds, add explicit binder reset commands by format, and align QMD reference/label highlighting so structural tokens share consistent visual semantics.
2026-02-11 20:36:16 -05:00
Vijay Janapa Reddi
0630674a71 fix(module16): correct sparsity percentage bugs in compression module
- Fix incorrect percentile claim in pruning ASCII diagram (rewrote with
  20 values and correct 50th percentile threshold)
- Fix 7000% sparsity display in demo_compression_with_profiler where
  measure_sparsity() returns percentage (0-100) but code treated it as
  fraction (0-1), causing double multiplication

Closes harvard-edge/cs249r_book#1168
2026-02-11 18:55:12 -05:00
Vijay Janapa Reddi
ce68808185 Fix: make pipe table prettifier apply visible alignment changes
Treat internal spacing changes as real formatting differences and normalize separator padding so table prettification is applied consistently. Save files before running pre-commit fixers from the extension so results match editor state.
2026-02-11 18:46:18 -05:00
Vijay Janapa Reddi
c16333cbad Refactor: Finalize Volume 2 P.I.C.O. refactor and TikZ standardization
- Refactored ops_scale.qmd to P.I.C.O. pattern and standardized constants.
- Standardized TikZ colors in storage.qmd (fig-storage-hierarchy) and distributed_training.qmd.
- Verified elimination of magic numbers (1e9, 3600, etc.) across all Volume 2 Python cells.
- Completed full conversion of narrative guards to check() helper in Volume 2.
2026-02-11 17:34:55 -05:00
Vijay Janapa Reddi
66c4970c51 Refactor: standardize all appendix files across Volume 1 and 2
- Refactored appendix_algorithm.qmd, appendix_data.qmd, and appendix_dam.qmd to P.I.C.O. pattern.
- Integrated standardized constants (BILLION, THOUSAND, SEC_PER_HOUR) in all appendix calculations.
- Simplified narrative guards in appendices using the check() helper.
- Verified backmatter consistency across both volumes.
2026-02-11 16:19:14 -05:00
Vijay Janapa Reddi
9a1e9a53cd Refactor: standardize Volume 2 constants and move checkpoint math
- Refactored Volume 2 core chapters (Intro, Dist Training, Storage) to P.I.C.O. pattern.
- Moved Young-Daly checkpoint optimization logic from Storage to Distributed Training.
- Eliminated magic numbers (1e9, 3600, etc.) from all Volume 2 calculation cells.
- Implemented central 'chapter-start' cells with shared imports for consistency with Vol 1.
2026-02-11 16:05:04 -05:00
Vijay Janapa Reddi
77f478c1b5 Refactor: standardize constants, simplify invariants, and polish Vol 1 docs
- Standardized time (SEC_PER_HOUR, SEC_PER_DAY), memory (KIB_TO_BYTES), and scale (BILLION, TRILLION) constants in mlsys/constants.py.
- Refactor reordered time constants to fix NameError in constants.py.
- Refactored 90+ narrative guards across Volume 1 to use the simplified check() helper.
- Eliminated remaining magic numbers (1024, 3600, 1e9, etc.) from Python calculation cells.
- Adopted 'Goal / Show / How' documentation structure for key P.I.C.O. scenarios.
- Performed minor stabilization and feature polish in book/vscode-ext.
2026-02-11 15:57:00 -05:00
Vijay Janapa Reddi
abe634ead2 Refactor: unify binder workflows and polish authoring UX
Consolidate Binder/extension command behavior, improve chapter navigation and QMD editor ergonomics, and carry forward Volume 1 content updates so build/debug and writing workflows stay aligned.
2026-02-11 12:34:06 -05:00
Vijay Janapa Reddi
ff3797a1d8 Refactor: Finalize Volume 1 and update CLI/VSCode tooling
- Completed full Volume 1 refactor to Safe Class Namespace pattern.

- Fixed render errors and verified all 16 chapters.

- Updated 'binder' CLI with native validation and maintenance namespaces.

- Enhanced VS Code extension with Chapter Navigator and Run History.

- Integrated 'binder validate' into pre-commit workflows.
2026-02-11 09:25:50 -05:00
Vijay Janapa Reddi
41ec86ba10 Refactor: Fix Render Errors in Vol 1
- ml_systems.qmd: Fixed NameError in CloudEdgeTCO/EdgeSizing exports (replaced undefined '_value' vars with class attributes).

- training.qmd: Fixed IndentationError in TrainingDimensions class.
2026-02-11 09:08:06 -05:00
Vijay Janapa Reddi
ce867fe486 Refactor: Finalize Chapter 8 (Model Training) Migration
- Refactored FlashAttentionSpeedup, GradientAccumulation, and TrainingCarbonFootprint to Safe Class Namespace pattern.

- Added P.I.C.O. structure and invariant checks.

- Exported variables for prose integration.

- Fixed inline Python validation warnings (replaced LaTeX math with Unicode).
2026-02-11 08:37:28 -05:00
Vijay Janapa Reddi
275475e14a Refactor: Port Chapter 7 (ML Frameworks) to mlsys with Direct Access Pattern
- Refactored  to use , , , , , ,  classes.
- Used  and  registries.
- Implemented strict narrative invariants (e.g., verifying A100 ridge point > 100).
- Removed verbose export blocks.
- Verified render.
2026-02-10 18:06:52 -05:00
Vijay Janapa Reddi
3a8a0e6e26 Refactor: Finalize Chapter 6 (Network Architectures) Migration
- Fixed  adjacency warnings by replacing with Unicode .
- Fixed missing  usage in prose.
- Added  to  class for self-containment.
- Verified render passes without errors.
- Completed full migration of  to  objects and Direct Access pattern.
2026-02-10 17:54:52 -05:00
Vijay Janapa Reddi
6f562fd003 Refactor: Port Chapters 4 & 5 to mlsys with Direct Access Pattern
- Refactored  (Chapter 4) to use  and .
- Refactored  (Chapter 5) to use  and  classes.
- Adopted the 'Direct Access' pattern: eliminating export blocks and referencing  directly in Markdown.
- Verified renders for both chapters.
2026-02-10 17:24:48 -05:00
Vijay Janapa Reddi
89a7b5305c Refactor: Port Chapter 2 (ML Systems) to mlsys Objects
- Refactored  to use , , and  registries.
- Expanded  with  devices (Coral, Jetson, NUC) and .
- Expanded  with  (DLRM) and  family.
- Fixed registry bugs (Coral bandwidth, GPT class definition).
- All unit tests passing.
2026-02-10 17:19:34 -05:00
Vijay Janapa Reddi
ad0e36f7c6 Harden with internal assertions and migrate Chapters 1, 13, 16
- Added  assertions to  and  to enforce physical plausibility.
- Introduced  registry for Cloud/Edge/Mobile/TinyML constraints.
- Refactored , , and  to use object-oriented Digital Twins.
- Replaced loose constants with registry-backed attributes (e.g. ).
- Verified build and unit tests pass.
2026-02-10 16:54:07 -05:00
Vijay Janapa Reddi
f136f96fd8 Refactor: Rename library to and introduce Digital Twins
Renamed the core physics engine from  to  to better align with
the book's title and pedagogical goals.

New features:
- Introduced  and  classes in  and .
- Digital twins now carry their own attributes (bandwidth, FLOPS) and
  methods (ridge_point, memory_size).
- Global search and replace updated all 16 chapters to use .
- Maintained backward compatibility for legacy constants during migration.
2026-02-10 16:46:37 -05:00
Vijay Janapa Reddi
073bee9f13 Cleanup: Remove legacy physx modules and test artifacts
Removed obsolete Python modules from  that were replaced
by the P.I.C.O. design pattern (logic moved directly into QMD files).
Deleted files include chapter-specific scripts (), unused
calculators (, , etc.), and manual audit tools.
2026-02-10 15:45:31 -05:00
Vijay Janapa Reddi
83ce92624e Editorial Corrections & Code Hardening (Volume 1)
This commit refactors the underlying Python calculation cells for Chapters 1-16
to strictly enforce mathematical consistency with the narrative.

**Key Text/Numeric Updates (For Editorial Review):**

1.  **Chapter 3 (Workflow) - Edge Necessity Scenario:**
    -   *Change:* Increased clinic patient count from **100** to **150**.
    -   *Reason:* With 100 patients, the calculated upload time was ~5.5 hours, which fits within the 8-hour clinic day, contradicting the chapter's conclusion that 'Edge is Mandatory.' Increasing to 150 pushes upload time to >8 hours, mathematically validating the narrative.

2.  **Chapter 1 (Introduction) - Model Drift Scenario:**
    -   *Change:* Reduced monthly accuracy drift rate from **8.0%** to **0.8%**.
    -   *Reason:* An 8% monthly drop is a catastrophic failure that would be immediately noticed. A 0.8% drop correctly models the 'silent failure' (boiling frog) scenario described in the text.

3.  **Chapter 3 (Workflow) - Velocity vs Quality:**
    -   *Change:* Reduced 'Large Model' accuracy gain per iteration from **0.5%** to **0.15%**.
    -   *Reason:* The original rate caused the large model to hit 99% accuracy almost instantly, invalidating the 'Velocity is a Feature' argument. The new rate correctly models diminishing returns, allowing the faster (small) model to win.

4.  **Chapter 15 (Responsible Engineering) - TCO Analysis:**
    -   *Verification:* Verified and stabilized the 3-year Total Cost of Ownership (TCO) calculations. Confirmed that Inference TCO (.5M) dominates Training TCO (8K) by ~40x, supporting the 'Efficiency as Responsibility' thesis.

**Technical Changes (Code Only):**
-   Refactored all calculation cells to use the **P.I.C.O. (Parameters, Invariants, Calculation, Outputs)** design pattern.
-   Added assertion guards (Invariants) to prevent future regressions where math contradicts prose.
-   Fixed variable scope issues in Chapter 10 (Model Compression) and Chapter 15.
-   Disabled false-positive linter warnings for standard LaTeX spacing.
2026-02-10 14:59:26 -05:00
Vijay Janapa Reddi
76c1bb2dfc Merge branch 'dev' into feature/hardware-kits 2026-02-10 13:45:46 -05:00
Vijay Janapa Reddi
bc36e0de15 Merge branch 'dev' into feature/colab-notebooks 2026-02-10 13:45:39 -05:00
Vijay Janapa Reddi
9d840fc1a0 Merge branch 'dev' into feature/book-volumes 2026-02-10 13:12:34 -05:00
Vijay Janapa Reddi
7b43dc5ff5 Merge dev into feature/tinytorch-core 2026-02-10 13:10:48 -05:00
kai
f05bb12cb2 updated the iframe login issues 2026-02-10 10:25:11 -05:00
kai
1178d21600 flow with particles as new timeline opening 2026-02-09 17:46:03 -05:00
Vijay Janapa Reddi
9797b74707 Improves figure list generation for book builds
Refactors figure list generation to reliably locate and clear LaTeX manifest files.

- Searches for the figure manifest in both the quarto root and build output directory,
  handling cases where the post-render step moves the file.
- Clears stale manifests from both locations to avoid incorrect figure counts from
  previous builds.
- Moves the LaTeX manifest to the build output directory to keep the source
  tree clean.
- Updates the merge script to find the manifest dynamically.

This prevents issues where figure counts are mismatched due to outdated or
missing manifest files.
2026-02-09 15:33:45 -05:00
Vijay Janapa Reddi
20b8bb51a4 fix: restore black uppercase styling for part page titles 2026-02-09 10:58:12 -05:00
Vijay Janapa Reddi
224e6ad00e WIP: editorial updates across Vol 1/Vol 2 chapters and LaTeX config 2026-02-09 10:55:46 -05:00
kai
e95c9d96c7 updating antialiasing ant crawl issue...arxiv 2026-02-09 08:15:18 -05:00
Vijay Janapa Reddi
4dd1bf70aa Fix pre-commit issues: cross-refs, footnotes, unreferenced tables, SVG hook
- Fix broken cross-refs in training.qmd (em-dash parsed as part of ID)
- Remove footnote from table cell in ml_systems.qmd
- Add @tbl- references for 22 unreferenced tables across 5 files
- Comment out stale SVG prevention hook in pre-commit config
- Auto-fixes from bibtex-tidy, blank-line collapse, pipe-table prettify
2026-02-09 07:57:16 -05:00
Vijay Janapa Reddi
6dc90adf82 grammar pass 2026-02-09 07:36:59 -05:00
Vijay Janapa Reddi
1160cc55b3 page location 2026-02-09 07:09:54 -05:00
Vijay Janapa Reddi
c6784f7dc5 fixes 2026-02-09 05:55:56 -05:00
Vijay Janapa Reddi
924c0d43a9 commmit 2026-02-09 00:10:38 -05:00
Vijay Janapa Reddi
25f5fd40ed fix title numbers, part size etc. 2026-02-08 23:27:07 -05:00
Vijay Janapa Reddi
a532e3e031 commit 2026-02-08 23:22:01 -05:00
Vijay Janapa Reddi
53193bad5a fixes 2026-02-08 22:17:31 -05:00
Vijay Janapa Reddi
19911441d7 Add smooth gradient data bar and layer-colored wires to ML Systems Stack
The data bar now uses a smooth vertical gradient derived from the layer
intensities: each color stop matches the wire flowing into it, and PGF
interpolates between stops. This makes data's cross-cutting role visible
— two distant bright layers produce a gradient that stays warm across
the space between them, revealing skip connections through data.

Each wire's color matches its layer's intensity, showing how strongly
each layer plugs into the shared data bus. The About page now shows
three example stacks (HW Acceleration, Training, Responsible Engineering)
to illustrate how the lens shifts across chapters.
2026-02-08 19:33:48 -05:00
Vijay Janapa Reddi
881cf8852e Explain data bar gradient behavior in About page
Add prose explaining how the ML Systems Stack's data bar shading
reflects cross-layer data flow and skip connections, priming readers
to interpret the visual cue as they progress through chapters.
2026-02-08 19:26:09 -05:00
Vijay Janapa Reddi
5376f1ffc1 Editorial and formatting updates across Vol 1 chapters 2026-02-08 18:05:51 -05:00
Vijay Janapa Reddi
b43f8e887d Editorial pass across Vol 1 chapters and config
- Revise prose, index entries, and references across all 16 chapters
- Update quarto config (epub/html) for vol1 and vol2
- Add render_figures.py testing script
- Update inject_parts.lua filter and header-includes.tex
- Update notation, appendix_dam, and references.bib
- Remove vol1/vol2 foreword files
2026-02-08 17:18:42 -05:00