Skip to content

Improve BabyTorch correctness, book structure, and print editions - #5

Draft
amjadmajid wants to merge 3 commits into
mainfrom
codex/book-production-revision
Draft

Improve BabyTorch correctness, book structure, and print editions#5
amjadmajid wants to merge 3 commits into
mainfrom
codex/book-production-revision

Conversation

@amjadmajid

Copy link
Copy Markdown
Owner

What changed

  • fixes repeated-backward accumulation so leaf gradients accumulate without reusing stale intermediate gradients
  • corrects Adam/AdamW bias correction for parameters that start receiving gradients later
  • hardens optimizer, scheduler, DataLoader, and BPE validation, including symbol-safe BPE merging and strict unknown-token handling
  • adds regression tests for the corrected behavior
  • gives every English chapter explicit learning goals and key takeaways
  • adds a preface, PyTorch migration appendix, glossary, and primary-source reading list
  • corrects overstatements around PyTorch parity, production GPT tokenization, PPO, and RLHF in the book and tutorials
  • improves the corresponding Arabic explanations
  • adds reproducible 6×9-inch print interiors with front matter, contents, part dividers, embedded fonts, figure conversion, running heads, and RTL-aware Arabic layout
  • reduces the Arabic body typography to 9.5pt with tighter leading following review feedback

Why

The repository already had a strong educational sequence, but several correctness edge cases and production-layout weaknesses undermined its promise that the implementation, tests, and book agree. The revision makes the code safer, the explanations more precise, and both language editions suitable for print.

Validation

  • 202 tests collected: 200 passed, 2 hardware-dependent GPU tests skipped
  • snippet drift guard passes for English and Arabic
  • no broken local links in the manuscript
  • English PDF: 124 pages, 6×9-inch trim
  • Arabic PDF: 115 pages, 6×9-inch trim
  • fonts embedded and representative/all-page visual sweeps completed
  • git diff --check, Python compilation, and shell syntax checks pass

Generated PDFs remain ignored build artifacts; the reproducible sources and build pipeline are included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant