The Box — agents that model each other

A sealed arena of mathematical agents. None of them can see another's true nature — each one carries a probability distribution over what the others intend, updates it with Bayes' rule after every encounter, and (at the deepest setting) models what the others believe about it. Cooperation, suspicion, and deception are not scripted. They fall out of the arithmetic. Click any agent to read its mind.

Tick
0
Encounters
0
Cooperation rate
—
Deceptions
0
Mean belief error
—
Belief error trend · 600t
—
Contraction cost · avg
—
Arena coverage
0%
Witnesses / false beliefs cut
0 / 0
Keys Space pause / play . step R reset Mind L0 Reactive L1 Models others L2 Recursive TipHover or tap an agent to trace what it believes about its neighbours.
The box · live
  • Agent — its own colour is its identity
  • Energy ring — green full, red nearly empty
  • Reputation halo (Level 2) — green trusted, red suspected
  • Energy pellet — eating one restores energy
  • Trust link — the focused agent believes a cooperator
  • Distrust link — the focused agent suspects a defector
  • Witness test — steering to test a confident belief
  • Encounter pulse — split green/red means a deception

Each orb's outer ring is its energy; the small nose shows where it's heading. A green pulse means it just cooperated, red means it defected, and a split green/red pulse means its signal lied — a deception. At Level 2 a soft halo shows reputation. Hover or select an agent to trace its belief links (green = trust, red = suspicion, line weight = confidence) and its dashed amber witness-test target.

Controls

Run

Mind

Theory-of-mind depth Level 2

At level 2 an agent also tracks its own reputation — what it estimates each rival believes about it — and can spend or exploit that reputation.

Deceptive signaling Allowed

Guide: the only lie that pays is promising cooperation and then defecting. Turn deception off to remove that move entirely — then compare the Deceptions counter and the cooperation rate against a run with it on.

World

Run mode Random

Deterministic mode runs on a seeded generator — same seed, same box, replayed exactly. Pellet and spawn placement stop rolling dice: each placement is chosen to minimize an arena-coverage potential (the conditional-expectations trick). Switching modes resets the box.

Agents jointly infer beliefs by exact contraction over a core of at most this many neighbors. The reputation boundary stays exact; beliefs outside the core are compressed to a 0.1 grid.

Guide: wall-clock pace only. Speed changes how fast ticks pass, never the math — a seeded run replays identically at any speed.

Guide: applies on reset. Dead agents are replaced by offspring of the current energy leader, with mutated traits — selection pressure is on. More agents means more witnesses per encounter, so beliefs converge faster.

Guide: how fast energy pellets appear. Scarce food raises the stakes of every encounter — a −5 exploitation hurts more when the next pellet is far away; plentiful food lets even exploited cooperators survive.

Guided experiments

One click loads a controlled comparison — same seed, one variable changed. Run A, watch the stat strip for ~3,000 ticks (about a minute at 1×), then run B and compare.

1 · Does modeling others change cooperation?

Deception allowed, seed 42. A runs a purely reactive population; B adds beliefs, reputations, and trust-spending.

Expected: Level 0 surprises people. With nobody guarding, cooperation runs high — 58% on seed 42 — because reactive agents cooperate from temperament alone and never learn to stop, even while being exploited; its 21 deceptions are random temperament, not strategy. Level 2 invents both guarding and deliberate trust-spending: cooperation falls to 24% while deceptions rise to 41, because only a Level 2 agent can decide a reputation is worth cashing in. The smarter box is the warier — and the more dishonest — one.

2 · What does a bigger reasoning budget buy?

Level 2, seed 42. A never contracts jointly (pairwise Bayes only); B contracts over cores of up to 6 neighbours — 64 configurations per inference.

Expected: cost explodes, accuracy doesn't follow. On seed 42 at tick 3,000, depth 1 — which never contracts at all — ends at belief error 0.45. Depth 6 pays an average of 415 multiply-adds per contraction and ends at 0.48: no better. The sweet spot on this seed is depth 3 (error 0.32 at just 25 multiply-adds) — past it, joint inference mostly re-derives what pairwise Bayes already knew. Full table in the explainer below.

3 · Deterministic placement vs chance

Level 2, depth 4. A places every pellet by minimizing the arena's staleness potential; B places uniformly at random. Same seed — only the placement rule differs.

Expected: deterministic placement steers pellets toward the stalest cells, and at tick 3,000 coverage reads exactly 44% — above the random average (sampled runs landed between 31% and 50%, averaging ≈39%), though a lucky random run can beat it once. What determinism actually guarantees is not a bigger number but the same number, and the same entire run, every time. Leave A running past ~5,000 ticks and a second effect appears: pellets stranded in far corners pile up to the 46-pellet cap, spawning stalls, and deterministic coverage decays — the potential optimizes placement, not delivery.

Inside one mind

Emergence, graphed

— cooperation rate — belief accuracy

Energy leaders

    What just happened

      The mathematics of being aware of others

      "Aware of others" is not one thing. The box implements it as three nested levels of belief, and the depth control above switches the whole population between them so you can watch the behavior change.

      Level 0

      Reacts to others

      An agent senses a neighbor and responds from its own fixed disposition only. It keeps no record of who did what. Mathematically it is a function of the present state and nothing else — awareness in the weakest sense, the kind a thermostat has.

      Walkthrough. Aria (cooperativeness 0.80) meets Bram (0.25). Aria cooperates because 0.80 is her nature — she would cooperate with anyone, and she will cooperate with Bram again no matter how often he defects, because nothing is recorded. Bram defects on the same coin-flip of temperament. At Level 0, energy — not learning — decides who survives.

      Level 1

      Models others

      Each agent keeps, for every other agent, a probability P(cooperator) and revises it with Bayes' rule after each observed action. Decisions are then made against the model, not the agent: cooperate with the probably-kind, guard against the probably-hostile.

      Walkthrough. Same pair, one level up. Bram defects; Aria's belief in Bram runs through the formula below: 0.50 → 0.17. Next meeting her cooperation chance drops by 0.34 (belief under 0.35) — she guards. Meanwhile Bram watched Aria cooperate, so his belief in her rose to 0.77, and his cooperation chance rises by 0.22 (belief over 0.62). The beliefs, not the temperaments, are now driving the encounter.

      Level 2

      Models others modeling it

      The recursive step. Agent A also maintains BA( BB( A is a cooperator ) ) — its estimate of B's belief about A. That estimate is a reputation A can protect, repair, or spend: a trusted deceiver defects precisely because it expects to be believed. Deception and reputation management only exist at this level.

      Walkthrough. At Level 2, Aria also tracks her reputation with Bram — her estimate of his belief in her, which stands at 0.77 after she cooperated. If Aria were a deceiver (deceptiveness above 0.35), that 0.77 crosses the exploit threshold of 0.68: she would signal cooperation and defect, spending the trust for +10 energy. If instead her reputation sagged below 0.35 and she is no deceiver, she cooperates extra (+0.18) to repair it. Reputation becomes a currency — earned slowly, spent in one move, repaired on purpose.

      The belief update (Bayes' rule)

      After watching agent B cooperate or defect, agent A revises its belief that B is a cooperator type. Cooperators cooperate with probability 0.85; defector types still cooperate 0.25 of the time (camouflage), which is what keeps the inference honest:

      P(C | action) = P(action | C) · P(C) ⁄ [ P(action | C) · P(C) + P(action | D) · P(D) ]

      Worked example: prior P(C) = 0.50, B cooperates → 0.85 × 0.50 ⁄ (0.85 × 0.50 + 0.25 × 0.50) = 0.77. One defection from the same prior drops it to 0.17. Bad acts are more informative than good ones — which is why trust in the box is slow to build and fast to lose, exactly as the formula dictates.

      Chain two observations and the asymmetry compounds: 0.50 → (B cooperates) → 0.77 → (B defects) → 0.40. The defection more than erases the cooperation, because a defection is the more informative act — its likelihood ratio is 0.15 ⁄ 0.75 = 0.2, against 0.85 ⁄ 0.25 = 3.4 for cooperation. One bad act outweighs one good one; that is not a mood, it is the likelihoods. The event log shows this before → after pair on every encounter, so you can watch individual beliefs move.

      The "mean belief error" stat above compares every agent's belief about every other against that agent's true disposition. Watch it fall as the population learns — and spike when a deceiver is camouflaging well.

      The encounter (a prisoner's dilemma)

      When two agents come within range, each first broadcasts a signal of intent, then acts. With deceptive signaling allowed, a signal can lie. Payoffs are in energy:

      I play \ They playCooperateDefect
      Cooperate+6 / +6−5 / +10
      Defect+10 / −5−2 / −2

      Defection pays more against a cooperator (+10) than cooperation does (+6) — the classic temptation. Mutual cooperation is still the best joint outcome, so whether the box settles into trust or into a suspicion spiral depends on how well the belief models track reality.

      The contraction, worked by hand

      Pairwise Bayes treats every neighbour as independent evidence. The contraction does not: it enumerates every joint configuration of a small core of neighbours and weights each one by all the beliefs and couplings at once. A concrete pass — an agent holds beliefs X = 0.80, Y = 0.30, Z = 0.60 about three neighbours, and has witnessed X and Y act alike often enough to earn a coupling κXY = +0.45 (their behaviour correlates). All 23 = 8 configurations, weighted by the product of the unary beliefs times (1 + κ) when X and Y agree, (1 − κ) when they differ:

      X Y ZWeightX Y ZWeight
      1 1 10.20880 1 10.0198
      1 1 00.13920 1 00.0132
      1 0 10.18480 0 10.1218
      1 0 00.12320 0 00.0812

      The weights sum to 0.8920. Summing the weights of every configuration where a variable is 1 and dividing gives the joint marginals: X = 0.6560 ⁄ 0.8920 = 0.74, Y = 0.3810 ⁄ 0.8920 = 0.43, Z = 0.60. Read what happened: Y's belief rose from 0.30 to 0.43 without Y doing anything — Y is coupled to X, X looks like a cooperator, so some of X's credit flows along the coupling. Z, coupled to nobody, is untouched at 0.60. The box then blends each marginal in at 55% weight (X stored as 0.76, Y as 0.37), so a single contraction nudges beliefs instead of whipsawing them. The cost of this pass: 8 configurations × (3 unary factors + 1 coupling) = 32 multiply-adds — the same counter the inspector reports after every real contraction, and the number that grows as 2k when you raise the depth slider.

      Borrowed machinery — four methods from a deterministic DLP proof

      In November 2026, Liu, Zhang & Ren published a deterministic, subexponential algorithm for the discrete logarithm problem, built from four distinctive techniques. Each one has a working analogue in this box — not as decoration, but as the actual mechanism the controls above switch on.

      Paper techniqueWhat it does in the proofIts analogue in the boxControl
      Exact tensor contractionEvaluates conditional sums over a Boolean tensor network exactly, no samplingJoint belief marginals over a neighbour core, enumerated over all 2k configurationsDepth slider
      Method of conditional expectationsBuilds the factor basis choice by choice, keeping a potential Φ from rising, until ≥ 7/8 of the group is coveredSeeded, replayable runs; every placement chosen to minimize the arena's staleness potentialDeterministic mode
      Counterexample separationWitnesses separate false candidate tables; a nonnegative filter keeps evidence from cancellingAgents steer into test encounters that can falsify confident beliefs; witness counts only ever riseLevels 1–2
      Terminal-preserving partial contractionContracts the low-degree core to bounded depth while Θ(b) boundary terminals stay exactCore capped at k neighbours, off-core beliefs compressed to a 0.1 grid, reputation boundary kept at full precisionDepth slider
      Method 1 · Tensor contraction

      Beliefs inferred jointly, not one at a time

      The paper evaluates its conditional sums exactly by contracting a Boolean tensor network instead of sampling. Here, after each encounter an agent contracts a small factor graph over its social neighborhood: unary factors are its pairwise beliefs, and pairwise factors are estimated from encounters it witnessed where two others acted together — behavior in a shared encounter is not independent evidence, because a defection may have been defensive. The joint marginals come from enumerating all 2k configurations of the core; the inspector shows the core members, the configuration count, and the multiply-add cost of the last contraction.

      Method 2 · Conditional expectations

      Deterministic mode — coverage by construction

      The paper builds its factor basis choice by choice, each pick keeping a potential Φ from rising, until the sumset provably covers at least 7/8 of the group — with zero random bits. Deterministic mode above does the same to the arena: a seeded generator makes the run replayable, and every pellet or spawn placement is chosen from seeded candidates to minimize total cell staleness. Coverage — the share of the arena's 36 cells served recently, shown in the stat strip — is driven up by the potential instead of being left to uniform chance. Same seed, same box.

      Φ(t) = Σ over 36 cells of staleness(cell) — place each pellet in the candidate cell that cuts Φ most

      Concretely: every tick, each of the arena's 36 cells ages by one. A pellet resets its cell to zero. In deterministic mode each spawn draws 10 seeded candidate positions and keeps the one in the stalest cell — the placement that reduces Φ the most, the exact derandomization move the paper makes when it fixes each basis element greedily. Coverage in the stat strip is the share of cells served within the last 900 ticks; watch it climb under deterministic placement and wander under random placement (Experiment 3 measures the gap).

      Method 3 · Counterexample separation

      Witnesses that falsify false beliefs

      The paper separates false candidate logarithm tables with witnesses, using a nonnegative filter polynomial so evidence from different witnesses can never cancel out. In the box, a confident belief is a candidate false table. Agents steer toward its subject to force a test encounter; when the observed act contradicts the confident belief, a falsifying witness is recorded. Witness evidence only ever accumulates — the counter never decreases — and a confident belief that stops being wrong is counted in the stat strip as a false belief eliminated.

      Worked case: an agent holds a confident 0.85 belief that Bram is a cooperator, but Bram's true cooperativeness is 0.30 — a candidate false table. The agent steers toward Bram (the dashed amber line in the arena) until a test encounter happens. Bram defects. That single act is a falsifying witness: the witness counter rises by one, and Bayes drags the belief 0.85 → 0.53 in one step — out of the confident zone entirely. Because witness evidence is a count that never decreases, later camouflage cooperation can rebuild the belief only through the same slow likelihood climb anyone else faces; the falsification itself is never un-happened.

      Method 4 · Terminal-preserving compression

      A reasoning budget with an exact boundary

      The paper's lookup tensors exceed its contraction degree limit, but only Θ(b) boundary wires exist — so it contracts the low-degree core to a bounded depth and keeps the boundary terminals exact. The contraction-depth slider is that budget: the joint core is capped at k neighbors (2k configurations), beliefs outside the core are compressed onto a coarse 0.1 grid, and reputation — what an agent estimates others believe about it, the boundary of its network — is always stored at full precision. The live tradeoff, belief error against average contraction cost, is printed under the slider.

      The depth tradeoff, measured

      Raising the contraction depth multiplies the cost of every inference — the configuration count doubles per step and each configuration carries more factors, so the measured average climbs from 8 multiply-adds at depth 2 to 415 at depth 6 — while the accuracy it buys is an empirical question. This table is not illustrative: it is the actual outcome of the deterministic run (seed 42, Level 2, deception on, 3,000 ticks) at each depth setting, reproducible from the Guided experiments panel.

      DepthCore ≤Configs 2^kAvg multiply-adds / contractionBelief error at tick 3,000
      1— (no contraction)—00.45
      22480.41
      338250.32
      4416670.43
      55321690.48
      66644150.48

      The honest reading: on this seed the cheapest settings are not the most accurate, and the most expensive are not either. Depth 3 hits the sweet spot; by depth 6 the contraction is mostly re-deriving what pairwise Bayes already knew, at 64 configurations a pass — and because beliefs steer behaviour, the deeper reasoners also change the world they are measuring, which can push error back up. That is the real accuracy/cost tradeoff of bounded joint inference, and it is why the budget is a slider rather than a fixed maximum.

      Honest limits

      Behavioral awareness is not inner experience. The agents pass every behavioural test this page can set — they model, predict, deceive, and repair reputations — and none of that settles whether anything is felt inside. The simulation demonstrates the arithmetic of mutual modeling; it makes no claim about consciousness, and neither should its reader.

      Beliefs are scalars. Each agent stores one number per neighbour — P(cooperator). Real social cognition tracks why someone acted (provoked? desperate? mistaken?), and this box cannot: a defensive defection and a predatory one enter the formula identically, which is exactly the bias the coupling factors only partly correct.

      Observation is perfect, the world is tiny. Witnesses within earshot see true actions with no noise, payoffs are fixed and known, and the joint core caps at six neighbours because 2k is unforgiving. Real deployments of these ideas — fraud detection, negotiation agents, multi-robot coordination — add learned models, partial observability, and validation against real data before anyone trusts the output.

      Honesty about the source: the paper's headline result is conditional. Its deterministic DLP algorithm assumes an unrefereed OpenAI preprint claiming the Exponential Time Hypothesis is false; if that premise falls, the theorem falls with it, and the Lean verification claimed for the proofs has not been independently checked. The four methods, though, are sound techniques that stand on their own — which is why they were worth transplanting. This page borrows the machinery and makes no claim about the paper's conclusion.