Scaling Laws with Vocabulary: Larger Models Deserve Larger Vocabularies
Abstract
Research on scaling large language models (LLMs) has primarily focused on model parameters and training data size, overlooking the role of vocabulary size. % Intuitively, larger vocabularies enable more efficient tokenization by representing sentences with fewer tokens, but they also increase the risk of under-fitting representations for rare tokens. We investigate how vocabulary size impacts LLM scaling laws by training models ranging from 33M to 3B parameters on up to 500B characters with various vocabulary configurations. We propose three complementary approaches for predicting the compute-optimal vocabulary size: IsoFLOPs analysis, derivative estimation, and parametric fit of the loss function. Our approaches converge on the same result that the optimal vocabulary size depends on the available compute budget and that larger models deserve larger vocabularies. However, most LLMs use too small vocabulary sizes. For example, we predict that the optimal vocabulary size of Llama2-70B should have been at least 216K, 7 times larger than its vocabulary of 32K. We validate our predictions empirically by training models with 3B parameters across different FLOPs budgets. Adopting our predicted optimal vocabulary size consistently improves downstream performance over commonly used vocabulary sizes. By increasing the vocabulary size from the conventional 32K to 43K, we improve performance on ARC-Challenge from 29.1 to 32.0 with the same 2.3e21 FLOPs. Our work emphasizes the necessity of jointly considering model parameters and vocabulary size for efficient scaling.
Community
This is an automated message from the Librarian Bot. I found the following papers similar to this paper.
The following papers were recommended by the Semantic Scholar API
- Are Protein Language Models Compute Optimal? (2024)
- Resolving Discrepancies in Compute-Optimal Scaling of Language Models (2024)
- Scaling Laws for Linear Complexity Language Models (2024)
- Large Vocabulary Size Improves Large Language Models (2024)
- Repurposing Language Models into Embedding Models: Finding the Compute-Optimal Recipe (2024)
Please give a thumbs up to this comment if you found it helpful!
If you want recommendations for any Paper on Hugging Face checkout this Space
You can directly ask Librarian Bot for paper recommendations by tagging it in a comment:
@librarian-bot
recommend
Maybe I'm missing something, but how/on what were the tokenizers trained? I see that they are BPE tokenizers with varying vocab size but I don't see much more detail than that. any insights on what was the diff/added to the vocab as the vocab size increased?
Hi @pszemraj , thanks for your insightful comments! We train the tokenizer on the SlimPajama corpus (the same corpus as our training). We will upload different tokenizers later for others' reference. Thanks for the reminder!
Models citing this paper 2
Datasets citing this paper 0
No dataset linking this paper