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

第五章 反馈飞轮:费希尔信息、隐私噪声与自我确认的路由

回路学得多快

书库网站所描述的飞轮是:诊断站收集脱敏的聚合数据,聚合数据校准专著的参数,专著得到修订,读者被引导到合适的卷。这样的回路学得多快?对于独立的是非结果,关于一个比率的费希尔信息与结果的数量成正比,标准误随其平方根下降 (Fisher 1925)。p09 比较固定的用户流与每月增长 10% 的用户流。

推导

# Chapter 5. p09: How fast does a feedback loop learn? Each user of a
# diagnostic station gives one yes/no outcome about a rate theta = 0.3
# (for example, whether the recommended volume helped). Fisher
# information per user is 1 / (theta (1 - theta)); after n users it is
# n times that, and the standard error is sqrt(theta (1 - theta) / n).
# Two growth paths for 34 stations: a constant 1,000 users a month in
# total, or 1,000 in the first month growing 10% a month.
from math import sqrt

TH = 0.3

if __name__ == "__main__":
    print("   month   constant: users  std error   growing: users  "
          "std error")
    n1 = n2 = 0
    for m in range(1, 37):
        n1 += 1000
        n2 += round(1000 * 1.1 ** (m - 1))
        if m in (1, 3, 6, 12, 24, 36):
            print("   {:5d}  {:16,d}  {:9.5f}  {:15,d}  {:9.5f}".format(
                m, n1, sqrt(TH * (1 - TH) / n1), n2,
                sqrt(TH * (1 - TH) / n2)))
    print("   information per user: {:.3f}, the same in every month".format(
        1 / (TH * (1 - TH))))
    print("   per station after 12 constant months: {:,} users, std error"
          " {:.4f}".format(12000 // 34, sqrt(TH * (1 - TH) / (12000 // 34))))
#    month   constant: users  std error   growing: users  std error
#        1             1,000    0.01449            1,000    0.01449
#        3             3,000    0.00837            3,310    0.00797
#        6             6,000    0.00592            7,716    0.00522
#       12            12,000    0.00418           21,386    0.00313
#       24            24,000    0.00296           88,496    0.00154
#       36            36,000    0.00242          299,125    0.00084
#    information per user: 4.762, the same in every month
#    per station after 12 constant months: 352 users, std error 0.0244

34 个诊断站每月共有固定的 1,000 名用户时,一年后的标准误是 0.00418,三年后是 0.00242;用户每月增长 10% 时,三年后是 0.00084。每名用户的信息量每个月都是 4.762。飞轮本身并不会加速学习:只有用户呈指数增长,信息才会呈指数增长。而分散到 34 个诊断站,一年的固定流量只给每个站 352 名用户,标准误为 0.0244。

固定用户与每月增长 10% 的用户下,一个比率的标准误随月份的变化(p09)。

隐私的代价

只发布带噪声的聚合数据能保护用户;差分隐私为每个计数加上尺度为 epsilon 分之一的拉普拉斯噪声 (Dwork et al. 2006)。p10 计算有多少信息留下来。

推导

# Chapter 5. p10: What de-identification costs in information. Each
# station releases only weekly bucket counts of "yes" answers from m
# users, with Laplace noise of scale 1 / eps added (differential
# privacy with parameter eps for one user's answer). For a rate of 0.3,
# the variance of a released count is m 0.3 0.7 + 2 / eps^2, so the
# share of the original information kept is m 0.21 / (m 0.21 + 2 /
# eps^2). Buckets below 20 users are suppressed (a k-anonymity rule).
if __name__ == "__main__":
    print("   users per bucket   eps 0.1   eps 0.5   eps 1    eps 2")
    for m in (10, 30, 100, 1000):
        row = []
        for eps in (0.1, 0.5, 1.0, 2.0):
            keep = m * 0.21 / (m * 0.21 + 2 / eps ** 2)
            row.append("suppr." if m < 20 else "{:.3f}".format(keep))
        print("   {:16,d}   {:>7}   {:>7}   {:>6}   {:>6}".format(m, *row))
    print("   users per bucket for 0.9 of the information at eps 0.5: {}"
          .format(round(0.9 / 0.1 * 2 / 0.5 ** 2 / 0.21)))
#    users per bucket   eps 0.1   eps 0.5   eps 1    eps 2
#                  10    suppr.    suppr.   suppr.   suppr.
#                  30     0.031     0.441    0.759    0.926
#                 100     0.095     0.724    0.913    0.977
#               1,000     0.512     0.963    0.991    0.998
#    users per bucket for 0.9 of the information at eps 0.5: 343

每桶 30 名用户、epsilon 为 0.5 时,只剩 0.441 的信息;100 名用户时 0.724;1,000 名用户时 0.963。少于 20 名用户的桶被完全隐去。要在 epsilon 为 0.5 时保留 0.9 的信息,一个桶需要 343 名用户。隐私与学习此消彼长,小站付出的代价最大。

自我确认的路由

把读者引向回路当前评价最好的卷,也就决定了回路接下来看到什么。p11 在两卷之间分配 5,000 名用户,两卷各以 0.30 与 0.35 的机会对用户有帮助。

推导

# Chapter 5. p11: A feedback loop that routes users by its own estimates.
# Two volumes help a user with chance 0.30 (A) and 0.35 (B). Each of
# 5,000 users is routed to one, and the outcome updates a Beta(1, 1)
# posterior for that volume. Greedy: the higher posterior mean. Explore
# 10%: greedy, but a random volume one time in ten. Thompson: a draw
# from each posterior, the higher draw wins. 400 runs each, seed 100.
import random

TRUE = (0.30, 0.35)

def run(rng, rule):
    s, f = [1, 1], [1, 1]
    to_b = 0
    for _ in range(5000):
        means = [s[i] / (s[i] + f[i]) for i in (0, 1)]
        if rule == "Thompson":
            d = [rng.betavariate(s[i], f[i]) for i in (0, 1)]
            k = 0 if d[0] > d[1] else 1
        elif rule == "explore 10%" and rng.random() < 0.1:
            k = rng.randrange(2)
        else:
            k = 0 if means[0] > means[1] else 1
        to_b += k
        if rng.random() < TRUE[k]:
            s[k] += 1
        else:
            f[k] += 1
    means = [s[i] / (s[i] + f[i]) for i in (0, 1)]
    return to_b / 5000, means[0] > means[1], means[1] - TRUE[1], s[1] + f[1]

if __name__ == "__main__":
    rng = random.Random(100)
    print("   rule          to better  ends favouring A  error on B"
          "  B trials")
    for rule in ("greedy", "explore 10%", "Thompson"):
        res = [run(rng, rule) for _ in range(400)]
        n = len(res)
        print("   {:<12}  {:9.3f}  {:15.3f}  {:+10.4f}  {:8,.0f}".format(
            rule, sum(r[0] for r in res) / n, sum(r[1] for r in res) / n,
            sum(r[2] for r in res) / n, sum(r[3] for r in res) / n))
#    rule          to better  ends favouring A  error on B  B trials
#    greedy            0.614            0.385     -0.0515     3,072
#    explore 10%       0.860            0.018     -0.0011     4,303
#    Thompson          0.910            0.000     +0.0002     4,554

贪婪路由只把 0.614 的用户送到较好的卷,在 0.385 的运行中最终偏向较差的一卷,并平均低估较好的一卷 0.0515,因为一旦不再把用户送过去,它就永远无法纠正早期的坏估计。每十次随机探索一次,把错误结局降到 0.018;汤普森抽样降到 0.000,同时把 0.910 的用户送到较好的卷。飞轮需要有意的探索,否则它的反馈只会确认它最初的错误。

假说 · 尚未验证

作者的诠释(尚未验证): 在书库的网站上,用汤普森抽样引导读者,比按当前最佳估计引导,会提高报告「推荐的卷有帮助」的读者比例。什么会证明它错: 在至少 5,000 名被引导读者的随机对照比较中,汤普森抽样下报告有帮助的比例不高于贪婪路由。

小结

反馈回路学习的速度与用户数成正比,而不是呈指数增长;隐私噪声在小站代价最大;按当前估计路由,除非有一部分用户被随机分配,否则会确认早期的错误。

参考文献

Dwork, Cynthia, Frank McSherry, Kobbi Nissim, and Adam Smith. 2006. “Calibrating Noise to Sensitivity in Private Data Analysis.” In Theory of Cryptography, vol. 3876. Lecture Notes in Computer Science. Springer.
Fisher, Ronald A. 1925. “Theory of Statistical Estimation.” Proceedings of the Cambridge Philosophical Society 22 (5): 700 to 725.

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