Skip to content

spec(0.10.0): §4's probability is p(last | first n−1) among sequences of the entry's own length — "joint prob otherwise" withdrawn - #16

Merged
coderoast-dev merged 1 commit into
mainfrom
spec/ngram-probability-is-a-conditional
Oct 2, 2026
Merged

coderoast-dev merged 1 commit into
mainfrom
spec/ngram-probability-is-a-conditional

Conversation

@coderoast-dev

Copy link
Copy Markdown
Collaborator

What

SPEC.md §4 defined behavior.top_ngrams[].probability only in the example's comment: "p(next | prev) for n=2; joint prob otherwise". This PR replaces that comment and adds a paragraph under §4:

An entry's probability is p(last | prefix): its count divided by the summed count of every sequence of the same length the producer counted in the window whose first n − 1 template ids equal the entry's own. Computed before the top_ngrams_size cut. Never a joint probability.

CHANGELOG.md records it under 0.10.0 (still unreleased) › Changed, and the 0.10.0 headline lists it among the breaking items.

Why

  • The conditional is what the field is for. §13's ngram_delta.rate_changed compares the value across two windows as a transition rate. A joint value restates frequency, which count already carries, so rate_changed would move with any change in traffic mix, and one field would mean a different quantity at each ngram_size.
  • The published population already means it. The reference producer has always emitted the conditional at every order.
  • "Same length" is the smallest rule that holds for every sequence a top_ngrams can carry. It also corrects a reference-implementation defect: when top_ngrams held sequences of two lengths, the producer pooled them under one denominator. Only such documents move.

Change class

Breaking by the letter: a producer that followed "joint" becomes non-conformant. Under GOVERNANCE.md §2's 0.x rule (PR #15), the editor merges it with no rfc: issue. No schema change: the field stays a number in [0, 1]. conformance/metalog_validate.py --selftest: 31/31 fixtures pass.

🤖 Generated with Claude Code

… of the entry's own length — "joint prob otherwise" withdrawn

The example comment was the field's only definition, and it was wrong at every
ngram_size above 2: the reference producer has always emitted the conditional,
and §13's ngram_delta.rate_changed reads the value as a transition rate, which a
joint probability (a restatement of count) cannot be. A paragraph under §4 now
defines it: count over the summed count of the window's counted sequences of the
same length sharing the first n-1 ids, before the top_ngrams_size cut. Breaking by
the letter, editor-merged under GOVERNANCE §2's 0.x rule; no schema change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderoast-dev
coderoast-dev merged commit 283e8d7 into main Oct 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant