Eyes
Shapes drift over a grey surface. One brain, running inside your browser, gives each shape its own eye and keeps the eye on its shape. It sees nothing but the page's pixels.
What it shows about CadenceA Cadence brain has a real state that carries over from one moment to the next, and it runs in real time, like the brain of a living being. When nothing moves, that state is the answer, so the brain rests and does no settling work at all, like a resting animal. Move a shape and the brain works only for that move: the shape's eye jumps after it, and the brain comes to rest again.
What you see
- The toolbar. Add a shape, start a new scene (Three, Six, Crowd, Unseen), clear the surface, open this help.
- The surface. Shapes on a grey, slightly noisy background. These pixels are everything the brain sees. A faint circle around a shape means it has an eye.
- An eye. Each eye has its own colour. The solid square is its sharp centre, where it sees one pixel at a time. The dashed square is how far it sees, 40 pixels each way, coarser the farther out. The small box is the brain's answer: where it says the eye's shape is. It is solid when the answer is right and dashed when it is not, and it is larger the farther out it points, because the eye sees coarser there.
- The walk-through. One line that says what to try next, and says what the page just showed.
- What the brain is doing. At rest: no work when nothing any eye sees has changed; settling: 32 sweeps when something moved and the brain repaired its state. Beside it: the sweeps of the last frame, the brain's time for it, how many frames a second it answers, and how many eyes have their own shape at their centre.
- Work, frame by frame. The settling sweeps of the last 300 frames. A flat line is a brain at rest.
- The controls. Let the shapes move on their own or hold them, show or hide the eyes, pause, and set how often the brain may look.
- The brain. Every neuron and synapse of the one brain, showing the stream of one eye (the eye with the outlined view below). Its regions carry their names; point at a name to read what the region does.
- The settle. Several times a second one frame's settle plays sweep by sweep on the brain, a wave from the retina to the gaze neurons. This curve shows how much the busiest neuron changed at each sweep: it falls as the brain comes to agree.
- What each eye sees. Each eye's 25 by 25 receptors, sharp in the middle and coarse at the edge, with what changed since the last frame in red. Click one to show that eye in the brain.
Every part of the page carries a question mark or explains itself when the pointer rests on it.
Why it matters
Work only when something moves. A resting animal spends little on a scene that does not change; what moves draws its eyes and its effort. A Cadence brain has the same habit, from the way it computes. Its answer is a settled state: a state in which all its parts agree with each other and with what the eyes see. That state carries over to the next frame. When the next frame is the same, the state it holds is the answer, and the brain passes its check without a single sweep of work. When a shape moves, the parts that disagree repair their state, sweep by sweep, until the brain agrees again, and then it rests.
A conventional network that answers each frame in one pass has no state to rest in: shown the same frame again, it runs the same whole pass again, unless a rule outside it decides to skip the frame. For a robot or a game character that watches a mostly unchanging world, a brain whose work follows what changes keeps its effort for the moments that matter.
One brain, many eyes. Every eye is one stream of the same brain. All streams settle together, each from its own last state, so adding an eye adds a stream, not a brain.
An eye that finds its shape again. Each eye sees sharply at its centre and coarsely around it, and it sees what changed. When its shape jumps away, the change shows where it went, and the eye jumps there, often in a single saccade. The control eye, which sees only a 26 by 26 pixel window at full detail, never finds a shape that jumps 20 pixels out of its window (the numbers below).
What you can do
- Untick "shapes move on their own". The shapes stop moving, every eye settles on its shape, and the brain comes to rest: zero sweeps, a flat work strip, a dark brain view, and a brain time of a few milliseconds.
- Drag a shape. Its eye jumps after it. In a motionless scene the work strip shows a short burst of sweeps for your move and goes flat again.
- Drag a shape away fast. The eye finds it again from the change it saw, in one jump or a few.
- Double-click a shape to give it an eye or take its eye away (up to eight eyes). Right-click a shape to remove it.
- Click a shape with an eye, or its view under the brain, to show that eye's stream in the brain.
- Add a shape from the menu. The shapes under "never seen" were never shown to the brain while it was raised.
- Three, Six, Crowd, Unseen start a new scene. In Crowd, six eyes must stay on their own shapes among twelve. Unseen gives eyes to a star, a tee and an ell, shapes the brain never saw while it was raised.
- Drag the brain to turn it, scroll to zoom, point at a neuron to read its activity.
- Show the eyes, pause, frames per second: what the surface draws, and how often the brain may look.
How it works
What it sees. Each frame, for each eye, the brain gets 625 receptors pooled from the page's pixels around the eye's centre: one pixel apart out to 6 pixels, then spreading out to 40 pixels, each pooling its patch, from one pixel at the centre to ten at the edge. Each receptor reports two things: brightness, and how much its patch changed since the last frame. Change is measured on the surface, so the eye's own jumps do not count as change. Nothing else reaches the brain: no positions, no names of shapes, no labels. Where an eye opens is your choice; after that, only the brain's answers move it.
The brain. 2,413 neurons and 74,612 synapses in four regions, named for the parts of an animal's visual system whose roles they play:
- Retina
- 1,250 neurons: the 625 receptors in two channels, brightness and change. The pixels enter here.
- V1
- 968 neurons in eight feature maps, each reading the retina through small 5 by 5 fields. Every place uses the same weights, as in a visual cortex.
- Colliculus map
- 169 neurons, a 13 by 13 map of the space around the eye's centre, wired both ways with V1. It settles on where the eye's own shape is, as the superior colliculus does.
- Gaze neurons
- 26 neurons, 13 for left and right and 13 for up and down. The most active one on each axis is the eye's jump: none, or 2.5, 4.5, 7.1, 13.4, 25 or 40 pixels either way.
How it answers. The answer is the settled state of the whole brain: retina, V1, the map and the gaze neurons in one equilibrium. There is no separate pass from input to output. The brain sweeps: every neuron repairs its disagreement with the neurons it reads, and the sweeps repeat until the largest change falls below a tolerance. The page runs the brain at a tolerance of 0.03, where a frame in which something moved usually settles in one chunk of 32 sweeps (35.7 on average in the page check). The eye then jumps to the answered place.
Why a motionless scene costs nothing. The state each eye settled into stays with the brain. Given the same input again, that state agrees with it, and the brain's check passes at zero sweeps. On the page, the brain's host compares each frame with the last, and when no eye's input changed it keeps the answers without calling the brain, since the brain would pass at zero sweeps with the same answers. When the brain was raised, each frame of its first-glance assays (600 frames) was shown to it twice more: every repeat cost zero sweeps.
How it was raised. Offline, before the page: 100,000 lessons in a world of moving shapes, one lesson a frame. After each free answer the world showed where the eye's own shape was, and the library's local learning rule nudged the gaze neurons toward it; the nudge spread back through the brain's two-way synapses, and every synapse changed by the activity at its two ends. Nothing is sent backwards through layers. The page runs the raised brain as it is: it does not learn in the page.
Where it runs. In your browser: Python and NumPy in Pyodide, the released cadence-net 0.95.2 library, unmodified, in up to six web workers that each hold the same brain. The page checks every file of the brain against its SHA-256 hash before it runs anything. Nothing is sent to a server.
The numbers
| Reading | Value |
|---|---|
| Raising assay: a frame shown again, share of repeats at zero sweeps (600 frames, each twice more) | 1.00 |
| On this page, three seconds with the shapes held: frames at zero sweeps | 65 of 65 (3.6 ms a frame) |
| On this page, shapes moving: sweeps per frame, on average | 35.7 (62 ms a frame) |
| Six eyes on six moving shapes: eyes on their own shape, on average | 5.83 of 6 |
| A shape dragged 20 px in 150 ms: its eye centred on it again | 0.6 px away |
| On this page, a shape dragged 18 px in 150 ms: the eye's jumps after the release to centre it, then frames at zero sweeps in 3 s | 1 · 65 of 65 |
| Its shape jumps 10 px: centred again after one / three frames | 0.93 / 1.00 |
| ... 20 px | 0.23 / 0.85 |
| ... 30 px | 0.22 / 0.58 |
| The window eye (control), same jumps: 10 / 20 / 30 px after three frames | 0.65 / 0.00 / 0.00 |
| Another shape jumps 10, 20 or 30 px: the eye stays on its own | 1.00 (control 0.75 to 0.88) |
| Eight shapes moving: frames on the eye's own shape, two seeds | 0.95, 0.87 (control 0.80, 0.75) |
| First glance from rest: shape found within 3 / 3 to 12 / 12 to 34 px of the centre | 0.99 / 0.94 / 0.74 |
| Never-seen shapes, first glance: star / tee / ell | 0.83 / 0.89 / 0.75 |
| The brain | 2,413 neurons · 74,612 synapses |
Where each number comes from, in the eyes/evidence/ folder of the repository: the repeated frames, the first glance and the never-seen shapes from fovea-v1x8-s1-summary.json (the raised brain, at its raised tolerance); the jumps, the other shape's jumps and the eight moving shapes from comparison.json (60 trials per jump, 30 s scenes at 20 frames a second, the page's tolerance); the six eyes and the dragged shape from page_check.txt; the page's rest, moving and drag readings from page_check-20261113-1155.txt (this page in a headless Chrome on an Apple M4 under a load average of about 130, the brain view drawn with the GPU). The window eye is the control: a Cadence brain that sees a 26 by 26 pixel window at full detail, with no change channel, raised on eight shapes without faces (the tests include faces).
Limits
- The brain does not learn in the page. It was raised offline and runs as raised. Continuing to learn from its own misses made every raised eye worse in development.
- On the page, the host skips a frame in which no eye's input changed, without calling the brain. The brain's own zero-sweep answer to a repeated frame is measured in the raising assay (every repeat), and the page's answers are the same either way.
- The rest is for the whole scene: when any eye's input changes, all the eyes settle that frame together.
- A shape that jumps 30 pixels between two answers is found again only some of the time. A fast drag works because the brain answers often enough that each step stays short.
- When two shapes pass through each other, an eye can go on with the other one.
- The brain has no working memory: an eye's continuity is its own settled state, carried from frame to frame.
- Grayscale shapes on a plain surface only.
- The brain's time per frame depends on your computer; a busy computer answers fewer frames a second.