Repository navigation
docs: clarify that word_count_threshold counts whitespace-separated words, not tokens - #13549
Merged
anakin87 merged 2 commits intoNov 4, 2026
Conversation
…ords `word_count_threshold` in LostInTheMiddleRanker is counted with str.split(), so it is a budget of whitespace-separated chunks rather than of model tokens. Spell that out in the class and parameter docs, and note that a value sized for a model context window can still overflow it for code-heavy or non-Latin text. No behaviour change.
Smilewithoutfalling
requested review from
anakin87
and removed request for
a team
November 4, 2026 01:13
Contributor
|
@Smilewithoutfalling is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
anakin87
approved these changes
Nov 4, 2026
anakin87
left a comment
Member
There was a problem hiding this comment.
Thank you!
I pushed a small improvement/simplification
anakin87
enabled auto-merge (squash)
November 4, 2026 09:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Documentation-only change to
LostInTheMiddleRanker: the docs now spell out whatword_count_thresholdactually counts. No behaviour change.Why
word_count_thresholdis computed withstr.split(), so it budgets whitespace-separated chunks, not model tokens. Users reasonably read "words" as a proxy for the downstream context window, but a URL, a hash, or a code expression counts as one word no matter how many tokens a tokenizer splits it into, and code-heavy or non-Latin text needs noticeably more tokens per word than English prose. A threshold sized for a model's context window can therefore still overflow it.@julian-risch offered exactly this follow-up in #11351:
Changes
__init__: the paragraph describing the threshold now states the counting unit.__init__andrun()::param word_count_threshold:explainstr.split(), what counts as a single word, and that the value is an approximate budget rather than a context-window guarantee.Verification
python -m py_compileon the modified file passes.line-length = 120.No tests added: no executable code changed.
Refs #11351