Simulating Markets Instead of Fitting Curves to Them
MiroFish replaces curve-fitting with agent-based social simulation for demand forecasting, seeded with FRED data, macro signals, and decades of history. What the architecture gets right, what it still cannot do, and where the evidence actually holds up.
One trader simulated 2,847 digital agents before every trade on Polymarket's short-term Bitcoin price markets. Over 338 trades they reported $4,266 in profit, with one position returning 1,655% in five minutes. The edge they described was simple: when the simulated crowd's consensus diverged from what Polymarket was pricing, the bot entered the trade. The engine behind it is MiroFish, and this essay is about what it might do for demand forecasting, where nobody has measured it yet.
A demand forecast is treated as good if last month's MAPE was 4.2%, which sounds like the number that should decide inventory. It is the number on the weeks the distribution already repeats itself. LightGBM catches seasonality, LSTMs stacked on transformers track the trend, and gradient-boosted trees absorb whatever FRED macro series you feed them. So on 90% of the distribution the MAPE looks fine in the quarterly review. Then a tariff lands, a Fed decision comes in sideways, or a TikTok shifts sentiment overnight. The same model is off by 35%. You are looking at a warehouse of inventory nobody wants — or a shelf that should have been restocked three weeks ago.
Where curve fitting breaks
Traditional demand forecasting treats the world as a physics problem: deterministic, reducible to equations, solvable with enough inputs. Demand comes from people. They react to each other, form opinions from what their neighbors are buying, and panic-buy when the news cycle gets loud. Feature engineering does not capture the social dynamics of a disruption. The cascade — importers scrambling to pre-order, retailers moving shelf space, consumers seeing coverage and making individual decisions that reshape the market — is not in the historical correlation.
Picture forecasting demand for consumer electronics ahead of the holiday season, with CPI, a consumer sentiment index, the unemployment rate, and three years of historical sales. A week before Black Friday the Fed announces an unexpected rate hold, a major competitor launches a surprise price war, and a prominent tech reviewer publishes a scathing video that goes viral. An ARIMA model has no place to put any of this. A gradient-boosted tree might catch the macro shift a quarter later, when the CPI data finally reflects it, by which time the inventory decision is made. Statistical models are trained on historical correlations. Correlations break when the underlying causal dynamics shift. The model has never seen this combination of macro conditions, competitive pressure, and sentiment cascade, because that combination has not happened.
MiroFish
Every major forecasting approach of the last thirty years has shared one premise, that the future is at least partially legible from the past. MiroFish drops it and asks what happens if you simulate the people.
It is an open-source swarm intelligence engine built by Guo Hangjiang, an undergraduate at Beijing University of Posts and Telecommunications, in roughly ten days. Within 24 hours of a rough demo, Chen Tianqiao, the billionaire founder of Shanda Group, committed around $4.1 million to incubate the project. It hit #1 on GitHub's global trending list, above OpenAI and Google repositories, and has over 45,000 stars as of this writing.
You provide seed material: news articles, financial reports, policy documents, datasets, market research, or whatever describes the current state of the world for your question. Then you describe the question in natural language. To parse the input and extract entities, relationships, and pressures, the engine uses GraphRAG, a retrieval approach that builds a structured knowledge graph rather than searching a flat index. That graph becomes the world model from which agent personas are generated, each with distinct backgrounds, stances, and behavioral logic. An Environment Configuration Agent sets the simulation parameters and rules.
The agents populate two parallel simulated platforms at once, one shaped like Twitter's short-form dynamics and one like Reddit's threaded discussions. They post, debate, argue, form coalitions, shift opinions, and influence each other. Memories update as simulated time advances via Zep Cloud. A simulated analyst who read a bearish macro report in round 3 still carries that read when they meet a competitor announcement in round 47. A dedicated ReportAgent watches the run and synthesizes what the population collectively arrived at. The simulation stays open: you can step inside it, interview any individual agent, inject new variables, ask the ReportAgent follow-up questions, and watch what happens. Underneath is OASIS (Open Agent Social Interaction Simulations) from CAMEL-AI. It supports up to one million agents with 23 different social actions, including following, commenting, reposting, liking, muting, and searching.
For the electronics season above, MiroFish skips the curve fitting. You seed it with the current macro environment, the competitors, and the social media sentiment, then watch thousands of simulated consumers, retailers, analysts, and media outlets interact. What emerges is a distribution of plausible futures, shaped by the same social behavior that drives demand. Demand is an emergent property of collective human behavior: the interactions between all of them at once produce it, with no single consumer or retailer or analyst responsible. Swarm intelligence fits that object architecturally.
Seed material
MiroFish is an engine, not a plug-and-play forecasting API, and its output is only as good as the seed material you write. A poorly constructed world produces agents whose behavior does not map to reality. Unlike a statistical model, nothing historical anchors it to catch the error, and the simulations come out confidently wrong. Building the input takes domain expertise, which is why teams without it will not operationalize this easily.
The Federal Reserve Economic Data (FRED) database contains over 800,000 time series, from the federal funds rate to county-level unemployment to the University of Michigan Consumer Sentiment Index. Most ML practitioners dump a handful of them into a feature matrix. MiroFish inverts that. You do not feed the Consumer Price Index in as a floating-point number. You write seed material that says: "CPI has risen 3.8% year-over-year, the highest in six months. Wages have stagnated after inflation. Grocery prices are up 5.2% while energy costs remain elevated. The Fed has held rates steady at 4.25–4.50% through the first quarter of 2026, and forward guidance suggests two cuts are likely before year-end."
Agents read that the way people do, as contextual knowledge that shapes behavior, risk tolerance, and purchasing, rather than as coefficients in a regression. A simulated retail consumer who knows inflation is sticky and wages are flat behaves differently from one who knows prices are falling and employment is strong. When thousands of them interact, the collective demand signal is grounded in behavioral responses to actual economic conditions.
The FRED series I have used for demand-forecasting seed material fall into four categories. Consumer-side indicators, CPIAUCSL, PCE, DSPIC96, UMCSENT, and RSXFS, tell your agents what it feels like to be a consumer right now. Labor market indicators, including UNRATE, PAYEMS, JTSJOL, and JTSQUR, drive the consumer confidence that shapes spending. Some studies have achieved forecasting error reductions of over 50% by incorporating leading macroeconomic indicators of this kind. Financial conditions indicators, such as FEDFUNDS, DGS10, SP500, and the Financial Conditions Index, shape business investment, credit availability, and the mood of institutional players. Supply-side indicators, including PPIACO, INDPRO, ISRATIO, and import price indexes, set the constraints on what is available, at what cost.
Dumped into one document, the series are just data. The work is synthesizing them into a coherent narrative of the current economic environment. MiroFish's GraphRAG will do some of the extraction, but the more structured and narrative the seed material, the richer the knowledge graph and the more realistic the agent behavior.
History as memory, and injected shocks
Agents have persistent memory via Zep Cloud, and you can seed that memory with historical patterns. You embed historical demand patterns into the seed material as context the agents carry, instead of feeding a time series into a statistical model. For instance: "This product category has historically seen a 22% demand spike in Q4, followed by a 15% pullback in Q1. During the 2023 holiday season, demand exceeded forecasts by 31% because of a viral social media campaign. The 2024 season was flat as post-pandemic normalization continued."
They carry that the way an experienced retail buyer or supply chain manager carries years of pattern recognition. Their decisions are informed by it and not mechanically determined by it. They can deviate when the simulated conditions warrant, the way an experienced human forecaster overrides the model when something is changing.
The project describes a God's-eye view, the ability to inject variables into a running simulation. For demand forecasting it maps onto scenario planning and stress testing. Say the simulation is running a baseline for Q3. Midway through, you inject: "Breaking: Major port strike shuts down West Coast shipping for two weeks." Importers, retailers, consumers, and media react as the event enters. Some consumers panic-buy, some retailers switch suppliers, some delay purchases. The emergent demand pattern shifts in ways a static model cannot anticipate, because the cascade is agent-to-agent. Injections can come from breaking news, social sentiment shifts, commodity spikes, geopolitics, competitor announcements. What they test is the forecast against the exogenous shocks that break traditional models.
The pipeline I converged on
I spent a few weeks prototyping with MiroFish. This is the pipeline I settled on for a demand forecasting application. It is not a production blueprint, since MiroFish is at v0.1.2, though the structure is sound.
Ingestion and synthesis come first. Pull the latest FRED data via the FRED API, internal sales history from your warehouse, social sentiment from your monitoring tools, and competitor intelligence from your market research feeds. Synthesize all of it into a structured seed document that is part narrative, part data, part knowledge graph primer. It is the state of the world the simulation is built on, and the single most important artifact in the pipeline.
For a consumer goods demand forecast, the agent population should include a mix of consumer archetypes — price-sensitive, brand-loyal, impulse-driven, research-heavy — alongside retail decision-makers, market analysts, media agents who amplify signals, and institutional or wholesale buyers. The GraphRAG step helps generate these personas, and reviewing and tuning them against your actual market is the work.
Then the run. Agents interact, debate, form opinions, change their minds, and temporal memory updates continuously. No single agent is predicting demand; demand emerges from agents making individual decisions, the way markets do. You are growing a market rather than fitting a model to one. Afterward you can interview specific agents to understand why the forecast came out the way it did: ask the simulated price-sensitive consumer why they delayed the purchase, ask the retail buyer why they over-ordered. That explanation exceeds what SHAP values on a gradient-boosted tree can give you. Finally, run the simulation multiple times with different injected variables. Each branch produces a scenario forecast, and the distribution across scenarios gives an uncertainty estimate grounded in behavioral dynamics rather than statistical confidence intervals.
One cost sits on all of this. The docs recommend starting with fewer than 40 simulation rounds for a reason: a run is hundreds of LLM API calls. For enterprise-scale demand forecasting across thousands of SKUs on a daily cadence, the compute economics do not work yet. They will change as inference costs fall, and today they decide where the approach applies.
Where it should win, and where it should not
Cascade events are where the architecture has an edge. Tariff announcements, surprise Fed decisions, viral social moments that shift consumer sentiment in ways a survey index will not capture for weeks. A traditional model sees a feature value change in next quarter's data, while a swarm simulation watches the cascade unfold agent by agent.
Consumer sentiment spreads through social networks and gets amplified by media, creating feedback loops that accelerate or dampen demand in ways that do not appear in any historical correlation until after they have happened. A survey scalar or a regression feature cannot hold that, and a MiroFish simulation captures it directly, through agents influencing agents. Markets also contain price-sensitive shoppers, brand loyalists, impulse buyers, and careful researchers who respond differently to the same stimulus, and a swarm with diverse personas shows how the interactions between those groups produce the aggregate demand signal.
When a traditional model's forecast is wrong, you can look at feature importances but you cannot ask it why. When a MiroFish simulation produces an unexpected result, you can go into the simulation, interview the agents, and read the social dynamics that produced it. That matters for supply chain decisions, where trust in the forecast is as important as the forecast itself.
Statistical models stay. MiroFish is strongest on the qualitative, behavioral, emergent dynamics that traditional models miss, and weaker on the precise point estimates that supply chains need for daily inventory management. So the near-term mix that holds up has the statistical model providing the baseline point estimate, with the swarm providing the scenario distribution and the behavioral uncertainty band around it. Moving from promising to practical would take automated FRED-to-seed-material pipelines that continuously synthesize the latest macroeconomic data into narrative context documents, plus hybrid ensembles built on that baseline. Domain-specific agent libraries pre-configured for retail, CPG, automotive, pharma, and tech hardware would help as well.
The Polymarket numbers
Prediction markets are crowd-behavior systems and MiroFish is a crowd-behavior simulator, so the external numbers people cite come from there. I did not log these runs, and they are anecdotal. Beyond the 2,847-agent trader above, one more structured experiment asked whether maritime shipping in the Strait of Hormuz would return to normal by the end of April 2026. The researcher seeded 200 agents with different roles — government officials, media, military, energy companies, traders, and citizens — and ran 100+ rounds of interaction.
The organic group consensus was 47.9% probability. Polymarket's market price was 31%, a 16.9 percentage point gap. The most cautious agents were the pessimists, and their organic expressions most closely matched Polymarket's pricing. They were also the ones with the most domain expertise who participated naturally rather than being interviewed. The simulation gave a number and a read on why the agents disagreed with the market. None of it is a demand-shock benchmark.
MiroFish has no published benchmarks against historical demand datasets. Its scenarios are plausible and feel behaviorally realistic, and nobody has run it against the 2020 pandemic demand shock or the 2021 supply chain crisis to measure how well the simulated emergent behavior matches what happened. The same test could extend to the 2022 inflation spike and the 2025 tariff waves.