MPI-IS Tübingen · AI Center · October 2026
Toward a Calculus of Grounded Computational Organisation
Christian Weilbach
0 · Motivation
Fourteen months later: about ten open-source libraries, from a forkable runtime to a proof checker, and a simulated Stuttgart of 936,597 people.
\(\displaystyle \text{progress per hour} \;\approx\; \frac{\mathbb{E}[\,\text{value of the experiment}\,]}{t_{\text{write}} + t_{\text{build}} + t_{\text{setup}} + t_{\text{run}} + t_{\text{check}}}\)
| term | usually costs time because… | here |
|---|---|---|
| write | programs are long | small programs as data; agents write Lisp well |
| build | compile, link, restart | the running REPL; Raster and Ansatz work inside it |
| setup | the state an experiment needs is rebuilt | fork a running world |
| run | each device has its own toolchain | Raster lowers one algebra to each device |
| check | review and tests sit outside the system | tests in forks, a proof kernel in the process, receipts |
| value | experiments are chosen by hand | inference chooses what to compute or measure next |
If the Milaneo closed, about half of the 93 M€ a year that residents spend there would move to other shops in Mitte.
Inspired by Axtell's agent-based models of firms (Science 2001; AAMAS 2016), which we reimplemented in Raster.
Background · learners at every scale · a persistent memory model · layered compilation as learning · building simulations with agents · where it leads
About ten open-source libraries in fourteen months, most of it written with coding agents at a REPL against the running system (timeline in the backup).
1 · Background
Weilbach, Beronov, Harvey & Wood, AISTATS 2020. With the faithfully inverted structure the flow needs 7,725 weights instead of 18,679, and learns faster than the dense flow.
Weilbach, Harvey & Wood, ICML 2023. Valid Sudokus 98 % of the time unconditionally and 96 % with 16 of 81 cells given; matrix factorisation trained up to size 10 generalises to size 200; attention costs O(nm) instead of O(n²).
Lisp: code is data, and the evaluator is a short program in the language itself (McCarthy 1960; Abelson & Sussman 1985). Three lines of work built on that:
Run an interpreter backwards: Byrd, Ballantyne, Rosenblatt & Might, ICFP 2017 (CC BY 4.0).
Grow a library of abstractions: Ellis et al., DreamCoder, PLDI 2021 (figure in the talk: Fig. 2 of arXiv:2006.08381).
A language model as the proposal in a probabilistic program: Lew et al. 2023 (CC BY 4.0); Loula et al., ICLR 2025.
What we take: programs are values that a running system proposes, tests and keeps; the proposer can be a person, a search, or a language model.
2 · Learners at every scale
Levin, Front. Psychol. 2019, Fig. 2 (art: Jeremy Guay), CC BY 4.0.
Maynard Smith & Szathmáry 1995; Buss 1987; West, Fisher, Gardner & Kiers 2015; Agüera y Arcas, What Is Intelligence?, 2025.
Gershman, Horvitz & Tenenbaum, Computational rationality, Science 2015 (figure in the talk: Fig. 2).
Still, Sivak, Bell & Crooks 2012; Kolchinsky & Wolpert 2018; von Neumann 1966; Russell & Wefald 1991; Lieder & Griffiths 2020.
Carry each step's error along the pipeline, and spend computation where it matters.
Data never exist on their own: a record means something relative to a context and the process that acquired it. Probabilistic numerics models that process; our stack records it.
Hennig, Osborne & Girolami, Proc. R. Soc. A 2015, Figs. 1 and 4 (CC BY 4.0); Hennig, Osborne & Kersting 2022.
Horsman, Stepney, Wagner & Kendon 2014: a physical system computes when its evolution and an abstract one agree through a representation.
Allocate is not a sixth move: it is the policy that chooses among them under one budget. Purposes are constraints on it, not prices.
3 · A persistent memory model
Persistent data structures: Driscoll, Sarnak, Sleator & Tarjan 1989; Okasaki 1998.
Driscoll, Sarnak, Sleator & Tarjan 1989; Okasaki 1998.
All open source under github.com/replikativ; overview at datahike.io.
| runtime | the rest of a run is… | cost |
|---|---|---|
| most interpreters and VMs | not a value, or resumable once (generators, async) | to try another future, start again |
| Anglican (Tolpin et al. 2016) | a value: the whole program in CPS | every call pays for the transform |
| partial-cps | a value: CPS only where the run can suspend | other code stays ordinary Clojure |
| Spindel | a value, together with the reactive state | fork in O(1), then commit or discard |
With the future as a value, expectations over what happens next become computable: continue many particles from the same state and weight them, \(\mathbb{E}[f] \approx \sum_i w_i\, f(x_i)\); SMC forks the likely ones.
defn model []:
spin:
mu := sample(dist/normal(0.0, 1.0), :id, :mu)
observe(dist/normal(mu, 1.0), 1.0, :id, :y)
mu
end
end
def world: sp/create-execution-context()
def posterior: sp/with-context world:
@infer/smc-infer(model(), 1000)
end(defn model []
(spin
(let [mu (sample (dist/normal 0.0 1.0) :id :mu)]
(observe (dist/normal mu 1.0) 1.0 :id :y)
mu)))
(def world (sp/create-execution-context))
(def posterior
(sp/with-context world
@(infer/smc-infer (model) 1000)))SMC, particle MCMC, HMC, involutive MCMC, BBVI, interventions and counterfactuals, simulation-based calibration. Open source: github.com/replikativ/foerster. Steering language models with SMC: Lew et al. 2023.
4 · Layered compilation as bounded-rational learning
measure \(c\) when \(\;\mathbb{E}\big[\,U(\text{plan after } c) - U(\text{plan now})\,\big] > \operatorname{cost}(c)\)
Value of computation: Russell & Wefald 1991. Raster on CPU: a LeNet-5 training step runs 1.7–2.4× faster than JAX.
Speculation with guards and deoptimisation: Hölzle, Chambers & Ungar 1992. In our stack the passes are values in the running system.
\(\displaystyle \mathbb{E}[P_L] = \mathbb{E}[P_0] + \sum_{l=1}^{L} \mathbb{E}[P_l - P_{l-1}]\) multilevel Monte Carlo: adjacent levels share their random numbers, so corrections are cheap
Christen & Fox 2005 (delayed acceptance); Giles 2008 (multilevel Monte Carlo); Hennig, Osborne & Kersting 2022 (probabilistic numerics).
CompCert: Leroy, CACM 2009. Translation validation: Pnueli, Siegel & Singerman 1998; Necula 2000. Reflection behind a gate: Amin, LICS 2026.
a/defn only-known [xs :- List(Nat) ys :- List(Nat)] List(Nat):
filter(x -> member(x, ys), xs)
end
w/explain('only-known)
;; {:verified? true,
;; :rewrites ["List.elem_filter_eq_index_probe"]}
;; a hash semi-join instead of a nested scan
;; 1461 ms → 3.9 ms per call at 10k × 10k(a/defn only-known [xs :- (List Nat), ys :- (List Nat)] (List Nat)
(filter (fn [x] (member x ys)) xs))
(w/explain 'only-known)
;; {:verified? true,
;; :rewrites ["List.elem_filter_eq_index_probe"]}
;; a hash semi-join instead of a nested scan
;; 1461 ms → 3.9 ms per call at 10k × 10k5 · Building simulations with agents
The forkable SCI runtime from simm.is, running in the browser. Serve the deck over http for this slide (python3 -m http.server in deck/).
Rooms of participants (people, models, scripts) on a bus. Five primitives: tagged messages (the tag is the speech act) · subscriptions by tag · ask, with the reply as a value · fork a room, then merge or discard · a handle that swaps who decides.
Discourse as reactive rational speech acts: Frank & Goodman 2012; Cohn-Gordon, Goodman & Potts 2019.
def analyst: {:id :analyst, :skills #{:research},
:model-policy {:provider :anthropic, :model "sonnet"},
:program {:kind :llm, :max-model-steps 32, :budget-dollars 0.5}}
def team: agent/roster({:id :investigation}) .> agent/make-agent(analyst)
def team-2: agent/revise-agent(team,
:analyst, {:prompt "Challenge the strongest contrary case"})
spin:
a := agent/hire!(team, :analyst, {:task claim, :settlement :review})
b := agent/hire!(team-2, :analyst, {:task claim, :settlement :review})
{:v1 :run/value(await(agent/result-spin(a))),
:v2 :run/value(await(agent/result-spin(b)))}
end(def analyst {:id :analyst :skills #{:research}
:model-policy {:provider :anthropic :model "sonnet"}
:program {:kind :llm :max-model-steps 32 :budget-dollars 0.5}})
(def team (-> (agent/roster {:id :investigation})
(agent/make-agent analyst)))
(def team-2 (agent/revise-agent team :analyst
{:prompt "Challenge the strongest contrary case"}))
(spin ; a reactive computation
(let [a (agent/hire! team :analyst {:task claim :settlement :review})
b (agent/hire! team-2 :analyst {:task claim :settlement :review})]
;; each Run works in its own fork of the room's world;
;; :review keeps both forks for a person to compare
{:v1 (:run/value (await (agent/result-spin a)))
:v2 (:run/value (await (agent/result-spin b)))}))Two versions of a team run side by side, each in its own fork of the world. Runs compose like any other reactive value (await, race), and :review keeps both forks for a person to compare.
\(\displaystyle p(\theta \mid e_1, e_2, s) \;\propto\; \frac{p(\theta \mid e_1, s)\;p(\theta \mid e_2, s)}{p(\theta \mid s)}\) exact iff \(E_1 \perp E_2 \mid \Theta, S\); naive error \(= I(E_1;E_2 \mid \Theta, S)\)
Grime & Durrant-Whyte 1994 (channel filter); Tresp 2000 (Bayesian committee machine); Goudie et al. 2019 (Markov melding); Green, Karvounarakis & Tannen 2007 (provenance semirings).
Task: find Simmis's competitors, each with a quote from a page the attempt fetched. On a frozen copy of the web, 51 pages saved from earlier runs, so every attempt sees the same web. Dvergr records every search and fetch.
Three attempts per model, Claude Haiku 5.5 and GPT-5.6 Luna, 9 October 2026. Searches are left out of the overlap, since attempts almost never repeat a query word for word.
| working now |
|---|
| rooms of people and agents |
| versioned, queryable company memory |
| branches across data, files, code and execution |
| proposal review: diff, conflicts, merge, discard |
| scheduled agent workflows |
| tool allowlists and spending limits per room |
| your own model keys |
In progress: permissions for acting users, one interface for branches. Research: the organisation simulating itself on branched state (simm.is/roadmap).
6 · Where it leads
simm.is/blog/measuring-agent-workflows, measured 1–10 October 2026: BIRD, 100 questions in SQL; SpreadsheetBench, 59 tasks.
One step, by hand, on BIRD: two sentences added to the description of Datalog.
| workflow | correct (of 100) | input tokens |
|---|---|---|
| SQL on SQLite | 59 | 8,880 |
| Datalog, revised | 63 | 14,042 |
| Datalog, previous | 58 | 16,684 |
Five more with less input, but p = 0.23: promising, to be confirmed before it is adopted.
working now a person or an agent proposes, Dvergr measures
building next the agent runs the whole loop
Merge when the cases show it is not worse: the rule a team applies to a code change.
Computing tells a learner about its model, not about the world: Hennig, Osborne & Kersting 2022. Loops that feed on their own output: Shumailov et al., Nature 2024; Manheim & Garrabrant 2018.
Brasília, the Eixo Monumental (photo: Roberto Castro / MTur, public domain).
"Certain forms of knowledge and control require a narrowing of vision."
James C. Scott, Seeing Like a State, 1998, opening line
Each failure breaks a rule of this talk: a coarse model proposes and something checks; the error stays with the claim; those affected are the evidence about their own lives.
His own remedies: take small steps, favour reversibility, plan on surprises, plan on human inventiveness. Measured steps, forks, uncertainty, and people as evidence.
Jan Saenredam after Cornelis van Haarlem, Antrum Platonicum, 1604 (Rijksmuseum, CC0).
The real is never known directly, but it answers back.
Plato, Republic VII; Helmholtz 1867; Friston, J. R. Soc. Interface 2013 (Markov blankets); von Foerster 2003.
"There is one quality more important than know-how … This is 'know-what': by which we determine not only how to accomplish our purposes, but what our purposes are to be."
Wiener, The Human Use of Human Beings, 1950, p. 210
A society of learners has to ground its purposes in the people they affect, who are the only source of evidence about their own lives.
Such channels exist. Polis lets thousands of people write and vote on short statements, maps the opinion groups, and finds the statements agreed on across them; Taiwan's vTaiwan process uses it. I worked on modernising its PCA and clustering pipeline (2025). In preparation: "Polis as an inverse problem: a generative model of opinion elicitation". The same channel can debate forks of a city, like the Stuttgart scenarios from the start.
Small, Bjorkegren, Erkkilä, Shaw & Megill, Recerca 2021, Fig. 1 (CC BY-SA 4.0).
We all learned this way: as children we rehearse the world in play. A society can rehearse its decisions.
Gopnik & Wellman 2012; Ullman, Spelke, Battaglia & Tenenbaum 2017. Photo: Thane Keller, CC0.
More humane, too: mistakes are made in forks before they are made in people's lives, and the people affected take part instead of being planned for.
The same rules bind every learner, including ones smarter than us: computing alone does not ground them, their evidence counts once, their budgets are conserved, their purposes come from those affected. We program the checks, records and budgets, and coexist inside them.
Agüera y Arcas, What Is Intelligence?, MIT Press 2025: life and intelligence as prediction, computation at the heart of the living.
simm.is · github.com/replikativ · christian@weilbach.name
Calculus draft, diagrams and sources on request.
Backup
| Python ecosystem | Julia | this stack (Clojure) | |
|---|---|---|---|
| optimisation passes live in | C++/CUDA libraries, each with its own build | Julia IR passes; LLVM (C++) below | Clojure data in the running image |
| iterate on a kernel or schedule | rebuild and relink a library | in Julia, down to LLVM | at the REPL, same process |
| inspect the middle | across opaque binaries | Julia IR yes; LLVM via dumps | every pass |
| database, proofs, runtime | separate systems | separate systems | Datahike, Ansatz, Spindel in one host |
| fork a running world | process level | process level | persistent values |
deftm norm [x :- Double y :- Double] :- Double:
sqrt(x * x + y * y)
end
par/map(f, xs)
par/reduce(+, 0, xs)
;; → primitive JVM bytecode, no boxing
;; fusion across function boundaries
;; → SIMD, OpenCL, Vulkan, Level Zero; CUDA in progress; HIP, FPGA planned(deftm norm [x :- Double, y :- Double] :- Double
(sqrt (+ (* x x) (* y y))))
(par/map f xs)
(par/reduce + 0 xs)
;; → primitive JVM bytecode, no boxing
;; fusion across function boundaries
;; → SIMD, OpenCL, Vulkan, Level Zero; CUDA in progress; HIP, FPGA planned| The learner has to… | So the medium provides… |
|---|---|
| try alternatives that share most of their state | persistent values: a fork stores only what changed |
| count each piece of evidence once when branches meet | immutable history, with every record's identity kept |
| describe itself in small languages with laws | algebras as libraries, cheap to propose, test and replace |
| change those languages while running, and test the change | code as data, staging, and a REPL in the running system |
| change its rules only through a check | a proof kernel inside the host |
| know what its computation costs | costs measured and recorded with the results |
| algebra | its laws give | library |
|---|---|---|
| replicated data types | convergence without coordination | Replikativ |
| Datalog with time | queries over any past state | Datahike |
| parallel array operations | fusion and lowering to devices | Raster |
| calculus of inductive constructions | checked proofs | Ansatz |
| Idealisation | Relaxed by | Added here |
|---|---|---|
| the machine is exact | probabilistic numerics; probabilistic rounding analysis | the device as the lowest translation, error measured |
| computation is free | metareasoning; resource-rational analysis; Ortega & Braun | costs as measured entries in one ledger; viability |
| representation fixed from outside | AutoML; Gödel machine; Genewein et al. (hierarchy from cost) | representation as a value, changes priced and checked |
\[ R_{t+1} = R_t + \Pi(o_t, w_t) - \kappa(o_t) - \mu(O_t), \qquad \text{viable while } R_t \in \mathcal V \]
Capture, minus the cost of acting and deciding, minus upkeep. Under ruin, maximising expected reserves is the wrong objective (Kelly; Peters 2019). Viability and purposes enter as constraints and are never traded for budget.
| Experiment | Tests | |
|---|---|---|
| 1 | the same system in Python, Clojure and a persistent IR, changed by agents | the cost-of-change claim |
| 2 | observation and computation under one budget, at several fidelities | allocation against SBI, BED, multi-fidelity methods |
| 3 | model-class revision from the Stuttgart mismatch, with recorded warrants | "isn't this AutoML?" |
| 4 | verified adaptive execution: when to re-measure and re-plan | grounding combined with rewriting |
"Das Ganze ist das Unwahre." (The whole is the false.)
Adorno, Minima Moralia, 1951
No. It cannot ground itself, every translation keeps its error explicit, and agreement among similar learners is worth less than agreement among diverse ones. Applied to itself, it stays open: the calculus agrees with Adorno's warning against a closed system, by its own rules.
AutoML optimises a pipeline against a given evaluation. Here the evaluation's warrant, the measurement and the organisation doing the search are part of the problem. Experiment 3 is the test.
Yes, when each loop is checked against a reference it cannot change: a finer simulator, a measurement, a proof kernel. Computing alone tells a learner about its model, not about the world, so a loop that is checked only by itself drifts. Changing what the system is for needs authority recorded from the people it affects.
| Level | What forks, and how | Library |
|---|---|---|
| storage | key–value stores and persistent B-trees, shared across forks | Konserve, persistent-sorted-set |
| data | Datalog database with queryable history | Datahike |
| data, files, code | one composite branch across several stores | Yggdrasil |
| execution | running programs and interpreters as forkable values | Spindel, forkable SCI |
| inference | probabilistic programs: SMC and MCMC over forked worlds | Foerster |
| model cache | a language model's KV cache with identity and copy-on-write | pretrained-rstr |
| compilers, proofs | passes as data; rewrites checked by a Lean-compatible kernel | Raster, Wandler, Ansatz |
| agents, teams | runs, receipts, budgets; review of proposals | Dvergr, Simmis |
Pavlovic, Programs as Diagrams (2023): a monoidal computer has data services, which copy and delete, and a program evaluator, so that programs are data.
Coding agents wrote much of this, working at a REPL against the running system. Their mistakes show up there immediately, and the proof kernel catches the ones that matter most.
Pooled reserves and pooled evidence are both worth only their independent part:
\(\displaystyle n_{\text{eff}} = \frac{n}{1 + (n-1)\,\bar r}\)
| Layer | Status |
|---|---|
| the laws | proven |
| programming model | partly built |
| the society | open |
If more of the work moves to agents, these laws still bind them. Programming such a society means writing its checks, records and budgets.
Before calling the model wrong, translate: compute the survey's quantity from the model, and let the survey enter as evidence in that shared description.
Dyer et al., NeurIPS 2024: interventionally consistent surrogates for agent-based models.
Top: the branch after two increments. Bottom: the original, unchanged.
Certified cases enter an experiment room; each attempt runs in its own fork and is graded there; only the verdict is kept (simm.is/blog/measuring-agent-workflows).
My prediction for the coming year: programming becomes inference and amortisation under a budget, and optimisation moves from network weights to whole systems.
| What | Status |
|---|---|
| many subsystems improve in parallel, each in its own fork, merged after review | partly built |
| agents and simulators steered by SMC; the trajectories become training data | built |
| training, inference and scientific computing planned together (Raster) | research |
| an organisation's workflows as one probabilistic program to infer and plan over | research |
That is recursive self-improvement, spread over many small loops. Each loop has to be checked against something it cannot change.
Step 1. Bayes on all the evidence, with \(p(\theta \mid s)\) as the prior: \(\;p(\theta \mid e_1, e_2, s) \propto p(e_1, e_2 \mid \theta, s)\; p(\theta \mid s)\)
Step 2. Independence, used only here: \(\;p(e_1, e_2 \mid \theta, s) = p(e_1 \mid \theta, s)\; p(e_2 \mid \theta, s)\)
Step 3. A branch reports its posterior, not its likelihood; Bayes for one branch, rearranged: \(\;p(e_i \mid \theta, s) \propto \dfrac{p(\theta \mid e_i, s)}{p(\theta \mid s)}\)
Step 4. Substitute:
\(\displaystyle p(\theta \mid e_1, e_2, s) \;\propto\; \frac{p(\theta \mid e_1, s)}{p(\theta \mid s)} \cdot \frac{p(\theta \mid e_2, s)}{p(\theta \mid s)} \cdot p(\theta \mid s) \;=\; \frac{p(\theta \mid e_1, s)\; p(\theta \mid e_2, s)}{p(\theta \mid s)}\)
Independence decides whether the product is right; without it the error is the factor \(p(e_1, e_2 \mid \theta, s) / \big(p(e_1 \mid \theta, s)\, p(e_2 \mid \theta, s)\big)\), on average \(I(E_1;E_2 \mid \Theta, S)\). The division turns each posterior back into a likelihood, so the shared part counts once.
\(s\) must be the records both actually read, from the receipts: a shared page missing from \(s\) is still counted twice; a private page wrongly put into \(s\) is divided out and lost.
Julia and Lean are extensible too. Whether one live host lowers the cost of change for people and agents is a hypothesis, and experiment 1 tests it.