Add a feature that will automatically calculate a source vocab size in a reasonable range.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39
- Forks
- 7
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 5
Description
We have an idea that source vocab sizes that yield tokens/piece numbers within a certain range gives the best results.
Running the preprocessing with a low source vocab size generates a list of the tokens/piece at each iteration.
If the size listed there the source vocab size that results in the given number of tokens/piece then we could use that to automatically select a source vocab size which falls in the 'best' range.
unigram_model_trainer.cc(500) LOG(INFO) EM sub_iter=1 size=9184 obj=8.06571 num_tokens=39409 num_tokens/piece=4.29105
unigram_model_trainer.cc(500) LOG(INFO) EM sub_iter=0 size=6884 obj=8.00724 num_tokens=40804 num_tokens/piece=5.92737
unigram_model_trainer.cc(500) LOG(INFO) EM sub_iter=1 size=6871 obj=7.98085 num_tokens=40842 num_tokens/piece=5.94411
unigram_model_trainer.cc(500) LOG(INFO) EM sub_iter=0 size=5153 obj=8.05308 num_tokens=44125 num_tokens/piece=8.56297
unigram_model_trainer.cc(500) LOG(INFO) EM sub_iter=1 size=5152 obj=8.03355 num_tokens=44122 num_tokens/piece=8.56405
unigram_model_trainer.cc(500) LOG(INFO) EM sub_iter=0 size=3864 obj=8.15299 num_tokens=48106 num_tokens/piece=12.4498
unigram_model_trainer.cc(500) LOG(INFO) EM sub_iter=1 size=3864 obj=8.12532 num_tokens=48106 num_tokens/piece=12.4498
unigram_model_trainer.cc(500) LOG(INFO) EM sub_iter=0 size=2898 obj=8.30461 num_tokens=52775 num_tokens/piece=18.2108
unigram_model_trainer.cc(500) LOG(INFO) EM sub_iter=1 size=2898 obj=8.26844 num_tokens=52777 num_tokens/piece=18.2115
unigram_model_trainer.cc(500) LOG(INFO) EM sub_iter=0 size=2750 obj=8.29886 num_tokens=53545 num_tokens/piece=19.4709
unigram_model_trainer.cc(500) LOG(INFO) EM sub_iter=1 size=2750 obj=8.29296 num_tokens=53593 num_tokens/piece=19.4884
In this example there is no point running two experiments one with a vocab size of 7000 and another with a vocab size of 8000, since these would both give the same number of tokens/piece of 4.29105
A flag of source_vocab_size_auto: true could be added to govern whether the system should automatically choose a source vocab size or not. We'd need to decide whether this setting would override any specific source_vocab_size setting or whether specifying both would raise an error during preprocessing.
Would it be useful to have a setting to specify a number of tokens/piece to aim for?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named. Start by tracing preprocessing configuration for source_vocab_size and the unigram trainer output that reports vocab size and num_tokens/piece. Define the acceptable tokens-per-piece range and the behavior when source_vocab_size_auto is combined with an explicit source_vocab_size, then establish preprocessing tests for the selected size.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100