Spatial memory under environmental change

A small, CPU-only benchmark comparing three ways for an embodied agent to remember where things are while the world changes underneath it.

Rathna Sabhapathy Badha · 2026 · synthetic world · 3 seeds · 21 tests

The question

As an environment changes and the mission gets longer, which memory representation stays correct at an acceptable memory and update cost?

What was compared

An object graph, a dense 16 x 16 x 8 voxel grid, and a 32-unit coordinate MLP trained online in numpy. All three share one interface. Objects move, appear and are removed. Queries are drawn from ground truth: current position, past position, region change, and stale objects.

Results

MemoryCurrent success@2Past success@2Persistent sizePeak memoryUpdate
Object graph0.8800.86715.4 KB, growing63 KB0.016 ms
Dense grid0.8800.69324.6 KB, flat31 KB0.142 ms
Coordinate MLP0.0270.01312.2 KB1.36 MB40.7 ms

The graph keeps identity and history but grows. The dense grid is flat but loses history and ids to voxel collisions. The small MLP is compact on disk and expensive in RAM, and this configuration has no usable operating point. That is a result about one 32-unit, 50-step model, not about implicit representations as a class.

Overhead ratio. Using alpha = peak memory / persistent size: 4.12 for the graph, 1.27 for the dense grid, and 111.9 for the MLP. The MLP is the smallest map on disk and the largest consumer of runtime memory.

Figure

Accuracy against persistent size, and memory growth over the episode

Extensions

Three follow-ups answer the obvious questions about the original benchmark: whether the MLP failure is just capacity, whether the memories can answer relations, and whether graph growth matters over a longer run.

Capacity

ConfigurationObjectsCurrent@2Past@2UpdatePeak
w32 d130.1040.16837.8 ms1.25 MB
w128 d230.1840.21672.8 ms6.47 MB
w32 d1300.0160.02439.6 ms1.28 MB
w128 d2300.0160.03274.0 ms6.50 MB
graph reference30.8960.8480.005 ms0.01 MB
graph reference300.9040.8560.028 ms0.06 MB

Wider and deeper does not rescue the MLP at 30 objects. At 3 objects the best setting reaches 0.184, still far below the graph. Capacity alone is not the explanation.

Relational queries

MemoryLeft ofRight ofNearNearest of class
Object graph0.8480.8720.8240.936
Dense grid0.8320.8560.7920.864
Coordinate MLP0.4320.4320.4160.200
Chance0.5000.5000.5000.217

The explicit stores answer simple relations. The MLP is at or below chance. The class channel is ground truth, so this is not a test of semantic labelling.

Maintenance and horizon

ConfigurationPast@2Stale precisionSize
Dense, no eviction0.6720.99324,576 B
Dense, evict age 100.112undefined24,576 B
Dense, evict age 200.5200.98924,576 B

Eviction does not reduce the array size. It trades history for freshness. Over 300 steps the graph grows from 16,848 B to 88,365 B, with query latency from 0.158 to 0.228 ms. Accuracy stays flat, so the cost is real but not yet a failure at this scale.

Dense-grid eviction and long-horizon growth

Scope

Synthetic world, CPU only, no downloaded data, no GPU. The numbers describe the representations, not a deployment. Persistent size is an estimate of serialized state, not live Python object overhead.

MIT license. Code: BigRathna/spatial-memory-under-change.