ChainsFormer: Numerical Reasoning on Knowledge Graphs From a Chain Perspective

Ze Zhao, Bin Lu, Xiaoying Gan, Gu Tang, Luoyi Fu, Xinbing Wang

TL;DR

ChainsFormer reimagines numerical reasoning on Knowledge Graphs (KGs) by shifting from traditional graph-based aggregation to a sequential "chain" perspective. By combining hyperbolic geometry for path filtering with Transformer-based sequence modeling, it achieves up to a 20% improvement over state-of-the-art methods in predicting missing numerical attributes like birth dates, coordinates, and populations.

What Problem Does This Paper Address?

Knowledge Graphs are excellent at storing relational data (e.g., "Sofia Coppola is the child of Francis Ford Coppola"), but they often struggle with numerical reasoning—predicting missing attributes like a person's height or a city's population.

Existing approaches usually fall into two camps: Graph Neural Networks (GNNs), which aggregate local neighbors, and Knowledge Graph Embeddings (KGEs), which map entities into a latent space. Both struggle with "multi-hop" numerical logic. For example, to guess a director's birth date, a model might need to look at the birth dates of their siblings or the release dates of their early films. As the number of hops increases, the number of possible paths explodes exponentially, making it nearly impossible for standard models to distinguish "signal" from "noise."

Methods

The authors introduce ChainsFormer, which treats reasoning as a sequence of logical steps rather than a static graph neighborhood. Its architecture consists of four main components:

  1. Relation-Attribute Chains (RA-Chains): Instead of looking at the whole graph, the model identifies specific paths consisting of relations and attributes (e.g., BirthDate -> Sibling -> BirthDate).
  2. Hyperbolic Filter: To solve the "path explosion" problem, the model uses hyperbolic geometry (the Poincaré ball). Because hyperbolic space expands exponentially with its radius, it is mathematically ideal for representing the tree-like structure of KG paths. This filter scores and prunes millions of potential chains down to the most relevant few.
  3. Chain Encoder: The selected chains are fed into a Transformer. To handle the massive variance in numerical values (e.g., a height of 1.8m vs. a population of 8.4 million), the authors use a Numerical-Aware Affine Transfer. This maps numbers into bit-streams and applies affine transformations, allowing the Transformer to "perceive" magnitudes effectively.
  4. Numerical Reasoner: This component weights the importance of different chains (providing transparency) and performs the final numerical projection to predict the missing value.

Datasets

The model was evaluated on two widely used Knowledge Graph benchmarks, specifically focusing on their numerical attributes:

  • YAGO15K: Contains 7 numerical attribute types (mostly temporal and spatial).
  • FB15K-237: A subset of Freebase containing 11 numerical attribute types, including quantities like area, population, and weight.

Key Insights and Ideas

  • The "Chain" Advantage: Numerical reasoning is inherently step-by-step. By treating paths as "sentences" and using in-context learning, the model captures logical dependencies that global graph aggregators miss.
  • Hyperbolic Efficiency: The authors found that low-dimensional hyperbolic filters are more effective at capturing KG hierarchy than high-dimensional Euclidean ones. This allows for much faster and more accurate path pruning.
  • Magnitude Perception: One of the biggest hurdles in numerical reasoning is the "scale" problem. ChainsFormer’s use of bit-stream encoding for numbers helps the model reason across wildly different units (years vs. meters vs. millions of people) without losing precision.
  • Interpretability: Unlike "black-box" embeddings, ChainsFormer can identify which specific RA-Chains contributed most to a prediction, making the reasoning process traceable.

Key Results

  • Superior Accuracy: ChainsFormer outperformed all baselines, including GNN and KGE-based models. It achieved a 20.0% improvement in Mean Absolute Error (MAE) on YAGO15K and a 7.4% improvement on FB15K-237.
  • Spatial Reasoning: The model was particularly strong at predicting coordinates (latitude/longitude), where long-distance spatial relationships are critical.
  • Outperforming LLMs: In zero-shot tests, ChainsFormer significantly beat ChatGPT-3.5 and ChatGPT-4.0 (by 33% and 26% respectively), proving that specialized structural reasoning still trumps general-purpose language modeling for complex KG tasks.

Limitations and Future Work

While highly effective, the authors note a few areas for growth:

  • Data Modality: Currently, the model only uses structured KG triples. Future versions could incorporate multimodal data like text descriptions or images associated with entities.
  • Chain Quality: The model relies on random walks for initial chain retrieval; a more sophisticated "chain quality evaluation" mechanism could further improve the starting pool of data.
  • Scalability: While the hyperbolic filter helps, reasoning over extremely dense, massive-scale KGs remains a computational challenge.

Summary updated

BibTeX
@inproceedings{zhao2025chainsformer,
  author = {Ze Zhao and Bin Lu and Xiaoying Gan and Gu Tang and Luoyi Fu and Xinbing Wang},
  title = {{ChainsFormer: Numerical Reasoning on Knowledge Graphs From a Chain Perspective}},
  booktitle = {ICDE},
  year = {2025},
  doi = {10.1109/icde65448.2025.00222},
}

Loading related content...

Figure