Hyperbolic Residual Quantization (HRQ)
- Hyperbolic Residual Quantization (HRQ) is a discrete representation framework that uses hyperbolic geometry to accurately model exponentially branching, tree-structured data.
- By replacing Euclidean operations with Möbius counterparts, HRQ aligns quantization with the natural exponential growth of hierarchies, ensuring lower distortion in deep branches.
- Empirical evaluations demonstrate that HRQ can improve Recall@10 by up to 20% compared to standard Residual Quantization, especially in tasks like hierarchy modeling and recommendation systems.
Hyperbolic Residual Quantization (HRQ) is a discrete representation learning framework designed to model data with latent hierarchical structures by performing residual quantization in a hyperbolic manifold, specifically the Poincaré ball. HRQ extends the standard Residual Quantization (RQ) paradigm by replacing Euclidean geometry with hyperbolic geometry throughout the embedding network, residual computation, and codebook lookup operations. This modification imparts an inductive bias aligned with exponentially branching, tree-like data, enabling more faithful and effective modeling of hierarchies. HRQ generates multi-token discrete representations that are empirically more suitable for downstream tasks involving hierarchical relationships than Euclidean RQ, with observed performance gains of up to 20% in hierarchy-structured evaluation scenarios (Piękos et al., 18 May 2025).
1. Background and Motivation
Residual Quantization (RQ) represents a vector by iteratively quantizing a sequence of residuals using multiple codebooks . Each quantization step produces a token indexing the closest codeword, yielding a multitoken encoding and a reconstruction
However, Euclidean RQ struggles with data exhibiting hierarchical branching. Real-world hierarchies, such as WordNet hypernym structures, exhibit exponential growth in leaf nodes at increasing depth. In contrast, Euclidean space's polynomial volume growth leads to "cramped" representations, insufficient separation of subtrees, and distortion of the hierarchical signal—particularly in deep branches. Empirical analyses demonstrate that RQ-VAEs incur substantial distortion in lower quantization levels when applied to such data.
Hyperbolic space possesses a fundamentally different volume growth property: in of negative curvature , volume grows exponentially with radius. This matches the geometry of tree-structured data, allowing embeddings to reflect both the depth and branching of hierarchies with low distortion. Any finite tree can be embedded in two-dimensional hyperbolic space with arbitrarily low distortion. Thus, HRQ leverages these properties to overcome geometric mismatch (Piękos et al., 18 May 2025).
2. Foundations: Hyperbolic Geometry
HRQ adopts the -dimensional Poincaré ball model , with its Riemannian metric
Key hyperbolic operations for HRQ include:
- Möbius Addition: The hyperbolic analogue of vector addition for is
Its inverse, Möbius subtraction, is .
- Hyperbolic Distance: The geodesic distance between and is
- Exponential and Logarithmic Maps: These maps allow moving between tangent spaces and the manifold:
These operations are essential for constructing neural-black hyperbolic layers and for the quantization algorithm.
3. HRQ Architecture and Algorithm
HRQ replaces each Euclidean linear (and nonlinearity) layer in the encoder and decoder with their hyperbolic counterparts. Given an input , it is lifted to the manifold via the exponential map:
A stack of Möbius-linear and nonlinearity layers then produces a latent encoding .
HRQ maintains codebooks , each of size . Starting with , the quantization proceeds as follows for :
- Token selection: , with .
- Hyperbolic residual: .
The multitoken representation is . Reconstruction is performed by sequential Möbius addition:
The decoder mirrors the encoder: , , and the Euclidean reconstruction is . The pseudo-code provided outlines this sequence of operations (Piękos et al., 18 May 2025).
4. Learning Objectives and Optimization
HRQ-VAE is trained by minimizing two principal objectives:
- Reconstruction Loss: Measures discrepancy in Euclidean space,
- Hyperbolic RQ Codebook Loss: Enforces codebook commitment and alignment at each quantization level,
where denotes the stop-gradient operator and trades off codebook commitment.
Optimization is performed using Riemannian variants of Adam or SGD, ensuring updates respect manifold constraints. Training typically involves thousands of epochs with learning rate warmup and utilizes the straight-through estimator to tie codebook and encoder updates.
5. Empirical Evaluation
HRQ has been evaluated on both supervised hierarchy modeling and unsupervised hierarchy discovery:
- Supervised Hierarchy Modeling (WordNet):
- Dataset: 82,115 nouns, 743,241 hypernymy edges (transitive closure).
- Protocol: Multitoken embeddings are trained with contrastive loss on hypernym vs. non-hypernym pairs plus HRQ loss; a Transformer seq2seq model is then trained to predict hypernyms.
- Metric: Recall@10 on a held-out 15% of hypernym pairs.
- Results: For codebook size 256 and ,
- Hidden dim 32: RQ 67.3% vs. HRQ 79.9% ()
- Hidden dim 16: RQ 69.8% vs. HRQ 78.9% ()
- HRQ consistently yields up to +20 percentage points Recall@10 improvement compared to RQ.
- Unsupervised Hierarchy Discovery (Recommender Systems):
- Datasets: Amazon Reviews 2014 (multiple product categories), MovieLens-10M (LLM-generated movie descriptions).
- Protocol: Each item is encoded via a text encoder, HRQ-VAE or RQ-VAE produces multitokens, and a Transformer recommender predicts next items from these tokens.
- Metrics: Recall@K, NDCG@K for .
- Representative results:
- Amazon Beauty, Recall@10: RQ 4.83% HRQ 5.01% ()
- MovieLens, Recall@10: RQ 25.11% HRQ 25.49% ()
- Across all metrics, HRQ-VAE shows 1–7% relative improvements (Piękos et al., 18 May 2025).
6. Analysis, Limitations, and Extensions
HRQ’s efficacy is rooted in the geometry of hyperbolic space:
- Hierarchical Codeword Placement: Low-frequency (high-level) codewords are encoded near the Poincaré ball’s center; high-frequency (leaf-level) codewords migrate near the boundary. The ball’s radii naturally map to hierarchy depths, encoding tree-like relationships with fidelity.
- Möbius Operations: Manifold-specific operations preserve geodesic distances, obviating distortions that Euclidean subtraction incurs in deep branches.
- Utilization Uniformity: The coefficient of variation of latent vector norms is nearly halved under HRQ compared to RQ, reflecting a more uniform use of representational capacity.
Limitations include:
- Assumed Data Structure: HRQ presumes data with latent hierarchical structure and focuses on discrete tokenization rather than continuous generative modeling. Extensions to diffusion models or other continuous domains remain an open area.
- Computational Complexity: Hyperbolic codebooks scale as and their reliance on nearest-neighbor search in non-Euclidean space presents scalability and efficiency challenges.
- Open Research Directions: Future work may explore hybrid (product) geometries, more expressive hyperbolic clustering techniques, and broader applications such as phylogenetics, knowledge graph embedding, and curriculum learning in RL.
7. Broader Significance and Future Work
Integrating hyperbolic geometry into multitoken discrete representation learning enables explicit encoding of latent hierarchies, providing a hierarchical inductive bias that is well-aligned with exponentially branching data. HRQ achieves substantial gains in both supervised and unsupervised downstream tasks, including up to 20% improvement in hierarchy modeling recall. Prospective extensions include developing scalable non-Euclidean nearest neighbor search algorithms, investigating product/hybrid manifolds, and adapting HRQ for continuous generative tasks and novel domains. The method establishes a theoretical and empirical foundation for hierarchically structured quantization in modern machine learning (Piękos et al., 18 May 2025).