关于「实证闭环:长任务接力摘要模板、关键事实复述位与预注册检验」,《中段遗忘与接力阈值》给出的定量结论是什么?

结论:第八章给出长任务接力摘要模板、分段接力阈值计算器与预注册检验方案。书中以标注框区分已发表的证据、可运行的 Python 计算(21 段程序)、原典与作者的假说。

数据口径:书中任务、材料与参数均为示意,模型常数来自 2023 年的一个模型;全部计算由书中程序生成,不调用任何模型接口;本书是非个人化经营建议,不评测、不推荐任何模型或服务。 书中以标注框区分已发表的证据、可运行的 Python 计算(21 段程序)、原典与作者的假说。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库

Segment Relay Threshold Calculator (B-255)
source 256 units, call fidelity q0.970, reader lam = 1.00
stuffed window capture0.476
s layers calls c(s) relay R threshold q*
28 255 1.000 0.784 0.911
36 132 0.960 0.652 0.921
44 85 0.908 0.601 0.915
64 54 0.832 0.424 0.999
83 37 0.781 0.435 1.000
162 17 0.681 0.437 1.013
322 9 0.612 0.352 1.128
best plan: segment 2, 8 layers, 255 calls, R0.784
winner: relay (relay 0.784 vs stuffed 0.476)
per-layer miss budget for target 0.950.00639
slot of 10 lines at the head: worst read 0.950
largest head slot with every line read >0.9: 16
carry the slot by template and CRC-32, not by rewriting
constants are a 2023 fit: measure your reader first
查看完整验算程序
# Chapter 8. p81: the Segment Relay Threshold Calculator, demo run.
# Same functions as distill/tool.py (reader from the p32 joint fit,
# tree relay of p51 and p52, flattening lam of p53, head slot of p61,
# miss budget of p63). Demo: a source of 256 units, call fidelity
# q = 0.97, the 2023 reader (lam = 1), target 0.95, a slot of 10
# key-fact lines. All inputs illustrative; no model is called.
import math

TAU, M0, K, A, B = 2.4, 0.752, 0.0505, 0.251, 0.128
LINE = 0.1
SEGMENTS = (2, 3, 4, 6, 8, 16, 32)


def rho(x, n, lam=1.0):
    v = (M0 - K * math.log(n) + A * math.exp(-(x - 1) / TAU)
         + B * math.exp(-(n - x) / TAU))
    return 1.0 - lam * (1.0 - min(1.0, v))


def capture(n, lam=1.0):
    return math.fsum(rho(i, n, lam) for i in range(1, n + 1)) / n


def tree(n, f):
    depth, total, width = 0, 0, n
    while width > 1:
        width = -(-width // f)
        depth += 1
        total += width
    return max(depth, 1), max(total, 1)


def plan_row(d, s, q, lam):
    depth, calls = tree(d, s)
    cs = capture(s, lam)
    return {"segment": s, "layers": depth, "calls": calls,
            "capture": cs, "relay": (q * cs) ** depth,
            "threshold": capture(d, lam) ** (1.0 / depth) / cs}


def slot_worst(k, s, lam):
    n = s + k * LINE
    return min(rho(1 + j * LINE, n, lam) for j in range(k))


def analyse(d, q, lam, target, k):
    rows = [plan_row(d, s, q, lam) for s in SEGMENTS if s < d]
    best = max(rows, key=lambda r: (r["relay"], -r["segment"]))
    stuffed = capture(d, lam)
    s = best["segment"]
    kmax = 0
    for j in range(1, 400):
        if slot_worst(j, s, lam) >= 0.9:
            kmax = j
    return {"units": d, "fidelity": q, "lam": lam, "target": target,
            "stuffed": stuffed, "rows": rows, "best": best,
            "winner": "relay" if best["relay"] > stuffed else "stuffed",
            "miss_budget": 1 - target ** (1.0 / best["layers"]),
            "slot_lines": k,
            "slot_worst": slot_worst(k, s, lam) if k else None,
            "slot_max_at_0.9": kmax}


def report(r):
    out = ["Segment Relay Threshold Calculator (B-255)",
           "source %d units, call fidelity q = %.3f, reader lam = %.2f"
           % (r["units"], r["fidelity"], r["lam"]),
           "stuffed window capture: %.3f" % r["stuffed"],
           "   s  layers  calls  c(s)   relay R  threshold q*"]
    for w in r["rows"]:
        out.append("%4d  %6d  %5d  %5.3f  %7.3f  %8.3f"
                   % (w["segment"], w["layers"], w["calls"],
                      w["capture"], w["relay"], w["threshold"]))
    b = r["best"]
    out.append("best plan: segment %d, %d layers, %d calls, R = %.3f"
               % (b["segment"], b["layers"], b["calls"], b["relay"]))
    out.append("winner: %s (relay %.3f vs stuffed %.3f)"
               % (r["winner"], b["relay"], r["stuffed"]))
    out.append("per-layer miss budget for target %.2f: %.5f"
               % (r["target"], r["miss_budget"]))
    if r["slot_worst"] is not None:
        out.append("slot of %d lines at the head: worst read %.3f"
                   % (r["slot_lines"], r["slot_worst"]))
    out.append("largest head slot with every line read >= 0.9: %d"
               % r["slot_max_at_0.9"])
    out.append("carry the slot by template and CRC-32, not by rewriting")
    out.append("constants are a 2023 fit: measure your reader first")
    return out


for line in report(analyse(256, 0.97, 1.0, 0.95, 10)):
    print(line)

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《长上下文注意力中段遗忘曲线、位置偏置与零损耗分段摘要接力阈值母典》第 8 章「实证闭环:长任务接力摘要模板、关键事实复述位与预注册检验」(版本 1.0.0). 5D Library. DOI 待发布

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

BibTeX
@book{fan2026255,
  author    = {Fan, Yafu},
  title     = {Mid-Context Forgetting in Long-Context Attention: Positional Bias and the Threshold for Lossless Segment-Summary Relays},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论