5D Library › 百卷知识超图拓扑、多模态个人先验编译与自主知识帝国标度律 · English

第六章 一百年:副本、共同冲击与可复现性能承诺什么

副本

书库以三种形式保存:带 DOI 的仓库、代码托管平台上的纯文本源码,以及印刷的书。数字保存的实践把过去的教训概括为「副本多,东西就安全」(Maniatis et al. 2005)。p12 用示意的损失率,计算至少一份副本存续一百年的机会。

推导

# Chapter 6. p12: Will at least one copy last a hundred years? Yearly
# loss hazards (illustrative): an institutional repository with a DOI
# 0.005; a code-hosting platform 0.02; one personal disk 0.05; one
# printed copy in private hands 0.02, with 5 such copies; one copy in a
# legal-deposit library 0.001, with 2 such copies. Independent losses
# give survival exp(-100 h) per copy. A common shock (chance 0.002 a
# year) destroys every digital copy at once and spares paper.
from math import exp

def surv(h, years=100):
    return exp(-h * years)

def any_of(ps):
    out = 1.0
    for p in ps:
        out *= 1 - p
    return 1 - out

if __name__ == "__main__":
    digital = [surv(0.005), surv(0.02), surv(0.05)]
    private = [surv(0.02)] * 5
    deposit = [surv(0.001)] * 2
    print("   copies                         survive 100 years")
    for name, ps in (("repository", digital[:1]), ("platform", digital[1:2]),
                     ("personal disk", digital[2:]),
                     ("5 private printed copies", private),
                     ("2 deposit-library copies", deposit)):
        print("   {:<28}  {:17.3f}".format(name, any_of(ps)))
    d = any_of(digital)
    shock = surv(0.002)
    rows = (("digital, independent", d), ("digital, common shock",
            d * shock), ("digital + private paper, shock",
            any_of([d * shock] + private)),
            ("digital + all paper, shock",
             any_of([d * shock] + private + deposit)))
    for name, p in rows:
        print("   {:<30}  {:15.4f}".format(name, p))
#    copies                         survive 100 years
#    repository                                0.607
#    platform                                  0.135
#    personal disk                             0.007
#    5 private printed copies                  0.517
#    2 deposit-library copies                  0.991
#    digital, independent                     0.6621
#    digital, common shock                    0.5421
#    digital + private paper, shock           0.7787
#    digital + all paper, shock               0.9980

单个仓库副本存续一个世纪的机会是 0.607,平台副本 0.135,个人硬盘 0.007。三份数字副本若损失彼此独立,合起来存续的机会是 0.6621;但若一次共同冲击能同时摧毁它们,只有 0.5421:放在同类基础设施上的副本并不独立。五本私人收藏的纸本提供了一些保护(与数字副本合计 0.7787);两本存于法定送存图书馆的纸本,因为图书馆会把书保存几个世纪,把它提高到 0.9980。在这个模型里,最有效的单一步骤是把纸本送存图书馆。

可复现性

存续不等于能运行。Python 的文档只保证 random() 在兼容的种子下产生相同的序列;random 模块的其他大多数算法「可能在 Python 版本之间改变」(Python Software Foundation 2011)。p13 把这一点换算成三类程序的存续曲线。

推导

# Chapter 6. p13: Will a program still print the same output? A program
# reproduces byte for byte only if the interpreter can still be run and
# every function it relies on still behaves as before. Python's random
# module guarantees only random() under a compatible seeder; gauss(),
# choice(), betavariate() and the like may change between versions.
# Illustrative yearly hazards: interpreter unavailable 0.005; each
# random algorithm other than random() 0.01; each other library call
# 0.001; each third-party package 0.03. Classes of program: (i) random()
# only, 6 other calls; (ii) 3 other random algorithms, 6 calls; (iii)
# as (ii) plus 5 third-party packages.
from math import exp

CLASSES = (("random() only", 0, 6, 0), ("3 random algorithms", 3, 6, 0),
           ("plus 5 packages", 3, 6, 5))

def p_ok(years, alg, calls, pkgs):
    h = 0.005 + 0.01 * alg + 0.001 * calls + 0.03 * pkgs
    return exp(-h * years)

if __name__ == "__main__":
    print("   class                  10 yrs   25 yrs   50 yrs   100 yrs")
    for name, a, c, k in CLASSES:
        print("   {:<20}".format(name) + "".join(
            "  {:7.3f}".format(p_ok(t, a, c, k)) for t in (10, 25, 50, 100)))
    print("   of 1,600 programs of class (ii), reproducing after 100 years:"
          " {:.0f}".format(1600 * p_ok(100, 3, 6, 0)))
#    class                  10 yrs   25 yrs   50 yrs   100 yrs
#    random() only           0.896    0.760    0.577    0.333
#    3 random algorithms     0.664    0.359    0.129    0.017
#    plus 5 packages         0.148    0.008    0.000    0.000
#    of 1,600 programs of class (ii), reproducing after 100 years: 27

在这个模型里,只依赖 random() 与少数其他调用的程序,一百年后逐字节复现输出的机会是 0.333;还用到另外三种随机算法(gauss、choice 之类,本书库多数程序都是如此)的程序是 0.017;再加五个第三方包的程序,50 年后就是 0.000。在 1,600 段第二类程序中,约有 27 段仍会印出完全相同的输出。「一个世纪 100% 可复现」的承诺无法兑现。能兑现的承诺较弱,但仍有价值:每段程序都把真实输出印在书中,所以即使原程序已不能运行,未来的读者也能重新实现它,并与书页上的结果核对。

p13 中三类程序逐字节复现其输出的机会随年数的变化。

假说 · 尚未验证

作者的诠释(尚未验证): 本书库印出的程序中,至少十分之九在十年后的通行 Python 版本下仍会逐字节复现其印出的输出。什么会证明它错: 用 2036 年的通行 Python 版本重新运行书库的全部程序,有超过十分之一的程序输出不同。

小结

副本要存续一个世纪,必须有一部分能躲过共同冲击,而存于图书馆的纸本是最有力的保障。即使是只用标准库的程序,逐字节的可复现性也会衰减;让计算保持可核验的,是印出的输出。

参考文献

Maniatis, Petros, Mema Roussopoulos, T. J. Giuli, David S. H. Rosenthal, and Mary Baker. 2005. “The LOCKSS Peer-to-Peer Digital Preservation System.” ACM Transactions on Computer Systems 23 (1): 2 to 50.
Python Software Foundation. 2011. Random: Generate Pseudo-Random Numbers, Notes on Reproducibility.

Fan, Y. (2026). Hundred-Volume Knowledge Hypergraphs, Multimodal Personal Prior Compilation and Autonomous Empire Scaling: Cross-Disciplinary Isomorphisms, Zero-Marginal-Cost Replication and Century-Scale Knowledge Preservation [百卷知识超图拓扑、多模态个人先验编译与自主知识帝国标度律] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090260 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).