T-SNE (t-Distributed Stochastic Neighbor Embedding)
Last Updated: July 29, 2026 | By Mihail Sebastian | AI Dictionary
A method that squeezes high-dimensional data into a 2D or 3D scatter plot by keeping near-neighbors near, used to see clusters rather than to build features.
What is T-SNE (t-Distributed Stochastic Neighbor Embedding)?
t-SNE is a dimensionality reduction method that maps high-dimensional points onto two or three axes so that points close together in the original space stay close in the plot. Its purpose is visualization, not feature construction.
It is nonlinear and stochastic, the opposite of principal component analysis: PCA rotates data deterministically into components you can reuse and invert, while t-SNE yields a different picture each run and no way back to the original values.
How t-SNE Works
- Neighbor probabilities. For each point, t-SNE turns distances to all other points into probabilities of being neighbors. The perplexity setting controls how wide that neighborhood is.
- A low-dimensional twin. The same probabilities are computed in the 2D layout, using a heavy-tailed t-distribution that lets distant points sit far apart without penalty.
- Gradient descent. Points shuffle around the plane until the two probability sets match. Starting positions are random, so the final layout differs each run.
t-SNE vs UMAP
Both produce 2D scatter plots of high-dimensional data; the practical difference is that UMAP runs faster on large datasets and keeps more of the global arrangement, while t-SNE concentrates on getting each point’s immediate neighborhood right.
In a t-SNE plot, cluster membership is informative but the space between clusters is not: two blobs on opposite sides of the canvas need not be more different than two adjacent ones. UMAP’s layout carries more meaning at that scale, which is why it has become the default for exploring embeddings.
| Criterion | t-SNE | UMAP |
|---|---|---|
| Structure preserved | Local neighborhoods; distances between clusters carry little meaning | Local neighborhoods plus more of the global arrangement |
| Speed | Slow on large datasets; often run on a subsample | Faster, and practical on millions of points |
| New data points | No transform for unseen points; rerun on the whole set | Can project new points into an existing embedding |
| Main settings | Perplexity | Number of neighbors, minimum distance |
Example of t-SNE
A team fine-tunes a text classifier on support tickets and wants to know what its final hidden layer learned. Each ticket becomes a 768-dimensional activation vector, unreadable as numbers.
Running t-SNE on those vectors yields five tight clumps matching the five ticket categories, plus a smear of points bridging two of them. Reading a few tickets from the smear shows they are billing complaints phrased as technical faults.
The plot measured nothing. It pointed at the label boundary that needed a decision.
FAQ
Why does my t-SNE plot look different every time I run it?
Initialization is random and the optimization is stochastic, so each run settles into a different arrangement. Fixing the random seed makes a run reproducible, and a rotated or mirrored layout is the same result.
Can I trust the distance between two clusters?
No. t-SNE optimizes local neighborhoods, and the gaps between well-separated clusters are largely an artifact of the layout. Use it to judge whether groups separate, not how far apart they are.
Related AI terms: UMAP · Dimensionality Reduction · Principal Component Analysis · Latent Space · Word Embedding
Did you like the T-SNE (t-Distributed Stochastic Neighbor Embedding) gist?
Learn about 250+ need-to-know artificial intelligence terms in the AI Dictionary.
Mihail Sebastian — Writes about AI governance, regulation, and the technology behind them. Placeholder bio — replace with a real credential line. About