AIToday

GPT-2's 32,070-token vocabulary mapped in interactive hyperbolic space

r/MachineLearning22h ago

Key takeaway

A visualization of GPT-2's 32,070-token vocabulary has been mapped into hyperbolic space (a Poincaré ball), revealing that the tokens naturally cluster in a tree-like forest structure—one main tree of roughly 2,300 tokens, several hundred smaller clusters, and about 6,700 isolated tokens. Hyperbolic geometry is better suited to this structure than flat space because trees embed naturally where available room grows exponentially with distance. The interactive tool runs on mobile devices and lets users explore token relationships through familiar touch gestures.

Summaries like this, in your inbox every morning.

Sign up free →

3 Key Points

  • What happened

    A researcher has visualized GPT-2-small's complete vocabulary of 32,070 tokens inside a Poincaré ball (a mathematical representation of hyperbolic space) using the model's raw token embeddings, creating an interactive 3D explorer that runs on mobile devices.

  • Why it matters

    The vocabulary's underlying structure is forest-like—one large tree of about 2,300 tokens, several hundred smaller family trees, and around 6,700 isolated tokens—which fits naturally in hyperbolic geometry where space expands exponentially with distance, rather than in flat 2D space where trees distort.

  • What to watch

    Users can interact with the visualization directly in a browser on their phone by dragging to rotate, pinching to zoom, and tapping tokens to center and explore neighboring relationships; this is a Möbius translation, the canonical navigation method in hyperbolic geometry.

In Depth

GPT-2-small's vocabulary consists of 32,070 tokens—the discrete units of text the model reads and generates. Each token is represented internally as a vector of numbers (an embedding), and these embeddings capture semantic and syntactic relationships: similar tokens cluster together in the embedding space. A researcher analyzed this structure and discovered it has a clear forest topology: one main tree containing about 2,300 tokens (likely common words and word pieces), several hundred smaller trees of specialized vocabulary clusters, and approximately 6,700 isolated tokens with no close neighbors. In traditional flat (Euclidean) space, tree structures suffer from distortion and inefficiency—branches at different depths require vastly different scaling to display legibly. Hyperbolic geometry avoids this problem. In hyperbolic space, the amount of surface area (or volume in higher dimensions) grows exponentially as you move outward, which is precisely the property that allows trees to be embedded efficiently. The creator used the Poincaré ball model, a standard mathematical representation where hyperbolic space is mapped into a unit ball, and populated it with GPT-2's actual token embeddings. The resulting visualization is fully interactive and runs directly in a web browser on mobile devices. Users can drag their finger to rotate the view, pinch to zoom, and tap any token to perform a Möbius translation—a transformation that smoothly brings that token to the center of view while the rest of the space reorganizes around it. This is the natural, distortion-minimizing way to navigate hyperbolic geometry. Tapping neighboring tokens allows continuous exploration of the vocabulary's structure. The visualization uses only GPT-2-small's raw embeddings with no additional processing, making it a faithful window into how the model encodes its discrete vocabulary.

Context & Analysis

This visualization project demonstrates a principled approach to understanding how large language models organize their vocabulary at scale. Rather than imposing a conventional 2D projection, the creator recognized that GPT-2's token embeddings naturally encode a hierarchical, tree-like structure—confirmed by the presence of one dominant cluster (around 2,300 tokens), numerous smaller family trees, and thousands of isolated tokens. Hyperbolic geometry provides a mathematically natural container for such structures because, unlike Euclidean space, it offers exponentially more room as you move away from the origin, making hierarchies and trees fit without distortion. By embedding this structure in a Poincaré ball (the standard computational model of hyperbolic geometry), the visualization becomes both mathematically faithful to the data's intrinsic shape and practically interactive on consumer hardware. The mobile-first implementation with touch-native controls (Möbius translation for navigation) makes this a rare example of hyperscale model internals presented in a format users can actually explore.

FAQ

What is a Poincaré ball and why use it for a vocabulary visualization?
A Poincaré ball is a mathematical model of hyperbolic space where available room grows exponentially with distance from the center. GPT-2's vocabulary forms a forest structure (one giant tree with about 2,300 tokens, several hundred smaller family trees, and around 6,700 isolated tokens), which fits naturally in hyperbolic space but distorts in flat 2D space.
How do you navigate the visualization?
You drag to rotate, pinch to zoom, and tap any token to bring it to the center as the entire space shifts around it through a Möbius translation—the natural way to move through hyperbolic geometry. You can then tap neighboring tokens to continue exploring.
What data does this visualization use?
It uses GPT-2-small's raw token embeddings and nothing else, laid out in hyperbolic space.

Get the latest Large Language Models news every morning

AI-summarized, only the topics you pick — one digest a day via Email, Slack, or Discord.

Free · takes 30 seconds · unsubscribe anytime

Discussion

No comments yet. Be the first to share your thoughts!

Log in to join the discussion

Related Articles

Stay ahead with AI news

Get curated AI news from 200+ sources delivered daily to your inbox. Free to use.

Get Started Free

Free · takes 30 seconds · unsubscribe anytime

1 minute a day. The AI essentials.

200+ sources · Email / LINE / Slack

Get it free →