What are AI tokens?
Tokens are pieces of data a model processes. In text they can be words, parts of words, punctuation or other units. Token counts depend on the tokenizer and the text. A word count alone cannot tell you exactly how much input will fit.
Try it
- Pick the model you plan to use.
- Count a sample with its token-counting tool.
- Reserve room for instructions, conversation history and the reply.
Worked example
An English paragraph and a block of code with the same character count can consume different numbers of tokens. Measure both before sizing a batch.
Check your result
Use the tokenizer for the actual model and count the complete input.