Recursive Training and Model Collapse › Simulating the Closed Loop
Language AI HandbookAll chapters We start with Gaussian recursion because the moments derived above have closed forms, allowing direct checks of the simulation's statistics.
The shared style is already seeded above. The following setup imports the plotting helpers; each stochastic experiment uses its own explicit seed.
Now the loop itself. The learner is a two-line maximum likelihood fit; the sampler is rng.normal. That is the whole self-consuming operator.
PythonIn [5]Expand
TRUE_MU, TRUE_SIGMA = 0.0, 1.0
def refit_gaussian(samples):
"""Maximum likelihood fit of a univariate Gaussian (ddof=0)."""
return samples.mean(), samples.std(ddof=0)
def run_closed_loop(n_samples, generations, seed):
"""Train on your own samples, for `generations` rounds."""
rng = np.random.default_rng(seed)
mu, sigma = TRUE_MU, TRUE_SIGMA
mus, sigmas = [mu], [sigma]
for _ in range(generations):
samples = rng.normal(mu, sigma, size=n_samples)
mu, sigma = refit_gaussian(samples)
mus.append(mu)
sigmas.append(sigma)
return np.array(mus), np.array(sigmas)We run thirty independent replicates with samples per generation over sixty generations. These replicates illustrate the range of outcomes; their averages still have Monte Carlo noise. The sampling, fitting, and path construction happen here, before any figure; the rendering cells that follow only draw the stored arrays.
PythonIn [6]Expand
N_SAMPLES = 50
GENERATIONS = 60
REPLICATES = 30
runs_mu, runs_sigma = [], []
for rep in range(REPLICATES):
mu_path, sigma_path = run_closed_loop(N_SAMPLES, GENERATIONS, seed=rep)
runs_mu.append(mu_path)
runs_sigma.append(sigma_path)
runs_mu = np.array(runs_mu) # shape (REPLICATES, GENERATIONS + 1)
runs_sigma = np.array(runs_sigma)
mean_sigma_path = runs_sigma.mean(axis=0)
mean_mu_path = runs_mu.mean(axis=0)
gen = np.arange(GENERATIONS + 1)
c_sigma = np.sqrt(2 / N_SAMPLES) * np.exp(
gammaln(N_SAMPLES / 2) - gammaln((N_SAMPLES - 1) / 2)
)
analytic_sigma = TRUE_SIGMA * c_sigma**gen
analytic_rms_sigma = TRUE_SIGMA * (1 - 1 / N_SAMPLES) ** (gen / 2)
analytic_mean_spread = TRUE_SIGMA * np.sqrt(1 - (1 - 1 / N_SAMPLES) ** gen)The first figure shows standard deviation on a log scale. It distinguishes the exact mean curve from the RMS curve .
VisualizationOut [7]Expand

The thirty-run mean tracks the exact mean curve; that theoretical curve lies below the RMS curve. The finite-run mean can cross either curve. Individual fitted variances can increase from one generation to the next, and most displayed runs end narrower than they began. Two of the thirty runs still have slightly more spread than the initial Gaussian at generation sixty. The contraction is an expectation and a long-run tendency, rather than a monotonic pathwise rule.
The second figure shows the same thirty runs by their mean rather than their spread.
VisualizationOut [8]Expand

The fitted means illustrate why matching pipeline settings is not enough to match a realized trajectory. Different seeds generally produce different centers, while their expectation remains at the true mean. The distribution of those centers, rather than a single run, measures this component of drift.
Let's check the numbers against the closed forms.
ConsoleOut [9]Expand
n = 50 samples/generation, 60 generations mean sigma ratio: observed 0.365 | theory 0.402 mean variance ratio: observed 0.199 | theory 0.298 mean spread: observed 0.925 | theory 0.838
The observed mean standard-deviation ratio is about 0.365, compared with its exact expectation of 0.402. The spread of the fitted means is about 0.925, compared with the population prediction of 0.838. The mean variance ratio averages squared fitted standard deviations; squaring the mean standard deviation computes a different statistic. Thirty runs give a noisy illustration, rather than a precise verification of each expectation.
Each lineage generates 3,000 points over the sixty rounds, but each successor fits only the latest fifty. The fitted standard deviation averages about 36.5% of its initial value across these runs. The earlier 2,950 points have been discarded; they are not a 3,000-point training corpus for the final model.
The Gaussian simulation is deliberately simple, but it isolates the essential statistics. There is no vocabulary, no decoder, and no architecture. There is only a distribution, a sampler, and a maximum likelihood fit. This demonstrates a collapse mechanism without a language-specific architecture. It does not establish that every repeated noisy fit must collapse.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!