关于「方法:五种失效模式、独占锁与校勘四法」,《多窗口写书防漂移》给出的定量结论是什么?

结论:第一章是方法:窗口之间的错误相关时,加窗口平均不掉错误,组内相关系数 0.02 时十六个窗口只等效于 48.35 处独立核对;四个窗口共用一个套话库,九章书期望 18.22 对重复句,各用各的只有 4.55 对;「先检查再创建」的锁在四个窗口的 2520 种交错里有 2160 种双重拥有,独占新建把它降为零;按一项已发表研究里 GPT-4 引文的出错比例,一章 12 条引文全部真实且无误的概率只有 0.003432。第二至第七章依次写并发锁与分波次调度、跨卷术语图、中英数字对账与重复句检测、零幻觉文献核验、风格防退化与校勘四法的自动化,并以四件套蒸馏规格收尾。

数据口径:书中未标出处的错误率都是假设参数或合成数据上的测量值;本书不是法律意见,也不推荐任何写作工具或模型。 第八章让四个窗口并发写一本九章合成书,注入五类共 119 个错误:四道闸门拦住 0.723,漏网的 33 个里有 28 个属于机器在结构上看不见的手法,扣除后检出率为 0.945;干净书上术语检测首轮误报 1672 处,人审 48 个词后归零;一份严肃的注入审计每类至少要 75 个错误。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.02, 18.22, 4.55, 48.35

A. effective independent checks N_eff = N / (1 + (N - 1) rho)
windows checks N rho0.00 rho=0.02 rho=0.05
190 90.0 32.37 16.51
2180 180.0 39.30 18.09
4360 360.0 44.01 19.00
8720 720.0 46.81 19.49
161440 1440.0 48.35 19.74
ceiling 1/rho: rho0.02 -> 50, rho=0.05 -> 20
B. boilerplate collisions: T2700 sentences, K = 20 stock lines, q = 0.01
C(T,2)3,643,650
shared stock, expected duplicate pairs18.22
separate stock per window (m4): 4.55; ratio 4.00
3 chapters, T900: expected pairs 2.02
9 chapters, T2700: expected pairs 18.22
27 chapters, T8100: expected pairs 164.00
C. simulation, 400 books, seed 152: shared 18.12, separate 4.67
D. P(no duplicate) >0.95 needs E[pairs] <= 0.0513
so q <0.000531: about one boilerplate sentence per 1,885 sentences
查看完整验算程序
# Chapter 1. p10: why more windows do not average errors out, and why shared templates breed duplicates.
# Part A. N checkable spots (terms, numbers, citations) are written by m windows. If the windows share
# one prompt template, their mistakes are correlated with intraclass correlation rho. The variance of
# the book-level error rate is p(1 - p) / N * (1 + (N - 1) rho), so the effective number of independent
# checks is N_eff = N / (1 + (N - 1) rho), which can never exceed 1 / rho however many windows write.
# Part B. Each sentence is, with probability q, drawn from a stock of K boilerplate sentences.
# With one shared stock, any two of the T sentences of the book can collide: E[pairs] = C(T, 2) q^2 / K.
# With a separate stock per window only pairs inside one window collide: m C(T / m, 2) q^2 / K.
# Part C. A seeded simulation checks Part B; Part D finds the largest q that keeps P(no duplicate)
# at 0.95 or more, using P(no duplicate) = exp(-E[pairs]).
import math
import random

SPOTS_PER_WINDOW = 90
RHOS = (0.0, 0.02, 0.05)


def n_eff(n, rho):
    return n / (1 + (n - 1) * rho)


def pairs_shared(t, q, k):
    return math.comb(t, 2) * q * q / k


def pairs_separate(t, q, k, m):
    return m * math.comb(t // m, 2) * q * q / k


def simulate(t, q, k, m, shared, trials, rng):
    dups = []
    per = t // m
    for _ in range(trials):
        counts = {}
        for w in range(m):
            for _ in range(per):
                if rng.random() < q:
                    key = rng.randrange(k) if shared else (w, rng.randrange(k))
                    counts[key] = counts.get(key, 0) + 1
        dups.append(sum(c * (c - 1) // 2 for c in counts.values()))
    return math.fsum(dups) / trials


if __name__ == "__main__":
    print("A. effective independent checks N_eff = N / (1 + (N - 1) rho)")
    print("   windows  checks N   rho=0.00   rho=0.02   rho=0.05")
    for m in (1, 2, 4, 8, 16):
        n = m * SPOTS_PER_WINDOW
        print("   {:7d}  {:8d}  {:9.1f}  {:9.2f}  {:9.2f}".format(
            m, n, *(n_eff(n, r) for r in RHOS)))
    print("   ceiling 1/rho: rho=0.02 -> {:.0f}, rho=0.05 -> {:.0f}".format(1 / 0.02, 1 / 0.05))
    t, k, q, m = 2700, 20, 0.01, 4
    print("B. boilerplate collisions: T = {} sentences, K = {} stock lines, q = {}".format(t, k, q))
    es, ep = pairs_shared(t, q, k), pairs_separate(t, q, k, m)
    print("   C(T,2) = {:,}".format(math.comb(t, 2)))
    print("   shared stock, expected duplicate pairs   {:.2f}".format(es))
    print("   separate stock per window (m = {}): {:.2f}; ratio {:.2f}".format(m, ep, es / ep))
    for chapters in (3, 9, 27):
        tt = chapters * 300
        print("   {:2d} chapters, T = {:5d}: expected pairs {:8.2f}".format(
            chapters, tt, pairs_shared(tt, q, k)))
    rng = random.Random(152)
    ss = simulate(t, q, k, m, True, 400, rng)
    sp = simulate(t, q, k, m, False, 400, rng)
    print("C. simulation, 400 books, seed 152: shared {:.2f}, separate {:.2f}".format(ss, sp))
    lam = -math.log(0.95)
    qmax = math.sqrt(lam * k / math.comb(t, 2))
    print("D. P(no duplicate) >= 0.95 needs E[pairs] <= {:.4f}".format(lam))
    print("   so q <= {:.6f}: about one boilerplate sentence per {:,.0f} sentences".format(qmax, 1 / qmax))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《多窗口并行写书防漂移控制、术语跨卷一致性图审计与零幻觉文献核验器》第 1 章「方法:五种失效模式、独占锁与校勘四法」(版本 0.1.0). 5D Library. DOI 待发布

DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-152 · v0.1.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026152,
  author    = {Fan, Yafu},
  title     = {Drift Control for Parallel Multi-Window Book Writing, Cross-Volume Terminology Graph Audits and Zero-Hallucination Citation Verifiers},
  year      = {2026},
  publisher = {5D Library},
  edition   = {0.1.0},
  note      = {DOI pending}
}

本书其他章节结论