Jun '25 (edited) • 🛠️ dev-help
You’re New to AI and Want to Use n8n, Start Here (Part 10)
Prerequisite: TOKENIZATION & TEXT PROCESSING (How AI breaks down text to understand and generate language)
WHAT IS TOKENIZATION
→ Tokenization is the process of splitting text into smaller units called tokens
→ Tokens can be words, parts of words (subwords), individual characters, or even punctuation
→ Every AI model starts by analyzing tokens, this is how it reads and processes text
→ Clean tokenization = better accuracy, faster processing, and fewer mistakes
TOKENIZATION TECHNIQUES
Different ways to split text, depending on the language and use case
WORD TOKENIZATION
→ Breaks text based on spaces
→ Example: "AI is transforming industries" → ["AI", "is", "transforming", "industries"]
SUBWORD TOKENIZATION
→ Splits words into smaller meaningful parts like prefixes and suffixes
→ Handles rare or made-up words better
→ Example: "unhappiness" → ["un", "happiness"]
CHARACTER TOKENIZATION
→ Treats each character (including spaces and punctuation) as a token
→ Useful for very detailed processing or languages without clear word boundaries
→ Example: "AI"→ ["A", "I"]
BYTE-PAIR ENCODING (BPE)
→ Merges the most frequent pairs of bytes in a word
→ Balances efficiency with vocabulary coverage
→ Example: "lower" → ["low", "er"]
SENTENCE TOKENIZATION
→ Splits large chunks of text into sentences
→ Helps AI preserve structure and meaning
→ Example: "AI is evolving. It impacts many sectors." → ["AI is evolving.", "It impacts many sectors."]
TOKENIZATION EXAMPLE
How the sentence “n8n is such a powerful tool!!” gets split
→ Word Tokenization: ["n8n", "is", "such", "a", "powerful", "tool!!"]
→ Subword Tokenization (BPE): ["n", "8", "n", "is", "such", "a", "powerful", "tool", "!!"]
→ Character Tokenization: Every letter, space, and punctuation is separate
→ OpenAI Tokenization: ["n8n", " is", " such", " a", " powerful", " tool", "!!"]
IMPACT ON EMBEDDINGS
Why token choice affects how text becomes numbers
GRANULARITY
→ Word-level: Fewer tokens, but struggles with rare words
→ Subword-level: Flexible and efficient; handles weird or rare words
→ Character-level: Very detailed, but creates long sequences
VOCABULARY SIZE
→ Large vocab = better coverage, higher memory cost
→ Small vocab = more efficient, but depends on subwords
OUT-OF-VOCABULARY HANDLING
→ Subword and character tokenization help the model handle words it hasn’t seen before
SEQUENCE LENGTH
→ More tokens = longer sequences = higher computational cost
→ Finer tokenization (like character-level) = more tokens
PREPROCESSING STRATEGIES
What to do before sending text into a model
TEXT NORMALIZATION
→ Lowercase everything for consistency
→ Remove punctuation unless it adds meaning
→ Expand contractions: "don’t" → "do not"
STOP WORD REMOVAL
→ Drop words like “the”, “and”, “but” if they don’t add meaning
→ Useful for some tasks, not for others, depends on the goal
STEMMING AND LEMMATIZATION
→ Stemming: Cuts words down to their root (e.g., “running” → “run”)
→ Lemmatization: Converts words to their base form using grammar and context (e.g., “was” → “be”)
HANDLING SPECIAL TOKENS
→ Padding: Adds blank tokens so all sequences are the same length
→ Start/End Tokens: Marks where input begins and ends, important for translation or generation tasks
DEALING WITH NOISE
→ Remove junk: URLs, tags, or unrelated symbols
→ Fix spelling issues so AI doesn’t tokenize nonsense
TOKENIZATION & PRICING
Why token count impacts your cost
WHAT IS A TOKEN
→ A token is a chunk of text, not always a full word
→ Example: “ChatGPT is great!” might break into 6 tokens→ ["Chat", "G", "PT", " is", " great", "!"]
HOW PRICING WORKS
→ Most APIs (like OpenAI) charge per 1,000 tokens
→ GPT-4o Mini costs $0.015 per 1,000 input tokens
COST IMPLICATIONS
→ Finer tokenization = more tokens = higher cost
→ Efficient tokenization = same results, lower bill
FINAL TAKEAWAY
→ Tokenization isn’t just a technical step, it decides how your data is interpreted, how much it costs, and how well your AI works
→ Pick the right strategy based on your goal: accuracy, speed, or budget
→ Clean tokens, clean inputs, better AI output
Thanks for reading, leave a like, follow along and let me know in the comments if you like it💫
And if you're even thinking about starting an agency, check out the system I built.
24
26 comments
Kate Lawson
6
You’re New to AI and Want to Use n8n, Start Here (Part 10)
AI Automation Agency Hub
skool.com/learn-ai
Start & Scale your own AI Automation Agency. Learn to build AI solutions, land clients & get paid. From the creators of the AAA business model.
Leaderboard (30-day)
Powered by