← Writing

The Ising model and the point of college

· 3 min read

drag to set
Fig. 1Ising model

The grid at the top of my homepage is a live Markov chain. It comes from a lecture in CS 4850, Probability, Vectors, and Matrices in Computing, taught by Bobby Kleinberg. It stuck with me long after the semester ended.

The idea

Each dot is a vertex labeled +1+1 (bright) or −1-1 (faint), and neighbors like to agree. A labeling xx gets weight

w(x)=exp⁡(c∑(u,v)∈Ex(u) x(v)),w(x) = \exp\Big( c \sum_{(u,v) \in E} x(u)\, x(v) \Big),

where cc is the inverse temperature. We want to sample from π=w/Z\pi = w / Z, but Z=∑xw(x)Z = \sum_x w(x) sums over 2n2^n states. You can't compute it.

The trick is to never compute it. Pick a random vertex rr, propose flipping it to get yy, and accept with probability

min⁡{1, w(y)w(x)}.\min\left\{ 1,\ \frac{w(y)}{w(x)} \right\}.

ZZ cancels in the ratio, and for a single flip it only depends on rr's four neighbors:

w(y)w(x)=exp⁡(c (y(r)−x(r))∑(r,v)∈∂rx(v)).\frac{w(y)}{w(x)} = \exp\Big( c\,\big(y(r) - x(r)\big) \sum_{(r,v) \in \partial r} x(v) \Big).

Run the chain long enough and its state is a sample from π\pi.

Near c≈0.44c \approx 0.44 something sudden happens: noise snaps into large aligned domains. Drag the slider above to cross it yourself, or hover over the grid to melt the domains and click to cool a spot.

On CS 4850

4850 has been my favorite class at Cornell. I didn't take it to satisfy a requirement. I took it because the description sounded cool. It was challenging to keep up with, but learning such unique topics was incredibly rewarding.

It was a reminder that education shouldn't be treated as a means to an end. The point of college is to get good at learning, and grades and job outcomes were supposed to be how we measure that. But once they become the goal, it's easy to end up graduating as fast as possible, checking off requirements, and only taking classes that help with recruiting. Goodhart's law, basically. I think a better metric is a much simpler one: what sounds cool, and what you find interesting.

Rather than going deep on one subject, the course let me explore the combination of fields I find most interesting: linear algebra, probability theory, and algorithm design. This lecture was one of my favorite examples of that. It pulls together Markov chains from probability, transition matrices from linear algebra, and a simple, intuitive algorithm you can describe in a couple sentences.