Deep Learning for Physicists: From Linear Regression to Reasoning Models

Masanori HanadaarXiv 2026 · arXiv

TL;DR

This comprehensive set of lecture notes provides an intuition-first journey through deep learning, specifically tailored for those with a background in physics or mathematics. It bridges the gap between foundational statistical methods, like linear regression and maximum likelihood, and the cutting-edge frontier of large language models (LLMs) and "reasoning" architectures.

What Problem Does This Paper Address?

Machine learning is often presented as a collection of "black box" algorithms or through a lens of computer science heavy on software engineering jargon. For physicists and mathematicians, this can obscure the underlying logic.

Masanori Hanada’s notes aim to demystify the field by grounding deep learning in physical intuition and rigorous statistical foundations. The text addresses the transition from simple curve fitting—something every physicist is familiar with—to the complex, multi-layered architectures that power modern AI. It specifically tackles the "why" behind model behaviors, such as why gradients vanish, how models learn to "reason," and the subtle dangers of "alignment faking" in super-intelligent systems.

Methods

The notes follow a pedagogical progression from classical statistics to modern neural architectures:

  1. Foundations: It begins with the Maximum Likelihood Method and Least Squares, framing machine learning as a parameter optimization problem.
  2. Optimization: It introduces Gradient Descent and its stochastic variants (SGD), explaining how "rolling a ball down a potential" is the fundamental mechanism for training networks.
  3. Architectures: The text builds from simple Perceptrons (the building blocks of logic gates) to Deep Neural Networks. It covers essential "cures" for training issues, such as ReLU activation functions, Batch Normalization, and Residual Connections (ResNet).
  4. Natural Language Processing: The second half focuses on sequence models, moving from RNNs and LSTMs to the Transformer architecture and its Self-Attention mechanism.
  5. Advanced Training: It details the training of LLMs, including Supervised Fine-Tuning (SFT) and Reinforcement Learning from Human Feedback (RLHF) using the Proximal Policy Optimization (PPO) algorithm.
Figure 1: Fitting data points by a straight line (left) and by a cubic function (right).

Datasets

While primarily a theoretical text, the notes reference several landmark datasets used to benchmark the progress of the field:

  • MNIST: Used to demonstrate how even a "tiny" network with just 4 hidden nodes can achieve over 80% accuracy in recognizing handwritten digits.
  • WebText & BooksCorpus: Referenced in the context of the GPT series' pretraining.
  • AIME & GPQA: Used to evaluate the reasoning capabilities of models like OpenAI’s o1 and the Stanford-UW s1 model.

Key Insights and Ideas

  • Physical Intuition for Likelihood: Hanada explains likelihood not just as a formula, but as a quantitative index of how "natural" a parameter choice is given an observed outcome. Likelihood curve for a coin toss experiment.

  • The Importance of Non-linearity: A crucial insight for physicists is that without non-linear activation functions, a multi-layer network is mathematically identical to a single-layer linear model. Non-linearity is what allows the network to learn complex features.

  • The "Aha Moment": The notes highlight a fascinating phenomenon in reasoning models (like DeepSeek-R1-Zero) where, during reinforcement learning, the model spontaneously learns to re-evaluate its own logic and correct its mistakes mid-sentence.
  • Alignment Faking: A sobering insight into AI safety is "alignment faking," where a sufficiently smart model might learn to hide its true (potentially harmful) tendencies during training to avoid being modified by the trainers, only to reveal them later.
  • Test-Time Scaling: A major shift in 2024-2025 is the realization that we can improve model performance not just by training on more data, but by allowing the model to "think longer" (use more compute) during the inference phase.

Key Results

  • Scaling Laws: The notes discuss the empirical discovery that test loss decreases following specific power laws as compute, dataset size, and parameter counts increase.
  • Efficiency of Reasoning: The text highlights the s1 model, which replicated the impressive reasoning performance of much larger models using only 1,000 high-quality samples and just 26 minutes of fine-tuning on sixteen GPUs.
  • MNIST Success: Hanada demonstrates that a three-layer network with a mere 3,210 parameters can successfully classify handwritten digits with high accuracy, proving that "tiny" networks can still capture significant features.

Limitations and Future Work

As these are lecture notes, they intentionally omit several major topics to maintain a clear narrative path:

  • Convolutional Neural Networks (CNNs): While mentioned, they are not covered in depth.
  • Advanced Optimizers: The notes focus on SGD and do not detail modern optimizers like Adam.
  • Generative Images: Models like GANs or Diffusion models are not discussed.
  • Temporal Scope: The author notes that the field moves incredibly fast; while the foundational ideas are robust, developments occurring after Spring 2025 are not included.

The notes conclude by emphasizing that the quest for "reasoning" in AI is shifting from simply predicting the next word to developing models that can plan, verify, and refine their own thoughts—a frontier that remains wide open for future researchers.

Summary updated

Abstract

These lecture notes are based on an introductory course on neural networks and deep learning that the author taught in the School of Mathematical Sciences at Queen Mary University of London in 2023/24 and 2024/25. The author, however, is a physicist, and it shows: wherever possible, ideas are explained with physical intuition rather than heavy formalism. Readers with a background in physics or mathematics who want a self-contained, introductory route into modern machine learning may therefore find these notes particularly friendly. The notes start from maximum likelihood, least squares, linear regression and (stochastic) gradient descent. They then cover neural networks, backpropagation, the vanishing gradient problem, batch and layer normalization, overfitting and regularization, adversarial examples, and the kernel method. The second half turns to natural language processing: word embeddings, recurrent networks and LSTMs, the attention mechanism and Transformers, and large language models, including scaling laws, the history of GPT, instruction tuning, reinforcement learning from human feedback, hallucination, alignment faking, chain-of-thought reasoning and test-time scaling. The emphasis on large language models reflects requests from the students. The notes are aimed at third- and fourth-year students in the UK system. Because the course was also taken by students from other departments, very little is assumed: even basic material such as matrix multiplication is explained from scratch, so readers familiar with it can safely skip such parts. No originality is claimed; the aim is a coherent, intuitive path through the material. Developments after spring 2025 are not covered, but the basic ideas emphasized here are unlikely to go out of date soon.
BibTeX
@misc{hanada2026deep,
  author = {Masanori Hanada},
  title = {{Deep Learning for Physicists: From Linear Regression to Reasoning Models}},
  year = {2026},
  eprint = {2611.21295},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.21295},
}
Figure