Look at a picture of a cat, and you’ll instantly recognize it as a cat. But try to program a computer to recognize cat photos, and you’ll quickly realize that it’s far from straightforward. You’d need to write code to pinpoint the quintessential quality shared by countless cats in photos with distinctive backgrounds and taken from different camera angles. Where would you even begin? These days, computers can easily recognize photos of cats, but that’s not because a clever programmer discovered a way to isolate the essence of “catness.” Instead, they do it using neural networks, artificial intelligence models that learn to recognize images by looking at millions or billions of examples. Neural networks can also generate text with startling fluency, master complex games and solve problems in math and biology — all without any explicit instruction. There’s a lot that researchers still don’t understand about the inner workings of neural networks. But they’re not completely inscrutable. By breaking down neural networks into their basic building blocks, we can explore how they learn to tell a tabby from a tablecloth. A Simple Classifier Cat detection is an example of what researchers call a classification task. Given an object — in this case, a picture — the goal is to assign it to the right category. Some classification tasks are much simpler than telling “cat” from “not cat.” Let’s consider a fanciful example involving two fictional regions, Triangle Territory and Square State. You get a new point, described by its longitude and latitude coordinates, and have to decide which region that point lies in. But you don’t have a map that shows the border. Instead, you have only a set of known points in the two regions. To build a “classifier” system that will automatically categorize unknown points, you need to draw a boundary. After that, when you’re given a new point, the classifier can just look at which side of the boundary it’s on. But how do you decide where to draw the boundary? That’s where neural networks come in. They find the most likely boundary based on the initial set of known data points. Before we can understand how that process works, we’ll need to set aside our map and explore the basic building blocks of neural networks, called neurons. A neuron is just a mathematical function, with several inputs and one output. Put in some numbers, and it’ll spit out a new number. That’s it.