Hashing Characters

A separate entry for every possible character can make a table large. Hashing maps characters into a fixed number of buckets, at the cost of sometimes giving different characters the same destination.

14 sections · 15 questions · 4 coding challenges

1 / 14

Could We Allocate Space Before Knowing Every Feature?

BOTIE

A growing text collection can keep introducing new items. If each one requires a new dictionary entry and feature coordinate, the representation grows with the collection. We may instead need a fixed amount of memory and a rule that can handle an item immediately.

Weinberger and colleagues' 2009 feature-hashing work examined mapping a large feature space into a smaller fixed one without maintaining a full feature dictionary. The character-hashing example here applies that broader idea to a small, inspectable case; it is not a claim that the original paper introduced this particular tokenizer.

A deterministic hash selects a bucket for each item. The same item returns to the same bucket, including when it first appears after training. Different items can share a bucket, so we trade a bounded representation for collisions and lost identity. A bucket number is therefore not a reversible token ID or a learned statement about meaning.

Sources for this history