The Grief Seed Economy

An Agent-Based Model of the Magical Girl System in Puella Magi Madoka Magica

Arisu Hoshinomiya

Independent researcher

An independent study written for fun. It has not been peer reviewed, and every result is a property of the model under its stated assumptions. Corrections are welcome as GitHub issues.

Abstract

We model the system connecting magical girls, witches and Kyubey in Puella Magi Madoka Magica as a closed resource cycle, and study its behaviour at the population level. Our simplification keeps five elements: soul gems accumulate corruption, corruption is cleansed using grief seeds left by defeated witches, a girl whose gem saturates becomes a witch, Kyubey collects the energy released by that transition, and new girls enter by contract. We implement this as a spatial agent-based model with explicit corruption accounting, endogenous recruitment, and hawk-dove contests over grief seeds.

Four results follow. First, lifetime corruption is dominated by conflict between magical girls rather than by combat with witches: when witches are rare the ratio is about 5.9 to 1, and it falls below 1 when witches are plentiful. Second, the rate at which girls leave the population is set by the contract rate and is insensitive to the grief seed supply; a richer witch supply changes how girls leave rather than how often, and the share of departures ending in transformation falls from 88% to 31%. Third, cumulative energy return is bounded by the rate at which new candidates become available, so the contract rate that maximises return decreases as the evaluation horizon lengthens: the early return is paid out of a stock that is consumed once, which is the structure of a Ponzi scheme. Fourth, aggression over grief seeds reproduces the tragedy of the commons: collective survival is highest near an aggression level of 0.15, but under scarcity slightly more aggressive strategies invade a less aggressive population.

Each result is a property of the model under the stated assumptions. We give the parameter ranges over which each holds and validate the implementation against an exact conservation identity.

Schematic of the resource cycle between candidates, magical girls, witches, grief seeds and Kyubey
The resource cycle. Solid arrows form the main loop, the purple dashed arrows are Kyubey's two roles, and the dotted arrows are the two boundary flows: witches arriving from outside the loop, and girls lost to a shattered soul gem, which produces no witch and so returns no energy.

Four results

  1. Conflict dominates the corruption budget. When witches are rare, corruption taken from other girls exceeds corruption taken from witches by a factor of 5.3 to 5.9; the ratio falls to 0.8 when witches are plentiful. In this model conflict is a symptom of scarcity rather than of character.
  2. Departures track recruitment, not the seed supply. Across a hundredfold range of witch arrival rates the departure rate stays between 0.0138 and 0.0157 per day. What changes is the manner of departure: the transformation share falls from 87.8% to 30.7%, and Kyubey's return falls with it, from 0.0126 to 0.0043 per day.
  3. Cumulative return is bounded by candidate inflow. The offer rate that maximises cumulative return falls as the evaluation horizon lengthens, from 0.140 at 500 days to 0.110 at 8000. The advantage of a high offer rate is drawn from a stock that is consumed once, which is the structure of a Ponzi scheme: only a continuing supply of new candidates keeps the high rate going.
  4. Aggression reproduces the tragedy of the commons. The collective optimum sits at aggression 0.15, yet under scarcity a mutant at 0.5 invades a resident population at 0.25 with 1.035 times the resident median career, so aggression drifts upward.
Corruption budget decomposition and the ratio of conflict to combat cost
Result 1. Left: lifetime corruption sources against sinks. Right: ratio of conflict cost to witch combat cost, with parity dotted.
Transformation share, Kyubey's return and career survival curves
Result 2. Left: transformation share against witch arrival rate. Centre: Kyubey's return with the theoretical prediction. Right: career survival curves in both regimes.
Optimal offer rate against evaluation horizon and return trajectories
Result 3. Left: normalised cumulative return against offer rate for three horizons. Right: return trajectories under a restricted candidate pool.
Aggression landscape and mutant invasion fitness
Result 4. Left: median career length in uniform populations. Right: invasion fitness of mutants against the resident population, with neutrality dotted.

Extension: can reinforcement learning beat Kyubey's best fixed offer rate?

Result 3 compares only fixed offer rates. Since the level of the candidate pool is observable state, a state-dependent policy ought to do better by throttling recruitment when the pool runs low and raising it once the pool recovers. We searched for such a policy with tabular Q-learning, a reinforcement-learning method, taking a macro-step of 100 days, six discrete offer rates, and the discount factor in place of the evaluation horizon.

The result is negative. At each of three discount factors, 2000 training episodes produced no policy that beats the best fixed rate.

Discount factorLearned policyBest fixed rateDifference
0.9229.7242.3−5.2%
0.99209.0242.3−13.8%
0.999180.0242.3−25.7%

This does not mean fixed rates are better. Two features of the setup limit what the experiment can show: cumulative return is nearly flat in the offer rate above 0.096, so the margin available to a state-dependent policy is smaller than the evaluation noise, and the learned tables are visibly under-fitted. The claim is therefore narrow: under this setup, a state-dependent policy shows no demonstrable advantage.

Reproducing

The environment is managed with uv. Replicates use deterministic seeds, so a rerun reproduces the reported numbers.

git clone https://github.com/yuna0x0/madoka-magica-abm.git
cd madoka-magica-abm
uv sync
uv run madoka-abm experiments   # about three minutes on one core

The paper is built with Typst; the Chinese edition needs a CJK serif face (Noto Serif CJK TC by default).

Citation

@misc{hoshinomiya2026griefseed,
  title  = {The Grief Seed Economy: An Agent-Based Model of the Magical Girl
            System in Puella Magi Madoka Magica},
  author = {Hoshinomiya, Arisu},
  year   = {2026},
  url    = {https://madoka-magica-abm.pages.dev},
  note   = {Independent study, not peer reviewed. Code and data:
            https://github.com/yuna0x0/madoka-magica-abm}
}