Skip to content

harvard-edge/cs249r_book

Repository files navigation

Machine Learning Systems

Principles and Practices of Engineering Artificially Intelligent Systems

Book TinyTorch Updated License Cite Fund Us

📖 Read Online🔥 TinyTorch📄 Download PDF📓 Download EPUB🌐 Explore Ecosystem

📚 Hardcopy edition coming 2026 with MIT Press.


About This Project

This repository contains an open source textbook and hands-on framework for learning how to engineer AI systems. It began in Harvard's CS249r course by Prof. Vijay Janapa Reddi. Today, it supports classrooms, study groups, and independent learners around the world.

Mission: Accessible AI systems education for anyone, anywhere.

What's Here

Read → Experiment → Build

Component Description Getting Started
📖 Book The Machine Learning Systems textbook that walks through design, optimization, deployment, edge computing, and responsible AI in a clear, end-to-end way book/README.md
🔥 TinyTorch A from-scratch ML framework that lets you build the full stack yourself, piece by piece, and learn how real systems work under the hood tinytorch/README.md
🔮 Lens Hands-on Colab simulations that let you experiment with ML systems, explore tradeoffs, and see how design decisions ripple through a working microchamber Coming in Summer 2026

What You Will Learn

This textbook teaches you to think at the intersection of machine learning and systems engineering. Each chapter bridges algorithmic concepts with the infrastructure that makes them work in practice.

The ML ↔ Systems Bridge

ML Concept Systems Concept What You Learn
Model parameters Memory constraints How to fit large models on resource-limited devices
Inference latency Hardware acceleration How GPUs, TPUs, and accelerators execute neural networks
Training convergence Compute efficiency How mixed-precision and optimization techniques reduce cost
Model accuracy Quantization and pruning How to compress models while preserving performance
Data requirements Pipeline infrastructure How to build efficient data loading and preprocessing
Model deployment MLOps practices How to monitor, version, and update models in production
Privacy constraints On-device learning How to train and adapt models without sending data to the cloud

Book Structure

Part Focus Chapters
I. Foundations Core concepts Introduction, ML Systems, DL Primer, Architectures
II. Design Building blocks Workflow, Data Engineering, Frameworks, Training
III. Performance Making it fast Efficient AI, Optimizations, HW Acceleration, Benchmarking
IV. Deployment Making it work MLOps, On-device Learning, Privacy, Robustness
V. Trust Making it right Responsible AI, Sustainable AI, AI for Good
VI. Frontiers What's next Emerging trends and future directions

What Makes This Book Different

This project is a living textbook. I keep it updated as the field grows, with community input along the way.

AI may feel like it is moving at lightning speed, but the engineering building blocks that make it work do not change as quickly as the headlines. This book is built around those stable foundations.

Think of it like LEGO. New sets arrive all the time, but the bricks themselves stay the same. Once you learn how the bricks fit together, you can build anything. Here, those "AI bricks" are the solid systems principles that make AI work.

Whether you are reading a chapter, running a lab, or sharing feedback, you are helping make these ideas more accessible to the next learner.

Thank you for being a part of the story.


Why This Project Exists

Students learn how to train ML models, but few are taught how to engineer the systems that make those models useful in practice. As AI capabilities grow, progress will depend less on developing new algorithms and more on developing the engineers who can design scalable, efficient, and responsible systems that bring those algorithms to life.

This project is part of a broader personal mission to educate one million learners worldwide in the foundations of AI systems engineering. The long term impact of AI will be shaped by a generation of engineers and builders who know how to turn ideas into working systems.

— Vijay Janapa Reddi


Start Here

For Readers:

  1. Read Chapter 1 and the overview
  2. Skim the Benchmarking chapter to know what to measure
  3. Pick a TinyML kit and run a lab

For Builders:

  1. Clone this repo and explore TinyTorch
  2. Start with Module 01 (Tensors) and build your way up
  3. Train a CNN on CIFAR-10 with code you wrote from scratch

For Everyone:


Support This Work

We are tracking our way to 1 million learners by 2030. Every star, share, and contribution helps us get there.

Why GitHub Stars Matter

What gets measured gets done. Every star represents a learner or believer in accessible AI education.

Stars

Star History Chart

1 ✓ → 10 ✓ → 100 ✓ → 1,000 ✓ → 10,000 ✓ → 100,000 by 2026 → ... → 1M by 2030

Fund the Mission

All contributions go to Open Collective, a transparent fund that supports educational outreach: TinyML system kits, workshops, and infrastructure for learners worldwide.

Open Collective


Community and Resources

Resource Description
📖 Textbook Interactive online textbook
🔥 TinyTorch Educational ML framework (Early Access)
🌐 Ecosystem Resources, workshops, and community
💬 Discussions Questions and ideas

Contributing

We welcome contributions to both the book and TinyTorch!

I want to... Go here
Fix a typo or improve a chapter book/docs/CONTRIBUTING.md
Add a TinyTorch module or fix a bug tinytorch/CONTRIBUTING.md
Report an issue GitHub Issues
Ask a question GitHub Discussions

Quick Start

For Readers

# Read online
open https://mlsysbook.ai

# Download PDF
curl -O https://mlsysbook.ai/pdf

# Download EPUB
curl -O https://mlsysbook.ai/epub

For Book Contributors

cd book

# First time setup
./binder setup
./binder doctor

# Daily workflow
./binder clean
./binder build
./binder preview intro

For TinyTorch Learners

cd tinytorch

# One-command setup
tito setup
source .venv/bin/activate

# Start building
tito module start 01

See book/README.md and tinytorch/README.md for detailed instructions.


Citation & License

Citation

@inproceedings{reddi2024mlsysbook,
  title        = {MLSysBook.AI: Principles and Practices of Machine Learning Systems Engineering},
  author       = {Reddi, Vijay Janapa},
  booktitle    = {2024 International Conference on Hardware/Software Codesign and System Synthesis (CODES+ ISSS)},
  pages        = {41--42},
  year         = {2024},
  organization = {IEEE},
  url          = {https://mlsysbook.org}
}

License

  • Book content: Creative Commons Attribution–NonCommercial–ShareAlike 4.0 International (CC BY-NC-SA 4.0)
  • TinyTorch code: MIT License

Contributors

Thanks goes to these wonderful people who have contributed to making this resource better for everyone:

Vijay Janapa Reddi
Vijay Janapa Reddi

Zeljko Hrcek
Zeljko Hrcek

Marcelo Rovai
Marcelo Rovai

Jason Jabbour
Jason Jabbour

Ikechukwu Uchendu
Ikechukwu Uchendu

Kai Kleinbard
Kai Kleinbard

Naeem Khoshnevis
Naeem Khoshnevis

Sara Khosravi
Sara Khosravi

Douwe den Blanken
Douwe den Blanken

Jeffrey Ma
Jeffrey Ma

Didier Durand
Didier Durand

shanzehbatool
shanzehbatool

Elias
Elias

Jared Ping
Jared Ping

Itai Shapira
Itai Shapira

Maximilian Lam
Maximilian Lam

Jayson Lin
Jayson Lin

Andrea
Andrea

Sophia Cho
Sophia Cho

Alex Rodriguez
Alex Rodriguez

Korneel Van den Berghe
Korneel Van den Berghe

Nimo
Nimo

Colby Banbury
Colby Banbury

Zishen Wan
Zishen Wan

Mark Mazumder
Mark Mazumder

Divya Amirtharaj
Divya Amirtharaj

Srivatsan Krishnan
Srivatsan Krishnan

Abdulrahman Mahmoud
Abdulrahman Mahmoud

Haoran Qiu
Haoran Qiu

Aghyad Deeb
Aghyad Deeb

marin-llobet
marin-llobet

Gabriel Amazonas
Gabriel Amazonas

Michael Schnebly
Michael Schnebly

Thuong Duong
Thuong Duong

oishib
oishib

Emil Njor
Emil Njor

Aditi Raju
Aditi Raju

ELSuitorHarvard
ELSuitorHarvard

Jared Ni
Jared Ni

Henry Bae
Henry Bae

Jae-Won Chung
Jae-Won Chung

Eimhin Laverty
Eimhin Laverty

Yu-Shun Hsiao
Yu-Shun Hsiao

Matthew Stewart
Matthew Stewart

jianqingdu
jianqingdu

Jennifer Zhou
Jennifer Zhou

Marco Zennaro
Marco Zennaro

Pong Trairatvorakul
Pong Trairatvorakul

Shvetank Prakash
Shvetank Prakash

Andrew Bass
Andrew Bass

Emeka Ezike
Emeka Ezike

Eura Nofshin
Eura Nofshin

Arya Tschand
Arya Tschand

Tauno Erik
Tauno Erik

Fatima Shah
Fatima Shah

Tess314
Tess314

The Random DIY
The Random DIY

Sercan Aygün
Sercan Aygün

Gauri Jain
Gauri Jain

Fin Amin
Fin Amin

Allen-Kuang
Allen-Kuang

Bruno Scaglione
Bruno Scaglione

Alex Oesterling
Alex Oesterling

TheHiddenLayer
TheHiddenLayer

gnodipac886
gnodipac886

Abenezer Angamo
Abenezer Angamo

Aritra Ghosh
Aritra Ghosh

abigailswallow
abigailswallow

अरनव शुक्ला | Arnav Shukla
अरनव शुक्ला | Arnav Shukla

Yang Zhou
Yang Zhou

yanjingl
yanjingl

Jahnic Beck
Jahnic Beck

Baldassarre Cesarano
Baldassarre Cesarano

happyappledog
happyappledog

Jason Yik
Jason Yik

Jessica Quaye
Jessica Quaye

Emmanuel Rassou
Emmanuel Rassou

Andy Cheng
Andy Cheng

Cursor Agent
Cursor Agent

Bilge Acun
Bilge Acun

Shreya Johri
Shreya Johri

Sam Wilcock
Sam Wilcock

Sonia Murthy
Sonia Murthy

Costin-Andrei Oncescu
Costin-Andrei Oncescu

formlsysbookissue
formlsysbookissue

Annie Laurie Cook
Annie Laurie Cook

Vijay Edupuganti
Vijay Edupuganti

Jothi Ramaswamy
Jothi Ramaswamy

Batur Arslan
Batur Arslan

Curren Iyer
Curren Iyer

Fatima Shah
Fatima Shah

Edward Jin
Edward Jin

Tess Watt
Tess Watt

bluebaer7
bluebaer7

a-saraf
a-saraf

songhan
songhan

jvijay
jvijay

Zishen
Zishen


⭐ Star us on GitHub💬 Join discussions🌐 Visit mlsysbook.ai

Built with dedication by the MLSysBook community.