Repository navigation
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
SBrandeis
marked this pull request as ready for review
November 19, 2026 11:39
store AddedToken (including content) instead of flags only
SBrandeis
force-pushed
the
fix/normalized-added-content
branch
from
November 19, 2026 16:07
96c25fd to
b173163
Compare
SBrandeis
marked this pull request as draft
November 19, 2026 16:08
This branch has not been deployed
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.
TL;DR
Store
AddedTokensin full inBucketAddedVocabulary, which has the nice property of storing the original content of the added tokensFixes #2693
Supersedes #2485 (same bug on the write path: a
normalized: trueadded token was written back by its normalized form, so ids moved after save or pickle).What changes
AddedVocabularykeepsadded_tokens: Box<[AddedToken]>by internal id;AddedTokenFlagsis gone.get_vocab,get_added_tokens_decoderandto_jsonreport each token's declared content. Matching and decoding still use the normalized form, so ids and decoded text are unchanged.llama-2.json:get_vocab_size(true)is 32000 again (32003 on main, 32000 on 0.23).round_trip_preserves_ids_on_every_real_configis enabled and green.Not in this PR:
token_to_idstill looks up the matcher form, sotoken_to_id("Hello")isNonefor a normalized token under a lowercasing normalizer.Throughput (tokbench, HF Jobs)
Job 6afed1bf: EPYC 7R13, one pinned core, 30 rotated rounds, max-of-N,
pipelineengine. Three arms: main1a9ec50b1, a second build of main (A/A control) and this branch at96c25fdb. Ids and decoded text are identical across arms and rounds. Read the change column against the A/A control column, which is the noise of two builds of the same source.MB/s is the best of the 30 rounds. "A/A control" is the same change measured on the second build of main.
Encode (the
added-*corpora are where the matcher reads the larger per-token entry):Decode:
The branch is inside the A/A band everywhere except two places: deepseek-v4 encode on
english(−6.5% against −2.7% for A/A) and llama-3 decode (3 to 6% above A/A). One job does not tell a real effect from a build-layout one for either.Memory (tokbench
measure memory, HF Jobs)Job 6afede23: live heap, main
1a9ec50b1against96c25fdb,englishcorpus (added-special-densegives the same deltas).The cost is the stored content plus the larger per-token entry: about 70 to 85 bytes per added token, 1.4% of the load heap on deepseek-v4 and under 0.3% elsewhere.