Repository navigation
docs(structured): split decide_batch's keywords by who reads them - #1130
Merged
NandhaKishorM merged 1 commit intoOct 12, 2026
Merged
Conversation
Owner
|
Merged. The split by who reads a keyword is the thing that makes Naming |
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
The "Scoring many states" section of
docs/structured.mdsays ofdecide_batch: "Keyword argumentsreach
predict_batch, sobatch_size=,model=and hooks work as they do fordecide." That isonly true for some of the keywords, and
model=-- the one named in the sentence -- is the one thatis not. Rewritten to state the split the code actually makes. Docs only; no code line changed.
Why
laya/structured.py::decide_batchhandles its two kinds of keyword differently. Call-level keywordsare forwarded to
predict_batch; the routing pins and the token budget(
laya/structured.py::_ROUTER_REQUEST_KEYS=model,task,lang,lang_guess,max_len,head_max_len) are read off every request by aRouter, whosepredict_batchdeclares none ofthem, so
decide_batchcopies them onto each request dict instead -- which is whymodel=works ona
Routerbut is not "a keyword that reachespredict_batch". On anAgent-like runner thedifference is something a caller meets:
predict_batchdeclaresbatch_size=/lang=/hooks=, hasno
model=, and swallows nothing, so passingmodel=there is aTypeError, not a silent extraargument. Measured on
c4a805b5(first column is which class the signature belongs to):The
Routerhalf is already pinned in the repo:tests/test_structured.pyhasbatch/router model= reaches a registered checkpoint(:442) andbatch/router decide_batch(model=) agrees with decide(model=)(:446). This PR's sibling for thedocstring half is #1125; this one changes only the page, so the two do not collide.
How it was verified
The two new sentences were grepped out of the built page (
site/structured/index.html) rather thanassumed from the build's exit code.
Deconfliction and scanning:
gh pr list --state open --limit 200 --json files(53 open PRs) -- only perf(agent): tokenize only the prefix of state a sequence holds, and make state_tokens opt-in #687 also touchesdocs/structured.md, and its hunk is at-159,19while this one is-141,9; no overlap.c4a805b5(release 0.4.3), one commit,docs/structured.mdonly (+10/-3).Checklist
mainFixes #