关于「top-k 截断:一个文段被放进上下文的概率」,《知识库权威传播与直答片段》给出的定量结论是什么?

结论:第四章计算 top-k 截断下的入选概率:想有九成把握进入前三名,需要 2.46 个标准差的分数优势。

数据口径:书中参数为示意;全部计算由书中程序生成;本书不是法律、理财或经营方面的个人化建议,也不对任何系统中的引用排名作出承诺。 第一章用幂迭代与随机冲浪者计算 PageRank 与 HITS:在阻尼系数 0.85 的示意知识库里,母典页拿到 0.3240,是均匀份额的 2.59 倍。

English version

对照数据表

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

delta top-1 top-3 top-5 top-10
0.00.0500 0.1500 0.2500 0.5000
0.50.1164 0.2863 0.4220 0.6847
1.00.2284 0.4631 0.6105 0.8320
1.50.3830 0.6475 0.7757 0.9255
2.00.5580 0.8021 0.8915 0.9728
3.00.8468 0.9632 0.9857 0.9980
with delta 0 the chance is k/20, as it must be
margin for a 0.90 chance of top-13.30 sd
margin for a 0.90 chance of top-32.46 sd
margin for a 0.90 chance of top-52.05 sd
margin for a 0.90 chance of top-101.33 sd
查看完整验算程序
# Chapter 4. p42: top-k truncation with Gaussian score noise.
# N = 20 candidates: 19 rivals with true score 0, one target with true
# score delta (in units of the noise standard deviation). Observed score
# = true score + N(0, 1) noise, independent. P(target in top k) =
# integral of phi(x) * P(Binomial(19, 1 - Phi(x + delta)) <= k - 1),
# computed by Simpson's rule on [-9, 9] with 3,600 panels.
# Also: the margin needed for a 0.90 chance of entering the top k.
import math

M = 19


def Phi(x):
    return 0.5 * math.erfc(-x / math.sqrt(2))


def phi(x):
    return math.exp(-x * x / 2) / math.sqrt(2 * math.pi)


def p_top(delta, k, panels=3600):
    a, b = -9.0, 9.0
    h = (b - a) / panels
    terms = []
    for i in range(panels + 1):
        x = a + i * h
        q = 1 - Phi(x + delta)
        cdf = math.fsum(math.comb(M, j) * q ** j * (1 - q) ** (M - j)
                        for j in range(k))
        wt = 1 if i in (0, panels) else (4 if i % 2 else 2)
        terms.append(wt * phi(x) * cdf)
    return math.fsum(terms) * h / 3


def margin_for(k, goal=0.90):
    lo, hi = 0.0, 6.0
    for _ in range(40):
        mid = (lo + hi) / 2
        if p_top(mid, k, 600) < goal:
            lo = mid
        else:
            hi = mid
    return hi


if __name__ == "__main__":
    ks = (1, 3, 5, 10)
    print("delta " + "".join("   top-{:<3}".format(k) for k in ks))
    for delta in (0.0, 0.5, 1.0, 1.5, 2.0, 3.0):
        print("{:5.1f} ".format(delta) + "".join(
            "{:10.4f}".format(p_top(delta, k)) for k in ks))
    print("with delta 0 the chance is k/20, as it must be")
    for k in ks:
        print("margin for a 0.90 chance of top-{:<2}: {:.2f} sd".format(
            k, margin_for(k)))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《机器可读知识库超链接权威传播、生成式问答检索截断博弈与高信噪比摘要提取》第 4 章「top-k 截断:一个文段被放进上下文的概率」(版本 1.0.0). 5D Library. DOI 待发布

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

BibTeX
@book{fan2026176,
  author    = {Fan, Yafu},
  title     = {Hyperlink Authority Propagation in Machine-Readable Knowledge Bases, Retrieval-Truncation Games in Generative Answering and High-SNR Snippet Extraction},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论