How Grid Cells Map Space

Matthew Taylor • Open Source Community Manager

This blog post contains interactive visualizations that may not work well on older web browsers and mobile devices.

For those who’ve been following our research developments, you may have noticed that we’ve been focused on grid cells lately. In fact, our Co-founder, Jeff Hawkins, gave a talk last month, “Does the Neocortex Use Grid Cell-Like Mechanisms to Learn the Structure of Objects?” If you’re wondering what grid cells are, don’t worry. This post will walk you through the basics and demonstrate how they relate to our current research.

A grid cell is a type of pyramidal neuron that responds to location. To do this, each grid cell creates a cognitive map of space. One example of grid cell behavior is how one grid cell might respond to an agent’s location in a room. Play the movie below and watch as one grid cell fires as a mouse moves throughout a room. These firing fields form a hexagonal lattice across the room.

While grid cells in the entorhinal cortex have been found to help identify an animal’s position in space, recent evidence suggests that grid cell-like mechanisms may be present in the neocortex. We propose that cortical grid cells exist in every cortical column and play an essential role in all cortical function. Based on this premise, we’re working on a theoretical framework for understanding what cortical columns do.

In order to understand how grid cells can represent objects in space, it’s easier to understand first how grid cells can represent one unique location in space. The series of interactive visualizations below will guide you through these concepts.

A Simulation of Grid Cells in Action

Move your cursor over the the interactive visualization below, where you can see an object moving through a 2-dimensional space, which wraps at the edges. You can also check the “Random Walk” box to start the animation automatically. This 2D space is being mapped by 3 grid cells (red, blue, and green). The color splotches are each grid cell’s firing fields, or the locations in the space where the cell has fired recently in response to the object’s location. These spikes fade away as they are replaced with new firings as the object moves through the space.

As the grid cells’ firing fields fill in, notice they project slightly differently across the space. Each one has a different orientation and scale. But they all create the same spaced pattern.


If you’re a fast reader, the firing fields may not have filled in much yet. Hover your mouse or drag your finger over the 2D space to control the location of the object and watch as each grid cell fires in response to your movement. See if you can find the firing fields yourself as you move the cursor across the space.

To stop the simulation, uncheck the “Random Walk” checkbox.

One Grid Cell’s Firing Fields

One grid cell observes the space below and only reacts to certain places. The locations it activates in response to are called firing fields. In the figure above, you can see that each color cell has many firing fields. As an attended object gets closer to the center of the field, the probability of the grid cell firing becomes higher.

In the figure below, one grid cell’s firing fields are displayed as filled circles in a hexagonal lattice. This represents all the locations the grid cell is receptive to. As you mouse over the filled circles, they change color, indicating that the grid cell monitoring this space is firing. The grid cell has noticed something within its receptive field.


Each grid cell can project onto space in many ways. Above, you can change the orientation and scale of this grid cell’s projection onto the 2D space. Try moving the sliders now.

One grid cell is not enough to represent a location in space. As you can easily see above, the representation is ambiguous, and could represent a number of places in the space. That’s why grid cells work together in modules.

The Grid Cell Module

A grid cell module is simply a group of grid cells sharing the same projection properties onto space. Using many grid cells, we can cover a patch of space and use it to tile over a larger space.


The overlay on the bottom left shows all 16 grid cells within the module, and which one is currently active in response to an object’s location in space. Hover your mouse over the parallelogram shape in the overlay to see each individual grid cell’s firing fields. Note that this parallelogram shape is not how these neurons are arranged in the brain! This is just how they project onto space. (There is no hexagonal arrangement of neurons in your cortex.)

One grid cell module can tell us a lot more about an object’s location in space than a lone grid cell. As you hover or swipe the space above, notice how the grid cell module knows you must be within one of many locations moving across the space. But it cannot decipher an exact location.

Again, one grid cell module is not enough to uniquely map space. But when we use many grid cell modules together, we can map a virtually infinite amount of space.


Grid Cell Modules Working Together

When grid cell modules work together, they can uniquely map space by combining their representations. Each cell in a grid cell module is like a bit in an Sparse Distributed Representation (SDR). As you can see below, this space is being mapped with ? grid cell modules each with 16 cells (? grid cells).


Let’s try something. First, select only 4 grid cell modules, then turn on the random walk. With only a few grid cell modules mapping this space, it would be hard to tell where the object is without the marker. But if you increase the number of grid cell modules, you can easily tell where the object is by looking for the space with the most overlap. Use your mouse to hover over the space and explore. Uncheck the “Random Walk” box to turn off the animation.

Grid Cell Modules are Sparse Distributed Representations

Grid cell module activations are SDRs, and can be used to represent semantic location information in many ways in the brain. Many grid cell modules’ SDR representations can be used to create unique binary representations of space.


Grid Cells in the Neocortex

Grid cells, located in the medial entorhinal cortex, represent the location of an animal in various environments. We propose that the lower layers of the neocortex have cells that work on principles similar to those used by grid cells. Whereas grid cells represent the location of one thing (the body) the neocortex simultaneously represents the location of hundreds of things. Cortical columns that receive input from different parts of the body track the location of each body part relative to external reference frames.

Because of these unique properties, we think grid cells are extremely important processing units for our brains to understand space and represent objects in reality. For even more reasons why I’m excited about grid cells, check out Episode 14 of HTM School below!

Matthew Taylor • Open Source Community Manager

Leave a Reply

Your email address will not be published. Required fields are marked *