Skip to content

BM25 recall: length bias — long nodes with many repeated topical terms outrank short precise matches #5

Description

@alexgrebeshok-coder

Context

Found while dogfooding: migrated a real 49-node personal memory bundle (Russian-language content) and ran a 10-question recall exam against it (okf-recall.mjs --mode bm25, v0.3.0).

Result: 9/10 queries hit the correct node at rank 1. The one miss is a systematic pattern, not noise.

Repro

Query (RU): «какое правило действует для входящих файлов»

  • Expected top-1: concepts/rule-incoming-files.md — short, precise node that answers exactly this.
  • Actual top-1: concepts/obsidian-shtab-organization.md — a long node that repeats the topical terms (документы, файлы, правило, ШТАБ) many times. The expected node came in at rank 2.

Hypothesis

Long documents accumulate score from repeated terms — looks like BM25 length normalization is too weak or per-term saturation isn't applied. Worth checking in the BM25 path of tools/lib/recall.mjs:

  • k1/b vs conventional values (k1 ≈ 1.2–2.0, b ≈ 0.75) and whether doc length is measured post-tokenization;
  • per-term TF saturation actually saturating;
  • optionally: a boost for title/description matches so short precise nodes can win over long bodies.

Notes

RU queries against RU content + EN slugs worked fine overall — this is purely a length-bias tail case. Happy to share the exam harness (10 Q/A pairs) if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions