Inspiration
Most infrastructure resilience tools wait for something to break. They monitor, alert, and respond to failures that have already happened or been manually scripted. We kept asking a different question: what are the failure modes nobody has thought to rehearse? Real-world cascading collapses — power grids, hospital systems, city-wide outages — often emerge from obscure dependency chains that no operator modeled in advance. We wanted to build something that actively hunts those hypotheses rather than waiting for reality to surface them.
What it does
Black Swan Forge is an adversarial world model for a synthetic interconnected city. It simulates 28 infrastructure nodes and 46 directed dependencies across power, water, telecom, hospitals, transport, fuel, payments, emergency services, and civic systems. Instead of replaying known disaster scripts, it runs a seeded evolutionary search to discover previously unseen cascading failure scenarios — combinations of shocks that produce severe, cross-domain collapse. Once a candidate is found, a delta-debugging algorithm strips it down to the minimal conditions that still cause collapse. A cost-ranked optimizer then finds the smallest intervention that prevents it, and counterfactual replay verifies the city survives. A natural-language explanation layer powered by Google Gemini translates the algorithmic output into plain English for each discovered failure and its repair.
How we built it
The simulation core is a pure TypeScript engine with no runtime dependencies — deterministic, seeded, and fully testable. It runs discrete-time propagation with delayed effects, finite backups, recovery rates, and causal parent tracking. On top of that we layered five research algorithms: evolutionary scenario search, delta-debugging minimization, causal-edge ablation by deletion replay, combinatorial Pareto intervention optimization, and seeded Monte Carlo uncertainty analysis. We also built a validated adapter for the public MATPOWER IEEE 14-bus power topology. The front end is Next.js with React Flow for the live dependency graph and Recharts for severity timelines. The Gemini integration runs as Next.js API routes so the API key never reaches the browser — the client calls our own backend, which calls Gemini and returns plain-text explanations.
Challenges we ran into
Keeping the simulation fully deterministic while making the evolutionary search genuinely adversarial required careful seeding at every layer — random candidates that look severe but are algorithmically trivial had to be filtered by a fitness function that rewards cross-domain spread, causal depth, and delayed impact rather than raw destruction. Delta-debugging was tricky to implement correctly: each minimization step requires a full simulation replay, and the order in which conditions are removed matters for the minimality guarantee. On the Gemini side, model availability varied by API key tier, so we added automatic fallback and smoke-tested available models at setup time to pick one that actually responds.
Accomplishments that we're proud of
The evolutionary search consistently outperforms uniform-random, criticality-ranked, and graph-centrality baselines under equal simulation budgets — and that result is reproducible from a single npm run study command that prints machine-readable JSON, not a hand-written claim. The causal minimizer genuinely reduces discovered scenarios to their irreducible core, and edge-deletion ablation independently verifies which dependency links are necessary for collapse. The 90-second demo walks through an authentication → payment → fuel → hospital cascade, minimizes it, finds the repair, and replays the counterfactual survival — all from deterministic, auditable code with no fabricated numbers anywhere in the UI.
What we learned
Formal causal minimization and adversarial search are much more useful together than either is alone. Search finds the needle; minimization makes it legible. We also learned that building for reproducibility from day one — fixed seeds, machine-readable output, no presentation copy — changes how you think about every design decision. And integrating an LLM as a pure explanation layer, with strict instructions to only describe what the data shows, is a practical pattern that adds genuine value without introducing hallucination risk into the core results.
What's next for Black Swan Forge
The immediate research agenda is fitting dependency distributions from validated operational data rather than synthetic parameters, and running expert-blinded evaluation of the discovered hypotheses against domain specialists. On the algorithmic side: multi-intervention Pareto search, epistemic uncertainty quantification, and formal comparison against model-checking and Monte Carlo baselines. For the Gemini layer, the next step is enabling interactive Q&A so analysts can interrogate a specific failure — "why didn't the water system recover?" — and get answers grounded strictly in the simulation trace. Longer term, the architecture is designed to accept real infrastructure topology as input; the path from research prototype to deployment tool is documented, and the gap is validated data and domain expert partnership, not fundamental methodology.
Log in or sign up for Devpost to join the conversation.