Inspiration Every policy decision — a new transit line, a zoning change, a minimum wage increase — affects thousands of people in ways that are nearly impossible to predict before implementation. Policymakers rely on surveys, focus groups, and gut instinct. We wanted to build something better: a way to simulate public reaction at scale before a single dollar is spent or a single life is disrupted. We were inspired by the idea of digital twins used in engineering — virtual replicas of physical systems used to test decisions safely — and asked: what if we built one for society? What it does MARGIN is a policy simulation toolkit that deploys thousands of AI agents to predict how a population will react to any given policy. Paste in a transit proposal, a housing bill, a political campaign, or an ad — MARGIN distributes it across a network of agents, each modeled with distinct traits like institutional trust, emotional reactivity, and political identity. The agents interact, influence each other, and drift toward positions of support or opposition. The result is a live visualization showing which communities support the policy, which oppose it, how sentiment spreads through social networks, and where displacement or unintended harm is likely to emerge. How we built it We built MARGIN as a full-stack simulation framework with two core layers. The first is Prism — an individual agent modeling system that assigns each agent a profile across key psychological and sociological dimensions. The second is Swarm — a multi-agent interaction engine that models how agents influence each other across a social graph, producing emergent group behavior from thousands of individual decisions. The frontend visualizes this in real time as a holographic city where buildings glow by district stance, and a force-directed network graph where agents visibly drift into polarized clusters. Challenges we ran into The hardest challenge was validity — it is easy to make agents behave in interesting ways, but much harder to make them behave in meaningful ways. We had to carefully choose which trait dimensions actually drive policy reaction without making the model so complex it became uninterpretable. Balancing simulation realism with explainability took significant iteration. On the technical side, rendering a responsive real-time city simulation and live physics-based network graph simultaneously in the browser pushed performance limits hard. Accomplishments that we're proud of We achieved an 87% accuracy rate in predicting how an agent will react to a policy in a way that closely mirrors real human response patterns. We built a two-layer simulation architecture — Prism and Swarm — with a clean separation of concerns that makes the system interpretable and extensible. And we created a visualization that makes abstract simulation data immediately intuitive: you can watch a city light up in real time and watch a population polarize before your eyes. What we learned We learned that the most dangerous version of this kind of tool is one that oversells its certainty. MARGIN is a scenario engine, not a crystal ball — it shows you what could happen under a given set of assumptions, not what will happen. That distinction shaped every design decision we made, from how we label outputs to how we frame the AI analysis. We also learned that emergent behavior in multi-agent systems is surprisingly sensitive to small changes in individual trait parameters — which is itself an insight about how real societies work. What's next for MARGIN We want to calibrate Prism profiles against real demographic and behavioral datasets to move from plausible simulation toward genuinely predictive modeling. We plan to expand the policy input types beyond text to include structured data like budget proposals and zoning maps. We are exploring partnerships with urban planning departments, civic research labs, and NGOs who need tools to stress-test policy decisions before rollout. Longer term, MARGIN could become a platform where any citizen can input a proposed policy and see a transparent, explainable simulation of who it helps and who it hurts — making the hidden consequences of governance visible to everyone.

Built With

Share this project:

Updates