EconIAC
Differentiable economics on the Pacioli manifold.
EconIAC is a Python library for building differentiable macroeconomic and financial models grounded in gauge theory, thermodynamics, and double-entry bookkeeping. Named after MONIAC (1949), Bill Phillips's hydraulic computer — EconIAC is MONIAC for the 21st century. Learn more →
What EconIAC does
Every threshold, choice, and aggregation is a smooth Gibbs relaxation — end-to-end JAX/PyTorch gradients, calibratable by gradient descent.
Double-entry accounting as a discrete gauge theory. The Pacioli identity (every claim has a counter-claim) is enforced algebraically — money can be created by banks, but only by simultaneously creating a liability.
Differentiable Shapley values via the Gibbs ensemble. Attribute systemic risk, carbon tax burden, or supply-chain criticality in one backward pass.
FX, yield curves, and credit spreads as parallel transport on the Pacioli manifold. Triangular arbitrage = non-zero holonomy.
Find the minimum-cost intervention that keeps a supply chain, coalition, or portfolio above a survival threshold — via differentiable optimisation.
A typed DSL for financial flows.
flow, sequence, choose, fold — every combinator preserves conservation by construction.
Fire sales, repo runs, rehypothecation collapse — modelled as a typed operator algebra. Policy gradient
∂loss/∂haircut in one pass. Covers interbank, sovereign repo, and deposit-run channels.
Bilateral risk (H⁰) is hedgeable with swaps. Triangular risk (H¹) — convexity, basis, XVA correlation — is the first obstruction no bilateral hedge covers. Higher classes are proposed to describe system-level inconsistency. The H⁰/H¹ construction is classical and verifiable; the systemic-risk reading is untested on data.
What EconIAC adds over mainstream simulation frameworks
Mainstream system dynamics, digital twin, and agent-based modelling frameworks (Stella, Vensim, AnyLogic, NetLogo) are excellent for building and communicating models. EconIAC is designed for what comes next: calibration, differentiation, and stress-testing.
| Capability | Mainstream frameworks | EconIAC |
|---|---|---|
| Exact policy gradients | Manual parameter sweeping | jax.grad — one backward pass |
| Calibration | Manual dial-turning | Gradient descent on calibrate_beta(data) |
| Reverse stress testing | Not supported | Differentiable optimisation over survival threshold |
| Double-entry enforcement | Modeller discipline | Algebraic — every claim must have a counter-claim; violations are type errors |
| Second-order sensitivities | Not supported | jax.hessian — exact cross-gamma in one call |
| Tipping point early-warning | Simulate through bifurcation | χ(β) computable before the bifurcation arrives |
| Differentiable ABMs | Hard IF/THEN thresholds | Smooth Gibbs relaxations, end-to-end differentiable |
| GPU/TPU acceleration | Limited or none | Native via JAX |
EconIAC can import Stella/Vensim models via the pysd backend — use the visual
modelling tools you already have, then bring the model into EconIAC to differentiate and calibrate it.
Quick start
from econiac.pcl import flow, sequence, choose, compile, typecheck
# Three sectors, one instrument
wages = flow("firms", "households", "deposits", 1000.0)
taxes = flow("households", "government", "deposits", 200.0)
reinvest = flow("households", "firms", "deposits", 500.0)
save = flow("households", "banks", "deposits", 300.0)
# β=2: lean toward the higher-value strategy, but hedge
quarterly = sequence(wages, sequence(taxes, choose(2.0, reinvest, save)))
assert typecheck(quarterly)
fast = compile(quarterly)
Or run the supply-chain reverse stress test:
from econiac.economics.supply_chain import COPPER_CHAIN, reverse_stress_test
result = reverse_stress_test(COPPER_CHAIN, threshold=0.85, beta=3.2)
print(result.criticality_vector) # which suppliers to buffer first
print(result.min_cost_buffers) # minimum buffer allocation
The core idea: one temperature parameter, every scale
The ⊕_β semiring operation
interpolates continuously between ordinary addition (β → 0), Gibbs weighting (0 < β < ∞), and the hard minimum (β → ∞). This single substitution makes any discrete model differentiable — and the same parameter β governs systems across every scale:
| System | β → ∞ (classical) | Finite β | β = it (quantum) |
|---|---|---|---|
| Economics | Perfect rationality | Calibrated agent behaviour | — |
| Statistical mechanics | Ground state | Gibbs ensemble | Quantum amplitude |
| Shor's algorithm | Classical modular exp | — | QFT interference |
| FMO photosynthesis | Hard energy minimum | Thermal fluctuations | Coherent transfer |
| Optimal transport | Monge map | Sinkhorn plan | — |
Rationality is temperature is the economics corollary: standard models treat agents as perfectly rational (β → ∞, argmax). EconIAC treats rationality as a calibrated temperature — finite β, fit from observed choice variance. At β → ∞ you recover the classical model exactly. At finite β you get policy gradients, reverse stress tests, and early-warning signals for tipping points before they arrive. The snap event at β = (3/8)ln(1/(1−ρ)) marks the transition from exploratory to committed regimes — computable from network density ρ alone, before any individual institution fails.
A note on what is and is not established. The H⁰/H¹ construction is classical applied sheaf theory (Curry, Ghrist, Robinson, Hansen) and is verifiable directly. The reading of systemic risk as a higher cohomology class is a proposal that has not been computed on historical data — not for 2008, not for any other episode. The obstacle is data rather than mathematics: a non-trivial higher class requires the same exposure to be estimated differently by different institutions, and those estimates are proprietary. Claims of early warning are motivation for the construction, not demonstrated capability.
EconIAC is the economics and finance engine of the Topological Resonance Synthesis (TRS) framework. The same β parameter and the same five opcodes (SPLIT/SPLAT/FLIP/FLOP/TWIST) that describe quantum circuits and nuclear spectroscopy also describe the Keynesian multiplier, XVA pricing, and systemic contagion — not by analogy, but as the same theorem instantiated for different sheaves.
Read more: Rationality is temperature →
Papers
EconIAC is the economics and finance engine of HotLogiQ — the same β parameter and five-opcode vocabulary used to describe FMO photosynthesis efficiency, Shor's algorithm, and nuclear spectroscopy also describes the Keynesian multiplier, XVA pricing, and systemic contagion. The papers below are Portfolio G; the full bibliography is at the HotLogiQ site.
Foundations
| Paper | What it establishes |
|---|---|
| 289 — The Temperature of Rationality | Maslov–Gibbs ensemble as economic foundation; rationality as temperature |
| 291 — The Topology of Conservation | Double-entry accounting as discrete gauge theory; the Pacioli manifold |
| 294 — Thermodynamic Information Routing | TIR unified framework across economics, computation, knowledge retrieval |
| 315 — Differentiable Nash | QRE as implicit differentiation; coalition stability; climate policy |
Financial gauge theory
| Paper | What it establishes |
|---|---|
| 295 — Currency Bundles | FX as connection curvature; triangular arbitrage = non-zero holonomy |
| 296 — Term Structure Bundles | Interest rates as temporal connections on the Pacioli manifold |
| 298 — Credit Bundles | Survival probabilities as parallel transport |
| 299 — XVA as Curvature | CVA/DVA/FVA/MVA as gauge curvature; Burgard–Kjaer PDE as flatness condition |
| 300 — Economic Gauge Theory | Stock-flow consistency, thermodynamic constraints, climate risk |
| 301 — Primer on Economic Gauge Theory | Connections, curvature, and conservation on the Pacioli manifold |
Cohomological risk (bilateral · triangular · systemic)
| Paper | What it establishes |
|---|---|
| 396 — The Unhedgeability Theorem | The unhedgeability theorem: bilateral risk = H⁰, triangular risk = H¹, systemic risk = H². Options exist because H¹ ≠ 0. |
| 397 — Systemic Risk as H² | Cohomological stress test; SIFI theorem; XVA wrong-way risk as H²; 2008 as a topological event. |
| 398 — The Topology of Risk (Primer) | Plain-language introduction for practitioners. No prior topology required. |
Systemic risk and contagion
| Paper | What it establishes |
|---|---|
| 332 — CHZ Fire Sales (in preparation) | Differentiable interbank contagion; capital paradox; sheaf H¹ early-warning precedes cascade by 2–3 periods |
| 333 — European Sovereign Repo Run (in preparation) | Rehypothecation collapse; LDI surcharge; 2022 UK gilt crisis as H² event |
| 335 — Topological Inconsistency (in preparation) | H¹ as first-class economic observable; R²=1 and H¹≠0 simultaneously possible |
Climate and macro
| Paper | What it establishes |
|---|---|
Modules
| Module | What it does |
|---|---|
econiac.core |
BalanceSheet, Gibbs weights, manifold geometry |
econiac.routing |
TIR routing, thermal Shapley attribution |
econiac.pcl |
Pacioli Combinator Library — conservation-enforcing DSL |
econiac.economics |
Macro models: Keen, GEMMES, LowGrow, supply-chain RST, climate yield |
econiac.finance |
FX, yield curves, credit spreads, XVA — gauge-theoretic finance |
econiac.finance.contagion |
Systemic risk operator algebra — fire sales, repo runs, sheaf H¹ early-warning, policy gradient |