Language Models as Hierarchy Encoders

Yuan He, Moy Yuan, Jiaoyan Chen, Ian Horrocks
2/3/2026

No official code found. Best implementation: KRR-Oxford/HierarchyTransformers (43 stars, Apache-2.0, last commit 2026-01-06).

Abstract

Interpreting hierarchical structures latent in language is a key limitation of current language models (LMs). While previous research has implicitly leveraged these hierarchies to enhance LMs, approaches for their explicit encoding are yet to be explored. To address this, we introduce a novel approach to re-train transformer encoder-based LMs as Hierarchy Transformer encoders (HiTs), harnessing the expansive nature of hyperbolic space. Our method situates the output embedding space of pre-trained LMs within a Poincar\'e ball with a curvature that adapts to the embedding dimension, followed by training on hyperbolic clustering and centripetal losses. These losses are designed to effectively cluster related entities (input as texts) and organise them hierarchically. We evaluate HiTs against pre-trained LMs, standard fine-tuned LMs, and several hyperbolic embedding baselines, focusing on their capabilities in simulating transitive inference, predicting subsumptions, and transferring knowledge across hierarchies. The results demonstrate that HiTs consistently outperform all baselines in these tasks, underscoring the effectiveness and transferability of our re-trained hierarchy encoders.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Language Models as Hierarchy Encoders

438PythonAug 16, 20239 months agoApache-2.0
hierarchy-encoderhierarchy-transformershitlanguage-modelsentence-transformers+1 more

Similar Papers

Cite this paper

@article{he2026language,
  title  = {Language Models as Hierarchy Encoders},
  author = {Yuan He and Moy Yuan and Jiaoyan Chen and Ian Horrocks},
  year   = {2026},
  eprint = {2401.11374},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2401.11374},
  url    = {https://arxiv.org/abs/2401.11374},
  journal = {NEURIPS 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2401.11374.svg)](https://codeofpaper.com/paper/2401.11374)

Discussion