5D Library › 算法之镜 · English

第五章 回音室与模型崩溃

当模型向模型学习

随着生成的文本在互联网上扩散,未来的模型将部分地用来自早先模型的数据训练。如果一个模型一代又一代地用自己的输出训练,会发生什么?

证据

舒迈洛夫(Shumailov)等人表明,不加区分地用模型生成的内容训练,会造成不可逆的缺陷,他们称之为模型崩溃:原始分布的尾部消失,学到的分布一代代变窄。他们在高斯混合模型、变分自编码器和语言模型中都演示了这一现象,并认为随着生成内容的扩散,来自真实人类互动的数据将变得更有价值 (Shumailov et al. 2024)。

证据

格斯特格拉瑟(Gerstgrasser)等人表明,结果取决于原始数据的去留。当每一代的合成数据替换之前的数据时,模型会崩溃;当合成数据与原始真实数据累积在一起时,在语言模型、扩散模型和自编码器中都避免了崩溃。他们在线性模型中证明,累积数据时,无论经过多少代,测试误差都有上界 (Gerstgrasser et al. 2024)。

机制的缩影

推导

对 20 个样本拟合一个高斯分布,从拟合结果中抽取下一代的 20 个样本,重复 300 代;一种是每代替换数据,一种是保留所有之前的数据(包括最初的真实样本)。程序报告 20 次运行中拟合标准差的中位数。

import math, random, statistics

# Recursive training in miniature: fit a Gaussian to 20 samples, draw the next
# generation's 20 samples from the fit, and repeat. "Replace" fits only the latest
# synthetic samples; "accumulate" fits all data so far, including the original real data.
def run(mode, gens, n=20, seed=0):
    rnd = random.Random(seed)
    data = [rnd.gauss(0, 1) for _ in range(n)]
    s, s2, m = sum(data), sum(x * x for x in data), n          # running totals
    sds = []
    for _ in range(gens):
        mu = s / m
        sd = math.sqrt(max(s2 - m * mu * mu, 0) / (m - 1))
        sds.append(sd)
        new = [rnd.gauss(mu, sd) for _ in range(n)]
        if mode == "replace":
            s, s2, m = sum(new), sum(x * x for x in new), n
        else:
            s, s2, m = s + sum(new), s2 + sum(x * x for x in new), m + n
    return sds

checkpoints = (1, 30, 100, 300)
for mode in ("replace", "accumulate"):
    runs = [run(mode, 300, seed=k) for k in range(20)]
    med = [statistics.median(r[g - 1] for r in runs) for g in checkpoints]
    print(f"{mode:10s} median fitted SD (20 runs) at generation "
          + ", ".join(f"{g}: {v:.3f}" for g, v in zip(checkpoints, med)))
# replace    median fitted SD (20 runs) at generation 1: 1.042, 30: 0.463, 100: 0.069, 300: 0.000
# accumulate median fitted SD (20 runs) at generation 1: 1.042, 30: 1.006, 100: 0.997, 300: 1.000
300 代中拟合出的分散程度(对数坐标)。只用上一代的样本训练,分散程度趋向于零;保留原始数据,则使它保持在真实值附近。

每一次拟合都略有偏差,而由于每一代只向上一代学习,偏差不断累积。从小样本估计分散程度往往略微偏小,而样本中的极端值又是新样本最先无法重现的,所以漂移的方向是变窄。保留原始数据,则使每一次拟合都有锚。

推导

同样的过程作用在词汇上:5000 个词型按齐普夫频率分布,每一代学习 20000 个词元的词频,再生成下一代的 20000 个词元。某一代没有被抽到的词就永远消失了,除非混入新鲜的真实文本。

import random

# Rare words disappear first. A vocabulary of 5,000 word types with Zipf frequencies;
# each generation "learns" the empirical frequencies of 20,000 tokens and generates
# the next 20,000 tokens from them. A word that happens not to be sampled is gone for good,
# unless some fresh real text is mixed in.
random.seed(11)
V = 5000
w = [1 / (r + 1) for r in range(V)]
types = list(range(V))

def generations(fresh_share, gens=30, n=20000):
    counts = None
    alive = []
    for g in range(gens):
        n_fresh = int(n * fresh_share) if g else n
        sample = random.choices(types, weights=w, k=n_fresh)
        if counts and n - n_fresh:
            words = list(counts)
            sample += random.choices(words, weights=[counts[x] for x in words], k=n - n_fresh)
        counts = {}
        for t in sample:
            counts[t] = counts.get(t, 0) + 1
        alive.append(len(counts))
    return alive

for share in (0.0, 0.1):
    a = generations(share)
    print(f"fresh real text {share:4.0%}: word types still in use at generations 1, 10, 30: "
          f"{a[0]}, {a[9]}, {a[29]}")
# fresh real text   0%: word types still in use at generations 1, 10, 30: 3201, 1117, 559
# fresh real text  10%: word types still in use at generations 1, 10, 30: 3196, 2004, 1976

罕见词最先消失;没有新鲜文本,词汇就不断萎缩。每一代混入十分之一的新鲜真实文本,就足以使在用词型的数量保持稳定,稳定在由抽样文本量决定的水平上。

新信息从哪里来

模拟和已发表的结果指向一个简单的原则:生成与再训练构成的闭环会丢失信息,使它保持活力的,是来自环路之外的数据。这些数据可以有许多来源:新的人类写作、测量、实验、事件记录、对话、传感器数据。人对物理世界的亲身经验,以及把遥远领域联系起来的判断力,是其中最有价值的来源之一,因为它们难以替代;但它们不是唯一的来源,一台记录新测量值的实验仪器,和一个人一样能打破这个环路。

假说 · 尚未验证

尚未确立。 在使用语言模型的知识工作中,建立在新的第一手观察(做过的实验、做过的测量、实地考察)之上的产出,在严谨性相同的情况下,比仅凭模型和现有文献得出的产出,更被盲评专家评为新颖。该假说预测:在一项匹配项目的随机比较中,第一手观察条件的新颖性评分更高,且严谨性不降低。如果新颖性评分没有差别,或者是以严谨性为代价换来的,假说就被推翻。

参考文献

Gerstgrasser, Matthias, Rylan Schaeffer, Apratim Dey, et al. 2024. Is Model Collapse Inevitable? Breaking the Curse of Recursion by Accumulating Real and Synthetic Data. arXiv preprint arXiv:2404.01413.
Shumailov, Ilia, Zakhar Shumaylov, Yiren Zhao, Nicolas Papernot, Ross Anderson, and Yarin Gal. 2024. “AI Models Collapse When Trained on Recursively Generated Data.” Nature 631: 755–59.

Fan, Y. (2026). The Algorithmic Mirror: Self-Attention Geometry, Ashby's Requisite Variety and Cognitive Projection in Information Theory and East Asian Philosophy of Mind [算法之镜] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.23723557 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).