Electoral Equilibrium
Electoral Equilibrium is a stochastic-optimization pipeline that reads a plain-text political shock, uses a fine-tuned Mistral 7B model to estimate how each demographic bloc’s loyalty shifts, then computes—via convex optimization and Monte Carlo simulation—how a party’s winning coalition must rebalance and its probability of still winning with a 90% confidence interval.
What it is
Built as a Claremont McKenna College Summer Research Program (SRP) 2026 project, advised by Prof. Gaston Espinosa. It is prescriptive, not predictive: rather than forecasting who will win, it asks what a coalition would have to change to still win if the world shifted overnight. It is a research tool, not an election forecast.
How it works
The system runs a three-stage pipeline, streamed to the browser over Server-Sent Events (SSE) so each stage appears as it completes:
- Shock interpretation — a fine-tuned Mistral 7B model (QLoRA, with constrained/structured decoding) reads free text describing an event and estimates a per-stratum loyalty shift (Δμ) for every demographic bloc.
- Coalition optimization — a CVXPY disciplined-quasiconvex (DQCP) optimizer rebalances the race/ethnicity weights to maximize the probability of winning, subject to feasibility constraints, and returns the new optimal weights plus a feasibility flag.
- Win-probability simulation — a Monte Carlo simulation over a logistic-normal (isometric-log-ratio, ILR) distribution with N = 10,000+ draws produces a point estimate of P(win) with a 90% confidence interval.
Demographic architecture
The electorate is partitioned into 15 demographic blocs across three parallel strata — Race/ethnicity (5 groups), Religion (7 groups), and Gender (3 groups). These are parallel marginal tables, not nested cross-tabulations, which keeps the model tractable given severe data scarcity. Only the race/ethnicity stratum holds the optimizer’s decision variables; the other strata contribute fixed-weight terms to the effective metric.
Technical stack
| Shock model | Fine-tuned Mistral 7B (QLoRA / PEFT), constrained decoding |
|---|---|
| Optimization | CVXPY, disciplined quasiconvex programming (DQCP) |
| Simulation | Monte Carlo over logistic-normal (ILR), NumPy / SciPy |
| Signal / NLP layer | RoBERTa scoring; social + news collection via Bluesky and Apify |
| Frontend | Next.js (App Router), server-side rendered, SSE streaming |
| Inference / infra | Modal / vLLM inference backend |
Results & validation
Calibration uses iterative proportional fitting (IPF) over roughly 20 U.S. presidential cycles (1948–2024). IPF converged in 2 iterations to raked stratum weights of race 0.114, religion 0.224, and gender 0.662 — recovering the well-documented growth of the gender gap from first principles. This is a model-calibration result reflecting cross-cycle temporal variance, not a claim that gender matters more than race at the individual level (African American party loyalty, for instance, has been a stable 87–92% since 1964). TODO(juhi): add any held-out backtest or win-probability calibration metrics you want to cite publicly.
Limitations
The central constraint is data scarcity: only ~20 modern presidential elections exist, so the architecture is built to work around roughly 20 data points rather than learn freely from history. λ weights are aggregate-level regression coefficients subject to the ecological fallacy, not individual-level causal effects. The additive-independence assumption across strata does not model intersectional interactions (e.g. Latino Evangelical women). The tool estimates equilibria under stated assumptions; it is explicitly not a forecast of real election outcomes.
Frequently asked questions
What is Electoral Equilibrium?
A machine-learning research pipeline that models how a political party’s winning voter coalition must structurally rebalance after a hypothetical shock, and estimates the probability of still winning. It combines a fine-tuned Mistral 7B model, CVXPY convex optimization, and Monte Carlo simulation.
Who built Electoral Equilibrium and is it a forecast?
It was built by Juhi Damley as a Claremont McKenna College Summer Research Program 2026 project, advised by Prof. Gaston Espinosa. It is a prescriptive research tool, not an election forecast.
What machine-learning methods does it use?
A fine-tuned Mistral 7B model (QLoRA) with constrained decoding for shock interpretation, CVXPY disciplined-quasiconvex optimization for coalition rebalancing, and Monte Carlo simulation over a logistic-normal (ILR) distribution for win-probability estimation.