Commit Graph

1481 Commits

Author SHA1 Message Date
Vijay Janapa Reddi
704f7555fe footnotes: Vol1 targeted enrich/add/remove pass from quality audit
Restoration pass (selective, based on Three-Job Rule audit):
- introduction: restore fn-eliza-brittleness, fn-dartmouth-systems, fn-bobrow-student
- data_engineering: restore fn-soc-always-on (always-on island architecture)
- benchmarking: restore fn-glue-saturation (Goodhart's Law arc, 1-year saturation)

Group A surgical edits:
- nn_computation: remove fn-overfitting (Context=1, Tether=1 — only confirmed failure)
- training: strip dead etymology from fn-convergence-training, fn-hyperparameter-training
- model_serving: enrich fn-onnx-runtime-serving with 5–15% TensorRT throughput figure

Group B new footnotes:
- nn_computation: add fn-alexnet-gpu-split (GTX 580 3 GB ceiling → model parallelism lineage)
- responsible_engr: add fn-zillow-dam (D·A·M decomposition of $304M failure)
2026-02-24 08:40:01 -05:00
Vijay Janapa Reddi
08eb91f492 Merge pull request #1200 from harvard-edge/fix/ch13
Updated figures in chapter 13
2026-02-24 08:39:37 -05:00
Zeljko Hrcek
15f430206d Updated figures in chapter 13 2026-02-24 14:32:36 +01:00
Vijay Janapa Reddi
446d848fa8 vol2: finalize notation and formatting (standardized symbols, decimal units, and en-dash ranges) 2026-02-24 07:51:08 -05:00
Vijay Janapa Reddi
9f931da1ea vol2: comprehensive standalone transformation (Appendix A foundations review, progressive disclosure pass, and term decoupling) 2026-02-23 18:07:29 -05:00
Vijay Janapa Reddi
5b0b2235f3 vol2: comprehensive footnote pass (25+ new high-signal footnotes across 16 chapters) 2026-02-23 17:58:08 -05:00
Vijay Janapa Reddi
f6f98266a0 vol2: comprehensive transformation pass (P.I.C.O. refactor, archetypes, hardware trajectories) 2026-02-23 17:38:37 -05:00
Vijay Janapa Reddi
2d887c5778 vol1: content updates (intro, data_selection, nn_architectures, model_compression, appendix_machine, responsible_engr, foundations_principles) 2026-02-23 17:22:47 -05:00
Vijay Janapa Reddi
913c616177 vol1: add IDs to all principle callouts, use \ref in conclusion table and prose 2026-02-23 16:39:33 -05:00
Vijay Janapa Reddi
951669d356 fix: inline math × — dimensions as $N\times M$, multipliers as N$\times$
- Fix rendering: dimensions (e.g. 224×224) use single math span $N\times M$
- Revert multipliers to N$\times$ / N--M$\times$ per LaTeX convention
- Fix malformed $N\times$ M → $N\times M$ across vol1/vol2
- Add revert_times_multipliers.py (one-off) and fix_times_math.py (dimension-only)
- Update book-prose guidelines in .claude/rules (dimension vs multiplier)
2026-02-23 14:51:24 -05:00
Vijay Janapa Reddi
97e21d21ce Adds constants for book consistency
Introduces a set of constants to ensure consistency across the book's code and prose.

These constants include:
- Memory capacities, interconnect bandwidths, model sizes
- Useful measures (GiB, GB, second, etc.)
- Formatting tools
- Deployment tiers (cloud, edge, mobile)
2026-02-23 13:08:56 -05:00
Vijay Janapa Reddi
689b040fde Pull in PR #1199: Updated figure in chapter 11 (hw_acceleration war story) 2026-02-23 09:40:05 -05:00
Vijay Janapa Reddi
5247736ce3 Centralizes constants and formatting for consistency
Refactors various sections to utilize centralized constants and formatting functions, improving code maintainability and consistency across the book.

Specifically:

- Replaces hardcoded values with constants defined in `mlsys.constants`.
- Uses the `fmt` function for consistent number formatting.
- Removes redundant calculations and string conversions by leveraging existing functions and constants.
- Introduces a `TransformerScaling` namespace to encapsulate transformer scaling logic.
- Adds invariants (guardrails) to ensure calculations match the book's narrative.
- Refactors MNIST example and moves the inference calculation to MNISTInference.
- Integrates responsible AI principles with lifecycle stages.

This reduces code duplication and ensures a unified representation of key parameters and calculations throughout the book.
2026-02-23 09:33:35 -05:00
Vijay Janapa Reddi
a392f073af fix(vol2): apply book-prose rules — section opener, contractions, leverage/utilize 2026-02-22 19:03:42 -05:00
Vijay Janapa Reddi
5005c14cd6 style(prose): eliminate 'the fact that' where possible (book-prose)
- Replace with 'that' or rephrase clause as subject; fix one remaining But→However in nn_architectures
2026-02-22 19:00:37 -05:00
Vijay Janapa Reddi
f661814f4c style(prose): fix sentence-initial But/And/Or (book-prose)
- Replace But with However or rephrase; And with Furthermore/restructure; Or with Alternatively where appropriate
2026-02-22 18:59:48 -05:00
Vijay Janapa Reddi
c9959e4689 style(prose): expand contractions in body prose (book-prose)
- can't→cannot, don't→do not, it's→it is, won't→will not, etc.
- Skip code/check()/comments; fix narrative and callouts only
2026-02-22 18:58:39 -05:00
Vijay Janapa Reddi
f4a006ce71 style(prose): apply book-prose rules across vol1 and vol2
- Replace recap-style openers (Having established… we now turn to)
- Replace section meta-openers (This section examines/presents…) with concrete openings
- Remove announcement transitions (We will examine, we now turn to)
- Remove Importantly/Most importantly at sentence start
- Remove In summary, bleeding edge, the lesson is clear
- Replace leverage/utilize (verb) with use; keep high-leverage
- Replace building upon with building on; remove as noted there
- Sample fixes: can't→can we not, it's→it is, So,→Thus, (contractions/sentence-openers)
2026-02-22 18:57:12 -05:00
Vijay Janapa Reddi
ca33f2f758 chore: checkpoint staged state before prose-style audit fixes 2026-02-22 18:47:52 -05:00
Vijay Janapa Reddi
3bde64caf0 refactor: gold-standard footnote overhaul across all 30 Vol1+Vol2 chapters
- Rewrote ~1,026 footnotes to MIT Press gold standard (ML Systems Tether,
  Three-Question Audit, Five Types A-E)
- Fixed 16 cross-chapter duplicate fn- keys with chapter-specific suffixes
- Pruned footnotes that failed Three-Question Audit (prerequisites,
  navigation aids, tool catalog entries)
- Restored fn-goodharts-law with Strathern attribution and ML failure modes
- Added 9 gold-standard footnotes to performance_engineering.qmd (previously zero)
2026-02-22 18:31:50 -05:00
Vijay Janapa Reddi
4ac473278e Adds citations and clarifies energy/scaling laws
Adds missing citations and clarifies the text in the appendix on machine learning,
specifically around the energy hierarchy and scaling laws. It also updates the
fault tolerance section to include a reference to the backpropagation paper.
2026-02-22 16:11:26 -05:00
Vijay Janapa Reddi
15a7ef57fa fix: prose edits — index placement, definition titles, dimension spacing
- introduction: consolidate index tags, fix 224×224 spacing, definition callout titles
- data_selection, fault_tolerance, vol2 intro, responsible_ai, robust_ai: misc prose fixes
2026-02-22 14:01:43 -05:00
Vijay Janapa Reddi
4d53b7af4d Merge remote-tracking branch 'origin/feature/book-volumes' into feature/book-volumes 2026-02-22 14:00:56 -05:00
Vijay Janapa Reddi
aff8a0fc0d fix: × consistency — compound OK for a×b, LaTeX in prose/tables, Unicode only in fig-alt
- book-prose: allow compound × for simple products; require × alone only when
  followed by word/unit; Unicode × only in fig-alt
- Revert split × back to compound (e.g. $3 \times 10^{-4}$)
- data_engineering: 8× A100 → 8$\times$ A100 (LaTeX in table)
- appendix_dam: Python outputs use LaTeX ×
- hw_acceleration: table dimensions use compound math ($4\times4\times4$)
- benchmarking: fix Python equation string
2026-02-22 14:00:34 -05:00
Vijay Janapa Reddi
bee7db3a22 Merge pull request #1197 from harvard-edge/fix/ch10
Updated figures in chapter 10: model_compression
2026-02-22 13:09:20 -05:00
Vijay Janapa Reddi
95956dee3c Scales cover images to 100% width
Ensures cover images in Vol. 2 chapters fill the available width, improving visual presentation across different screen sizes.

Removes duplicate cover image from the introduction chapter.

Corrects a typographical error in Appendix Machine regarding energy ratios.
2026-02-22 12:48:37 -05:00
Vijay Janapa Reddi
77d0081e38 Refactors build process and validation logic
Refactors the build process to leverage shared output file resolution logic, ensuring consistency across build and debug commands.

Improves validation by streamlining bibliography handling and adding stricter citation matching.

Updates diagram dependencies and adjusts content for clarity and accuracy.
2026-02-22 12:06:46 -05:00
Zeljko Hrcek
4884d40b76 Updated figures in chapter 10: model_compression 2026-02-22 18:00:03 +01:00
Vijay Janapa Reddi
e9171b1379 fix: remove duplicate figure captions in vol2
Figures should have caption only in fig-cap attribute, not duplicated
as trailing text. Removed redundant captions from:
- introduction.qmd: fig-loss-vs-n-d, fig-data-scaling-regimes, fig-scaling-regimes
- sustainable_ai.qmd: fig-datacenter-energy-usage
2026-02-22 11:18:32 -05:00
Vijay Janapa Reddi
1a22405288 fix(vol2): correct fenced div closers (:::: → :::) in security_privacy 2026-02-22 10:31:21 -05:00
Vijay Janapa Reddi
e1a667e06f refactor(vol2): convert bold pseudo-headers in collective_communication and robust_ai
- collective_communication: Torus Topology (TPU Pods), Rail-Optimized Routing (NVIDIA DGX) → ####
- robust_ai: Conceptual Foundation, Fast Gradient Sign Method (FGSM) → ######
2026-02-22 10:09:35 -05:00
Vijay Janapa Reddi
1d087503a0 refactor(vol2): convert bold pseudo-headers to proper headers per book-prose rules
- inference: Pattern 1/2/3, Example 8-way tensor parallelism
- sustainable_ai: Hardware/Mobile/Edge measurement, Cascade/Wake-word/Federated
  patterns, TinyML stack, MLPerf benchmarks, Energy Delay Product
- edge_intelligence: Peak Memory Usage, Convergence/Non-IID/Heterogeneity,
  Communication-Computation Trade-off, When Does FL Work?
- ops_scale, fault_tolerance, security_privacy: prior bold-to-header conversions
2026-02-22 10:05:33 -05:00
Vijay Janapa Reddi
266079c816 Enables appendices in PDF output
Uncomments the appendices section in the PDF configuration
file to ensure that appendices are included in the PDF output.
2026-02-22 09:29:45 -05:00
Vijay Janapa Reddi
bccc4d2646 Misc: quarto config, vol2 chapters, vscode-ext utils, remove site_libs clipboard 2026-02-21 19:45:46 -05:00
Vijay Janapa Reddi
4053b73384 Vol2 Fleet Stack: remove vertical line, center three-column example 2026-02-21 19:44:18 -05:00
Vijay Janapa Reddi
f0ddc607d6 Improve vol2 Fleet Stack: subtitles, Part labels, Distribution icon, line wraps 2026-02-21 19:34:05 -05:00
Vijay Janapa Reddi
f44ead20bf Standardize cover images across Vol1 and Vol2; fix Vol2 PDF config
- Cover images: no caption, no fig label, consistent images/ path, fig-alt for all
- Vol1: remove captions from conclusion, data_selection
- Vol2: remove half-title, fix intro/ conclusion/ fleet_orchestration covers;
  add fig-alt to 11 chapters; fix robust_ai path ./images/ -> images/
- Vol2 PDF: use before-body-includes.tex (match Vol1, no half-title)
2026-02-21 19:25:27 -05:00
Vijay Janapa Reddi
40d606fda0 Match Vol2 PDF config to Vol1; sync about.qmd format blocks
- Vol2 PDF: remove half-title, disable lof/lot/lol, toc/number-depth 2, align titlepage
- Vol2 about.qmd: add Beyond This Book and Using This Book supplementary blocks
2026-02-21 19:13:40 -05:00
Vijay Janapa Reddi
17117adc70 fix(vol2): use ETH Zurich Blue intensity gradient for Fleet Stack diagrams
Replace four distinct colors (Brown, Blue, Green, Red) with ETHZ Blue
intensity gradient (25%→50%→75%→100%) in fig-fleet-stack and
fig-vol2-roadmap, matching vol1 mlsysstack crimson gradient pattern.
2026-02-21 19:07:08 -05:00
Vijay Janapa Reddi
f954de69d2 fix: replace directional figure/table refs with explicit @tbl- cross-refs
Replace 'above'/'below' references with stable @tbl- and @fig- IDs
to avoid broken refs when content or layout changes.

Vol 1: model_compression.qmd - deployment gap table
Vol 2: collective_communication, compute_infrastructure, introduction,
       ops_scale
2026-02-21 19:00:36 -05:00
Vijay Janapa Reddi
b1d7fa6778 docs: refactor all 134 definitions across Vol 1 & 2 to Platinum Standard template 2026-02-21 18:54:57 -05:00
Vijay Janapa Reddi
8f6950a257 feat(pdf): align cover layout across volumes, add logo recolor script
- Vol 2: reference/citation at document end, sky-blue logo, cover image position
- Vol 1: match cover image position (bg-image-left 0.175, bg-image-bottom 8)
- Add recolor_cover_logo.py for hue-shift variants of cover logo
2026-02-21 16:20:05 -05:00
Vijay Janapa Reddi
417f47722a fix(pdf): align Vol 2 reference/citation location with Vol 1 (document) 2026-02-21 15:59:29 -05:00
Vijay Janapa Reddi
218ad6ad93 style(tables): use • and <br> for list cells in pipe tables
- edge_intelligence: Constraint-Solution Mapping (•&nbsp; → •<br>)
- security_privacy: Defense Selection Framework (- Item → •<br>)
- sustainable_ai: Critical Materials (semicolons → •<br>)

Consistent with hw_acceleration pattern for HTML/PDF/EPUB.
2026-02-21 15:58:32 -05:00
Vijay Janapa Reddi
b4c86de3f1 refactor(figures): div wrapper pattern, responsive CSS, remove redundant labels
- Wrap Python figures in div with fig-env, fig-pos, fig-cap, fig-alt
- Remove #| label from blocks when div has #fig-xxx
- Add responsive figure CSS (max-width, height: auto) for HTML
- Add figure headers to Python blocks (Context, Goal, Show, How, Imports, Exports)
2026-02-21 15:52:26 -05:00
Vijay Janapa Reddi
99661315eb feat(pdf): pipe table cell line breaks with <br> and makecell
- Add Lua filter to convert <br> in table cells to \makecell for PDF
- Use pipe table with • and <br> in hw_acceleration hardware evolution table
- Add makecell package; set arraystretch to 1.6; top-align makecell cells
- Register filter in PDF config
2026-02-21 15:50:37 -05:00
Vijay Janapa Reddi
eaa545f115 docs: add documentation-style headers to Python figure blocks
Add Context/Goal/Show/How/Imports/Exports headers to all Python figure
blocks (#| label: fig-*) in Vol 1 and Vol 2, matching the setup-block
pattern. Headers placed after Quarto options and before imports.
2026-02-21 14:44:24 -05:00
Vijay Janapa Reddi
b756cb7da3 fix: vscode extension activation error handling and workspace detection
- extension.ts: wrap activate() body in try/catch so activation failures
  surface in the Output channel instead of crashing silently
- workspace.ts: return undefined when no book/binder marker is found
  instead of returning the first workspace folder unconditionally
2026-02-21 14:33:43 -05:00
Vijay Janapa Reddi
9e809d21c4 feat: full-stack Pint robustness and class-based namespace isolation
Python library (mlsys/):
- constants.py: add ureg.default_format, set_application_registry, MS alias comment
- formatting.py: isinstance checks, add fmt_full(), fmt_split(), .m_as() modernization
- formulas.py: fleet formulas return Quantity, @ureg.check() decorators, .m_as() everywhere
- hardware.py: dimension-first validation in __post_init__, Quantity[float] annotations
- models.py: __post_init__ dimension checks, size_in_bytes() enforcement, ureg.count→ureg.param
- test_units.py: +50 robustness tests (wrong-unit HardwareSpec, fleet formulas, fmt_full)
- validate_pint_usage.py: new static analysis script for Pint anti-patterns in QMD files
- transform_pico_cells.py: transformation script for PICO cell restructuring

QMD chapters (Vol1 + Vol2 — all 43 chapters with Python cells):
- Wrapped all Python compute cells in class-based namespace isolation (PICO pattern)
- Added EXPORTS bridges so class-internal values are accessible to prose inline Python
- Modernized .to(unit).magnitude → .m_as(unit) throughout
- Removed bare .magnitude calls; all unit extractions now explicit
- Fleet appendices (appendix_fleet, appendix_communication, appendix_reliability):
  full Quantity-return cascade for MTBF, AllReduce, Young-Daly, checkpoint formulas

All 43 chapters verified building cleanly (HTML) after changes.
2026-02-21 14:33:36 -05:00
Vijay Janapa Reddi
b887b91a2c fix: resolve cross-cell export gaps found during comprehensive HTML build verification
After the class-based namespace isolation pass, missing EXPORTS bridge
variables were discovered by running all chapters through the HTML build pipeline.

Vol1 fixes:
- nn_computation: add hog_grid_str/hog_bins_str exports; convert generator
  expressions to for-loops (Python 3 class scope skips class namespace);
  add mnist_large/small_l1/l2 exports for footnote inline Python
- ml_systems: add cloud_compute/memory/ai_frac, mobile_tops/bw/ratio/
  bottleneck/compute/memory_frac, cloud_thresh_bw_str, edge_thresh_bw_str
  exports; complete ResnetMobile EXPORTS section
- data_selection: fix FpScalingCalc invariant (min_samples_threshold 50→150
  so 100 expected rare samples < 150 threshold holds true)
- model_compression: FusionCalc bandwidth_reduction invariant 50→40%
- nn_architectures: add 'param' unit to lighthouse-table-specs imports

Vol2 fixes:
- data_storage: add missing 'watt' import to chapter setup cell
- fault_tolerance: export per_node_gbs raw float for prose arithmetic
- appendix_fleet: export rho_7b raw float for fmt() call in prose
- appendix_c3: add .magnitude to calc_effective_flops() result (returns
  Quantity since formulas.py upgrade, not raw float)
- appendix_reliability: wrap worked-example-young-daly in class with EXPORTS

All 43 chapters with Python cells verified passing after fixes.
2026-02-21 14:20:43 -05:00