What does Mid-Context Forgetting and Relay Thresholds conclude, in numbers, about “A Position-Recall Model: a Primacy Bump, a Recency Bump and a Floor That Sinks with Length”?

Answer: Program p31 fits the two-exponential model separately to thirty and twenty documents: the primacy bump is 0.249 in both, the decay lengths are 2.5 and 2.2 documents, and only the floor falls, from 0.609 to 0.578. Program p32 turns that structure into a joint model, fitting twelve cells with five parameters at an error of 0.0105, and extrapolates a capture curve: 0.908 at four documents, 0.612 at thirty-two and 0.477 at two hundred and fifty-six. Every number on this curve can be remeasured by an owner on his own reader, and Chapter 8 gives the method. With this curve in hand we can ask the relay question. If long material is cut into short segments, summarised and passed on, how much is lost at each hand-off, and after how many layers does relaying stop paying?

Scope of the numbers: Tasks, material and parameters are illustrative and the model constants come from one 2023 model; all calculations are generated by the book's programs, which call no model. It is not individual business advice and neither rates nor recommends any model or service.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 0.0105, 0.477, 0.578, 0.612, 0.908, 32

joint fit: tau 2.4M0 0.752K 0.0505A 0.251B 0.128
rmse over 12 cells: 0.0105 (relative recall)
nfloorrho(1)rho(mid)rho(n)capture c(n)
10.7521.0001.0001.0001.000
20.7171.0001.0001.0001.000
40.6830.9710.9040.8830.908
80.6480.9060.7440.7890.782
160.6130.8640.6310.7410.682
320.5780.8290.5780.7060.612
640.5430.7940.5430.6710.560
1280.5080.7590.5080.6360.516
2560.4730.7240.4730.6010.477

Key formula

\[\rho(i, n) = m + A\, e^{-(i-1)/\tau} + B\, e^{-(n-i)/\tau},\]
Show the full program
# Chapter 3. p32: one model for both lengths, and the capture curve.
# Joint fit (ours) to the 20- and 30-document GPT-3.5-Turbo curves of
# Liu et al. (2024), relative to oracle accuracy:
#   rho(i, n) = M0 - K ln n + A exp(-(i-1)/tau) + B exp(-(n-i)/tau),
# capped at 1. The floor falls with log length (dilution); the two
# bumps keep a fixed size in documents. Grid on tau, least squares on
# M0, K, A, B. Capture c(n) = mean of rho over the n positions: the
# expected recall of a fact whose position is not known in advance.
# Extrapolation beyond 30 documents is illustrative only.
import math

DATA = (
    (30, (1, 5, 10, 15, 20, 25, 30),
     (73.4, 55.1, 50.5, 50.9, 51.8, 54.9, 63.7), 88.6),
    (20, (1, 5, 10, 15, 20), (75.8, 57.2, 53.8, 55.4, 63.2), 88.3),
)


def solve(a, b):
    k = len(b)
    m = [row[:] + [v] for row, v in zip(a, b)]
    for c in range(k):
        p = max(range(c, k), key=lambda r: abs(m[r][c]))
        m[c], m[p] = m[p], m[c]
        for r in range(k):
            if r != c:
                f = m[r][c] / m[c][c]
                m[r] = [x - f * y for x, y in zip(m[r], m[c])]
    return [m[i][k] / m[i][i] for i in range(k)]


def design(tau):
    rows, ys = [], []
    for n, xs, acc, orc in DATA:
        for x, v in zip(xs, acc):
            rows.append((1.0, -math.log(n), math.exp(-(x - 1) / tau),
                         math.exp(-(n - x) / tau)))
            ys.append(v / orc)
    return rows, ys


def fit(tau):
    rows, ys = design(tau)
    ata = [[math.fsum(r[i] * r[j] for r in rows) for j in range(4)]
           for i in range(4)]
    aty = [math.fsum(r[i] * y for r, y in zip(rows, ys))
           for i in range(4)]
    par = solve(ata, aty)
    res = [y - math.fsum(p * q for p, q in zip(par, r))
           for r, y in zip(rows, ys)]
    return math.sqrt(math.fsum(e * e for e in res) / len(res)), par


best = min(((fit(t / 10)[0], t / 10) for t in range(5, 151)))
rmse, par = fit(best[1])
m0, k, a, b = par
tau = best[1]
print("joint fit: tau %.1f  M0 %.3f  K %.4f  A %.3f  B %.3f"
      % (tau, m0, k, a, b))
print("rmse over 12 cells: %.4f (relative recall)" % rmse)


def rho(i, n):
    v = (m0 - k * math.log(n) + a * math.exp(-(i - 1) / tau)
         + b * math.exp(-(n - i) / tau))
    return min(1.0, v)


print("    n   floor  rho(1)  rho(mid)  rho(n)  capture c(n)")
for n in (1, 2, 4, 8, 16, 32, 64, 128, 256):
    c = math.fsum(rho(i, n) for i in range(1, n + 1)) / n
    print("%5d  %6.3f  %6.3f  %8.3f  %6.3f  %8.3f"
          % (n, m0 - k * math.log(n), rho(1, n), rho((n + 1) // 2, n),
             rho(n, n), c))

Single source and citation

Fan, Y. (2026). Mid-Context Forgetting in Long-Context Attention: Positional Bias and the Threshold for Lossless Segment-Summary Relays (Version 1.0.0), Chapter 3: A Position-Recall Model: a Primacy Bump, a Recency Bump and a Floor That Sinks with Length. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 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}
}

Other chapter answers in this book