mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #597] setup: a draft vocabulary for French, acceptance 0.52 to 0.64 and decode 11% faster on an RTX 5090 #280
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#280
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @gputier on GitHub (Oct 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/597
Based on v0.1.38.
French answers draft poorly with the shipped subsets.
draft_vocab_en.binholds 40,525 ids, built from English and code. On 8 French Wikipedia articles, 23.8% of the token occurrences fall outside it. The draft head cannot propose those tokens, so the draft stops there.cjkandcyrillicadd whole scripts, but no subset adds the accented Latin tokens French needs.I built a subset for French and measured it against
en. Both arms use the same model and settings. Onlydraft_vocab.binin the--mtpfolder differs.What the engine and setup do today
<--mtp folder>/draft_vocab.bin(int32 ids) at load:src/core/mtp.cpp:433(the list itself) andsrc/core/mtp.cpp:309(the VRAM estimate inbind_bytes). Any list of ids works, nothing in the engine is tied to a language.setup.pycopies one of three shipped files into that folder:DRAFT_VOCABS = {"cjk": ..., "en": ..., "cyrillic": ...}atsetup.py:2740, chosen by--draft-vocab(setup.py:2968), applied byrefresh_draft_vocab(setup.py:2824).tools/draft_vocab.py --addacceptshan,kana,hangul,cjk_punct,cjkorcyrillic(tools/draft_vocab.py:11, theSCRIPTStable at:24, the check at:73). There is no Latin block. A block by code point range would not help here anyway: theenlist already holds the plain Latin letters, and what French lacks is specific words and word pieces.The list
The
enlist (40,525 ids) plus the 6,062 tokens that cover 99% of the occurrences in the 8 French articles, 46,587 ids in all. The corpus is plain text from French Wikipedia: 982,297 characters, 258,528 tokens.en, 0.55% with the new list.draft head over N tokens): 81.2 MiB, then 93.3 MiB (+12 MiB).The 99% cut and the 8 articles are my choice. I did not try other cut-offs or a larger corpus.
Measurement
RTX 5090, Windows, IQ3_S, engine 0.1.38,
--spec 4, temperature 0, 300 tokens per request, no reasoning. 12 French prompts written for this test and 4 code prompts. Two French prompts share a topic with corpus articles (the French Revolution, the Second World War); without them the median ratio below is 1.106 instead of 1.110. The arms alternate (en, new,en, new,en, new), so 3 passes each. Each server start runs 2 warm-up prompts that are not counted.French, 12 prompts:
en, 0.638 with the new list. The 3 passes of each arm sit within 0.012 of each other.en, 157.5 tok/s with the new list (mean over the 12 prompts and 3 passes).en: median 1.110, from 1.063 to 1.216. The new list is ahead on 12 prompts out of 12, and on each of the 3 passes taken alone.Code, 4 prompts:
en, 0.838 with the new list.English was not measured in this run. An earlier, smaller run (2 English prompts) gave acceptance 0.591 with
enand 0.599 with the new list.The engine is not deterministic at temperature 0 on this machine: two passes of the same configuration gave different text on 7 prompts out of 8. I compared rates, not texts.
What I did not measure
Ask
Two ways to ship this, and I would rather you pick:
tools/draft_vocab.py: add to a base list the tokens that cover a given share of a text corpus, so a language can be added from its own text.frin--draft-vocabandDRAFT_VOCABS, with adata/draft_vocab_fr.binof about 182 KB (46,587 int32 ids) next to the other three.I can send the script that builds the list (it takes a text file, the tokenizer files, the base list and a coverage threshold) and the list itself, as a PR in whichever shape you choose. If you want another corpus or another threshold first, tell me which.
@Niko1221 commented on GitHub (Oct 3, 2026):
Thanks, a very clear measurement. A French list fits well. Please send the PR with both parts: the coverage mode in tools/draft_vocab.py (base list + tokens that cover a given share of a corpus) and data/draft_vocab_fr.bin with 'fr' added to DRAFT_VOCABS and --draft-vocab. Your 99% cut on the 8 articles is fine to start with; we'll run our own English and code check on it when we review.
@gputier commented on GitHub (Oct 3, 2026):
Sent as #664, with both parts:
tools/draft_vocab.py --cover-textanddata/draft_vocab_fr.binwithfrinDRAFT_VOCABSand--draft-vocab.The file in the PR is the list measured here, byte for byte (sha256
f236f215...), and the PR gives the command that rebuilds it and the revisions of the 8 articles.@Niko1221 commented on GitHub (Oct 4, 2026):
Thanks for the clear measurement. There was no PR yet, so we built it from your description in 0.1.39, in both shapes you offered:
tools/draft_vocab.py --corpus FILE... --coverage 0.99: adds to a base list the most frequent tokens of a corpus that together cover the given share of its occurrences, and prints the share outside the base and outside the new list.data/draft_vocab_fr.binand--draft-vocab fr: theenlist plus 5,686 tokens (46,211 ids), from 10 French Wikipedia articles (1.24 M characters) at 0.99. 23.6% of that corpus's tokens are outsideen, 0.74% outside the new list. Setup knows it as a shipped subset, so a later--draft-vocab cjkorenreplaces it again, and the model's config keeps the choice.Our check on an RTX 5070 with IQ3_XXS (temperature 0, 256 tokens, 8 French prompts on topics outside the corpus, arms alternating, 2 passes): drafts accepted 0.505 with
en(0.507 with the defaultcjk) -> 0.597 withfr, higher on all 8 prompts and in each pass. English 0.610 -> 0.629 and code 0.772 -> 0.779, so no loss there. We couldn't measure decode speed cleanly on that machine that day, so the release notes quote your 141 -> 158 tok/s on the 5090.If you'd like the list built from your corpus or another cut instead, a PR with that
.binand the command you used is welcome.@gputier commented on GitHub (Oct 5, 2026):
Thanks for building it. Your list does what I asked for, so my fork now uses the one in 0.1.39 and I won't send a second PR.