What does Link Authority, Retrieval Truncation and Direct Answers conclude, in numbers, about “BM25 and Length Normalisation: the Term-Frequency Ledger of Stuffing, Padding and Direct Answers”?

Answer: Chapter 3 implements BM25 with the standard library and shows that stuffing soon peaks while padding is discounted by length: a twelve-word direct answer padded to two hundred and forty words keeps only 0.302 of its score.

Scope of the numbers: Its parameters are illustrative; all calculations are generated by its programs; the book is not personalised legal, financial or business advice and makes no promise about citation rankings in any system. Chapter 1 computes PageRank and HITS with power iteration and a random surfer: in an illustrative knowledge base with damping factor 0.85, the mother page receives 0.3240, or 2.59 times the uniform share.

中文版

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: 25

query: pagerank damping factoravgdl 22.9
snippetlengthBM25 b=0.75rankBM25 b=0rank
stuffed114.37113.8271
def212.67222.5822
faq162.15431.8893
notes100.90040.6935
long970.75251.1734
bm2580.00060.0006
hits90.00070.0007
rag110.00080.0008
stuffed leads def by 1.700 at b=0.75 and 1.245 at b=0
Show the full program
# Chapter 3. p31: BM25 on an illustrative eight-snippet corpus.
# Score = sum over query terms of idf * tf (k1 + 1) /
#         (tf + k1 (1 - b + b dl / avgdl)),
# idf = ln(1 + (N - n + 0.5) / (n + 0.5)), the non-negative variant.
# k1 = 1.2 and b = 0.75 are common defaults discussed by Robertson and
# Zaragoza (2009). Snippets and query are invented for illustration.
import math
from collections import Counter

FILL = ("our team has written this complete guide so that every reader"
        " can learn all about search and links and why they matter for"
        " a growing brand in a crowded market").split()
DOCS = {
    "def": "pagerank damping factor d is the chance that the surfer"
           " follows a link and brin and page used d of 0.85",
    "faq": "what is the damping factor short answer the chance of"
           " following a link rather than jumping",
    "long": " ".join(FILL * 3 + "pagerank matters pagerank helps"
                     " pagerank grows pagerank".split()),
    "stuffed": "pagerank pagerank pagerank damping damping factor"
               " factor pagerank best pagerank guide",
    "bm25": "bm25 scores terms by frequency and document length",
    "hits": "hits computes hubs and authorities for a query subgraph",
    "rag": "retrieval augmented generation puts the top k passages"
           " into the prompt",
    "notes": "notes on link analysis pagerank hits and the random"
             " surfer",
}
QUERY = "pagerank damping factor".split()


def bm25(docs, query, k1=1.2, b=0.75):
    toks = {k: v.split() for k, v in docs.items()}
    n_docs = len(toks)
    avgdl = math.fsum(len(t) for t in toks.values()) / n_docs
    df = Counter()
    for t in toks.values():
        df.update(set(t))
    out = {}
    for k, t in toks.items():
        tf = Counter(t)
        s = []
        for q in query:
            idf = math.log(1 + (n_docs - df[q] + 0.5) / (df[q] + 0.5))
            norm = k1 * (1 - b + b * len(t) / avgdl)
            s.append(idf * tf[q] * (k1 + 1) / (tf[q] + norm))
        out[k] = math.fsum(s)
    return out, avgdl


if __name__ == "__main__":
    full, avgdl = bm25(DOCS, QUERY)
    flat, _ = bm25(DOCS, QUERY, b=0.0)
    print("query: " + " ".join(QUERY) + "   avgdl {:.1f}".format(avgdl))
    print("snippet   length  BM25 b=0.75  rank  BM25 b=0  rank")
    r1 = sorted(full, key=lambda k: (-full[k], k))
    r0 = sorted(flat, key=lambda k: (-flat[k], k))
    for k in r1:
        print("{:<9}{:7d}{:13.3f}{:6d}{:10.3f}{:6d}".format(
            k, len(DOCS[k].split()), full[k], r1.index(k) + 1, flat[k],
            r0.index(k) + 1))
    print("stuffed leads def by {:.3f} at b=0.75 and {:.3f} at b=0".format(
        full["stuffed"] - full["def"], flat["stuffed"] - flat["def"]))

Single source and citation

Fan, Y. (2026). Hyperlink Authority Propagation in Machine-Readable Knowledge Bases, Retrieval-Truncation Games in Generative Answering and High-SNR Snippet Extraction (Version 1.0.0), Chapter 3: BM25 and Length Normalisation: the Term-Frequency Ledger of Stuffing, Padding and Direct Answers. 5D Library. DOI pending

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

Other chapter answers in this book