[GH-ISSUE #3846] [Engine] A Portuguese draft subset (--draft-vocab pt): 25% of Portuguese tokens are outside the shipped subsets #1636

Closed
opened 2026-11-04 01:52:49 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @klvnblst on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3846

Area

[Engine] (speed, kernels, models, the server and API)

What do you want to do?

A shipped draft subset for Portuguese, --draft-vocab pt, built the same way as fr (#597): the English/code subset plus the tokens of a Portuguese corpus.

Why. About a quarter of a Portuguese text's tokens can never be drafted with the shipped subsets. tools/draft_vocab.py --corpus on 2,000 Portuguese Wikipedia articles (1,104,839 token occurrences) says:

Base subset Occurrences outside it
cjk (the default) 25.27%
en 25.31%
fr 23.72%
en + this corpus at --coverage 0.99 (54,148 ids, 13,623 added) 0.72%

Brazilian and Portuguese users talk to the model in Portuguese and mostly ask for code, so their answers mix Portuguese text with code.

What I measured (one machine, the reporter's own):

  • RTX 5090 Laptop GPU 24 GB, Core Ultra 9 275HX, 64 GB RAM, Windows 11.
  • Strata 0.2.3 (commit 5c8dd322), prebuilt engine 0.1.48 (CUDA 13).
  • Qwen3.8-Flash-Next IQ3_S, 131K context, INT8 KV, vision on, --spec 4 --spec-min-p 0.5, calibrated settings.
  • The only change between arms: --mtp-draft-vocab <the pt subset>.
  • Method: a fresh server per arm, in this order: baseline, pt subset, four other arms, baseline again. 5 code prompts in Portuguese and 2 in English, each run twice, 400 generated tokens each, temperature 0, thinking off. Speeds are the engine's own predicted_per_second, and acceptance is draft_n_accepted / draft_n, from the answer's timings.
Prompt Baseline tok/s, mean of 4 (range) pt subset tok/s, mean of 2 (range) Change Drafts accepted
pt 1 (CPF validator in Python) 120.4 (117-122) 125.3 (119-132) +4.1% 67.8% -> 78.1%
pt 2 (process vs thread, C#) 104.5 (97-109) 104.8 (96-113) +0.3% 60.0% -> 61.6%
pt 3 (PowerShell script) 131.5 (127-134) 135.2 (132-138) +2.9% 74.9% -> 78.9%
pt 4 (JavaScript fetch bug) 119.2 (116-122) 123.8 (122-126) +3.8% 65.1% -> 66.9%
pt 5 (Flask REST API) 124.1 (117-130) 130.6 (122-139) +5.2% 70.9% -> 74.1%
en 1 (CSV parser in Python) 126.9 (118-133) 134.8 (134-135) +6.2% 75.2% -> 77.8%
en 2 (BST in TypeScript) 147.7 (139-151) 147.2 (140-154) -0.4% 91.1% -> 90.1%
  • Portuguese, median over all requests: 121.7 -> 123.9 tok/s (+1.8%).
  • Median acceptance in Portuguese: 66.9-68.6% -> 74.1%.
  • English: no loss.
  • The draft head drops from 106,299 to 54,148 tokens (212.9 -> 108.4 MiB), and the auto expert cache takes 41 more slots (5,676 -> 5,717).

Limits.

  • The speed gain is small and within the run-to-run spread of single requests. Only the acceptance gain and the coverage are clear.
  • One machine, two runs per prompt per arm, and the arms ran in a fixed order (not interleaved pairs).
  • Thinking was off. Thinking on was not measured.
  • No CJK or Cyrillic text was tested: a user writing those would lose drafts with this subset, as with fr.

How the subset was built.

  • 2,000 articles of wikimedia/wikipedia, config 20231101.pt, fetched as rows from the Hugging Face datasets-server API (100 rows at offsets 1000 + k * 54000, k = 0..19, first 6,000 characters of each).
  • 12 Portuguese answers of the model itself to prompts that are not the measured ones.
  • python tools/draft_vocab.py --gguf Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00001-of-00002.gguf --base data/draft_vocab_en.bin --corpus wiki_pt.txt model_pt.txt --coverage 0.99 --out draft_vocab_pt.bin
  • A shipped version should probably use only a public corpus, so anyone can rebuild it. I can share the file, the corpus recipe and the A/B script if it helps.

Related: #597 (fr, the same approach) and #1963 (a withdrawn latin subset that would also have covered Portuguese accents).

What do you do today instead?

I run the subset by hand with --mtp-draft-vocab <file> in the model's config. Setup run again does not keep engine options added by hand to args (carry_over in setup.py lists them in args_dropped), so after every re-run the user has to add it back. A named --draft-vocab pt would be remembered like the other subsets.

Originally created by @klvnblst on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/3846 ### Area [Engine] (speed, kernels, models, the server and API) ### What do you want to do? A shipped draft subset for Portuguese, `--draft-vocab pt`, built the same way as `fr` (#597): the English/code subset plus the tokens of a Portuguese corpus. **Why.** About a quarter of a Portuguese text's tokens can never be drafted with the shipped subsets. `tools/draft_vocab.py --corpus` on 2,000 Portuguese Wikipedia articles (1,104,839 token occurrences) says: | Base subset | Occurrences outside it | | --- | ---: | | `cjk` (the default) | 25.27% | | `en` | 25.31% | | `fr` | 23.72% | | `en` + this corpus at `--coverage 0.99` (54,148 ids, 13,623 added) | 0.72% | Brazilian and Portuguese users talk to the model in Portuguese and mostly ask for code, so their answers mix Portuguese text with code. **What I measured** (one machine, the reporter's own): - RTX 5090 Laptop GPU 24 GB, Core Ultra 9 275HX, 64 GB RAM, Windows 11. - Strata 0.2.3 (commit `5c8dd322`), prebuilt engine 0.1.48 (CUDA 13). - Qwen3.8-Flash-Next IQ3_S, 131K context, INT8 KV, vision on, `--spec 4 --spec-min-p 0.5`, calibrated settings. - The only change between arms: `--mtp-draft-vocab <the pt subset>`. - Method: a fresh server per arm, in this order: baseline, pt subset, four other arms, baseline again. 5 code prompts in Portuguese and 2 in English, each run twice, 400 generated tokens each, temperature 0, thinking off. Speeds are the engine's own `predicted_per_second`, and acceptance is `draft_n_accepted / draft_n`, from the answer's `timings`. | Prompt | Baseline tok/s, mean of 4 (range) | pt subset tok/s, mean of 2 (range) | Change | Drafts accepted | | --- | ---: | ---: | ---: | --- | | pt 1 (CPF validator in Python) | 120.4 (117-122) | 125.3 (119-132) | +4.1% | 67.8% -> 78.1% | | pt 2 (process vs thread, C#) | 104.5 (97-109) | 104.8 (96-113) | +0.3% | 60.0% -> 61.6% | | pt 3 (PowerShell script) | 131.5 (127-134) | 135.2 (132-138) | +2.9% | 74.9% -> 78.9% | | pt 4 (JavaScript fetch bug) | 119.2 (116-122) | 123.8 (122-126) | +3.8% | 65.1% -> 66.9% | | pt 5 (Flask REST API) | 124.1 (117-130) | 130.6 (122-139) | +5.2% | 70.9% -> 74.1% | | en 1 (CSV parser in Python) | 126.9 (118-133) | 134.8 (134-135) | +6.2% | 75.2% -> 77.8% | | en 2 (BST in TypeScript) | 147.7 (139-151) | 147.2 (140-154) | -0.4% | 91.1% -> 90.1% | - Portuguese, median over all requests: 121.7 -> 123.9 tok/s (+1.8%). - Median acceptance in Portuguese: 66.9-68.6% -> 74.1%. - English: no loss. - The draft head drops from 106,299 to 54,148 tokens (212.9 -> 108.4 MiB), and the auto expert cache takes 41 more slots (5,676 -> 5,717). **Limits.** - The speed gain is small and within the run-to-run spread of single requests. Only the acceptance gain and the coverage are clear. - One machine, two runs per prompt per arm, and the arms ran in a fixed order (not interleaved pairs). - Thinking was off. Thinking on was not measured. - No CJK or Cyrillic text was tested: a user writing those would lose drafts with this subset, as with `fr`. **How the subset was built.** - 2,000 articles of `wikimedia/wikipedia`, config `20231101.pt`, fetched as rows from the Hugging Face datasets-server API (100 rows at offsets 1000 + k * 54000, k = 0..19, first 6,000 characters of each). - 12 Portuguese answers of the model itself to prompts that are not the measured ones. - `python tools/draft_vocab.py --gguf Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00001-of-00002.gguf --base data/draft_vocab_en.bin --corpus wiki_pt.txt model_pt.txt --coverage 0.99 --out draft_vocab_pt.bin` - A shipped version should probably use only a public corpus, so anyone can rebuild it. I can share the file, the corpus recipe and the A/B script if it helps. Related: #597 (`fr`, the same approach) and #1963 (a withdrawn `latin` subset that would also have covered Portuguese accents). ### What do you do today instead? I run the subset by hand with `--mtp-draft-vocab <file>` in the model's config. Setup run again does not keep engine options added by hand to `args` (`carry_over` in setup.py lists them in `args_dropped`), so after every re-run the user has to add it back. A named `--draft-vocab pt` would be remembered like the other subsets.
Author
Owner

@Niko1221 commented on GitHub (Nov 5, 2026):

Thanks for taking the time to report this.

Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.11. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6659766171 --> @Niko1221 commented on GitHub (Nov 5, 2026): Thanks for taking the time to report this. Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.11. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#1636
No description provided.