Skip to content

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 →

pip install econiac

What EconIAC does

New here? See the ASA framework map — a one-page guide showing how MGE, TRS, the ISA trilogy, the H^k ladder, and EconIAC fit together in five layers.
Differentiable models
Every threshold, choice, and aggregation is a smooth Gibbs relaxation — end-to-end JAX/PyTorch gradients, calibratable by gradient descent.
Stock-flow consistency
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.
Thermal attribution
Differentiable Shapley values via the Gibbs ensemble. Attribute systemic risk, carbon tax burden, or supply-chain criticality in one backward pass.
Financial gauge theory
FX, yield curves, and credit spreads as parallel transport on the Pacioli manifold. Triangular arbitrage = non-zero holonomy.
Reverse stress testing
Find the minimum-cost intervention that keeps a supply chain, coalition, or portfolio above a survival threshold — via differentiable optimisation.
Pacioli Combinator Library
A typed DSL for financial flows. flow, sequence, choose, fold — every combinator preserves conservation by construction.
Systemic risk & contagion
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.
Cohomological risk classification
Bilateral risk (H⁰) is hedgeable with swaps. Triangular risk (H¹) — convexity, basis, XVA correlation — requires options; no bilateral hedge covers it. Systemic risk (H²) — wrong-way risk, cascade amplification — requires CCPs or central banks. EconIAC computes all three and detects when H² becomes non-trivial before any individual institution fails.

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

\[a \oplus_\beta b = -\frac{1}{\beta}\ln\!\left(e^{-\beta a}+e^{-\beta b}\right)\]

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.

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 the Adelic Simplicial Architecture (ASA) — the same β parameter and five-opcode instruction set that governs FMO photosynthesis efficiency, Shor's algorithm, and nuclear spectroscopy also governs the Keynesian multiplier, XVA pricing, and systemic contagion. The papers below are Portfolio G of the ASA; the full bibliography is at the ASA 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
293 — Thermal Attribution Differentiable Shapley values via the Gibbs ensemble
294 — Thermodynamic Information Routing TIR unified framework across economics, computation, knowledge retrieval
313 — Thermal Economics Implicit differentiation through fixed points as unifying schema
315 — Differentiable Nash QRE as implicit differentiation; coalition stability; climate policy
316 — EconIAC / MONIAC The platform paper; differentiable macroeconomics via Gibbs ensemble
305 — Differentiable ABM Gauge-theoretic digital twin on the Pacioli manifold

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
303 — Pacioli Combinator Library Conservation-enforcing DSL for financial and economic computation

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
311 — Climate Hazard Yield Surface 2D yield surface for climate investment; doomsday clock isocurve; EGT holonomy
290 — Beyond DAGs Non-associative algebra of policy interventions

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