Manuscript Offprint

arXiv:2609.10305

RiLM: Parameter-Efficient Language Modeling via Geodesic Decoding

Fang Li

Fang Li

Department of Computer Science Oklahoma Christian University Edmond, USA Email: fang.li@oc.edu

Abstract—Language models under one million parameters matter for edge deployment, domain adaptation, and reproducible research, yet a two-layer LSTM or Transformer at embedding width d=128d=128 still spends roughly one third of its capacity on the output matrix Wout∈Rd×∣V∣W_{\text{out}} \in \mathbb{R}^{d \times |V|}. We propose Riemannian Language Models (RiLM), which remove that layer entirely: context unfolds as a trajectory on a Riemannian manifold, and next-token probabilities arise from squared geodesic distance between the current state and vocabulary embeddings. The same embedding map serves input and output—decoding is geometry. We instantiate the framework on flat Rd\mathbb{R}^d (Flat RiLM) and the Poincaré ball Hd\mathbb{H}^d (HypRiLM) with a shared MLP composition map φ∼290k\varphi \sim 290\text{k} parameters, d=128,∣V∣=2000d=128, |V|=2000. Across five seeds on WikiText-2, HypRiLM reaches 54.2±0.254.2 \pm 0.2 validation perplexity versus 87.6±0.687.6 \pm 0.6 for Flat RiLM; tied and matched LSTM, Transformer, and SSM controls remain at 113-147 PPL on WT-2—HypRiLM leads by roughly 2×2\times over the strongest tied recurrent baseline (SSM, 113.0±3.8113.0 \pm 3.8). Penn Treebank and a 10k-vocabulary stress test confirm that geodesic decoding transfers across corpora and larger ∣V∣|V|, while hyperbolic curvature helps selectively. We also characterize boundary collapse in naive hyperbolic recurrence and show how Möbius stabilization restores trainability. Claims are scoped to controlled small-model comparisons, not full-vocabulary state of the art.

Index Terms—language modeling, Riemannian geometry, hyperbolic neural networks, parameter efficiency

I. INTRODUCTION

Neural language models map token sequences to distributions over the next word. The dominant recipe—token vectors in Rd\mathbb{R}^d, state updates via LSTM gating [1] or self-attention [2], and an affine readout Wouth+bW_{\text{out}}h + b—scales to billions of parameters and underpins systems from machine translation to code generation [3], [4]. That recipe is the right default when compute and data are abundant. It is a poor default when the model must fit on device, adapt quickly to a narrow domain, or serve as a reproducible scientific instrument: below one million parameters, Wout∈Rd×∣V∣W_{\text{out}} \in \mathbb{R}^{d \times |V|} can consume one third of the budget at d=128d=128 and ∣V∣=2000|V|=2000, matching the embedding table. Shrinking dd to compensate weakens the recurrent or attention core; enlarging ∣V∣|V| without enlarging the model makes the output layer dominate entirely. Tied embeddings [5] halve redundant rows but still decode via a linear functional detached from how states move through representation space.

Language also carries hierarchical structure—syntax, lexical relations, topical organization—that Euclidean space embeds with distortion that grows in depth [6]. Hyperbolic space offers exponentially growing volume and has improved static embeddings and feed-forward layers [7], yet it is rarely used to govern how context is composed step by step. We ask whether manifold geometry can replace not only word vectors but the decoder itself.

We introduce Riemannian Language Models (RiLM). The state hth_t lives on a Riemannian manifold (M,g)(M, g). A single map φ\varphi, shared at every timestep, reads the current state and incoming token and proposes a tangent direction; the state then moves along the corresponding geodesic. Decoding needs no WoutW_{\text{out}}: word ww is likely when its embedding ewe_w lies close to hth_t in geodesic distance, p(w∣ht)∝exp⁡(−dM(ht,ew)2/τ)p(w \mid h_t) \propto \exp(-d_M(h_t, e_w)^2/\tau). Context becomes a trajectory h0→h1→⋯→hTh_0 \to h_1 \to \cdots \to h_T; classification and representation are coupled because the model must arrange vocabulary points so that plausible continuations lie near that trajectory.

We study two instantiations: Flat RiLM on M=RdM=\mathbb{R}^d (the Euclidean special case of our earlier unpublished prototype) and HypRiLM on the Poincaré ball M=HcdM=\mathbb{H}_c^d. Hyperbolic recurrence posed an unexpected obstacle—naive exponential-map updates drive states to the ball boundary and flatten all logits—which we analyze and resolve with Möbius translation (Section V). Empirically, we report multi-seed WikiText-2 and Penn Treebank results against untied, tied, and matched-parameter LSTM, Transformer, and selective state-space baselines. HypRiLM improves ∼38%\sim 38\% relative to Flat RiLM on web text and trails Flat RiLM on newswire PTB; on both corpora, each RiLM variant beats matched and tied LSTM, Transformer, and SSM controls by wide margins (Tables IV and VI). We do not target billion-parameter pretraining; the contribution is a geometric language-modeling template, a trainability analysis for hyperbolic recurrence, and evidence that decoding geometry matters when parameters are scarce.

Contributions. This paper makes four claims, each backed by controlled experiments at ∼290k\sim 290\text{k} parameters. First, geodesic decoding replaces WoutW_{\text{out}} with distance to vocabulary points on MM, coupling representation and classification without a separate readout layer. Second, the same template instantiated flat and hyperbolic sequential models, enabling a direct test of whether curvature helps composition when φ\varphi is held fixed. Third, we identify boundary collapse in naive hyperbolic recurrence—a failure mode that drives perplexity to the uniform ∣V∣|V| baseline—and show that Möbius-based updates restore stable training. Fourth, under explicit fairness protocols (tied and matched baselines, including a modern SSM control), both RiLM variants outperform LSTM, Transformer, and SSM decoders on WikiText-2 and Penn Treebank by margins that tied embeddings alone do not explain.

Scope and organization. Our primary evaluation uses the 2000 most frequent words on WikiText-2 and PTB so that WoutW_{out} accounts for a transparent ∼\sim256k parameters at d=128; we do not claim numerically comparable perplexity to full-vocabulary leaderboard models. Section III defines RiLM; Section IV presents multi-seed results, vocabulary scaling, ablations, and geometry analysis; Section V interprets boundary collapse, when curvature helps, and limitations.

References (12)

  • Long short-term memory
  • Attention is all you need
  • Language models are unsupervised multitask learners
  • Transformer-XL: Attentive language models beyond a fixed-length context
  • Using the output embedding to improve language models
  • Poincaré embeddings for learning hierarchical representations
  • Hyperbolic neural networks
  • Regularizing and optimizing LSTM language models
  • LoRA: Low-rank adaptation of large language models
  • Neural ordinary differential equations
  • Variational inference with normalizing flows
  • Mamba: Linear-Time Sequence Modeling with Selective State Spaces