Source-linked AI summary

Unraveling the Localized Latents: Learning Stratified Manifold Structures in LLM Embedding Space with Sparse Mixture-of-Experts

Xin Li, Anand Sarwate

arXiv:2502.13577v1cs.LG

TL;DR

LLM embeddings may have local manifold structures of differing dimensions, rather than a single global manifold. The paper analyzes this hypothesis with a dictionary-learning Mixture of Experts and reports non-uniform geometry across strata, while noting that mathematical analysis and applications remain future work.

  • Problem

    The paper investigates whether LLM embeddings form local manifolds of varying dimensions rather than one global manifold, with strata potentially corresponding to domains, perplexities, or semantic concepts.

    Source: §1 · p. 1
  • Method

    A dictionary-learning Mixture-of-Experts model uses experts with different sparsity levels and attention-based soft gating to assign embeddings to specialized sub-manifolds.

    Source: §1 · p. 1, §4 · p. 3
  • Results

    The experiments report non-uniform embedding geometry, with strata varying in intrinsic dimension and complexity as reflected by average sparsity levels.

    Source: §5.2 · p. 8
  • Takeaways & Limitations

    The analysis provides insight into fine-grained localized LLM embedding structure and can be adapted to embedding spaces from other model architectures.

    Source: §6 · p. 8

    The work has not yet investigated the structure's mathematical details or potential applications of stratification.

    Source: §7 · p. 8

Abstract

from arXiv · show

However, real-world data often exhibit complex local structures that can be challenging for single-model approaches with a smooth global manifold in the embedding space to unravel. In this work, we conjecture that in the latent space of these large language models, the embeddings live in a local manifold structure with different dimensions depending on the perplexities and domains of the input data, commonly referred to as a Stratified Manifold structure, which in combination form a structured space known as a Stratified Space. To investigate the validity of this structural claim, we propose an analysis framework based on a Mixture-of-Experts (MoE) model where each expert is implemented with a simple dictionary learning algorithm at varying sparsity levels. By incorporating an attention-based soft-gating network, we verify that our model learns specialized sub-manifolds for an ensemble of input data sources, reflecting the semantic stratification in LLM embedding space. We further analyze the intrinsic dimensions of these stratified sub-manifolds and present extensive statistics on expert assignments, gating entropy, and inter-expert distances. Our experimental results demonstrate that our method not only validates the claim of a stratified manifold structure in the LLM embedding space, but also provides interpretable clusters that align with the intrinsic semantic variations of the input data.

1 Introduction

The introduction hypothesizes that LLM embeddings form local manifolds of varying dimensions rather than one smooth global manifold. It proposes a dictionary-learning Mixture-of-Experts framework and outlines analyses of expert assignments, stratification, and visualizations.

1 Introduction

  • The hypothesis is that LLM embeddings form a union of lower-dimensional local manifolds whose dimensions may vary with domain, perplexity, or semantic concept.The introduction contrasts this proposed Stratified Space with a single global manifold.Source: §1 · p. 1
  • The proposed framework uses dictionary-learning experts with different sparsity levels and attention-based soft gating to route samples among specialized sub-manifolds.The gating implicitly selects the dimension of a local sub-manifold.Source: §1 · p. 1
  • An MoE pipeline analyzes sample-level expert assignments to illuminate the intrinsic structure of embedding-space strata.The introduction presents this as part of a framework for examining the stratified-manifold hypothesis.Source: §1 · p. 1
  • The paper proposes empirical evaluations and visualizations to examine embedding stratification and LLM working mechanisms.The stated aims include insights into interpretability and performance.Source: §1 · p. 1

2 Related Work

Related work discusses geometric properties of LLM embeddings, Mixture-of-Experts models, and dictionary-learning methods used for sparse representation.

2 Related Work

  • Robinson et al. are reported to have shown a stratified-manifold structure in LLM token embeddings, while other work describes anisotropic distributions and high similarity between unrelated words.The cited discussion connects anisotropy with limits on model expressive power.Source: §2 · p. 2
  • Unlike MoE approaches used to scale model capacity, this paper uses unsupervised experts with known hyperparameters to partition fixed embeddings by geometric structure.The related-work discussion describes conventional MoE routing among specialized experts and notes scaling with minimal added computations (Shazeer et al., 2017).Source: §2 · p. 2

Dictionary Learning & Sparse Coding

  • Dictionary learning represents data as sparse linear combinations of learned atoms, with methods including KSVD, Online Dictionary Learning, OMP, IHT, and ISTA.The passage also lists Learnable-ISTA as a dictionary and sparse-coding method.Source: Dictionary Learning & Sparse Coding · p. 2

3 Preliminaries

The preliminaries review mathematical foundations for stratification and introduce Mixture-of-Experts models as a way to divide inputs among specialized experts.

3.1 Mathematical Foundations of Stratification

  • A manifold is defined as a second-countable Hausdorff space whose points have neighborhoods homeomorphic to R^n, and is described as locally resembling Euclidean space.The preliminaries also introduce stratification after reviewing these mathematical concepts.Source: §3.1 · p. 2

3.2 Mixture of Experts (MoE): An Introduction

  • A Mixture of Experts combines specialized models through a gating network, partitioning input space into regions handled by different experts.The predefined complexity of experts can provide dimensional information about learned subregions.Source: §3.2 · p. 3
  • The gating mechanism assigns non-negative weights to experts, and the mixture combines expert outputs using those weights.Blending simpler experts can represent complex functions and help examine how different expert complexities behave across embedding-space localities.Source: §3.2 · p. 3

4 Our Approach

The approach models last-hidden-state embeddings with dictionary-learning experts at predefined sparsity levels, using attention-based soft gating to assign inputs to experts. The sparsity constraints associate expert assignments with stratum dimensions, while allowing multiple experts to represent a stratum.

4 Our Approach

  • Each expert uses a learnable dictionary to find a sparse code for an embedding, with Learnable ISTA used for sparse coding.The inputs are embeddings from the model's last hidden states.Source: §4 · p. 3
  • Predefined expert sparsity levels set hard support constraints: each code keeps its top s(e) entries, with a straight-through estimator for gradient flow.Each dictionary is designed to capture a stratum's distinguishable linear structure, while soft gating permits multiple experts per stratum.Source: §4 · p. 3
  • Attention-based gating acts as a soft dictionary lookup, producing a probability distribution over experts from query-key similarities and a softmax.The dot product is scaled by √Q before softmax.Source: §4 · p. 4
  • The gating network uses learnable expert keys as templates to help determine expert assignments for each input.Figure 1 is described as an overview of the model mechanism for learning stratum information.Source: §4 · p. 4, Figure 1 · p. 4

5 Experiments

The experiments examine embeddings from a multi-domain text mixture across several language models, using visualizations and stratum-level measurements to assess embedding-space structure. The reported results show domain-related clustering and variation in inferred stratum dimensions and complexity.

5 Experiments

  • The evaluation combines 500 samples from each data source and analyzes seven dictionary-learning experts with different sparsity levels across five strata.The reported models include RoBERTa, Llama-3.2-1B, and DeepSeek-R1-Distill-Qwen-1.5B.Source: §5 · pp. 4, 7

5.1 Visualizations

  • The visualization analysis projects embeddings into 3D with PCA and uses stratum indices as labels, alongside gating-probability visualizations.The visualizations cover RoBERTa, Llama-3, and DeepSeek.Source: Figure 2 · p. 6, Figure 3 · p. 6, §5.1 · p. 7
  • Similar-dataset embeddings cluster together, larger models show clearer domain separation than RoBERTa, and DeepSeek assignments are slightly more concentrated than Llama’s.The authors suggest the concentration difference might indicate smoother embeddings across strata and domains in DeepSeek.Source: Figure 2 · p. 6, Figure 3 · p. 6, §5.2 · pp. 7–8

5.2 Evaluation

  • Across the examined strata, intrinsic dimensions and weighted sparsity levels vary, indicating non-uniform geometric structure in the embedding spaces.Intrinsic dimensions are estimated by counting PCA eigenvalues capturing 75% of data variance; weighted sparsity is reported separately.Source: §5.2 · p. 8, Table 1 · p. 8, Table 2 · p. 8

6 Conclusions

The authors present a framework for analyzing local geometry in LLM embedding spaces and report results consistent with a stratified-manifold account. They point to fine-grained structure and future research, including adapting the analysis to other architectures.

6 Conclusions

  • The proposed framework analyzes local geometrical structures in LLM embedding spaces using dictionary-learning experts and attention-based soft assignments.Experts have different sparsity levels, treated as hypothetical strata.Source: §6 · p. 8
  • The reported results align with the hypothesis that LLM embeddings form local stratified manifolds of different dimensions rather than one smooth global manifold.The authors describe this as insight into fine-grained localized structure.Source: §6 · p. 8
  • The authors say the analysis can be adapted to embedding spaces from other model architectures and may inform future research.They identify smarter design choices and improved understanding of language models as future directions.Source: §6 · p. 8

7 Limitations

The authors identify mathematical characterization and applications of the stratification idea as unfinished work.

7 Limitations

  • The mathematical details and properties of the proposed structure have not yet been investigated rigorously.The authors call for a more mathematically rigorous examination in future work.Source: §7 · p. 8
  • The paper has not explored potential applications of the stratification idea.Possible applications to model performance or interpretability are proposed as future work, not established outcomes.Source: §7 · p. 8
  • The authors characterize stratification as a fairly novel idea and identify its applications as an open area for further study.They suggest future applications might address LLM performance or interpretability.Source: §7 · p. 8

A.1 Review of Basic Mathematics Concepts

This section provides a review of concepts intended to help readers understand the paper’s discussion of stratification.

A.1 Review of Basic Mathematics Concepts

  • The section reviews relevant concepts to support understanding of stratification as discussed in the paper.The passage describes the review as a guide to the paper’s treatment of the idea.Source: §A.1 · p. 10

A.1.1 Basics of Mathematical Analysis

This section defines equivalence through one-to-one correspondence and distinguishes finite, infinite, and uncountable sets.

A.1.1 Basics of Mathematical Analysis

  • A one-to-one mapping from X onto Y puts the sets in one-to-one correspondence, denoted X ∼ Y.The passage names this relation equivalence.Source: §A.1.1 · p. 10
  • A set X is finite if it is equivalent to Jn for some positive integer n; the empty set is also finite.Source: §A.1.1 · p. 10
  • A set is infinite if it is not finite, and uncountable if it is neither finite nor countable.Source: §A.1.1 · p. 10

A.1.2 Basics of Topology

The appendix reviews topology and algebra concepts, defines smooth manifolds through compatible local charts, and includes expert-gating visualizations for BERT and GPT-3.

A.1.2 Basics of Topology

  • Metric spaces associate distances to point pairs, while topological spaces specify open sets through neighborhood axioms or closure properties.The section also defines neighborhoods, limit points, and closure.Source: §A.1.2 · pp. 10–11

A.1.3 Basics of Abstract and Commutative Algebra

  • The algebra review builds from binary operations and groups to rings, modules, and filtrations of submodules.A monoid satisfies the first two group properties; a group additionally requires inverses.Source: §A.1.3 · pp. 11–12

A.1.4 Smoothness of Manifolds

  • A smooth n-dimensional manifold is a Hausdorff, second-countable topological space equipped with an atlas of compatible charts.A chart maps an open set in X to R^n.Source: §A.1.4 · p. 12

A.2 More Results and Visualizations

Loading 2502.13577v1…