Theory ofIntelligence
Physics Connection•Intermediate• 8 min

Why I'm Learning AI as a Physicist: Optimization, Energy, and Continuous Math

The moment you realize machine learning is just classical mechanics and thermodynamics with data.

TOI
Theory of Intelligence Editorial
First Principles Research Group • 2026-03-16
Interactive Lab Simulation
Interactive 3D Loss Landscape Visualizer
Launch Lab→

1. The Illusion of Disconnection

When software engineers and computer scientists approach deep learning, the field is often framed through an imperative, algorithmic mindset: layers of matrix multiplications, backwards autodiff passes, and learning rate schedulers.

To a physicist, however, a modern deep neural network does not feel like an algorithm at all. It feels like a high-dimensional dynamical system governed by statistical mechanics and potential field theory.

The foundational equations that power modern AI are not native to computer science — they were discovered centuries ago by Hamilton, Lagrange, Boltzmann, and Gauss.


2. Loss Surfaces as Potential Energy Wells

In classical Newtonian mechanics, a physical particle in a conservative force field experiences a potential energy function V(x)V(\mathbf{x}). The force F\mathbf{F} acting on that particle is strictly the negative gradient of potential energy:

F=−∇V(x)\mathbf{F} = -\nabla V(\mathbf{x})

Now look at standard gradient descent in machine learning. We define a scalar loss function L(w)\mathcal{L}(\mathbf{w}) over a weight vector w∈Rd\mathbf{w} \in \mathbb{R}^d. The parameter update rule is:

wt+1=wt−η∇L(wt)\mathbf{w}_{t+1} = \mathbf{w}_t - \eta \nabla \mathcal{L}(\mathbf{w}_t)

In the continuous limit as step size η→0\eta \to 0, this is simply an overdamped particle settling into a gravitational potential well:

dwdt=−∇L(w)\frac{d\mathbf{w}}{dt} = -\nabla \mathcal{L}(\mathbf{w})

The parameter space is identical to a physical configuration manifold. When an optimizer escapes saddle points or navigates narrow ravines, it is obeying the exact laws of dissipative fluid dynamics.


3. Momentum as Newtonian Inertia

Standard gradient descent frequently oscillates across steep canyon walls rather than making progress down the central valley. In 1986, Polyak momentum was introduced to deep learning:

vt+1=βvt+(1−β)∇L(wt)\mathbf{v}_{t+1} = \beta \mathbf{v}_t + (1 - \beta) \nabla \mathcal{L}(\mathbf{w}_t) wt+1=wt−αvt+1\mathbf{w}_{t+1} = \mathbf{w}_t - \alpha \mathbf{v}_{t+1}

To a physicist, this is nothing other than Newton's Second Law with a viscous friction drag coefficient:

md2xdt2+γdxdt=−∇V(x)m \frac{d^2 \mathbf{x}}{dt^2} + \gamma \frac{d\mathbf{x}}{dt} = -\nabla V(\mathbf{x})

Where:

  • mm is the virtual particle mass.
  • γ\gamma represents viscous damping (analogous to 1−β1 - \beta).
  • ∇V(x)\nabla V(\mathbf{x}) is the conservative restoring force.

By integrating this second-order ordinary differential equation (ODE), the optimizer accumulates kinetic momentum in consistent directions while averaging out orthogonal, high-frequency oscillations.


4. Softmax is the Maxwell-Boltzmann Distribution

One of the most profound realizations occurs when deriving the standard attention softmax function. Consider the probability P(i)P(i) of selecting a discrete state ii given logit energies ziz_i:

P(i)=exp⁡(zi/τ)∑jexp⁡(zj/τ)P(i) = \frac{\exp(z_i / \tau)}{\sum_j \exp(z_j / \tau)}

Compare this directly to the Maxwell-Boltzmann distribution of statistical physics, which defines the probability of an ideal gas particle occupying energy state EiE_i at thermodynamic temperature TT:

P(Ei)=exp⁡(−Ei/kBT)Z,where Z=∑jexp⁡(−Ej/kBT)P(E_i) = \frac{\exp(-E_i / k_B T)}{\mathcal{Z}}, \quad \text{where } \mathcal{Z} = \sum_j \exp(-E_j / k_B T)

The mathematical equivalence is exact:

  1. Negative energy −Ei-E_i corresponds to the dot-product similarity logit zi=qTkiz_i = \mathbf{q}^T \mathbf{k}_i.
  2. The thermodynamic temperature kBTk_B T corresponds exactly to the attention temperature τ=dk\tau = \sqrt{d_k}.
  3. The partition function Z\mathcal{Z} is the denominator normalizer that guarantees conservation of probability.

When temperature τ→0\tau \to 0, the system collapses into a zero-entropy ground state (argmax / Dirac delta). When τ→∞\tau \to \infty, the thermal fluctuations dominate and the distribution converges to maximum entropy (uniform random noise).


5. The First-Principles Advantage

Viewing artificial intelligence through first principles changes how you debug and design models:

  • Diffusion models are not random denoising tricks; they are time-reversed Langevin dynamics integrating non-equilibrium thermodynamics.
  • Normalizing flows are invertible Hamiltonian phase-space transformations preserving symplectic volume (Liouville's theorem).
  • Residual connections (ResNets) are Euler discretizations of continuous neural ODEs: xt+1=xt+f(xt)\mathbf{x}_{t+1} = \mathbf{x}_t + f(\mathbf{x}_t).

When you stop treating machine learning as black-box code and start treating it as applied geometry and physics, the entire field becomes intuitive, predictable, and beautiful.

Cite this Article (BibTeX)
@article{toi2026physicist_ai,
  title   = {Why I'm Learning AI as a Physicist: Optimization, Energy, and Continuous Math},
  author  = {Theory of Intelligence Research},
  journal = {Theory of Intelligence Editorial},
  year    = {2026},
  url     = {https://theoryofintelligence.com/blog/why-im-learning-ai-as-a-physicist}
}
TOI
Theory of Intelligence Editorial

Published by the Theory of Intelligence research collective. We create open-access, first-principles educational materials bridging physical sciences and machine learning.

Discussion & Questions

Ask a question about this derivation or share your intuition

0 Comments
Loading discussion...