[HN Gopher] Visualize Latent Spaces
___________________________________________________________________
Visualize Latent Spaces
Author : skadamat
Score : 69 points
Date : 2024-02-17 12:44 UTC (10 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| leobg wrote:
| This is great! Used to hack something like that together whenever
| working with embeddings, clustering, semantic search etc., using
| umap and plotly. This looks a lot more polished!
| jellyfish24 wrote:
| Wondering how this compares to the Tensorflow embedding
| projector? https://projector.tensorflow.org/
| johnsutor wrote:
| Honestly, looks more useful. Tensorflow embedding projector is
| pretty limited except for quick nifty visualizations, but it
| doesn't really inform you much about different clusters of
| points or why different clusters or hierarchies emerge. From a
| quick glance, it looks like this library lets you do that.
| dist-epoch wrote:
| How does one create a new embedding?
|
| If I have a new kind of data, not text, not image, so there is no
| existing embedding, how do I create one?
|
| Any good articles/talks on this?
| Terretta wrote:
| If you use phind.com or similar tools, they can get you started
| using the references on the right or refining your question:
|
| https://www.phind.com/search?cache=gvivp6ubidmlzrtntlrt72i8
| johndough wrote:
| How to "create an embedding" depends a lot on what kind of data
| you have.
|
| Usually, you train a neural network to solve some kind of task
| with your data. The most common task is probably
| classification, for example, "Is the animal shown in this image
| a dog or a cat?" or "Does this text sound happy or sad?".
|
| Once your network is trained, you discard its last layer, which
| was responsible for classification, and use the output of the
| second-to-last layer as your embedding vector.
|
| This works because the first few layers of the network have
| already transformed the data into a generally useful
| representation, which gets turned into specific classes by the
| last layer, or can be used as an embedding vector instead.
| jszymborski wrote:
| Lots of different ways to go about this. "Representation
| Learning" is what you're going to want to look up.
| ametrau wrote:
| Looks very cool. Looking forward to trying it on my embeddings
| jimmySixDOF wrote:
| Atlas from Nomic AI is popular and Weights & Bias have some tools
| but generally high dimensional data is hard to visualize whatever
| you do with it. This is a solid roll it yourself at home
| implementation though and well documented so nice work and thanks
| to the author this would be a good Show HN post.
| benreesman wrote:
| First, this is _awesome_ and we need more of this kind of thing.
|
| Second, disclaimer: I am not now and might never be a serious
| algebraic and/or differential geometer. Just a fan at the moment.
|
| I've been calling the useful transformations in LLM latent
| manifolds things like "substantially affine", and I think that's
| probably true enough of the current crop.
|
| I don't think this about `{V, I}-JEPA` (about which there's a lot
| of information and I plan to look into it a lot more) or Sora
| (about which there is less information but is still impressive
| AF). One imagines that `V-JEPA` and Sora have some deep
| parallels/symmetries.
|
| Either way, I'll wager that serious Riemannian geometry is
| rapidly on it's way to table stakes. We have extreme high-
| dimension spaces that result from backprop and gradient descent,
| some combination of smooth/continuous/differentiable/compact seem
| pretty likely to fall out? Along with interesting curvature
| tensors and parallel transport for moving around in them? And TDA
| for figuring it out numerically/computationally?
|
| I'd love if an expert chimed in, I'm trying to describe an
| intuition with a fluency that involves pointing and gesturing.
| heyitsguay wrote:
| To my knowledge as a math-turned-ML guy, there are currently no
| useful geometric characterizations of deep net latent spaces
| that are both "deep" (in the sense of using advanced
| mathematics) and "useful" (in the sense of revealing properties
| of networks or their latent spaces that aren't understood
| otherwise). Of course if anyone knows better I'd love to hear
| about it.
|
| Continuous geometric concepts don't play super well with the
| way we like to decompose model outputs into discrete entities
| (classes, words, visual properties). We can, e.g. find
| variables in celebrity face GAN latent spaces that seem related
| to face orientation, or hair color, sort of, over some variable
| range and under some input conditions, but that doesn't really
| translate cleanly into any typical mathematical
| characterizations, geometric or otherwise, where you'd be
| looking for some property to hold everywhere or at least have
| an atlas of connected local approximations to simple
| characterizations.
|
| Instead, we get high-dimensional messes of spaces, and network
| gradients during training don't exhibit clean or easy to
| understand dynamics except in the simplest toy cases.
|
| To paraphrase a more serious "math for ML" prof I've chatted
| with at times -- "doing math" classically involves being able
| to find a description with only a few free parameters for a
| complex phenomenon that may superficially appear to have
| many/infinite free parameters. It's possible that for large ML
| models trained on natural data, such a reduction just doesn't
| exist, you can't break the contributions of millions or
| billions of parameters down into a low-dimensional
| approximation. He was/is skeptical of us attaining deep
| mathematical insight into their operation, but he could always
| be wrong. I'd certainly love to see cool novel insights come
| out of mathematics that give clarity to what's been going on
| these past 15 years.
| benreesman wrote:
| Thank you very much for the thoughtful and insightful reply!
|
| This is obviously speculation/intuition, but it's not
| terribly surprising to me at least that operating in e.g.
| pixel-space or a straightforward lifted latent manifold
| (modern diffusers basically) wouldn't have _apparent_
| structure under the fancy t-SNE type things that seem to be
| the heaviest artillery brought to the party (at least in the
| open). In pixel space, you get 6-17 fingers on 1-3 hands.
|
| The `france - paris + uk === london` thing is real, and it's
| not surprising because there aren't typically much in the way
| of nonlinearities in `word2vec`/`fasttext`/`glove` type
| stuff. But this substantially survives all the leaky relus or
| whatever in LLMs. They're pretty clearly interpolating in a
| way that you could get close to with a composition of affine
| transforms.
|
| JEPA (and maybe Sora if..., fuck it) seems a dramatic shift
| in forcing joint loss into a much higher-level space/manifold
| with (to me at least) shockingly semantic properties. I mean
| look at the I-JEPA reconstructions from pre-trained lifted
| space with some dinky diffuser/VAE-thing eating the
| hyperplane:
|
| https://ai.meta.com/blog/yann-lecun-ai-model-i-jepa/
|
| That's not pixel space, and you've got a _lot_ of freedom to
| make it smoother, I suspect no one says "L1 regularization"
| anymore, but there's some modern version of that, we know how
| to do this.
|
| AFAIU (and again, I welcome expert correction) TDA at least
| and really a lot of modern geometry is about "scruffy
| intrinsic / smooth embedded" or vice versa, and "scruffy at
| this scale but smooth if you set the focus right".
| tudorw wrote:
| preserving topology during dimension reduction might affect
| this? something something, fractal dimensionality, erm
| tropical geometry and amoebas and the, here it is,
| https://proceedings.mlr.press/v80/zhang18i.html
|
| Edit, obviously I don't know my zonotope from my tropical
| hypersurface, I do however like the pretty pictures ;)
| spacecadet wrote:
| Great project!
|
| I wrote a little tool last year for myself that I called
| "hyperspace" haha- it allows me to do a similar "inspection" of
| model activity and output across a series of visualizations.
| enjalot wrote:
| Author of the project here. Definitely appreciating the
| supportive comments. I'd be happy to answer questions folks have
| and am very interested in what kind of data folks end up
| visualizing with it!
| tudorw wrote:
| Did you look at using PHATE for dimension reduction?
| enjalot wrote:
| I hadn't seen it, looking at the API it seems like it could
| be pretty straightforward to drop it in and see how the
| projections look.
| tudorw wrote:
| I'd be really interested to see if that works out. There's
| some interesting comparisons here;
| https://www.nature.com/articles/s42003-022-03628-x
___________________________________________________________________
(page generated 2024-02-17 23:00 UTC)