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.4 | M0 0.752 | K 0.0505 | A 0.251 | B 0.128 | |
| rmse over 12 cells: 0.0105 (relative recall) | |||||
| n | floor | rho(1) | rho(mid) | rho(n) | capture c(n) |
| 1 | 0.752 | 1.000 | 1.000 | 1.000 | 1.000 |
| 2 | 0.717 | 1.000 | 1.000 | 1.000 | 1.000 |
| 4 | 0.683 | 0.971 | 0.904 | 0.883 | 0.908 |
| 8 | 0.648 | 0.906 | 0.744 | 0.789 | 0.782 |
| 16 | 0.613 | 0.864 | 0.631 | 0.741 | 0.682 |
| 32 | 0.578 | 0.829 | 0.578 | 0.706 | 0.612 |
| 64 | 0.543 | 0.794 | 0.543 | 0.671 | 0.560 |
| 128 | 0.508 | 0.759 | 0.508 | 0.636 | 0.516 |
| 256 | 0.473 | 0.724 | 0.473 | 0.601 | 0.477 |
Key formula
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
- Chapter 1 · The Collapse in the Middle: Original Numbers, Effect Sizes and Dose for the U-Shaped Position Curve
- Chapter 2 · Dissent and Diversity: Four Curves, Bigger Windows and the Single-Needle Test
- Chapter 4 · The Product of Retention Rates: a Ceiling on Layers, the Recency Slope of Running Summaries and the Casualties among Details
- Chapter 5 · The Best Segment Length and the Relay Threshold: a Tug of War between Losses in Reading and in Writing
- Chapter 6 · The Key-Fact Restatement Slot: Zero Loss Comes Only from Template Copying and Checksums
- Chapter 7 · The Classics Examined: Mencius on One Day of Sun and Ten Days of Cold, and Ebbinghaus on Memory
- Chapter 8 · Closing the Loop: a Relay Template for Long Tasks, the Key-Fact Slot and a Pre-Registered Test