The Grief Seed Economy

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

Yuna 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.

Implementation and drafting relied on a large language model (Claude Opus 5, Anthropic). The research direction, the rules and the final decisions are the author's. Everything checkable by machine is verified; the modelling choices and interpretation have been reviewed by one non-specialist reader. See the paper's appendix, Reproduction and validation.

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.

Abstract

We model the system connecting magical girls (girls, hereafter), witches and Kyubey in Puella Magi Madoka Magica as a resource cycle and study its behaviour at the population level. Every rule we impose is taken from the setting: cleansing moves corruption into a grief seed rather than destroying it, a filled seed hatches into a witch unless Kyubey consumes it, a defeated witch leaves a seed only sometimes, a clouded gem saps its owner's combat power, and familiars mature into witches of their own. The parameters the setting fixes are set from it, and the rest are calibrated against three things the setting shows: a city holds a handful of magical girls, veterans run a few years, and most careers end in transformation.

Four results follow. First, at the density the setting shows, combat with witches dominates the corruption budget and conflict between girls is minor, a factor of 0.15; the ratio rises with density and passes parity only near nine standing girls, far above anything the setting depicts. Second, the rate at which girls leave is set by the contract rate and is insensitive to the seed supply, which instead changes how they leave and how much Kyubey collects. Third, cumulative return saturates in the offer rate. The advantage aggressive recruitment buys is temporary, because it comes from a stock that can only be spent once, which is the structure of a Ponzi scheme. Fourth, a city closed to migration has only two outcomes: the girls starve for want of seeds, or familiars multiply and the city is lost; the first is also where Kyubey's return is highest.

Each result is a property of the model under the stated assumptions, and we validate the implementation against an exact conservation identity.

Four results

  1. Combat dominates the corruption budget at the density the setting shows. Fighting witches costs 6.7 times what fighting other girls costs; infighting is a factor of 0.15. The ratio rises with density and passes parity only near 9.4 standing girls, an order of magnitude above the one to five the setting depicts.
  2. Departures track recruitment, not the seed supply. The departure rate stays between 0.0034 and 0.0045 per day across the whole range of migration rates, matching the contract rate. Making seeds plentiful changes not how many girls leave but how they leave: the transformation share falls from 99.5% to 89.1%, and Kyubey's return falls with it from 0.0050 to 0.0038 per day.
  3. Cumulative return saturates. Past an offer rate of 0.016 the total after 8000 days sits between 45.0 and 46.9, against 13.8 at 0.004. Aggressive recruitment buys an advantage drawn from a stock consumed once, which is the structure of a Ponzi scheme.
  4. A closed city starves or is overrun. Below a familiar maturation rate of 0.005 girls barely cleanse at all and careers last exactly the no-cleansing lifespan; at 0.02 witches reach 173.5 and every run is lost. There is no sustainable middle. The first side is the best one for Kyubey, with a return of 0.0055 units per day, the highest in that sweep.
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 combat cost, with parity dotted.
Conflict to combat ratio and median career against standing population
Where Result 1 turns over. Left: the ratio rises with standing population and passes parity near 9.4 girls. Right: median career against standing population.
Transformation share, Kyubey's return and career survival curves
Result 2. Left: transformation share against migration. Centre: Kyubey's return with the despair-only prediction. Right: career survival curves.
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.
Standing counts and the share of runs lost in a closed city
Result 4. Left: standing counts of girls and witches against familiar maturation. Right: the share of runs in which the city is lost.

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, though the margin is small. At each of three discount factors, 2000 training episodes produced no policy that beats the best fixed rate.

Discount factorLearned policyBest fixed rateDifference
0.946.347.6−2.8%
0.9945.347.6−4.9%
0.99946.547.6−2.4%

This does not mean fixed rates are better. It means the return is capped by the rate at which candidates arrive: fixed rates already plateau above 0.016, the learned policies sit on that plateau, and the learning curve shows no upward trend after episode 200. The claim is therefore narrow: under this setup, a policy that adjusts with the state shows no demonstrable advantage.

Extension: does farming familiars pay?

In the setting a familiar carries no grief seed, but one that feeds on enough humans matures into a witch that may. Leaving familiars alive until they mature is therefore a named practice, witch farming, and characters argue about it. The baseline folds familiars into a maturation rate, so the model has no such choice in it. Here they are individuals again: they take humans, they die when their parent witch is defeated, and culling one yields nothing. We sweep the share of girls who farm.

Farming raises the seed supply and buys nothing with it. Realised maturation rises by a factor of 4.3, while both career length and Kyubey's return stay within replicate noise. What rises is the cost nobody in the loop is counting.

Share farmingMaturation rateMedian careerKyubey's returnHumans lost / 1000 days
00.0022211635.416.3
0.50.0037911535.918.3
10.0094910634.024.6
Career length, Kyubey's return and human losses against the share of girls who farm familiars
Familiars as individuals. Left: median career length. Middle: Kyubey's cumulative return. Right: human losses per thousand days.

The reason is the one behind Result 3: the return is limited by the rate at which candidates arrive, not by the seed supply. Career length does not move because the extra seeds arrive attached to extra witches. This is an accounting result at the level of the population rather than a claim about any individual girl.

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 a minute 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, Yuna},
  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}
}