mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4079] [Other] tokenizer: llama.cpp's pre label set, a prerequisite for the DeepSeek-V4-Flash-0731 (deepseek4) port #4895
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#4895
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4079
Author: @yoyz
Created: 10/25/2026
Status: 🔄 Open
Base:
main← Head:f-tokenizer-joyai-pre📝 Commits (1)
c93cf51[Other] tokenizer: the splitter follows llama.cpp's label set, so joyai-llm is not split with Qwen's pattern📊 Changes
2 files changed (+36 additions, -4 deletions)
View changed files
📝
tools/strata_tokenizer.py(+5 -1)📝
tools/test_strata_tokenizer.py(+31 -3)📄 Description
Problem and result
This is the first of a few PRs that add DeepSeek-V4-Flash-0731 (GGUF architecture
deepseek4) to Strata, on the existingstrata-dsv41engine rather than a new one.What it does on my PC (Ryzen 9 3900X, 128 GiB RAM, RX 9070 XT 16 GiB, gfx1201): 10.80 tok/s decode over 256 tokens with
--vram-experts 0 --ssd-cache 96, three runs, spread under 1 %; 334 tok/s prefill over 19,095 new tokens; and with a 48 GB expert store the process stays under 50 GB of RAM while the experts stream from the SSD.Putting all the expert in memory provide a bit more performance at 12 tok/s decode.
The POC is here : https://github.com/yoyz/Strata/tree/f-deepseek-v4-flash-0731
Now back to this first PR about tokenizer.
llama.cpp gives four
tokenizer.ggml.prelabels one regex sequence: LLAMA_VOCAB_PRE_TYPE_DEEPSEEK3_LLM, JOYAI_LLM, HUNYUAN_DENSE and HY_V4 share it (src/llama-vocab.cpp). tools/strata_tokenizer.py chose the splitter with startswith("deepseek"), so a vocabulary stating one of the other three fell through to the Qwen pattern: every digit split on its own, where the DeepSeek3 list keeps runs of 1-3 together, so the ids are not the ones the model was trained on.Those labels are in use. DeepSeek-V4.1-Flash's IST-DAS IQ2_XXS shard states "tokenizer.ggml.pre = joyai-llm" in its GGUF header (read from the first 3 MB of shard 1), and DeepSeek-V4-Flash-0731's pack states the same. What Strata serves today is unchanged: tools/dsv41/pack_gguf.py writes "pre": "deepseek3" into tokenizer.json whatever the header says, and that label selects this same sequence. The change is for a pack that keeps the header's own label, as tools/dsv41/pack_gguf.py on the DeepSeek-V4-Flash-0731 branch does.
Measured with DeepSeek-V4-Flash-0731's vocab.json and merges.txt - the same vocabulary under the two labels:
'Grüße aus München am 25.10.2026'
joyai-llm [32882, 2134, 30234, 9200, 83566, 1030, 223, 1069, 16, 553, 16, 939, 24]
qwen35 [32882, 2134, 30234, 9200, 83566, 1030, 223, 20, 23, 16, 19, 18, 16, 20, 18, 20, 24]
'The year 2026 costs 42 Euro.'
joyai-llm [671, 1141, 223, 939, 24, 6329, 223, 3180, 3651, 16]
qwen35 [671, 1141, 223, 20, 18, 20, 24, 6329, 223, 22, 20, 3651, 16]
Validation
Validation (Python 3.14, no GPU, no model):
Passed: python -m unittest tools.test_strata_tokenizer.PreTokenizer -v (3 tests)
Passed: python -m unittest tools.test_strata_tokenizer (14 tests, 3 skipped without a vocabulary file)
Not run: llama.cpp's llama-tokenize on a decoded real vocabulary; no engine code touched, so no CUDA/HIP build
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.