Skip to the content.

Free Programming Books: AI, Machine Learning, Deep Learning and LLMs (Legally Free)

A curated index of legally free books on artificial intelligence, machine learning, deep learning, large language models (LLMs), reinforcement learning, math for machine learning and data science, grouped by level from beginner to research. Every entry is published free of charge by its authors or publisher (author websites, open-access editions, arXiv, official online versions), so you can read them without pirate PDF sites. It is for self-taught learners, students and engineers moving into AI.

Last reviewed: December 2026. “Free” here means free to read online or download from an official source at the time of review. Many of these books are also sold in print; buying a copy is a nice way to support the authors.


Table of Contents


How to Use This List

Entry format:

[Title](link) - Authors. Tags. What it is good for.


What Counts as Legally Free

A book is listed only if at least one of these is true:

  1. The author or publisher hosts the full text for free on an official site (for example the book’s own website or the author’s university page).
  2. The book is published under an open license (for example Creative Commons) or as an open-access edition.
  3. The full text is posted by the authors on arXiv.
  4. It is a public-domain work hosted by a reputable archive such as Project Gutenberg.

Not listed: books that only offer a free sample chapter, books behind a free trial, and “free PDF” uploads by third parties. If a link here ever points to an unofficial copy, please open an issue.


Suggested Reading Paths

Path A: Software developer to ML engineer (about 6 months)

  1. Python Data Science Handbook (data tools)
  2. An Introduction to Statistical Learning, Python edition (classic ML)
  3. Dive into Deep Learning or Deep Learning with Python (deep learning, hands-on)
  4. Machine Learning Systems (deploying and operating ML)
  5. Foundations of Large Language Models (LLMs)

Path B: Math-first, aiming for research (about 12 months)

  1. Mathematics for Machine Learning
  2. Introduction to Probability (Blitzstein and Hwang)
  3. Pattern Recognition and Machine Learning or Probabilistic Machine Learning: An Introduction
  4. Understanding Deep Learning
  5. Understanding Machine Learning: From Theory to Algorithms or Learning Theory from First Principles

Path C: Data analyst to data scientist (about 4 months)

  1. R for Data Science or Python for Data Analysis
  2. Introduction to Modern Statistics
  3. An Introduction to Statistical Learning
  4. Forecasting: Principles and Practice
  5. Causal Inference for the Brave and True

Path D: LLM and generative AI engineer (about 4 months)

  1. Neural Networks and Deep Learning (Nielsen), for intuition
  2. Understanding Deep Learning, chapters on transformers and diffusion
  3. Speech and Language Processing, chapters on transformers and LLMs
  4. Foundations of Large Language Models
  5. Reinforcement Learning from Human Feedback (Lambert)
  6. The Ultra-Scale Playbook and How to Scale Your Model

Level 0: Prerequisites

Programming for Data and ML

Math Refreshers


Level 1: Beginner

First Machine Learning Books

First Deep Learning Books

Data Science with Python and R

Probability and Statistics

Linear Algebra and Calculus for ML


Level 2: Intermediate

Core Machine Learning Textbooks

Deep Learning Textbooks

Natural Language Processing and LLMs

Computer Vision

Reinforcement Learning

Bayesian and Probabilistic Machine Learning

Causal Inference

Time Series and Forecasting

Interpretability, Fairness and AI Safety

ML Engineering and Systems

Classic AI (Search, Planning, Agents)


Level 3: Advanced

Learning Theory

Optimization

Generative Models and Diffusion

Training and Scaling LLMs

Advanced Reinforcement Learning

Graph and Geometric Deep Learning

Robotics

Scientific Machine Learning


Level 4: Research Monographs and Theory of Deep Learning


Interview Preparation


How to Read a Technical Book Without Giving Up

  1. Read the table of contents and the preface first. Authors usually say which chapters you can skip.
  2. Do a fast first pass of each chapter (skim figures, headings and summaries), then a slow second pass with pen and paper.
  3. Re-derive one key result per chapter by hand. If the book has code, re-implement one algorithm without looking.
  4. Do at least three exercises per chapter. Exercises are where understanding is tested.
  5. Keep a one-page summary per chapter in your own words. These pages become your personal cheat sheet.
  6. Pair a book with a course that covers the same material, for example ISL with its authors’ lectures, or Sutton and Barto with a university RL course.
  7. Stop and backfill. If a chapter needs math you do not have, take a week with a Level 0 or Level 1 math book, then return.

Contributing

Pull requests are welcome. Please keep entries accurate:

License

This list is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). The books themselves belong to their authors and publishers and keep their own licenses.

If this helped you, a star helps others find it.

More free resources

Part of the Ralpberry Labs open-source collection. See also Top 100 Open Source.