diff --git "a/complexnumericalreasoningwithnumericalsemanticpretrainingframework/full.md" "b/complexnumericalreasoningwithnumericalsemanticpretrainingframework/full.md" new file mode 100644--- /dev/null +++ "b/complexnumericalreasoningwithnumericalsemanticpretrainingframework/full.md" @@ -0,0 +1,973 @@ +# Complex Numerical Reasoning with Numerical Semantic Pre-training Framework + +Jun Zhang Haihong E* Tianyi Hu Yifan Zhu Meina Song Haoran Luo + +Beijing University of Posts and Telecommunications + +bupt-reasoning-lab.github.io/CNR-NST + +BUPT-Reasoning-Lab/CNR-NST + +# Abstract + +Multi-hop complex reasoning over incomplete knowledge graphs (KGs) has been extensively studied, but research on numerical knowledge graphs (NKGs) remains relatively limited. Recent approaches focus on separately encoding entities and numerical values, using neural networks to process query encodings for reasoning. However, in complex multi-hop reasoning tasks, numerical values are not merely symbols, and they carry specific semantics and logical relationships that must be accurately represented. In this work, we propose a Complex Numerical Reasoning with Numerical Semantic Pre-training Framework (CNR-NST). The CNR-NST framework can perform binary operations on numerical attributes in NKGs, enabling it to infer new numerical attributes from existing knowledge. Our approach effectively handles up to 102 types of complex numerical reasoning queries. On three public datasets, CNR-NST demonstrates SOTA performance in complex numerical queries, achieving an average improvement of over $40\%$ compared to existing methods. Notably, this work expands the query types for complex multi-hop numerical reasoning and introduces a new evaluation metric for numerical answers, which has been validated through comprehensive experiments. + +# 1 Introduction + +Complex query answering (CQA) refers to the process of reasoning and performing computations on knowledge graphs (KGs) by combining multiple entities and relationships to retrieve entities that fulfill specific logical conditions (Kotnis and García-Durán, 2019). This field has seen significant advancements, with research increasingly focused on enhancing the accuracy of models in handling intricate query tasks (Zhu et al., 2022; Arakelyan et al., 2021). Despite this progress, real-world KGs + +![](images/b677e81f3932ac78917647ddfb0d0bda06b58ff8efd0c64012af8684f8f02e5b.jpg) +Figure 1: Three types of queries: (1) $Q1$ refers to Complex Queries Involving Only Entities, which involve complex reasoning tasks that solely include entities; (2) $Q2$ refers to Complex Numerical Queries, which combine both numerical values and entities for reasoning; (3) $Q3$ refers to Complex Numerical Queries with Arithmetic, where the query requires performing computations between two numerical values from the NKG. + +are not limited to discrete entity-relation knowledge, and they also contain numerous numerical attributes, such as birth dates, event times, and territorial sizes of countries. Numerical knowledge graph (NKG), therefore, offer a more nuanced approach to modeling real-world queries (Xue et al., 2022). Figure 1 presents an example of the FB15K NKG (Kotnis and García-Durán, 2019) illustrating three distinct query types: (1) Complex Queries Involving Only Entities, such as “Q1: Which film directors are married?”; (2) Complex Numerical Queries, such as “Q2: Who are the married individuals born in August 1955?”; (3) Complex Numerical Queries with Arithmetic, such as “Q3: What is the combined population of Schleswig-Holstein and Dakar?” + +Traditional CQA methods are effective for multi-hop queries but encounter challenges in accurately capturing the subtle nuances of numerical semantics (Ren et al., 2024). These methods neglect the + +![](images/e89e08d803a29405320eb17f798d8cd571738a029904e448b265a5fecb0023d9.jpg) +Figure 2: (a): The process of performing operations on two fuzzy numbers derived from reasoning; (b): The pre-training process for learning numerical semantics in CNR-NST; (c): Numerical sparsity in the KG and two numerical representation methods: direct encoding and fuzzy sets. + +![](images/676d81bb681efe2503e9dbab11374f15f5f4c45a7c14e037426fae2231a54e59.jpg) + +![](images/e610c5a5195c34e86a771d6188e46b4402b94e324bd704c7ea2c0368b65ad6b6.jpg) + +inherent meanings of numerical attributes. Existing approaches, such as the Numerical Reasoning Network (NRN) (Bai et al., 2023a), present a framework that encodes entities and numerical values separately. However, when using Sinusoidal (Sundararaman et al., 2020) and DICE (Vaswani et al., 2017) encoding methods for numerical values, this approach encounters issues with sparsity in the KG. Many encoding regions lack corresponding numerical mappings in the KG, leading to incomplete learning of numerical semantics. + +Handling complex numerical query tasks presents significant challenges. First, current methods are constrained by reasoning answers limited to the NKG, unable to compute or infer new numerical answers from multi-values (Q3), while inferring new numerical attributes from existing values is essential for practical applications. Second, numerical values are continuous, with semantics influenced by units, ranges, precision, and context (Ren et al., 2024; Kim et al., 2023). And numerical data sparsity in KGs introduces additional challenges for complex query resolution (Li et al., 2022). + +To tackle the challenges in complex numerical reasoning, we propose the Complex Numerical Reasoning with Numerical Semantic Pre-training Framework (CNR-NST), which consists of the following three components. + +- Numerical Binary Operation Operator As shown in Figure 2(a), CNR-NST introduces new numerical query operators to handle queries with numerical answers absent from the original KG, supporting 102 distinct query types. Using relevant theorems in fuzzy mathematics, operations on two fuzzy numbers within the real number domain are enabled. By representing numerical values as fuzzy sets, these operations can be effectively mapped to mathematical calculations + +between two numerical attributes in the KG. The mathematical proof of the mapping between real number operations and fuzzy set operations is provided in Appendix A.1. + +- Numerical Semantic Learning To effectively capture the semantics of numerical values, we utilize a joint predictor learning the relationships between entity attributes and their numerical values, thus facilitating knowledge transfer across tasks. Figure 2(b) provides a comprehensive overview of this architecture. +- Complex Numerical Reasoning and Computation CNR-NST represents numerical values and entities using fuzzy sets, avoiding training neural operators in an unrestricted numerical embedding space (Figure 2(c)). Fuzzy sets capture the uncertainty of numerical values during complex reasoning and effectively represent the inherent fuzzy relationships within numerical data. Intermediate variable values in the reasoning process reflect probability scores of corresponding entities or numerical values, significantly enhancing numerical inference accuracy. + +In summary, our contributions are: + +- We introduce the binary operation operator for the first time in complex numerical queries, defining new operators and query types. +- We introduce the CNR-NST framework, which learns various entity-numerical relationships during the pre-training stage. +- Compared to the current SOTA, CNR-NST achieves substantial performance gains across all 102 types of complex numerical queries. + +# 2 Preliminaries + +Numerical Knowledge Graph NKG is the KG with numerical attributes, defined as $\mathcal{G} =$ + +
NotationsDefinitions
GNKG
VThe set of entity in the NKG
RThe set of relation in the NKG
AThe set of attribute in the NKG
FThe set of numerical relation in the NKG
NThe set of numbers in the NKG
X= V ∪ N, the set of universal vertex in the NKG
E= R ∪ A ∪ F, the set of universal edge in the NKG
Tthe triples in the NKG
X ∈ XAny vertex (including entities and numerical values) in the NKG
r(V, V')The entity V' is associated with the entity V' by the relationship r
a(V, N)The entity V is associated with the numerical N by the attribute a
f(N, N')The numerical N is associated with the numerical N' by the numerical relational f
+ +Table 1: Definition of mathematical symbols. + +$(\mathcal{V},\mathcal{N};\mathcal{R},\mathcal{A},\mathcal{F};\mathcal{T})$ , which contains entity $V\in \mathcal{V}$ attribute value $N\in \mathcal{N}$ , relation $r\in \mathcal{R}$ , attribute $a\in \mathcal{A}$ , numerical relation $f\in \mathcal{F}$ , and triples $(h,r,t)\in \mathcal{T}\subset (\mathcal{V}\times \mathcal{R}\times \mathcal{V})\cup (\mathcal{V}\times \mathcal{A}\times \mathcal{N})\cup$ $(\mathcal{N}\times \mathcal{F}\times \mathcal{N})$ . The difference from KG (Pai and Costabello, 2021) is that $\mathcal{N}$ $\mathcal{A}$ $\mathcal{F}$ have been added. + +Numerical Complex Query Answering The complex query $Q$ on a NKG $\mathcal{G}$ can be defined as: + +$$ +q \left[ X _ {?} \right] = V _ {1}, \dots , V _ {i} \in \mathcal {V}, N _ {1}, \dots , N _ {j} \in \mathcal {N}: c _ {1} \vee c _ {2} \vee \dots \vee c _ {n} \tag {1} +$$ + +$$ +c _ {i} = e _ {i, 1} \wedge e _ {i, 2} \wedge \dots \wedge e _ {i, m} \tag {2} +$$ + +Here, $X$ refers to a vertex, which can be any entity or numerical value. And $c_{i}$ represents a conjunction of several atomic logical expressions $e_{i,j}$ , where each $e_{i,j}$ can be one of the following expressions: + +$$ +e _ {i, j} = r \left(V, V ^ {\prime}\right), V, V ^ {\prime} \in \left\{V _ {1}, \dots , V _ {i} \right\}, V \neq V ^ {\prime}, r \in \mathcal {R} \tag {3} +$$ + +$$ +e _ {i, j} = a (V, N), V \in \{V _ {1}, \dots , V _ {i} \}, N \in \{N _ {1}, \dots , N _ {j} \}, a \in \mathcal {A} \tag {4} +$$ + +$$ +e _ {i, j} = f \left(N, N ^ {\prime}\right), N, N ^ {\prime} \in \left\{N _ {1}, \dots , N _ {j} \right\}, N \neq N ^ {\prime}, +$$ + +$$ +f \in \mathcal {F} = \{\leq , \geq , = , +, -, \times , \div , \dots \} +$$ + +In the above equations, $V$ represents a subset of entity $\mathcal{V}$ , and $N$ represents a subset of the numerical attribute set $\mathbb{N}$ . The binary function $r_i$ determines whether a class $i$ relationship exists between two entities. The function $a_j$ determines whether an entity possesses a value for attribute $j$ . The function $f$ checks whether a filtering condition, such as greater than, less than, or addition, subtraction, multiplication, and division, is satisfied between two numerical values. + +# 3 Methodology + +In this section, we introduce the CNR-NST framework. We first describe the construction of + +the entity-numerical knowledge graph embedding (KGE) model, followed by an explanation of how the adjacency matrix is used for reasoning and computation in multi-hop queries. Figure 3 provides an overview of the CNR-NST framework. + +# 3.1 Constructing Numerical and Entity Adjacency Matrices + +Pre-training Framework To address complex queries involving both entities and numerical values, we propose the Multi-ComplEx joint training framework (as shown in Figure 3), based on the ComplEx model (Trouillon et al., 2016), and introduce three link predictors: $r(V,V^{\prime})\in \mathbb{R}$ $a(V,N)\in \mathbb{A}$ and $f(N,N^{\prime})\in \mathbb{F}$ which effectively capture relationships among entities, relations, attributes, and numerical values. The architecture designed to learn numerical size relationships is presented in Appendix A.2. These triples are jointly trained with the various types of $(h,r,t)$ triples from the KG training set, and the scoring function for the triples is as follows: + +$$ +f (h, r, t) = \sum_ {r _ {j} \in \{\mathbb {R}, \mathbb {A}, \mathbb {G} \}} \beta_ {j} R e (\langle h, r _ {j}, \bar {t} \rangle) \tag {5} +$$ + +where $\beta_{j}$ represents the weight parameters under different types of triple relationships. Among them, $h$ is the head entity, $r_j$ is the relationship, $t$ is the tail entity, and $\bar{t}$ represents the conjugate complex number of the complex vector $t$ . Re refers to the real part of the complex vector. For any given triple $(h,r,t)$ , the Loss Function for link prediction training is defined as follows: + +$$ +\mathcal {L} _ {X} = - \sum_ {(h, r, t) \in (\mathbb {R} \times \mathbb {A} \times \mathbb {F})} \log \sigma (f _ {X} (h, r, t)) - +$$ + +$$ +\sum_ {\left(h ^ {\prime}, r, t\right) \in \left(\mathbb {R} ^ {\prime} \times \mathbb {A} ^ {\prime} \times \mathbb {F} ^ {\prime}\right)} \log \sigma \left(f _ {X} \left(h ^ {\prime}, r, t\right)\right) \tag {6} +$$ + +$$ +\mathcal {L} _ {\text {j o i n t}} = \sum_ {X \in (\mathbb {R} \cup \mathbb {A} \cup \mathbb {F})} \beta_ {X} \cdot \mathcal {L} _ {X} \tag {7} +$$ + +where $X$ represents various relationships between numerical attributes and entities, $\sigma$ denotes a hyperbolic tangent function, and $f_{X}$ is the cross-entropy loss function. The training details of the joint training framework are provided in Appendix A.2. + +As demonstrated by the experiments in Section 4.4, the Multi-ComplEx joint training framework + +![](images/aab71124e32e04444492ee7b786b5bf1bcb1573f76ea29bd65960b42eb718081.jpg) +Computational Processes of Complex Numerical Reasoning over NKG +Figure 3: Overview of the CNR-NST framework. For complex multi-hop queries, the intermediate variable at each step is quantified by a score computed via a pre-trained KGE model. + +provides substantial improvements in numerical link prediction compared to methods that train entity and numerical relationships separately. + +Scoring Function Using a Multi-ComplEx model, we can score the likelihood of three atomic formulas $f_{r}(v_{i},v_{j})$ , $f_{a}(v_{i},n_{j})$ , and $f_{f}(n_{i},n_{j})$ . This is achieved by employing neural link predictors $f_{r}$ , $f_{a}$ , $f_{f}$ to infer missing edges in the KG in the $\mathcal{V} \times \mathcal{R} \times \mathcal{V}$ , $\mathcal{V} \times \mathcal{A} \times \mathcal{N}$ , $\mathcal{N} \times \mathcal{F} \times \mathcal{N}$ space. The probabilities of all known triples within the KG are set to 1, while the probability values of triples outside the known KG are modeled to follow the original distribution (Arakelyan et al., 2021). We define the neural adjacency matrix $M_{R} \in [0,1]^{|\mathcal{R}| \times |\mathcal{V}| \times |\mathcal{V}|}$ , $M_{A} \in [0,1]^{|\mathcal{A}| \times |\mathcal{V}| \times |\mathcal{N}|}$ , $M_{F} \in [0,1]^{|\mathcal{G}| \times |\mathcal{N}| \times |\mathcal{N}|}$ as: + +$$ +\hat {R} \left(x _ {i}, x _ {j}\right) = \frac {\exp \left(\mathcal {E} \left(x _ {i} , x _ {j}\right) \cdot N _ {X}\right)}{\sum_ {x \in \mathcal {V} \cup \mathcal {N}} \exp \left(\mathcal {E} \left(x _ {i} , x _ {j}\right)\right)} \tag {8} +$$ + +$$ +N _ {X} = | \{(x _ {i}, \mathcal {E}, x _ {j}) \in \mathcal {F} _ {t r a i n} | x _ {i}, x _ {j} \in \mathcal {V} \cup \mathcal {N}) \} | +$$ + +$$ +\hat {R} \left(x _ {i}, x _ {j}\right) = \left\{ \begin{array}{c l} 1 & \text {i f} \left(x _ {i}, \mathcal {E}, x _ {j}\right) \in \mathcal {F} _ {\text {t r a i n}} \\ \min \left\{\hat {R} \left(x _ {i}, x\right), 1 - \epsilon \right\} & \text {o t h e r w i s e} \end{array} \right. \tag {9} +$$ + +where $x$ represents either a numerical value or an entity, and $\mathcal{E}$ refers to one of the three relationships: $\mathcal{R}, \mathcal{A}, \mathcal{F}, \mathcal{F}_{train}$ represents the training set in the KG, and $x_{i}$ represents an entity or a numerical value. The expression $(x_{i}, \mathcal{E}, x_{j})$ refers to any triple in one of the three categories. The value of $\epsilon$ is typically set to 0.0001. Also note that the matrix $M$ contains a large number of zeros, and it will be stored as a sparse matrix, significantly reducing storage space. + +# 3.2 Fuzzy Representation and Operator Definition + +Fuzzy Set Representation CNR-NST utilizes fuzzy sets to address the inherent uncertainty of numerical values. Specifically, for an anchored entity $v$ or an anchored numerical value + +$n$ , we represent them using an initialization vector $[0, 0, \dots, 1, \dots, 0]$ , where the position corresponding to the entity or numerical value is set to 1, with all other positions set to 0. For intermediate entities or numerical values, we use fuzzy vectors $v_{1,\dots,k} \in [0,1]^{|V|}$ ( $n_{1,\dots,j} \in [0,1]^{|N|}$ ), respectively, to represent their states. The uncertainty present in complex queries can then be quantified using a membership function. + +$$ +\mathcal {U} (Q) = \left\{\left(x, \mu_ {A} (x)\right) | x \in X \right\} \tag {10} +$$ + +where the element $x$ represents an entity or a numerical value, $\mathcal{U}(Q)$ denotes the probability that $x$ satisfies the query $Q$ , and the membership function is $\mu_A$ . + +Numerical Operators There are three types of numerical operators: attribute projection, reverse attribute projection, and numerical projection. Let $V^{*}(X = x)$ represent the maximum truth value of a subquery rooted at $X$ when $x$ is assigned as an entity or numerical value. We recursively compute the $\mathbf{V}^{*}(X) = [V^{*}(X = x)]_{x\in \mathcal{N}} \in [0,1]^{|N|}$ for each node in the query tree to maximize the overall truth value of the query tree, ultimately deriving the truth value $\mathbf{V}^{*}(x?)$ at the root node. + +When a node is connected to its child node by an edge, the fuzzy set of the node is calculated as follows: + +$$ +\mathbf {V} ^ {*} (x _ {?} \big) = \max _ {j} \left(\left(V ^ {*} \left(x _ {k}\right) ^ {T} \dots \times | X |\right) \odot M _ {x}\right) \tag {11} +$$ + +where $\max_{j}$ represents the maximum value in the column, and $x$ can represent either an entity or a numerical value. $M_{x}$ refers to the entity-value probability distribution matrix $M_{a}$ , value-entity prob + +ability distribution matrix $M_{a}^{T}$ or the value-value probability distribution matrix $M_{f}$ . + +Numerical complex queries also involve entity-related operators, such as relation projection, intersection, and union. The mathematical formulations of these operators are provided in Appendix B.3. + +# 3.3 Fuzzy Reasoning and Computation + +In this section, we introduce how numerical complex queries are answered using the numerical atomic queries defined earlier. Starting from the anchor node $X_{anchor}$ , which can represent either an entity or a numerical value, numerical reasoning and computation are executed based on the types of edges within the query computation tree. + +Numerical Reasoning At each step of numerical complex reasoning, CNR-NST assigns a score $\mathbf{V}^{*}(X_{?})\in [0,1]^{|\boldsymbol{x}|}$ to each node $X$ , where this score reflects the likelihood of the query tree with $X_{?}$ as the endpoint being satisfied. CNR-NST then determines the optimal entity assignments by back-propagating through the query tree: + +$$ +\mathbf {V} _ {i} = \varphi_ {i} \left(V _ {i 1}, V _ {i 2}, \dots , V _ {i m}\right) \tag {12} +$$ + +where $\mathbf{V}_i$ refers to the fuzzy representation of nonanchor nodes, and $\varphi$ denotes the various prediction functions applied to numerical values or entities. Specifically, when $V$ represents a numerical value, $V_{im} = \mu_m(n_m)$ . + +Numerical Computation It is important to distinguish between numerical computation and numerical reasoning. Numerical computation involves performing arithmetic operations, such as addition, subtraction, multiplication, or division, on numerical values in the KG. In the CNR-NST, when handling numerical complex queries, the numerical value at a given step is not a precise value but instead a fuzzy set $[0,1]^{[x]}$ . We interpret coordinate-corresponding numerical values as membership functions, converting the fuzzy set into a fuzzy number. + +Let $\mathcal{R}$ be the real number domain, and let the mapping $\mathcal{R} \cdot \mathcal{R} \to \mathcal{R}$ be a binary operation on the real number domain (Mordeson, 2001). From this mapping, a new mapping $F(R) \cdot F(R) \to F(R)$ can be induced. Based on the extension principle in fuzzy mathematics, we can easily derive the following theorem: + +$$ +\underline {{A}} \otimes \underline {{B}} = \int_ {R} \bigvee_ {x \otimes y = z} \left(\mu_ {\underline {{A}}} (x) \bigwedge \mu_ {\underline {{B}}} (y)\right) / z \tag {13} +$$ + +Here, $\otimes$ can represent the four basic arithmetic operations on real numbers. For convenience, we often discretize the real number domain for processing, so the above expression is transformed into: + +$$ +\underline {{A}} \otimes \underline {{B}} = \sum_ {z} \frac {\bigvee_ {x \otimes y = z} \left(\mu_ {\underline {{A}}} (x) \wedge \mu_ {\underline {{B}}} (y)\right)}{z} \tag {14} +$$ + +As a result of the above derivation, we obtain a new fuzzy number and a membership set with a size of $|N|^2$ . To prevent exponential growth in dimensionality during multiple numerical operations, we retain only the components with the highest membership values. This approach ensures that the dimensionality of numerical fuzzy sets remains stable throughout the reasoning process. + +# 3.4 Performance Complexity Analysis + +Space Complexity CNR-NST's memory usage includes the composite neural adjacency matrix $M_{x}$ , containing $|V|^{2}|\mathcal{R}| + |N|^{2}|\mathcal{F}| + |V||N||\mathcal{A}|$ elements. However, as described in Section 4.1, most values in the neural matrix $M_{x}$ can be filtered by a threshold $\epsilon$ . Experiments show $M_{x}$ can be stored on a single 24GB GPU. + +Time Complexity In the numerical reasoning process, each variable is computed with a complexity of $O\left(|\mathcal{X}^2|\right)$ , where $\mathcal{X}$ refers to either numerical values or entities. However, since each variable contains a large number of zero elements, the actual complexity of a single query, as derived from Equation 6, is $O\left(|\mathcal{X}|\cdot N\cdot |\mathbf{V}^{*}(X_{k}) > 0|\right)$ , where $N$ represents the number of projections. + +# 4 Experiments + +# 4.1 Experimental Setup + +Datasets We conducted experiments on three datasets: FB15K, DB15K, and YAGO15K (Kotnis and Garcia-Duran, 2019) (see Appendix B for details). We used the 8 major categories and 92 subtypes of multi-hop numerical queries introduced by NRN (Bai et al., 2023a). A full statistical overview of these numerical queries is in Appendix B.4. + +Baselines We selected the LitCQD (Demir et al., 2023) model and the three numerical reasoning models from NRN (Bai et al., 2023a) as our baselines. However, because the calculation of average MRR values in NRN relies heavily on the query sampling method, and their original dataset did not include all 92 query types, we expanded the dataset + +
DatasetMethod1rp2pppp2pi3p3i2pippppi2pu2pup
FB15K-237LitCQD34.7611.437.3837.4743.7116.6623.524.254.55
CNR-NST35.3618.1115.9443.5359.0227.5536.1116.5516.63
FB15KLitCQD85.2244.2923.5474.2371.1160.1751.3413.949.66
CNR-NST85.2464.4152.6174.7871.1869.5570.1874.7960.24
DB15KLitCQD38.5527.7119.0159.1774.0436.8553.8411.3416.78
CNR-NST36.8930.0124.1860.4776.4638.4554.2524.2927.23
YAGO15KLitCQD51.9316.298.7448.6166.2120.9134.664.247.29
CNR-NST54.5117.149.3354.7164.5821.2936.3221.8813.04
DatasetMethodnrnnpnrpi1ap(MAE)1ap(MSE)pa(MAE)pa(MSE)2pa(MAE)2pa(MSE)
FB15K-237LitCQD0.941.938.730.0770.0240.0510.0080.0390.004
CNR-NST3.737.6213.920.0510.0110.0180.0020.0110.0007
FB15KLitCQD0.050.615.720.3760.2230.3860.2280.4140.265
CNR-NST1.619.2216.190.0480.0110.0290.0060.0320.006
DB15KLitCQD0.191.6331.680.0420.0150.0390.0080.0390.006
CNR-NST1.483.6414.590.0420.0170.0170.0030.0130.001
YAGO15KLitCQD0.140.9916.350.0490.0070.0620.0110.0790.013
CNR-NST2.671.458.550.0610.0130.0610.0100.0580.008
+ +Table 2: MRR (%) and MAE, MSE for the types of queries that LitCQD can support. + +accordingly. We took into account the differences in average calculation methods and the number of queries, and conducted comprehensive comparative experiments to ensure consistency and accuracy. + +Evaluation Protocol For each complex numerical query, answers are labeled "easy" or "hard" based on whether they can be directly inferred from existing graph edges. For instance, on the test set, easy answers are derivable from training/validation graphs, while hard answers require reasoning over missing edges. We evaluate complex multi-hop queries using MRR and Hits@K on the test set (Zhang et al., 2019). + +Implementation Details We first trained multiple KGE models on the training graph, adopting an extended Multi-ComplEx model, based on ComplEx (Trouillon et al., 2016) and incorporating N3 regularization (Lacroix et al., 2018). Next, we derived several computational neural adjacency matrices $M_{x}$ from these KGE models. To reduce the memory footprint of $M_{x}$ , we applied an adjacency matrix filter $A$ to remove values below a specific threshold, converting the matrix into a sparse format that fits storage on a single NVIDIA A40 GPU. + +# 4.2 Main Results + +Tables 2 and 3 present CNR-NST's performance in complex numerical query reasoning on four public datasets. Table 2 compares it with LitCQD, + +showing CNR-NST supports more query types and outperforms LitCQD. Table 3 compares it with three benchmarks, demonstrating it exceeds baselines in nearly all query types (without specialized training), with over $100\%$ improvements in many cases. Table 4 highlights CNR-NST's average $300\%+$ performance gain in numerical answer queries vs. baselines. We attribute this improvement to the pre-training framework, which predicts link probabilities between entities and numerical values and enhances generalization for complex multi-hop queries (experimental verification in Section 4.4). The multiple entity-numerical value relationships serve as extra constraints in numerical reasoning, narrowing the reasoning space and boosting accuracy. Moreover, fuzzy sets inherently address the numerical fuzziness in complex reasoning, further improving CNR-NST's task performance. + +# 4.3 Answering Complex Numerical Computation Query + +The 92 aforementioned query types are limited to single-numerical reasoning. This paper introduces 5 new query types that perform calculations and reasoning on two or more numerical values in the KG, further diversifying multi-hop queries. Unlike previous methods confined to the discrete numerical domain in KG, we for the first time extend KG numerical reasoning to the real number domain, enabling more accurate modeling of real-world KG queries. + +
DatasetQueryNAvgMMethodAvgAll1p2p2i3ipiip2uup2b3bbppb2pb
FB15K77AvgWGQE+NRN20.0431.698.1533.9941.1923.1010.107.574.51-----
Q2B+NRN22.3637.017.7436.8842.7224.2510.0915.614.54-----
Q2P+NRN24.4442.7512.8733.7138.7523.1413.2323.167.89-----
CNRNST40.7860.2638.3551.4954.0136.8936.1624.9124.19-----
AvgGQE+NRN11.7611.194.2418.8534.667.5211.473.412.73-----
Q2B+NRN12.8314.333.8721.0834.368.1312.745.023.09-----
Q2P+NRN11.6212.203.3119.4333.575.5210.855.522.56-----
CNRNST29.6441.1119.1737.3745.4427.1426.2722.9117.69-----
92GQE+NRN15.059.794.5927.8345.448.6717.913.322.85-----
Q2B+NRN16.2012.044.1628.2148.0718.939.995.023.14-----
Q2P+NRN10.349.653.4717.5026.4111.965.475.652.58-----
CNRNST29.0032.3223.0234.9336.6931.1528.9725.1819.74-----
102CNRNST22.7832.3223.0234.9336.6931.1528.9725.1819.7411.1611.5110.2918.9612.24
DB15K77AvgWGQE+NRN10.9610.292.5320.1435.4612.502.522.082.14-----
Q2B+NRN11.8910.962.7122.6037.4413.813.052.412.13-----
Q2P+NRN12.9814.713.8123.7536.6614.472.964.632.81-----
CNRNST23.4622.5416.9836.6046.5930.6714.918.4010.96-----
AvgGQE+NRN10.913.502.7217.6043.3011.285.541.401.91-----
Q2B+NRN12.014.152.7819.1247.8812.536.311.361.98-----
Q2P+NRN11.904.723.0113.5250.0313.815.212.512.41-----
CNRNST18.7715.6910.7230.0345.6120.8414.476.216.64-----
92GQE+NRN14.733.332.9923.4758.4519.147.121.381.97-----
Q2B+NRN15.263.923.2125.1657.2420.838.131.412.19-----
Q2P+NRN10.904.712.9918.5437.4713.984.842.462.20-----
CNRNST22.3316.1910.6832.1655.5629.9415.779.398.96-----
102CNRNST22.4116.1910.6832.1655.5629.9415.779.398.9612.2711.395.7221.4916.94
YAGO15K77AvgWGQE+NRN15.6014.794.2335.6839.9418.295.654.231.96-----
Q2B+NRN18.7821.404.5939.7245.1619.627.909.052.82-----
Q2P+NRN14.8222.975.7025.7029.0414.385.4011.873.51-----
CNRNST27.7131.1116.3244.3054.9833.6421.4810.139.71-----
AvgGQE+NRN15.532.723.2026.7262.7618.016.681.702.47-----
Q2B+NRN16.004.143.1026.3062.5020.836.811.882.45-----
Q2P+NRN17.997.803.7336.6259.5722.357.543.352.96-----
CNRNST26.0019.5511.0545.5868.1334.7416.456.316.20-----
92GQE+NRN16.922.593.4831.1362.2825.196.631.612.47-----
Q2B+NRN17.643.203.0332.5265.5325.537.401.602.34-----
Q2P+NRN16.506.213.7128.3053.3925.518.583.283.03-----
CNRNST22.9715.5011.2438.7455.2234.2316.445.906.45-----
102CNRNST19.5115.5011.2438.7455.2234.2316.445.906.4511.7112.495.9218.9420.79
+ +Table 3: MRR (%) of all test set query types. $Query_{N}$ : total query types. $\mathrm{Avg}_{\mathrm{M}}$ : average calculation method. $\mathrm{Avg}_{\mathrm{W}}$ : weighted average (by query type count). Avg: direct subclass average. See Appendix A.6 for details. + +As shown in Table 3, we define five new query types: 2b, 3b, bp, pb, and 2pb. The b operator denotes binary operations (addition, subtraction, multiplication, division) on two numerical values. Since the answers to these query types are not present in the original KG, they generate numerical subqueries. We adopt the new evaluation metrics introduced in Section 4.4. Detailed descriptions of these query types are provided in Appendix D. + +# 4.4 Supplementary Experimental Details + +New Evaluation Metrics for Numerical-Type Answers In complex multi-hop numerical reasoning, many queries return numerical answers. Previous methods used entity-based evaluation metrics for these queries, which are limited: they ignore differences between numerical values (e.g., their continuity) and fail to evaluate queries where numerical answers are absent from the original KG. To resolve this, we propose a new numerical evaluation metric analogous to Mean Reciprocal Rank (MRR), denoted as $\mathrm{MRR}_{0.001}$ . Instead of ranking by exact + +numerical match, we determine rank based on the probability of numerical nodes whose relative error against the correct answer is below a threshold (usually 0.001), with ranking calculations applied only to hard answers. + +As shown in Table 4, we re-evaluated the numerical answers across the 102 sub-queries handled by CNR-NST and compared the results with the baseline model, Q2P. CNR-NST significantly outperformed Q2P on the new evaluation metric: while it may not always generate completely accurate answers in numerical reasoning, its performance improves substantially within a permitted error margin, indicating that the inferred answers are often very close to the correct values. Furthermore, experimental results show that our approach offers a significant advantage over baseline models in numerical reasoning tasks, with an average performance improvement of $200\%$ . + +Sensitivity Analysis of the New MRR Metric At the beginning of this subsection, we propose a + +
DatasetMetricMethod\(Avg_{All}\)1p2p2i3ipiip2uup
FB15KMRRQ2P+NRN4.910.420.869.0617.757.393.170.140.47
CNR-NST20.0117.7715.3327.8737.8428.7018.384.259.91
\(MRR_{0.001}\)Q2P+NRN1.110.450.571.443.521.220.460.340.90
CNR-NST24.9422.5416.4136.2646.9837.8322.617.669.26
DB15KMRRQ2P+NRN2.910.220.496.5610.253.292.120.060.31
CNR-NST12.846.775.9317.2826.6421.0310.177.817.07
\(MRR_{0.001}\)Q2P+NRN10.674.966.294.585.609.6613.6918.2822.27
CNR-NST24.7918.9215.4525.6231.6135.8824.9023.2422.70
YAGO15KMRRQ2P+NRN10.630.511.1720.3136.2016.978.240.311.31
CNR-NST17.4812.3111.8025.1637.1625.8719.383.165.02
\(MRR_{0.001}\)Q2P+NRN19.265.6621.099.4810.4213.0621.8039.0533.52
CNR-NST25.3618.3517.3932.9237.5934.1022.3723.2416.91
+ +new MRR metric. To further verify the usability of the metric, we conduct a sensitivity analysis on the threshold value of this metric across multiple datasets, and the specific experimental results can be found in Figure 4. Through experiments, we find the change of the new MRR metric is basically linearly related to the change of its threshold, which also proves the scientificity and practicability of this metric. + +![](images/d6a81a9e864eb8a3a6bd61ff7751b86e7bb98c7c0895155f01f16fec2e7f35f8.jpg) +Figure 4: Sensitivity analysis of the new MRR metric and threshold parameter. + +Training and Inference Efficiency In Appendix A.8, we present a comparison of the training time of CNR-NST with the baseline model. During the training phase, CNR-NST requires less training time. Although its inference time is longer, the total time for both training and inference remains significantly lower than the time required by NRN. + +# 4.5 Performance of Large Language Models + +In this subsection, we utilize several of the currently most powerful large language models (LLMs) to accomplish CQA tasks. The specific approach involves providing the LLM with the query statement + +structure and the specific entity or relation names, and instructing it to output answers from the candidate options in descending order of probability. The candidate answers consist of the correct answer and several distractor options that share the same attributes as the correct answer. The experimental results demonstrate that GPT-5 achieves the best performance in CQA tasks on complex KGs. However, it still exhibits a significant gap compared with our CNR-NST. The experimental results are shown in Table 5. + +Table 4: MRR and $\mathrm{MRR}_{0.001}$ (\%) for the numerical queries. For detailed results, see Appendix A.7. + +
Model1p2p3p2i2u
Gemini 2.5 Flash3.202.153.389.784.78
Claude Sonnet 42.662.372.281.961.24
Deepseek-R14.321.170.130.540.94
GPT-4o15.7612.597.9722.3112.82
GPT-534.5322.5425.8247.8639.15
FNRC85.2364.3955.4074.7844.91
+ +Table 5: Performance of various LLMs on MRR metric. + +# 5 Related Work + +Complex Query Answering over KG CQA focuses on reasoning over relationships and entities in a KG to address complex logical queries. Early CQA methods relied on logical reasoning rules to query KGs. Methods like GQE (Hamilton et al., 2018), Q2B (Ren* et al., 2020), Q2P (Bai et al., 2022), ConE (Zhang et al., 2021) and BetaE (Ren and Leskovec, 2020) represent entity sets and queries using geometric shapes or probability distributions, utilizing geometric operations (e.g., intersections, projections) or probabilistic operations for reasoning. Later, CQD (Arakeyan et al., 2021) introduced a framework capable of handling com + +plex logical expressions without explicit training on complex queries. QTO (Bai et al., 2023b) further optimized the query computation tree during complex query processing, improving reasoning accuracy and reducing the search space. FIT (Yin et al., 2024) equips the neural link predictor with fuzzy logic theory and supports complex queries with provable reasoning capabilities. + +Numerical Reasoning over KG Numerical reasoning tasks in KGs involve making logical inferences or predictions based on numerical values associated with entities and relationships. Methods such as RAKGE (Kim et al., 2023), KR-EAR (Lin et al., 2016), TransEA (Wu and Wang, 2018) and (Lacroix et al., 2018) utilize attribute learning to improve numerical reasoning within KGEs. LiteralE (Kristiadi et al., 2019) enhances KGEs by incorporating textual information through learnable parametric functions. HyNT (Chung et al., 2023) uses the expressive power of Transformers to capture complex relational structures and numerical attributes in KGs. Neural-Num-LP (Wang et al., 2020) learns numerical rules within KGs. + +LLMs' Numerical Reasoning Numerical reasoning in LLM involves extracting relevant numerical information from textual descriptions and performing mathematical calculations (Zhang et al., 2023). MathPrompter (Imani et al., 2023) introduces the Chain-of-Thought (CoT) approach, using step-by-step prompting to guide models through solving complex arithmetic problems incrementally.NumeroLogic (Schwartz et al., 2024) defines new numerical formats to handle and execute arithmetic operations. Program-of-Thoughts (PoT) (Chen et al., 2023) employs the Codex model to represent reasoning processes as programs, which are then executed by external systems to perform computations and derive final answers. + +Complex Query Answering over NKG Research on CQA with numerical values is still limited. LitCQD (Demir et al., 2023) decomposes complex numerical queries into subqueries, solving them via symbolic and numerical reasoning integration. NRN (Bai et al., 2023a) embeds entities, relations, and numerical attributes into a shared vector space, using neural networks to learn and reason about numerical relationships. + +# 6 Conclusion + +In this paper, we present a novel framework for reasoning and computation on NKG, leveraging a pretrained multi-relational link predictor to infer over 102 types of complex numerical queries. Extensive experiments on three publicly available KGs demonstrate that our proposed model, CNR-NST, significantly surpasses previous SOTA methods. Furthermore, we introduce additional categories of numerical reasoning tasks and new evaluation metrics for numerical answers, contributing to the broader research of multi-hop numerical reasoning. + +# Limitations + +Although we propose the CNR-NST framework, this work has two limitations. First, relevant experiments lack extremely large KG validation. Second, practical engineering applicability remains unverified. Against this backdrop, future work could focus on two key directions: expanding CNR-NST's supported numerical query variety, and enhancing its applicability in diverse reasoning tasks. These efforts would address current limitations and promote the practical value of CNR-NST. + +# Acknowledgements + +This work is supported by the National Natural Science Foundation of China (Grant Nos. 62176026, 62473271), and the Engineering Research Center of Information Networks, Ministry of Education, China. We sincerely thank Zichen Tang for his invaluable assistance during the rebuttal and camera-ready stages, including guidance on reviewer response strategies and manuscript formatting. We would also like to thank the anonymous reviewers and area chairs for constructive discussions and feedback. + +# References + +Erik Arakelyan, Daniel Daza, Pasquale Minervini, and Michael Cochez. 2021. Complex query answering with neural link predictors. In International Conference on Learning Representations. +Jiaxin Bai, Chen Luo, zheng li, Qingyu Yin, Bing Yin, and Yangqiu Song. 2023a. Knowledge graph reasoning over entities and numerical values. In Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, KDD '23, page 57-68, New York, NY, USA. Association for Computing Machinery. + +Jiaxin Bai, Zihao Wang, Hongming Zhang, and Yangqiu Song. 2022. Query2Particles: Knowledge graph reasoning with particle embeddings. In *Findings of the Association for Computational Linguistics: NAACL* 2022, pages 2703-2714, Seattle, United States. Association for Computational Linguistics. +Yushi Bai, Xin Lv, Juanzi Li, and Lei Hou. 2023b. Answering complex logical queries on knowledge graphs via query computation tree optimization. In Proceedings of the 40th International Conference on Machine Learning, volume 202 of Proceedings of Machine Learning Research, pages 1472-1491. PMLR. +Wenhu Chen, Xueguang Ma, Xinyi Wang, and William W. Cohen. 2023. Program of thoughts prompting: Disentangling computation from reasoning for numerical reasoning tasks. Transactions on Machine Learning Research. +Chanyoung Chung, Jaejun Lee, and Joyce Jiyoung Whang. 2023. Representation learning on hyperrelational and numeric knowledge graphs with transformers. In Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, KDD '23, page 310-322, New York, NY, USA. Association for Computing Machinery. +Caglar Demir, Michel Wiebesiek, Renzhong Lu, Axel-Cyrille Ngonga Ngomo, and Stefan Heindorf. 2023. Litcqd: Multi-hop reasoning in incomplete knowledge graphs with numeric literals. In Machine Learning and Knowledge Discovery in Databases: Research Track: European Conference, ECML PKDD 2023, Turin, Italy, September 18-22, 2023, Proceedings, Part III, page 617-633, Berlin, Heidelberg. Springer-Verlag. +Petr Hajek. 2001. *Metamathematics of fuzzy logic*, volume 4. Springer Science & Business Media. +Will Hamilton, Payal Bajaj, Marinka Zitnik, Dan Jurafsky, and Jure Leskovec. 2018. Embedding logical queries on knowledge graphs. In Advances in Neural Information Processing Systems, volume 31. Curran Associates, Inc. +Shima Imani, Liang Du, and Harsh Shrivastava. 2023. MathPrompter: Mathematical reasoning using large language models. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 5: Industry Track), pages 37-42, Toronto, Canada. Association for Computational Linguistics. +Gayeong Kim, Sookyung Kim, Ko Keun Kim, Suchan Park, Heesoo Jung, and Hogun Park. 2023. Exploiting relation-aware attribute representation learning in knowledge graph embedding for numerical reasoning. In Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, KDD '23, page 1086-1096, New York, NY, USA. Association for Computing Machinery. + +Bhushan Kotnis and Alberto García-Durán. 2019. Learning numerical attributes in knowledge bases. In *Automated Knowledge Base Construction* (AKBC). +Agustinus Kristiadi, Mohammad Asif Khan, Denis Lukovnikov, Jens Lehmann, and Asja Fischer. 2019. Incorporating literals into knowledge graph embeddings. In *The Semantic Web - ISWC* 2019: 18th International Semantic Web Conference, Auckland, New Zealand, October 26-30, 2019, Proceedings, Part I, page 347-363, Berlin, Heidelberg. Springer-Verlag. +Timothee Lacroix, Nicolas Usunier, and Guillaume Obozinski. 2018. Canonical tensor decomposition for knowledge base completion. In Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pages 2863-2872. PMLR. +Qian Li, Shafiq Joty, Daling Wang, Shi Feng, and Yifei Zhang. 2022. Alleviating sparsity of open knowledge graphs with ternary contrastive learning. In *Findings of the Association for Computational Linguistics: EMNLP* 2022, pages 2279–2291, Abu Dhabi, United Arab Emirates. Association for Computational Linguistics. +Yankai Lin, Zhiyuan Liu, and Maosong Sun. 2016. Knowledge representation learning with entities, attributes and relations. In Proceedings of the Twenty-Fifth International Joint Conference on Artificial Intelligence, IJCAI'16, page 2866-2872. AAAI Press. +John N. Mordeson. 2001. Fuzzy Mathematics. Springer US, Boston, MA. +Sumit Pai and Luca Costabello. 2021. Learning embeddings from knowledge graphs with numeric edge attributes. In Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence, IJCAI-21, pages 2869-2875. International Joint Conferences on Artificial Intelligence Organization. Main Track. +Hongyu Ren, Mikhail Galkin, Zhaocheng Zhu, Jure Leskovec, and Michael Cochez. 2024. Neural graph reasoning: A survey on complex logical query answering. Transactions on Machine Learning Research. Survey Certification. +Hongyu Ren*, Weihua Hu*, and Jure Leskovec. 2020. Query2box: Reasoning over knowledge graphs in vector space using box embeddings. In International Conference on Learning Representations. +Hongyu Ren and Jure Leskovec. 2020. Beta embeddings for multi-hop logical reasoning in knowledge graphs. In Advances in Neural Information Processing Systems, volume 33, pages 19716-19726. Curran Associates, Inc. +Eli Schwartz, Leshem Choshen, Joseph Shtok, Sivan Doveh, Leonid Karlinsky, and Assaf Arbelle. 2024.NumeroLogic: Number encoding for enhanced LLMs' numerical reasoning. In Proceedings of the + +2024 Conference on Empirical Methods in Natural Language Processing, pages 206-212, Miami, Florida, USA. Association for Computational Linguistics. +Dhanasekar Sundararaman, Shijing Si, Vivek Subramanian, Guoyin Wang, Devamanyu Hazarika, and Lawrence Carin. 2020. Methods for numeracy-preserving word embeddings. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 4742-4753, Online. Association for Computational Linguistics. +Théo Trouillon, Johannes Welbl, Sebastian Riedel, Eric Gaussier, and Guillaume Bouchard. 2016. Complex embeddings for simple link prediction. In Proceedings of The 33rd International Conference on Machine Learning, volume 48 of Proceedings of Machine Learning Research, pages 2071-2080, New York, New York, USA. PMLR. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc. +Po-Wei Wang, Daria Stepanova, Csaba Domokos, and J. Zico Kolter. 2020. Differentiable learning of numerical rules in knowledge graphs. In International Conference on Learning Representations. +Yanrong Wu and Zhichun Wang. 2018. Knowledge graph embedding with numeric attributes of entities. In Proceedings of the Third Workshop on Representation Learning for NLP, pages 132-136, Melbourne, Australia. Association for Computational Linguistics. +Bingcong Xue, Yanzeng Li, and Lei Zou. 2022. Introducing semantic information for nbsp; numerical attribute prediction overnbsp; knowledge graphs. In The Semantic Web - ISWC 2022: 21st International Semantic Web Conference, Virtual Event, October 23-27, 2022, Proceedings, page 3-21, Berlin, Heidelberg. Springer-Verlag. +Hang Yin, Zihao Wang, and Yangqiu Song. 2024. Rethinking complex queries on knowledge graphs with neural link predictors. In The Twelfth International Conference on Learning Representations. +Beichen Zhang, Kun Zhou, Xilin Wei, Xin Zhao, Jing Sha, Shijin Wang, and Ji-Rong Wen. 2023. Evaluating and improving tool-augmented computation-intensive math reasoning. In Advances in Neural Information Processing Systems, volume 36, pages 23570-23589. Curran Associates, Inc. +Yongqi Zhang, Quanming Yao, Yingxia Shao, and Lei Chen. 2019. NSCaching: Simple and Efficient Negative Sampling for Knowledge Graph Embedding. In 2019 IEEE 35th International Conference on Data Engineering (ICDE), pages 614-625, Los Alamitos, CA, USA. IEEE Computer Society. + +Zhanqiu Zhang, Jie Wang, Jiajun Chen, Shuiwang Ji, and Feng Wu. 2021. Cone: Cone embeddings for multi-hop reasoning over knowledge graphs. In Advances in Neural Information Processing Systems, volume 34, pages 19172-19183. Curran Associates, Inc. +Zhaocheng Zhu, Mikhail Galkin, Zuobai Zhang, and Jian Tang. 2022. Neural-symbolic models for logical queries on knowledge graphs. In Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Research, pages 27454-27478. PMLR. + +# Contents + +1 Introduction 1 +2 Preliminaries 2 +3 Methodology 3 + +3.1 Constructing Numerical and Entity Adjacency Matrices 3 +3.2 Fuzzy Representation and Operator Definition 4 +3.3 Fuzzy Reasoning and Computation 5 +3.4 Performance Complexity Analysis 5 + +4 Experiments 5 + +4.1 Experimental Setup 5 +4.2 Main Results 6 +4.3 Answering Complex Numerical Computation Query 6 +4.4 Supplementary Experimental Details 7 +4.5 Performance of Large Language Models 8 + +5 Related Work 8 + +6 Conclusion 9 + +A Mathematical Proof 13 + +A.1 Fuzzy Set-based Numerical Computations 13 +A.2 Details of the Training Procedure for the Multi-ComplEx 15 +A.3 Mathematical Representation of Multi-hop Logical Reasoning 16 +A.4 Supplementary Task Definitions 16 +A.5 Reasoning Process of Fuzzy Sets in the Application of Logical Operators 17 +A.6 Main Experimental Results 17 +A.7 Detailed Experimental Results of the New Evaluation Metrics 20 +A.8 Detailed Experimental Results of the Training and Inference Efficiency 21 +A.9 Ablation Study of the Pre-training Framework 21 + +B Dataset Statistics 22 + +B.1 Numerical Sparsity of the Dataset 22 +B.2 Knowledge Graph Contraction 22 +B.3 Dataset Information for Pre-training 23 +B.4 Sample Queries from Graph 23 + +C Model Hyperparameter Settings and Training Details 27 +D Examples of Numeric Queries 28 + +# A Mathematical Proof + +# A.1 Fuzzy Set-based Numerical Computations + +The principle of extension is an important concept in fuzzy mathematics. It describes how to extend a precise mathematical concept or operation to fuzzy sets or fuzzy values. For example, in the addition operation of fuzzy numbers, according to the principle of extension, the addition operation of ordinary real numbers is extended to the field of fuzzy numbers, enabling us to handle the addition of fuzzy numbers in a way similar to that of ordinary numbers, but we need to take into account the uncertainty of fuzzy numbers. + +This section will demonstrate how mappings in the set of real numbers can be induced into mappings between fuzzy sets. + +First, we explain the concept of induction. Let there be a mapping on the real number domain: + +$$ +f: U \to V +$$ + +$$ +u \mapsto v = f (u) +$$ + +It means that for every element in $U$ , a unique corresponding element can be found in $V$ through the mapping $f$ . From this, a new mapping can be induced, which we still denote as $f$ : + +$$ +f: P (U) \to P (V) +$$ + +$$ +A \mapsto B = f (A) +$$ + +$$ +f (A) \triangleq \{v | \exists u \in A, \text {l e t} f (u) = v, v \in V \} +$$ + +Among them, the power set $P(U)$ is a set composed of all subsets of $U$ . The key to how a mapping on a set of real numbers can induce a mapping between fuzzy sets lies in determining the membership function of the fuzzy set. + +The definition of the extension principle is given below: Let $f: U \to V$ . From $f$ , we can induce two mappings: + +$$ +f: F (U) \to F (V), f ^ {- 1}: F (V) \to F (U) +$$ + +The membership functions of the induced mappings are as follows: + +$$ +\mu_ {f (A _ {\sim})} \left(v\right) = \left\{ \begin{array}{c l} \bigvee_ {f (u) = v} \mu_ {A _ {\sim}} \left(u\right) & \text {i f} \exists u \in U, l e t f \left(u\right) = v \\ 0 & \text {o t h e r w i s e} \end{array} \right. +$$ + +$$ +\mu_ {f ^ {- 1} (B)} (u) = \mu_ {B _ {\sim}} (v), v = f (u) +$$ + +Among them, $\mu_{A\sim}(u)$ is the membership degree of the element $u$ in the fuzzy set $A\sim$ . + +![](images/4abe01b7aa99d435b3adf71c6f4ed3843370d02038a481ecfcd2e8e8897e1284.jpg) +Figure 5: Visualization of the extension principle and the corresponding relationship between the operations of the set of real numbers and fuzzy sets. + +![](images/03a288426a27e73a8e10f4cd3157edde6af5427440e6ceffd9fd27036021c77e.jpg) + +# A.2 Details of the Training Procedure for the Multi-ComplEx + +![](images/5c245354f97da5e69f11d264340015408da8074b5b4e04ab50e201f6a0f87aeb.jpg) +Figure 6: Numerical relationship triplet generation based on the values in the training set for pre-training of the model. + +During the joint pre-training stage of CNR-NST, the objective function of the Multi-ComplEx model is defined as follows: + +$$ +f _ {A} (h, r, t) = R e (\langle \mathbf {h}, \mathbf {r} _ {\mathbf {A}}, \overline {{\mathbf {t}}} \rangle) +$$ + +$$ +f _ {B} (h, r, v) = R e \left(\langle \mathbf {h}, \mathbf {r} _ {\mathbf {B}}, \bar {\mathbf {v}} \rangle\right) +$$ + +$$ +f _ {C} (m, r, n) = R e \left(\langle \mathbf {m}, \mathbf {r} _ {\mathbf {C}}, \bar {\mathbf {n}} \rangle\right) +$$ + +where $h, t$ denotes the entity embeddings, $r$ refers to the embeddings for different types of relations, and $v, m, n$ represents the numerical embeddings. + +We employ cross-entropy loss as the optimization objective. For each triplet $(h,r,t)$ , the loss function for each predictor is defined as follows: + +$$ +\mathcal {L} _ {A} = - \sum_ {(h, r, t) \in \mathbb {R}} \log \sigma (f _ {A} (h, r, t)) + \sum_ {(h ^ {\prime}, r, t) \in \mathbb {R} ^ {\prime}} \log \sigma (- f _ {A} (h ^ {\prime}, r, t)) +$$ + +$$ +\mathcal {L} _ {B} = - \sum_ {(h, r, n) \in \mathbb {A}} \log \sigma \left(f _ {B} (h, r, n)\right) + \sum_ {\left(h ^ {\prime}, r, n\right) \in \mathbb {A} ^ {\prime}} \log \sigma \left(- f _ {B} \left(h ^ {\prime}, r, n\right)\right) +$$ + +$$ +\mathcal {L} _ {C} = - \sum_ {(m, r, n) \in \mathbb {F}} \log \sigma \left(f _ {C} (m, r, n)\right) + \sum_ {\left(m ^ {\prime}, r, n\right) \in \mathbb {F} ^ {\prime}} \log \sigma \left(- f _ {C} \left(m ^ {\prime}, r, n\right)\right) +$$ + +The loss functions of the three predictors are weighted and combined to form a joint loss function, where the weights are denoted by $W_{EAV}$ and $W_{VFV}$ . These weights can be adjusted based on the task's requirements and importance. The joint loss function is defined as follows: + +$$ +\mathcal {L} _ {\text {j o i n t}} = \mathcal {L} _ {A} + W _ {E A V} \cdot \mathcal {L} _ {B} + W _ {V F V} \cdot \mathcal {L} _ {C} +$$ + +To prevent overfitting, regularization terms are often incorporated into the loss function. L1 and L2 regularization can be applied to control the magnitude of the model parameters. For each predictor, the regularization term is defined as follows: + +$$ +\Omega = \lambda \left(\| \mathbf {h} \| ^ {2} + \| \mathbf {r} _ {\mathbf {A}} \| ^ {2} + \| \mathbf {t} \| ^ {2} + \| \mathbf {r} _ {\mathbf {B}} \| ^ {2} + \| \mathbf {v} \| ^ {2} + \| \mathbf {m} \| ^ {2} + \| \mathbf {r} _ {\mathbf {C}} \| ^ {2} + \| \mathbf {n} \| ^ {2}\right) +$$ + +The final joint objective function incorporates both the loss function and the regularization terms, and is given by the following expression: + +$$ +\mathcal {L} = \mathcal {L} _ {\text {j o i n t}} + \Omega +$$ + +# A.3 Mathematical Representation of Multi-hop Logical Reasoning + +This section will use mathematical expressions to explain and infer various logical operators and mappings involved in complex numerical reasoning. + +Let $V^{*}(X_{?} = x)$ represent the maximum truth value of the subquery at the root node $x$ when node $X$ is assigned a value $x$ . + +Assuming that the root node $x$ is formed by merging sub-node $\{x_{?}^{1},\ldots ,x_{?}^{K}\}$ by intersection, the maximum truth value of the query is given by the following expression: + +$$ +\begin{array}{l} V ^ {*} (x _ {?} = e) = \top_ {1 \leq i \leq K} V ^ {*} (x _ {?} = e) \\ V ^ {*} (x _ {?} = n) = \top_ {1 \leq i \leq K} V ^ {*} (x _ {?} = n) \\ \Rightarrow \mathbf {V} ^ {*} \left(x _ {?}\right) = \prod_ {1 \leq i \leq K} \mathbf {V} ^ {*} \left(x _ {?} ^ {i}\right) \\ \end{array} +$$ + +Similarly, when the root node is merged by union, the following expression applies: + +$$ +\begin{array}{l} V ^ {*} (x _ {?} = e) = \perp_ {1 \leq i \leq K} V ^ {*} (x _ {?} = e) \\ V ^ {*} (x _ {?} = n) = \perp_ {1 \leq i \leq K} V ^ {*} (x _ {?} = n) \\ \Rightarrow \mathbf {V} ^ {*} \left(x _ {?}\right) = 1 - \prod_ {1 \leq i \leq K} \left(1 - \mathbf {V} ^ {*} \left(x _ {?} ^ {i}\right)\right) \\ \end{array} +$$ + +When the root node is connected to its child edges through any relational edge, the maximum truth value of the query with this node as the root is expressed as shown in Equation 9 in the main text. Depending on the type of relation, the expression has the following four variations: + +$$ +\begin{array}{l} \mathbf {V} ^ {*} (v _ {?}) = \max _ {j} \left(\left(V ^ {*} \left(v _ {k}\right) ^ {T} \dots \times | v |\right) \odot M _ {E}\right) \\ \mathbf {V} ^ {*} (n _ {?} \big) = \max _ {j} \left(\left(V ^ {*} \left(v _ {k}\right) ^ {T} \dots \times | v |\right) \odot M _ {A}\right) \\ \mathbf {V} ^ {*} (v _ {?}) = \max _ {j} \left(\left(V ^ {*} \left(n _ {k}\right) ^ {T} \dots \times | n |\right) \odot M _ {A} ^ {- 1}\right) \\ \mathbf {V} ^ {*} (n _ {?} = \max _ {j} \left(\left(V ^ {*} (n _ {k}) ^ {T} \dots \times | n |\right) \odot M _ {F}\right) \\ \end{array} +$$ + +# A.4 Supplementary Task Definitions + +Numerical FOL Query A complex numerical query is defined in existential positive first-order logic form, which can be recursively defined as: + +1. Atomic Formulas: If $t_1, t_2, \ldots, t_n$ are variables or constants, and $P$ is an n-ary predicate, then $P(t_1, t_2, \ldots, t_n)$ is an atomic formula. +2. Compound formulas: It can be constructed using logical connectives $\land$ (and), $\lor$ (or), and quantifiers $\forall$ (for all) and $\exists$ (there exists). + +Numerical Complex Query Answering As every logic query can be converted into a disjunctive normal form, the complex query Q on a KG with numeric literals $(\mathcal{G})$ can be defined as: + +$$ +\begin{array}{l} q \left[ X _ {?} \right] = V _ {1}, \dots , V _ {i} \in \mathcal {V}, N _ {1}, \dots , N _ {j} \in \mathcal {N}: c _ {1} \vee c _ {2} \vee \dots \vee c _ {n} \\ c _ {i} = e _ {i, 1} \wedge e _ {i, 2} \wedge \dots \wedge e _ {i, m} \\ \end{array} +$$ + +Here, $c_{i}$ represents a conjunction of several atomic logical expressions $e_{i,j}$ , where each $e_{i,j}$ can be one of the following expressions: + +$$ +e _ {i, j} = r \left(V, V ^ {\prime}\right), \text {w i t h} V, V ^ {\prime} \in \left\{V _ {1}, \dots , V _ {i} \right\}, V \neq V ^ {\prime}, r \in \mathcal {R} +$$ + +$$ +e _ {i, j} = a (V, N), \text {w i t h} V \in \left\{V _ {1}, \dots , V _ {i} \right\}, N \in \left\{N _ {1}, \dots , N _ {j} \right\}, a \in \mathcal {A} +$$ + +$$ +\begin{array}{l} e _ {i, j} = f (N, N ^ {\prime}), \text {w i t h} N, N ^ {\prime} \in \{N _ {1}, \dots , N _ {j} \}, N \neq N ^ {\prime}, \\ f \in \{\leq , \geq , =, +, -, \times , \div , \dots \} \\ \end{array} +$$ + +In the above equation, the variable $E$ represents a subset of entity $\mathcal{V}$ , and the variable $C$ represents a subset of the numerical attribute set $\mathbb{N}$ . The binary function $r_i$ determines whether a class $i$ relationship exists between two entities. The function $a_j$ determines whether an entity possesses a value for attribute $j$ . The function $f$ checks whether a filtering condition, such as greater than or less than, is satisfied between two values. The function $b_f$ determines whether a quadratic operation between the first two values yields an answer. + +The objective of complex reasoning is to find a valid assignment for the variables such that the query $q[X_{?}]$ holds true. The incompleteness of the KG introduces uncertainty, which implies $e_{i,j}$ is no longer a binary variable. Instead, it stands for the likelihood that the correspondence holds, and its generalized truth value ranges between [0,1]. For this reason, as follows (Aragelyan et al., 2021), we formalise Eq.(1) as an optimisation problem: + +$$ +\begin{array}{l} q \left[ X _ {?} \right] = X _ {?} \cdot V _ {1}, \dots , V _ {i} \in \mathcal {V}, N _ {1}, \dots , N _ {j} \in \mathcal {N} = \\ \arg \max \left(e _ {1, 1} \top \dots \top e _ {1, m}\right) \perp \dots \perp \left(e _ {n, 1} \top \dots \top e _ {n, m}\right) \\ \end{array} +$$ + +where $e_{n,m}$ is the probability score inferred by Multi-ComplEx based on the corresponding atomic formula. $\bot$ and $\top$ are generalisations of fuzzy logic over [0,1] for conjunctive and disjunctive extraction, and we chose the product t-norm and t-connorm (Hajek, 2001) as natural connectives in fuzzy logic in this paper. + +# A.5 Reasoning Process of Fuzzy Sets in the Application of Logical Operators + +Based on Formula in the main text, the calculation process of logical operators in the query for CNR-NST is as follows. + +If root $V^{*}(x_{?})$ is aggregated from multiple child nodes $\{V_{?}^{1}, V_{?}^{2} \ldots V_{?}^{K}\}$ , then: + +$$ +\mathbf {V} ^ {*} \left(x _ {?}\right) = \prod_ {1 \leq i \leq K} V _ {i} ^ {*} \left(x _ {?}\right) +$$ + +where $x$ represents any node. For other definitions, you can refer to Formula 8 in the main text. + +Similarly, the union of the child nodes is shown as follows: + +$$ +\mathbf {V} ^ {*} \left(x _ {?}\right) = 1 - \prod_ {1 \leq i \leq K} \left(1 - V _ {i} ^ {*} \left(x _ {?}\right)\right) +$$ + +# A.6 Main Experimental Results + +Here, we present the MRR results for all 102 sub-queries on our dataset. We applied two sampling methods on the public datasets FB15K, DB15K, and YAGO15K, resulting in 77 query types using the NRN sampling method and 92 query types using our improved method. Additionally, we provide detailed results for the 10 extended numerical computation query types. + +The detailed data shows that, while Q2B+NRN and GQE+NRN exhibit decent performance on some sub-tasks involving intersection, they perform poorly on other tasks. Q2P+NRN demonstrates better overall performance, but our CNRNST model significantly outperforms Q2P+NRN in both average performance and numerical query tasks (see Section 4.2 of the main text for average performance). + +The definition of query subclass names: "p" stands for "Relation Prediction", "a" stands for "Attribute Prediction", "r" stands for "Reverse Attribute Prediction", "n" stands for "Numerical Prediction", "u" stands for "Union", "i" stands for "Intersection", and "b" stands for "Binary Operator". + +
Query_numMethod1rap1rp1ap1nppaarrpraan2n2pnr
77GQE+NRN1.6230.64-1.319.300.2512.401.121.072.296.810.71
Q2B+NRN2.1639.56-1.269.660.268.890.700.992.677.090.71
Q2P+NRN1.7940.95-0.0613.720.6411.071.010.100.097.800.70
CNRNST7.9585.21-30.1531.516.1340.934.432.042.6964.211.43
92GQE+NRN1.3631.185.221.4110.910.2513.231.322.041.616.690.72
Q2B+NRN2.2139.255.141.5711.170.358.760.622.302.426.840.81
Q2P+NRN0.2637.520.780.052.970.0713.010.300.120.0610.750.44
CNRNST7.9885.234.7931.3131.616.1646.891.6117.4614.4964.391.61
Query_numMethod2pi2aiprirpi2ri2ninaiani
77GQE+NRN27.65-29.9730.114.801.70
Q2B+NRN31.41-31.1831.419.641.77
Q2P+NRN37.22-35.7336.0525.850.02
CNRNST73.21-49.1245.6916.532.30
92GQE+NRN27.8358.1730.1130.703.611.3035.6435.27
Q2B+NRN31.2952.3431.1731.756.521.4435.9135.22
Q2P+NRN33.3022.4530.8930.500.980.2110.7610.91
CNRNST74.7835.7849.2349.7516.868.9323.5220.61
Query_numMethod2na3i3nir2p3irpr3inan3in2a3i2pr3i3riprp3ip2r3i3pi2pr3i2an3i3a3ia2n3iana3i
77GQE+NRN-1.9841.9838.00--37.26-41.9641.9032.6541.55---
Q2B+NRN-2.3143.1839.67--34.31-43.3534.4535.3742.25---
Q2P+NRN-0.0347.5956.41--47.67-47.5442.3339.8147.54---
CNRNST-5.8954.0252.10--48.90-54.3061.0571.0254.24---
92GQE+NRN49.981.7442.0729.5449.9983.4540.360.3041.6741.5432.9042.6749.5387.2349.9984.09
Q2B+NRN50.001.6843.2337.2249.4084.7227.390.4842.5839.5235.2742.2785.7795.1949.7684.70
Q2P+NRN15.830.2243.5336.4915.7024.8128.907.1442.9239.8337.7943.9926.9015.8815.7626.93
CNRNST15.213.6460.4959.3714.8625.0853.952.6342.1261.1471.1859.5927.1449.9814.8825.79
Query_numMethodpriiaairppiappipprippriprpiprriprpiaaainnainnairaninnninnniranirria
77GQE+NRN26.900.1813.3111.8012.3312.7711.0726.381.050.751.220.621.671.030.210.04
Q2B+NRN26.660.1915.3412.4912.9413.2814.8027.871.340.800.260.662.140.980.260.05
Q2P+NRN17.440.3417.9713.5816.7116.0218.9715.310.080.070.610.070.090.320.62100.00
CNRNST35.808.9637.6070.3865.0671.1477.8635.132.451.343.351.280.980.713.285.04
92GQE+NRN26.800.1618.8512.1312.4112.5810.2424.985.646.130.205.971.480.980.170.04
Q2B+NRN24.230.1420.2012.4812.9813.5514.6027.479.297.300.247.441.570.937.300.06
CNRNST8.360.086.3414.6015.7115.2115.647.940.720.970.070.900.090.770.060.03
CNRNST39.338.9641.3869.5571.9972.2278.1943.2912.598.032.988.224.580.581.230.43
Query_numMethodpppippriarpirpiarriprpinnaipaninnniannianairaninrpiraainrripaaii
77GQE+NRN17.7119.0526.1921.092.5821.33-9.891.971.00-2.3110.80-3.71-
Q2B+NRN22.0219.3127.3223.155.3020.02-11.512.591.23-2.8513.09-4.44-
Q2P+NRN24.8822.3536.2747.5413.8528.54-18.280.030.02-3.0219.05-26.01-
CNRNST70.7133.5046.2361.2421.4042.30-8.831.442.05-15.2416.25-6.44-
92GQE+NRN17.7019.5525.4021.372.2221.2439.8715.341.657.4341.952.6011.085.792.7250.67
Q2B+NRN21.1820.6326.8423.034.3821.0740.3516.931.957.2742.541.6912.785.924.3451.96
Q2P+NRN23.3620.9426.5823.881.1721.5616.415.260.281.2714.070.2812.083.262.6718.31
CNRNST70.1837.3648.3866.2610.0240.1837.247.397.238.5739.582.0516.1948.422.6356.79
Query_numMethod2purpu2rupru2au2nuanuanu
77GQE+NRN7.978.140.557.971.190.520.480.46
Q2B+NRN12.6511.950.3511.851.310.620.740.67
Q2P+NRN19.4319.870.6018.980.450.110.080.09
CNRNST75.5248.031.1248.034.101.012.772.75
92GQE+NRN7.917.730.577.770.960.550.540.52
Q2B+NRN12.6611.870.4211.781.170.670.820.77
Q2P+NRN14.7214.740.0915.100.110.150.160.15
CNRNST74.7852.432.0252.281.194.157.407.22
Query_numMethod2pup2puapruppruaanunanur2aur2aunnaurnaur2nun2nur2rup2ruarpuarpup
77GQE+NRN5.555.265.713.770.830.590.870.330.650.830.720.757.110.943.835.92
Q2B+NRN5.876.476.125.451.100.540.700.450.581.020.890.656.921.025.566.10
CNRNST6.0310.757.559.310.090.623.390.100.620.080.080.588.151.138.056.91
CNRNST59.6219.3152.3519.720.971.462.430.911.470.950.851.1246.031.2220.1754.58
92GQE+NRN5.515.975.674.220.990.651.050.710.670.960.640.766.760.924.225.86
Q2B+NRN5.516.896.055.001.640.540.711.050.621.580.880.686.791.095.116.09
CNRNST9.171.008.720.880.180.360.750.150.410.220.150.468.780.390.798.87
CNRNST60.2325.6956.9322.683.250.952.375.610.953.532.330.7349.981.4622.6256.55
+ +Table 6: Detailed MRR results (%) in the FB15K test set. + +
Query_numMethod1rap1rp1ap1nppaarrpraan2n2pnr
77GQE+NRN1.485.35-1.326.810.487.811.880.240.357.650.34
Q2B+NRN1.639.37-1.416.870.616.531.720.280.358.260.23
Q2P+NRN0.1226.72-0.0110.580.0214.060.460.020.013.490.05
CNRNST2.9654.60-21.1013.271.7118.404.5619.417.6622.391.01
92GQE+NRN1.185.851.831.495.870.378.211.931.970.358.780.34
Q2B+NRN1.538.761.481.045.160.416.211.302.270.348.280.26
Q2P+NRN0.5623.250.650.373.240.359.180.570.710.1615.220.25
CNRNST2.7150.982.4222.2113.401.8320.815.0221.627.1422.581.10
Query_numMethod2pi2aiprirpi2ri2ninaiani
7729.89-34.9437.0730.800.90--
Q2B+NRN25.69-33.3532.5539.120.77--
Q2P+NRN35.52-58.8456.4030.960.01--
CNRNST46.65-56.1051.9363.0010.20--
9229.9260.5830.5732.3431.010.6232.5931.44
Q2B+NRN24.9167.4928.8635.5737.780.8333.5431.21
Q2P+NRN39.2439.3734.8039.8831.230.2921.1620.42
CNRNST42.3045.4250.3653.0663.525.9124.6424.69
Query_numMethod2na3i3n3ir2p3irpr3inan3in2a3i2rp3i3r3iprp3ip2r3i3p3i2pr3i2an3i3a3ia2n3iana3i
77GQE+NRN-0.8457.5583.64--88.75100.0053.1085.0045.2050.79
Q2B+NRN-0.8253.7384.85--89.58100.0055.8086.1140.5251.10
Q2P+NRN-0.0180.3977.47--100.0050.0078.75100.0040.03100.00
CNRNST-2.4870.6583.3346.18-88.89100.0076.0487.1855.4871.13
92GQE+NRN46.210.6365.1789.2946.1880.6387.5020.0069.88100.0045.6167.4980.7077.3245.8182.00
Q2B+NRN47.560.8365.4580.3645.7381.2370.83100.0061.02100.0040.6863.4580.2585.7445.8879.57
CNRNST32.373.2163.7073.8132.2946.2661.11100.0065.8680.0055.1364.9646.6948.7331.9148.12
CNRNST21.416.6276.6792.8622.5048.6670.83100.0080.4472.2253.3670.4448.4355.6021.4042.10
Query_numMethodpriiaaairppiappippriippriiprpiiprpiippriiaaainnainnainninnnnirniriiriaia
77GQE+NRN19.950.5316.6914.0212.8811.437.5614.030.120.090.330.100.310.300.328.15
Q2B+NRN17.510.4019.4611.3614.2614.9811.9410.860.110.080.390.090.300.230.386.67
Q2P+NRN35.660.0518.105.078.698.477.3820.280.010.010.030.010.010.050.030.02
CNRNST42.491.7226.4923.2926.7126.8523.8238.547.6911.201.5310.724.760.881.3815.14
92GQE+NRN14.890.1716.3313.8112.0012.078.8414.664.976.130.286.270.240.290.293.12
Q2B+NRN14.460.1617.7112.7311.3912.3210.8818.345.445.300.165.790.370.310.312.74
CNRNST20.920.3115.0919.2217.4417.2916.3116.564.353.780.273.910.130.250.251.19
CNRNST39.191.5824.1226.1624.4226.6225.5646.209.7010.821.5711.574.540.771.378.90
Query_numMethodpppippriarpipppiarripripinpipaninnpinnnianniranirpiraainriiipaiii
77GQE+NRN23.1632.3027.9724.52-28.0240.38-5.860.83-0.233.0311.56-18.28
Q2B+NRN19.7235.6533.9026.07-29.7241.82-6.120.85-0.502.8320.62-32.11
Q2P+NRN15.1552.7439.3124.52-33.1849.27-12.740.01-0.011.2212.95-27.96
CNRNST39.5652.5951.2443.73-69.5055.74-12.205.54-30.258.0617.27-31.27
92GQE+NRN22.7931.0035.1623.9346.3334.9543.8530.7110.130.667.6838.433.4812.2042.0119.85
Q2B+NRN19.4940.1128.3023.2142.9132.9643.4030.568.290.666.0236.532.8920.3239.3333.45
Q2P+NRN32.8738.2938.7532.3536.0131.8040.7319.409.350.545.8827.281.2627.2836.0130.28
CNRNST38.0153.3444.2742.3553.9462.7750.3330.6213.825.047.1436.677.4517.0152.2732.65
Query_numMethod2purpu2rupru2au2nuanunau
77GQE+NRN4.793.700.403.700.390.310.160.16
Q2B+NRN4.273.820.344.330.490.710.530.58
Q2P+NRN13.7615.350.0416.030.030.010.050.01
CNRNST14.639.631.149.801.102.915.365.88
92GQE+NRN4.503.390.393.460.410.390.160.18
Q2B+NRN3.313.690.243.990.370.570.310.33
CNRNST11.637.070.236.070.140.250.450.42
CNRNST14.869.401.289.061.171.994.794.67
Query_numMethod2pup2puapruppruaanunanur2aur2aunnaurnauinnauin2nun2rui2ruarpuurpuu
77GQE+NRN5.903.755.713.190.250.244.240.110.270.250.460.423.791.683.495.75
Q2B+NRN5.073.116.033.570.370.213.600.130.220.390.950.344.261.643.545.68
Q2P+NRN3.003.365.363.130.010.0618.160.010.080.010.010.057.570.603.624.88
CNRNST16.5710.4314.509.212.030.491.354.450.542.601.580.5311.152.268.2813.25
92GQE+NRN7.703.686.064.110.710.244.160.450.270.690.400.423.321.903.275.11
Q2B+NRN6.272.696.232.941.110.152.120.400.180.910.870.213.501.483.145.28
CNRNST9.822.728.841.920.580.205.080.240.230.560.450.345.841.922.157.66
CNRNST18.2010.5615.057.892.540.441.383.980.332.391.470.3312.442.538.8314.86
Query_numMethod2b aabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAAABAA
+ +Table 8: Detailed MRR results (%) in the YAGO15K test set. + +
DatasetMethod1ap1npanpara2n2aiani2ninai
FB15KQ2P+NRN0.790.110.120.971.070.111.112.020.312.31
CNRNST20.5624.5125.7015.668.9615.3066.0326.6527.1525.21
DB15KQ2P+NRN8.871.062.837.8312.012.488.872.963.582.89
CNRNST17.4120.4217.1917.6517.779.1946.0925.0317.9513.42
YAGO15KQ2P+NRN4.536.7820.515.932.8155.105.324.8121.526.26
CNRNST19.0617.6421.2319.0112.1217.2045.7631.1120.6834.12
DatasetMethodpaaipaniannianainnainnniraniraai
FB15KQ2P+NRN1.722.020.451.321.370.400.911.53
CNRNST63.6225.7627.2746.2939.4618.6719.9661.60
DB15KQ2P+NRN7.746.783.003.283.145.3020.3527.71
CNRNST56.2721.2926.0444.8951.4814.2229.5943.30
YAGO15KQ2P+NRN6.958.2624.145.224.8845.474.435.13
CNRNST55.5220.4622.9938.5838.1721.6217.9557.47
DatasetMethod2piapriia2ainaninrpia2ria2ninnain
FB15KQ2P+NRN1.420.960.110.130.720.030.120.13
CNRNST20.6335.0422.2828.5432.896.4212.0223.07
DB15KQ2P+NRN6.2516.977.513.2520.1844.586.494.30
CNRNST23.5934.347.3916.1340.1856.938.5312.08
YAGO15KQ2P+NRN6.202.9127.8739.731.980.8156.3838.59
CNRNST23.6722.4115.4426.5326.2122.4017.4224.89
DatasetMethod2na3i3n3inan3in2a3i2an3i3a3ia2n3iana3i
FB15KQ2P+NRN2.850.503.182.052.8611.273.112.37
CNRNST27.1932.6836.7153.6857.5178.0535.1854.86
DB15KQ2P+NRN2.147.041.998.006.377.923.597.72
CNRNST19.9323.6920.7435.9032.9754.7125.7039.22
YAGO15KQ2P+NRN7.4236.037.737.226.535.237.685.50
CNRNST31.7826.4128.0847.0545.6155.3728.8337.60
DatasetMethodaau2nunau2puapruaanun2aunnaun2nun2ruarpua
FB15KQ2P+NRN0.470.290.261.931.660.280.280.360.340.741.64
CNRNST4.916.2211.8611.2914.055.2510.326.303.1511.4412.25
DB15KQ2P+NRN3.7627.2623.8210.9222.8023.2427.9322.1121.7326.7722.64
CNRNST6.5120.8724.9916.8019.5720.2329.3424.9417.8726.6326.22
YAGO15KQ2P+NRN2.9657.4856.716.345.5760.3862.9359.7663.903.086.18
CNRNST9.3726.6733.6713.4313.2520.1233.2120.1314.548.7911.80
+ +Table 9: Detailed MRR ${}_{0.001}$ results (%) in all test set. + +# A.8 Detailed Experimental Results of the Training and Inference Efficiency + +As shown in Table 10, during the training phase, CNR-NST only requires training on single-hop queries involving numerical values and entities, resulting in shorter training times compared to NRN, which must train on the entire dataset. CNR-NST's inference process requires calling a pre-trained prediction model at each step of the reasoning chain. In contrast, NRN has fixed neural network dimensions, which allows for faster inference. However, even on a dataset with 400,000 queries, CNR-NST completes the inference in just four hours, which is still significantly less time than what NRN requires for training. + +
MethodTraining_time1p2p2i3ipiip2uup2b3bbppb2pb
Q2P+NRN32.400.130.140.250.330.240.260.280.29-----
CNRNST0.223.0615.834.5310.0921.1916.664.5439.516.077.75603.7880.81528.20
+ +# A.9 Ablation Study of the Pre-training Framework + +Table 10: Training and inference times on the FB15K dataset (training time in hours, inference time in ms/query). + +
DatasetPre-training FrameworkAvgTestEREtEAVTestVFVTest
FB15KComplEx37.2181.965.5124.15
Multi-ComplEx60.6182.236.7892.83
DB15KComplEx27.4247.226.9728.08
Multi-ComplEx51.6347.2511.2696.36
YAGO15KComplEx23.2546.461.9821.32
Multi-ComplEx44.4248.343.3981.53
+ +Table 11: MRR results (%) for the predictors (ERE, EAV, VFV) on the validation and test sets. + +As shown in Table 11, we performed an ablation study in the pre-training framework. In the single ComplEx model, the three types of link predictors share parameters, whereas in the Multi-ComplEx model, parameters are not shared. Results show the Multi-ComplEx model significantly outperforms the ComplEx model in numerical prediction tasks. Moreover, knowledge embedded in entity relationships greatly enhances numerical prediction accuracy and improves complex numerical query performance. + +# B Dataset Statistics + +# B.1 Numerical Sparsity of the Dataset + +In this section, we present the numerical sparsity in the three public datasets FB15K, DB15K, and YAGO15K. + +![](images/222041c02e64d12de0a16c7d5ce917bc7aa5b288603e34a2144143e9f5b60b30.jpg) +FB15K + +![](images/a3e336547761bf07daddd8f89ed430e327053913664c84e9812a0721575f57b8.jpg) +DB15K + +![](images/9f6760981f98ab9dbe3413950870f62886287a92236150ad36716f830591ce35.jpg) +YAGO15K +Figure 7: Numerical distribution across the three public datasets. + +As shown in the three figures above, the horizontal axis represents the logarithmic transformation of actual values, while the vertical axis shows the frequency of occurrences. We observe that most values are concentrated in a specific region, yet the overall range of values remains broad, highlighting the numerical sparsity characteristic of NKGs. + +# B.2 Knowledge Graph Contraction + +Table 12 presents the detailed information for constructing KGs from the original datasets, from which we will randomly sample to form queries. + +
DatasetData SplitNodesNRelNAttrNRelEdgesAttrEdgesNumEdges
FB15KTraining25,106947,54020,24827,020
Validation26,1081345151,065,98222,77927,376
Testing27,1441,184,42625,31127,389
DB15KTraining31,980145,26233,13125,495
Validation34,19127930161,97837,26925,596
Testing36,358178,39441,41125,680
YAGO15KTraining32,112196,61621,73226,616
Validation33,078327221,19422,74826,627
Testing36,358245,77223,52026,631
+ +Table 12: The statistics of the three KGs. + +# B.3 Dataset Information for Pre-training + +Table 13 shows the training dataset information used for our pre-training framework Multi-ComplEx. The VFV triples are as defined by us, and the dataset splits are identical to those in Table 14. + +
DatasetData SplitERE TriadEAV TriadVFV Triad
FB15KTraining473,77020,248220,421
Validation59,2212,53127,553
Testing59,2222,53227,553
DB15KTraining79,22233,145296,006
Validation9,9034,14337,001
Testing9,9034,14437,001
YAGO15KTraining98,30818,816229,804
Validation12,2892,35228,725
Testing12,2892,35228,726
+ +Table 13: Details of the datasets used for pre-training. + +# B.4 Sample Queries from Graph + +Figure 8 provides a visual representation of the structure for most of the 102 query types. Tables 14 and 15 present the distribution of 13 major query types and 102 subquery types sampled from the three datasets. Note that these quantities only include the test set. Since CNR-NST does not require training on complex queries, we only sample from the test set and conduct experiments. Supplementary explanation: in the Query_Name column of the table, "p" stands for relation prediction, "ap" stands for attribute prediction, abbreviated as "a", "np" stands for numerical prediction, abbreviated as "n", and "rap" stands for reverse attribute prediction, abbreviated as "r". For example, PAAi refers to the intersection operation between a two-hop query involving one relation prediction and one attribute prediction and a single-hop query of one attribute prediction, with the final answer being a single numerical value. In contrast, PRuA denotes an operation where the union of one relation prediction and one reverse attribute prediction is followed by an attribute prediction, and the final answer consists of multiple numerical values. Table 16 shows the percentage of inference paths present on the top edge of the test set for each query type sampled on our dataset, reflecting to some extent the difficulty of the queries we sampled. + +![](images/e9bb21e59a19424873853d2a76015d4b3830ea3d376b8f5f121d2458a4e48aa7.jpg) +1P + +![](images/198292c0be12a9ced61856e52bc1b94e0a714e508b07e5df6f3926755f93d8b8.jpg) +2P + +![](images/5065c99a7497bed54302642715fcb05320edddc4f035dba6fdf92584b81e02d0.jpg) +2i + +![](images/3a0ba1fed3655a3b8c8fa139a6baca9acc1289e2e795cdab48247001814f955c.jpg) +Pi + +![](images/dbf720966e07bffc7a0531a3b9ef0f0800ee8be78d405b77919f7f9aa9af1ddd.jpg) +3i + +![](images/773761f1027cf1ea5db943beac180ff5392f8510ed90ba9bc17a8a633ad47774.jpg) +iP + +![](images/55dd73eed243f3ae683fb0cc24879f892924121550f4677839e56451498e7546.jpg) +2u + +![](images/ce37b983c39cd9c32e174db86204ecfa1ca558450521a58e58086ffe76a64792.jpg) +uP + +![](images/40f290a8fc2e04d9c4b69d98d864dfc0694f786982d55294761b706a30727e83.jpg) +New Queries Type +Figure 8: The visualization includes 102 complex numerical reasoning query types, displaying a subset. These structures can combine to form more intricate queries. At the bottom, we present newly defined numerical computation queries. + +
TypeQuery NameQuery Structure DefinitionFB15KDB15KYAGO15K
1p1np('nv', ('np')),173738941271
1ap('e', ('ap'));230634072326
1rap('nv', ('rap'));105910851133
1p('e', ('rp'));1995330296208
2pan(( 'e', ('ap'), ('np'));273540701641
2p(( 'e', ('rp'), ('rp'));1835520881273
nr(( 'nv', ('np'), ('rap'));232921971277
2n(( 'nv', ('np'), ('np'));214646552294
ra(( 'nv', ('rap'), ('ap'));5872481924
pa(( 'e', ('rp'), ('ap'));525748332988
ar(( 'e', ('ap'), ('rap'));457050723662
rp(( 'nv', ('rap'), ('rp'));554926152470
2iani(( 'e', ('ap'), ('nv', ('np'), ('i'));71761472710576
2pi(( 'e', ('rp'), ('e', ('rp'), ('i'));2572011922574
nai(( 'nv', ('np'), ('e', ('ap'), ('i'));74731482910607
2ni(( 'nv', ('np'), ('nv', ('np'), ('i'));9196133497765
2ai(( 'e', ('ap'), ('e', ('ap'), ('i'));197623073343
rpi(( 'nv', ('rap'), ('e', ('rp'), ('i'));5221229132
pri(( 'e', ('rp'), ('nv', ('rap'), ('i'));5161214135
2ri(( 'nv', ('rap'), ('nv', ('rap'), ('i'));10989661
3inan3i(( 'nv', ('np'), ('e', ('ap'), ('nv', ('np'), ('i'));127472145415296
2pr3i(( 'e', ('rp'), ('e', ('rp'), ('nv', ('rap'), ('i'));35151952
n2a3i(( 'nv', ('np'), ('e', ('ap'), ('e', ('ap'), ('i'));370337355989
r2p3i(( 'nv', ('rap'), ('e', ('rp'), ('e', ('rp'), ('i'));35271645
a2n3i(( 'e', ('ap'), ('nv', ('np'), ('nv', ('np'), ('i'));126412132115287
3p3i(( 'e', ('rp'), ('e', ('rp'), ('e', ('rp'), ('i'));18859294898
p2r3i(( 'e', ('rp'), ('nv', ('rap'), ('nv', ('rap'), ('i'));9366
2na3i(( 'nv', ('np'), ('nv', ('np'), ('e', ('ap'), ('i'));124592150015285
3a3i(( 'e', ('ap'), ('e', ('ap'), ('e', ('ap'), ('i'));197713272454
ana3i(( 'e', ('ap'), ('nv', ('np'), ('e', ('ap'), ('i'));362537235921
3n3i(( 'nv', ('np'), ('nv', ('np'), ('nv', ('np'), ('i'));114441195012818
prp3i(( 'e', ('rp'), ('nv', ('rap'), ('e', ('rp'), ('i'));35622446
2an3i(( 'e', ('ap'), ('e', ('ap'), ('nv', ('np'), ('i'));372437165874
2rp3i(( 'nv', ('rap'), ('nv', ('rap'), ('e', ('rp'), ('i'));9754
rpr3i(( 'nv', ('rap'), ('e', ('rp'), ('nv', ('rap'), ('i'));9727
3r3i(( 'nv', ('rap'), ('nv', ('rap'), ('nv', ('rap'), ('i'));1174
ip2pip(( 'e', ('rp'), ('e', ('rp'), ('i'));14745783828
nair(( 'nv', ('np'), ('e', ('ap'), ('i'));484947484436
2pia(( 'e', ('rp'), ('e', ('rp'), ('i'));710434681960
2nir(( 'nv', ('np'), ('nv', ('np'), ('i'));858145886937
nain(( 'nv', ('np'), ('e', ('ap'), ('i'));584691705772
2nin(( 'nv', ('np'), ('nv', ('np'), ('i'));506480436116
2air(( 'e', ('ap'), ('e', ('ap'), ('i'));419640683189
rpiip(( 'nv', ('rap'), ('e', ('rp'), ('i'));5910754740
anin(( 'e', ('ap'), ('nv', ('np'), ('i'));590692255898
prip(( 'e', ('rp'), ('nv', ('rap'), ('i'));6020814723
2rip(( 'nv', ('rap'), ('nv', ('rap'), ('i'));1683996464
2ain(( 'e', ('ap'), ('e', ('ap'), ('i'));226222891981
anir(( 'e', ('ap'), ('nv', ('np'), ('i'));485145814484
rpia(( 'nv', ('rap'), ('e', ('rp'), ('i'));43415722
priia(( 'e', ('rp'), ('nv', ('rap'), ('i'));37916823
2ria(( 'nv', ('rap'), ('nv', ('rap'), ('i'));1145913
+ +Table 14: The number and types of queries sampled from the three datasets. (1) + +
TypeQuery NameQuery Structure DefinitionFB15KDB15KYAGO15K
pianni((‘e’, (‘ap’)), (‘np’)), (‘nv’, (‘np’)), (‘i’)7960136339102
rppi((‘nv’, (‘rap’)), (‘rp’)), (‘e’, (‘rp’)), (‘i’)65116181381
nrpi((‘nv’, (‘np’)), (‘rap’)), (‘e’, (‘rp’)), (‘i’)1316128295621
paai((‘e’, (‘rp’)), (‘ap’)), (‘e’, (‘ap’)), (‘i’)133312451349
2nni((‘nv’, (‘np’)), (‘np’)), (‘nv’, (‘np’)), (‘i’)69751190411132
pani((‘e’, (‘rp’)), (‘ap’)), (‘nv’, (‘np’)), (‘i’)10097101007629
2nai((‘nv’, (‘np’)), (‘np’)), (‘e’, (‘ap’)), (‘i’)4537113007658
anai((‘e’, (‘ap’)), (‘np’)), (‘e’, (‘ap’)), (‘i’)446897277520
2ppi((‘e’, (‘rp’)), (‘rp’)), (‘e’, (‘rp’)), (‘i’)168755411063
nrri((‘nv’, (‘np’)), (‘rap’)), (‘nv’, (‘rap’)), (‘i’)137532471291
2pri((‘e’, (‘rp’)), (‘rp’)), (‘nv’, (‘rap’)), (‘i’)58069164
rani((‘nv’, (‘rap’)), (‘ap’)), (‘nv’, (‘np’)), (‘i’)80432581398
arpi((‘e’, (‘ap’)), (‘rap’)), (‘e’, (‘rp’)), (‘i’)2933139131
rpri((‘nv’, (‘rap’)), (‘rp’)), (‘nv’, (‘rap’)), (‘i’)1467570112
arri((‘e’, (‘ap’)), (‘rap’)), (‘nv’, (‘rap’)), (‘i’)10473273
raai((‘e’, (‘ap’)), (‘ap’)), (‘nv’, (‘ap’)), (‘i’)651142
2upru((‘e’, (‘rp’)), (‘nv’, (‘rap’)), (‘u’)1415757056783
2pu((‘e’, (‘rp’)), (‘e’, (‘rp’)), (‘u’)1912937342964
anu((‘e’, (‘ap’)), (‘nv’, (���np’)), (‘u’)125812305620887
2nu((‘nv’, (‘np’)), (‘nv’, (‘np’)), (‘u’)119882176711051
rpu((‘nv’, (‘rap’)), (‘e’, (‘rp’)), (‘u’)1419555916641
nau((‘nv’, (‘np’)), (‘e’, (‘ap’)), (‘u’)127572300021086
2ru((‘nv’, (‘rap’)), (‘nv’, (‘rap’)), (‘u’)9359774014718
2au((‘e’, (‘ap’)), (‘e’, (‘ap’)), (‘u’)254854973840
up2aur((‘e’, (‘ap’)), (‘e’, (‘ap’)), (‘u’)340329133922
rpup((‘nv’, (‘rap’)), (‘e’, (‘rp’)), (‘u’)), (‘rp’)687117181259
2aun((‘e’, (‘ap’)), (‘e’, (‘ap’)), (‘u’)), (‘np’)67051289210000
naur((‘nv’, (‘np’)), (‘e’, (‘ap’)), (‘u’)), (‘rap’)7195538712506
2pup((‘e’, (‘rp’)), (‘e’, (‘rp’)), (‘u’)), (‘rp’)101711022574
rpua((‘nv’, (‘rap’)), (‘e’, (‘rp’)), (‘u’)349433521770
anun((‘e’, (‘ap’)), (‘nv’, (‘np’)), (‘u’)), (‘np’)7186141109244
2nur((‘nv’, (‘np’)), (‘nv’, (‘np’)), (‘u’)881665789445
anur((‘e’, (‘ap’)), (‘nv’, (‘np’)), (‘u’)), (‘rap’)7071547312582
2rup((‘nv’, (‘rap’)), (‘nv’, (‘rap’)), (‘u’)433626102807
naun((‘nv’, (‘np’)), (‘e’, (‘ap’)), (‘u’)), (‘np’)7337143419114
2pua((‘e’, (‘rp’)), (‘e’, (‘rp’)), (‘u’)), (‘ap’)698130951245
2nun((‘nv’, (‘np’)), (‘nv’, (‘np’)), (‘u’)), (‘np’)7575144758895
prup((‘e’, (‘rp’)), (‘nv’, (‘rap’)), (‘u’)), (‘rp’)677916731204
prua((‘e’, (‘rp’)), (‘nv’, (‘rap’)), (‘u’)), (‘ap’)363132951768
2rua((‘nv’, (‘rap’)), (‘nv’, (‘rap’)), (‘u’)), (‘ap’)86449712133
2baab((‘e’, (‘ap’)), (‘e’, (‘ap’)), (‘b’)199719971997
3b3ab((‘e’, (‘ap’)), (‘e’, (‘ap’)), (‘e’, (‘ap’)), (‘b’)199719971997
2abpaabr((‘e’, (‘ap’)), (‘e’, (‘ap’)), (‘b’)), (‘rap’)8854311690
aabn((‘e’, (‘ap’)), (‘e’, (‘ap’)), (‘b’)), (‘np’)11101565305
p2abraab((‘nv’, (‘rap’)), (‘ap’), (‘e’, (‘ap’)), (‘b’)3498621225
paab((‘e’, (‘rp’)), (‘ap’), (‘e’, (‘ap’)), (‘b’)16471134771
2p2abrarab((‘nv’, (‘rap’)), (‘ap’), (‘e’, (‘rp’)), (‘ap’), (‘b’)510365826
rapab((‘nv’, (‘rap’)), (‘ap’), (‘e’, (‘rp’)), (‘ap’), (‘b’)99504481
parab((‘e’, (‘rp’)), (‘ap’), (‘nv’, (‘rap’)), (‘ap’), (‘b’)519517457
papab((‘e’, (‘rp’)), (‘ap’), (‘e’, (‘rp’)), (‘ap’), (‘b’)866608230
+ +Table 15: The number and types of queries sampled from the three datasets. (2) + +
DatasetAVG2p2i3ipiip2uup
FB15K0.75370.65050.91230.90070.75060.56440.73640.7612
DB15K0.62980.54880.68920.56950.54830.69150.61780.7433
YAGO15K0.60480.56270.76510.66280.69240.51060.62720.4128
+ +# C Model Hyperparameter Settings and Training Details + +The hyperparameter settings for CNR-NST are shown in Table 17. $W_{rel}$ refers to the score weight of the relation, $W_{EAV}$ refers to the task score weight in joint training, and Thrshd refers to the threshold of the corresponding adjacency matrix. $\text{Thrshd_fuzzy}$ refers to the filtering value for numerical fuzzy sets during binary operations, which is used to speed up the inference process. + +Table 16: Percentage of edges on the inference path that exist in the test set. + +
Training EpochLearning RateRankingDecay1Decay2\(W_{rel}\)\(W_{EAV}\)\(W_{VFV}\)
Multi-ComplEx1000.055000.90.999450.1
Fraction\(Thrsh_{ERE}\)\(Thrsh_{EAV}\)\(Thrsh_{VFV}\)\(Thrsh_{fuzzy}\)\(Neg_{Scale}\)
Reasoning Model100.0010.00010.00010.0016
+ +Table 17: Hyperparameter settings of CNR-NST. + +# D Examples of Numeric Queries + +This section presents a subset of query types from the 102 sub-queries that involve numerical reasoning and computation. We selected several queries with real-world significance to demonstrate that most of our query types are capable of reflecting real-world scenarios. + +For some query answers (e.g., 1ap), there is only one correct answer, but we still present the top 5 inferred answers. Additionally, for queries with too many answers, we skipped some of the correctly predicted easy answers to focus on demonstrating that our model can still infer the correct hard answers. + +![](images/6b108932c199a6917fe2e3f7b5fdd22efdfaa73007959bfba9ed8b2bdbe92e88.jpg) +Figure 9: Intermediate variable assignments and ranks for example 1ap query. + +
Logical Expression:Q [N?] = N?, ∃N?, a1 (e1, N?)
RankQuery AnswersCorrectnessAnswer type
153.69X-
253.8✓Hard
351.5X-
451.48X-
551.51X-
+ +![](images/808278d286bdb6f9b73947810eae37e58839c897fbd8a8587a5b8523e3191b1a.jpg) +Q: What are the years earlier than 2003? + +
Logical Expression:Q [N?] = N?, ∃N?, f1 (n1, N?)
RankQuery AnswersCorrectnessAnswer type
12002.17✓Easy
21988.33✓Easy
372202X-
42003X-
51920.92X-
61963.92✓Easy
710934.93X-
81911.5X-
91950.83✓Easy
101977.33✓Easy
111948.67✓Easy
121974.5✓Easy
131948.92✓Hard
+ +Figure 10: Intermediate variable assignments and ranks for example 1np query. +Q: What are the populations of half the number of people in City A? +Figure 11: Intermediate variable assignments and ranks for example an query. +![](images/50188de1b731cd78de21e70ddd9a2366c125d4185b546a825fe7003250d99386.jpg) +A1: population_number +F1: approximately_two-timesequal_to + +
Logical Expression:Q [N?] = N?, ∃Na, a1 (e1, Na) ∧ f1 (Na, N?)
RankQuery AnswersCorrectnessAnswer type
153827.00✓Easy
252966.00✓Easy
353326.00✓Easy
453066.00✓Easy
553025.00✓Hard
653374.00✓Easy
753437.00✓Easy
853483.00✗-
953838.00✓Easy
1053311.00✓Easy
+ +Q: When was the first showing of the TV show that aired on CBS? + +![](images/63fc597327e1ee25df898c93b3948c56c8aff9b6c96e4efed0c9c9f95cdb6940.jpg) +R1: program +F1: air_date_of_first Episode + +
Logical Expression:Q [N?] = N?, ∃Ea, r1 (e1, Ea) ∧ a1 (Ea, N?)
RankQuery AnswersCorrectnessAnswer type
11978.32✓Easy
21992.75✓Easy
31985.75✓Easy
41993.67✓Easy
51990.75✓Easy
……………………
261960.83✓Hard
271996.75✓Hard
282000.42✗-
291959.83✓Easy
301972.75✓Easy
+ +![](images/8d232151c8d6f78e9599b76da344dd8b364378a7bdb7551953051a70d9ba52c5.jpg) +Figure 12: Intermediate variable assignments and ranks for example pa query. +F1: approximatelyequal +F2: approximately_three(timesequal_to +Figure 13: Intermediate variable assignments and ranks for example 2n query. + +
Logical Expression:Q [N?] = N?, ∃Na, f1 (n1, Na) ∧ f2 (Na, N?)
RankQuery AnswersCorrectnessAnswer type
1137776✓Hard
2138296✓Easy
3137555✓Easy
4139790✓Easy
5139390✗-
+ +![](images/33e9f120645541fdb7fdd92a43af1687be1c9f0ad9c3cad08712a3b6c334e11f.jpg) +Which number is three times smaller than 5038976.0 +F1: approximatelyequal +F2: three-times_larger_than +Figure 14: Intermediate variable assignments and ranks for example 2ni query. + +
Logical Expression:Q [N?] = N?, ∃N?, f1 (n1, N?) ∧ f2 (n2, N?)
RankQuery AnswersCorrectnessAnswer type
173615.00✓Hard
273485.00✓Easy
373208.00✓Easy
4-77.91✗-
5-85.17✗-
+ +Who is a voice actor by profession and is about 1.65m tall? + +![](images/8b95159a801464899257f5340818ef13ce5c514181812a3609f6271b08844316.jpg) +A1: person.height_meters +R1: people_with_this-profession +Figure 15: Intermediate variable assignments and ranks for example rpi query. + +
Logical Expression:Q [E?] = E?, ∃E?, a1-1(n1, E?) ∧ r1 (e1, E?)
RankQuery AnswersCorrectnessAnswer type
1Debi Mazar✓Easy
2Andrea Bowen✓Easy
3Ian Holm✓Easy
4Breckin Meyer✓Easy
5Mel Brooks✓Easy
6Christina Applegate✓Easy
7Roy Kinnear✓Easy
8Nathan Lane✓Hard
9Molly Shannon✗-
10Common✗-
11Anna Paquin✓Hard
+ +Which number is the date San Francisco was built and is approximately equal to the 1764.0 and approximately twice the 891.0? +![](images/f4a228b473b67e00f946b55cf6b29d32385d60b2333e2e3fc087118aed60062a.jpg) +F1: approximatelyequal +F2: approximately_two-timesequal_to +A1: location.date_founded + +
Logical Expression:Q [N2] = N2, ∃N2,a1 (e1, N2) ∧ f1 (n1, N2) ∧ f2 (n2, N2)
RankQuery AnswersCorrectnessAnswer type
11776.50✔Hard
21763.83✘-
31765.00✘-
41775.67✘-
51776.67✘-
+ +Figure 16: Intermediate variable assignments and ranks for example 2na3i query. +Who has a career as both an actor and a television producer while being about 1.71m tall? +![](images/519cc504ed14c725f8c084404651f6cea37ba9502825af92381f23b1ef0c1cb5.jpg) +R1: people_with_this_profession +R2: people_with_this-profession +A1: person.height_meters + +
Logical Expression:Q [E?] = E?, ∃E?, r1 (e1, E?) ∧ r2 (e2, E?) ∧ a1-1 (n1, E?)
RankQuery AnswersCorrectnessAnswer type
1Ellen DeGeneres✓Easy
2Candice Bergen✓Easy
3Joan Chen✓Easy
4Martin Lawrence✓Easy
5Martin Short✓Easy
6Kirstie Alley✓Hard
+ +Figure 17: Intermediate variable assignments and ranks for example 2pr3i query. +Who is an actor by profession is about 1.88m tall and was born in 1964? +![](images/c6fc9c288154841b6605e94bab88f7babe9d0e9331413fd8ce89acbfa638971d.jpg) +R1: people_with.this-profession +A1: person.date_of_birth +A2: person.height_meters + +
Logical Expression:Q [E?] = E?, ∃E?, r1 (e1, E?) ∧ a1-1(n1, E?) ∧ a2-1(n2, E?)
RankQuery AnswersCorrectnessAnswer type
1Brendan Coyle✔Easy
2Benjamin Bratt✔Hard
3Til Schweiger✘-
4Iqbal Theba✘-
5Ray Romano✘-
+ +Figure 18: Intermediate variable assignments and ranks for example p2r3i query. +Who had friends who were 1.91m tall and died in 1997.58? +Figure 19: Intermediate variable assignments and ranks for example 2rip query. +![](images/21538b84559897633109f89ec59386f710108769ca4d19627348c84cc8a61e55.jpg) +A1: date_of_death +A2: person.height_meters +R1: friends + +
Logical Expression:Q [E?] = E?, ∃E?, r1 (E1, E?) ∧ (∃E1, a1-1 (n1, E1) ∧ a2-1 (n2, E1))
RankQuery AnswersCorrectnessAnswer type
1Henry Fonda✔Easy
2Robert Taylor✔Easy
3Myma Loy✔Easy
4Clark Gable✔Easy
5Robert Young✔Easy
6Joan Crawford✔Easy
7Loretta Young✔Easy
8James Stewart✘-
9Bette Davis✔Hard
10Lucille Ball✘-
+ +When did the person born in Brooklyn and was about 1.57 tall die? + +Figure 20: Intermediate variable assignments and ranks for example rpia query. +![](images/cf71d696e2dea8e12b7df576a834780e309c186f8f3fc6d9a5df5369bdec0fe5.jpg) +A1: person.height_meters +A2: date_of_death +R1: people_born_here + +
Logical Expression:Q [N?] = N?, ∃N2, a1 (E1, N2) ∧ (∃E1, a2-1(n1, E1) ∧ r1 (e1, E1))
RankQuery AnswersCorrectnessAnswer type
12014.75✓Easy
22014.33✓Hard
32014.17✗-
42001.67✗-
52011.42✗-
+ +When was the death of the person who won both the World Fantasy Award and was nominated for the + +Figure 21: Intermediate variable assignments and ranks for example 2pia query. +![](images/4150f1250249a1ac8ae5658cccf9b86eee98a6a49d0cb8b66643466f1e402a37.jpg) +R1: award-winning +R2: award_nominee +A1: date_of_birth + +
Logical Expression:\( Q\left\lbrack {N}_{2}\right\rbrack = {N}_{2},\exists N?,{a}_{1}\left( {{E}_{1},{N}_{?}}\right) \land \left( {\exists {E}_{1},{r}_{1}\left( {{e}_{1},{E}_{1}}\right) \land {r}_{2}\left( {{e}_{2},{E}_{1}}\right) }\right) \)
RankQuery AnswersCorrectnessAnswer type
11916.67✓Easy
21929.83✓Easy
31934.43✓Hard
41911✓Hard
51947.75✘-
+ +What is the race of the people in the film Eragon whose actors are about 1.7m tall? + +Figure 22: Intermediate variable assignments and ranks for example rpip query. +![](images/57b2729623fceb444f10bddd1e05e8004a0ada9be12ecd702ef712d9b0506bdf.jpg) +R1: actor +R2: award_nominee +A1: person_ethnicity + +
Logical Expression:Q [Eγ] = Eγ, ∃Eγ, r1 (E1, Eγ) ∧ (∃E1, a1-1 (n1, E1) ∧ r2 (e2, E1))
RankQuery AnswersCorrectnessAnswer type
1English people✓Easy
2Jewish people✓Easy
3Ashkenazi Jews✓Easy
4Hungarians✓Hard
5White Americans✗-
+ +Which films are based on Shawn Wayans and were released around 2003? + +Figure 23: Intermediate variable assignments and ranks for example nrpi query. +![](images/6bb7abfaceace9739c814db95598f81753d3c51c084939b9b3b7935a7564fcce.jpg) +F1: approximatelyequal +R1: film_story contributor +A1: film.initial_release_date + +
Logical Expression:Q [E?] = E?, ∃E?, r1 (E1, E?) ∧ (∃E?, f1 (n1, N1) ∧ a1-1 (N1, E?)
RankQuery AnswersCorrectnessAnswer type
1Scary Movie 3✓Easy
2Pride & Prejudice✓Easy
3Scary Movie 4✓Hard
4Scary Movie✗-
5Kill Bill Volume 1✗-
+ +Who have won awards founded in 1988 and are 1.88m tall? + +![](images/6dd740d253c0d54dfe5c2f017b71954d067aca7a27f7b2389c203370d6f231d1.jpg) + +R1: award_nominee +A1: location.date_founded +A2: person.height_meters + +
Logical Expression:Q [E?] = E?, ∃E?, a1-1(n1, E?) ∧ (∃E?, a2-1(n2, E1) ∧ r1(E1, E2))
RankQuery AnswersCorrectnessAnswer type
1James Coburn✓Easy
2Ray McKinnon✓Easy
3Djimon Hounsou✓Hard
4Morgan Freeman✓Hard
5Danny Huston✗-
+ +![](images/78e76108cdb009d9b9c2f1808bcfd3ca5056e7c4d16ad1e54329279c4746d53e.jpg) +Figure 24: Intermediate variable assignments and ranks for example rpri query. + +
Logical Expression:Q [E2] = E2, ∃E2, r1 (e1, E2) ∧ (∃E2, a2-1 (n2, E1) ∧ r2 (E1, E2))
RankQuery AnswersCorrectnessAnswer type
1New England Patriots✓Easy
2Buffalo Bills✓Easy
3Los Angeles Chargers✓Easy
4Chicago Bears✓Hard
5Toronto Argonauts✗-
+ +Which films are in the same genre as Sideways and were released in 2008.75? + +![](images/95db0ef989a649be49a3a83a11d332eaa3a1335ba9143586d6e224a349661aeb.jpg) +Figure 25: Intermediate variable assignments and ranks for example rppi query. + +
Logical Expression:Q [E7] = E7, ∃E2, a1-1(n1, E7) ∧ (∃E2, r1 (e1, E1) ∧ r2 (E1, E2))
RankQuery AnswersCorrectnessAnswer type
1The Brothers Bloom✔Easy
2Zack and Miri Make a Porno✔Easy
3Nick and Norah's Infinite Playlist✔Easy
4Management✔Hard
5Good✘-
+ +Which number is the release date of Breakfast at Tiffany's or approximately equal to 23398.0? + +![](images/e3811b13401cfd587c5528c57562ef556c72fbe959fdf348d3863cf375ae8b65.jpg) +Figure 26: Intermediate variable assignments and ranks for example ppri query. + +A1: film.initial_release_date + +F1: three-times_larger Than + +
Logical Expression:Q [N?] = N?, ∃N?, a1 (e1, N?) ∨ f1 (n1, N?)
RankQuery AnswersCorrectnessAnswer type
11961.83✓Easy
223260.00✓Easy
323504.00✓Easy
423307.00✓Easy
523398.00✓Easy
623549.00✓Hard
+ +Which entities are the subject of Austin Powers: International Man of Mystery or cities with a longitude of -111.94 degrees? + +![](images/53c5e5bb076fc0aaebea78128f1b02dc25aed0002ac7acd7367a4248df515f34.jpg) +Figure 27: Intermediate variable assignments and ranks for example anu query. +Figure 28: Intermediate variable assignments and ranks for example rpu query. + +A1: geocode longitude +R1: film/genre + +
Logical Expression:Q [E?] = E?, ∃E?, r1 (e1, E?) ∨ a1-1(n1, E?)
RankQuery AnswersCorrectnessAnswer type
1action film✓Easy
2comedy✓Easy
3spy film✓Easy
4parody✓Easy
5Tempe✓Easy
6Gullaug✓Hard
+ +![](images/4057de632667c4126b2844ab453b5b8a93d63651051dcc8d754f651edb27af59.jpg) +Figure 29: Intermediate variable assignments and ranks for example 2ru query. + +
Logical Expression:Q [E?] = E?, ∃E?, a1-1(n1, E?) ∨ a2-1(n2, E?)
RankQuery AnswersCorrectnessAnswer type
184th Academy Awards✓Easy
2Chinese Civil War✓Easy
354th Annual Grammy Awards✓Easy
462nd Berlin International Film Festival✓Easy
549th Annual Grammy Awards✗-
638th People's Choice Awards✗-
780th Academy Awards✗-
860th Academy Awards✗-
965th British Academy Film Awards✓Hard
+ +What is the longitude of the area in which Carol Burnett's institution or + +the film in which Martin Freeman appeared was released? + +![](images/6499a6e3c0d54dd4e4539f57311042569fe97ac36bc58eed66ac626aa3d65642.jpg) +Figure 30: Intermediate variable assignments and ranks for example 2pua query. + +R1: education/institution +R2: performance/film +A1: geocode longitude + +
Logical Expression:Q [N7] = N7, ∃N?, a1 (E1, N?) ∧ (∃E1, r1 (e1, E1) ∨ r2 (e2, E1))
RankQuery AnswersCorrectnessAnswer type
1-118.34✓Easy
2-118.44✓Hard
3-97.74✗-
4-87.67✗-
5-72.93✗-
+ +What musical compositions or companies came from places + +neighbouring Ashtabula County or from people who died in 1941.08? + +![](images/ab315cd67ad0afce316f28f67ec352532888cc2524f837950869bf5ddb97a90b.jpg) +Ashtabula County + +R1: adjoins +R2: music/artist/label +A1: person.date_of_death + +
Logical Expression:Q [E2] = E2, ∃E2, r1 (E1, E2) ∧ (∃E1, r1 (e1, E1) ∨ a1-1 (n1, E1))
RankQuery AnswersCorrectnessAnswer type
1Virgin Records✓Easy
2Columbia Records✓Easy
3Vanguard Records✓Easy
4Koch Entertainment✓Easy
5Warner Bros. Records✗-
6MCA Records✓Hard
+ +What are the musical compositions and categories of a place with an area of 53.23 or a person born in 1919.42? + +![](images/b5f7c7f38c6b381739812848ff1f704b1a134f0e80d18a4c215c6711048a1761.jpg) +Figure 31: Intermediate variable assignments and ranks for example rpup query. + +A1: location.location.area +A2: person.date_of_birth +R1:/music/artist/label + +
Logical Expression: Q[E?] = E?, ∃E?, r1(E1, E?) ∧ (∃E1, a1-1(n1, E1) ∨ a2-1(n2, E1))
RankQuery AnswersCorrectnessAnswer type
1Columbia Records✓Easy
2Vanguard Records✓Hard
3Warner Bros. Records✗-
4EMI✗-
+ +What is the height of a person born in 1964.33 or a person born in 1951.58? + +![](images/0150f3031a471ce7135c08210c2ad9ab8ec5a20d12e35f1ba3a336e3a85e6091.jpg) +Figure 32: Intermediate variable assignments and ranks for example 2rup query. +Figure 33: Intermediate variable assignments and ranks for example 2rua query. + +A1: person.date_of_birth +A2: person.date_of_birth +A3: person.height_meters + +
Logical Expression:Q [N?] = N?, ∃N?, a1 (E1, N?) ∧ (∃E1, a2-1 (n1, E1) ∨ a3-1 (n2, E1))
RankQuery AnswersCorrectnessAnswer type
11.75✓Easy
21.70✓Easy
31.88✓Easy
41.68✓Easy
51.85✓Easy
61.78✓Easy
71.82✓Easy
81.73✗-
91.65✓Hard
+ +What is the longitude of a film or television production released in 1912.0 or the capital of Durham? + +Figure 34: Intermediate variable assignments and ranks for example rpua query. +![](images/83107583bf4c9e887ba78e9f7765b4f22f62da297d3e1521d03cc97a92b92786.jpg) +A1: date_of_first Episode +A2: geocode longitude +R1: location/contains + +
Logical Expression:Q [N?] = N?, ∃N?, a1 (E1, N?) ∧ (∃E1, a2-1 (n1, E1) ∨ r1 (e1, E1))
RankQuery AnswersCorrectnessAnswer type
1-73.96✓Easy
2-1.57✓Hard
3-122.25X-
4-74.01X-
5-117.07X-
+ +What is the sum of Lubbock's total population and Hamilton's founding date? + +Figure 35: Intermediate variable assignments and ranks for example aab query. +![](images/999df207371315af2678441e49d32294590bb4acf580929b9154c3e932be4b94.jpg) +A1: population_number +A2: dated_location.date_founded + +
Logical Expression:Q [N7] = N7, ∃N7 = N1 + N2 | ∃N1, a1 (e1, N1), ∃N2, a2 (e2, N2)
RankQuery AnswersAccurate AnswersCorrectnessAnswer type
1237858.00237881✓Hard
2237905.00-✗-
+ +What is the number that approximately equals the total population of Syracuse to the longitude of the Inner Hebrides? + +Figure 36: Intermediate variable assignments and ranks for example aabn query. +![](images/5be6536e4d2518e1a473b618e7c0bb91d0d5e9a796a82a329b5b63775fbc7f03.jpg) +A1: population_number +A2: geocodelatitude +F1: approximatelyequal + +
Logical Expression:\( Q\left\lbrack {N}_{7}\right\rbrack = {N}_{7},\exists {N}_{7},\left( {{f}_{1}\left( {{N}_{3},{N}_{7}}\right) }\right) \land \left( {\exists {N}_{3} = {N}_{1} + {N}_{2}\exists {N}_{1},{a}_{1}\left( {{e}_{1},{N}_{1}}\right) ,\exists {N}_{2},{a}_{2}\left( {{e}_{2},{N}_{2}}\right) }\right) \)
RankQuery AnswersCorrectnessAnswer type
17981900.00✓Easy
28041685.00✓Easy
38053574.00✓Easy
48015348.00✓Easy
58081957.00✓Easy
68084000.00✓Hard
77977000.00✓Hard
+ +What is the sum of the date of birth of the person who won an Olympic medal with A and the longitude of Rockville? + +Figure 37: Intermediate variable assignments and ranks for example paab query. +![](images/b5d66c48695cfdb04adb966b5c425c1d37f14092188fd5a6966fcd9b97de3e3a.jpg) +A1: person.date_of_birth +A2: location.geocode longitude +R1: olympic_metal_honor/medalist + +
Logical Expression:\( Q\left\lbrack {N}_{i}\right\rbrack = {N}_{1},\exists {N}_{i},\left( {{f}_{1}\left( {{N}_{3},{N}_{5}}\right) }\right) \land \left( {\exists {N}_{4} = {N}_{1} + {N}_{2}\exists {N}_{1},{r}_{1}\left( {{e}_{1},{E}_{1}}\right) \land {a}_{1}\left( {{E}_{1},{N}_{1}}\right) ,\exists {N}_{2},{a}_{2}\left( {{e}_{2},{N}_{2}}\right) }\right) \)
RankQuery AnswersAccurate AnswersCorrectnessAnswer type
11907.851907.27✓Hard
21898.351898.35✓Easy
31899.181899.18✓Easy
41904.931904.93✓Easy
51899.27-✘-
+ +What is the sum of the time of incorporation of the city situated at longitude -5.93 degrees and the area of the city contained in Alaska? + +![](images/8f3e8b1e515d02ae0777117850d9c1de5741e62e7706cf0eea057e2046307e21.jpg) +Figure 38: Intermediate variable assignments and ranks for example parab query. + +A1: location.geocode.longitude +A2: location.location.area +A3: organization.date founded +R1: location/contains + +
Logical Expression:\( Q\left\lbrack {N}_{i}\right\rbrack = {N}_{1},{2\exists }{N}_{i}\left( {{f}_{1}\left( {{N}_{3},N}\right) }\right) \land \left( {\exists {N}_{3} = {N}_{1} + {N}_{2}\left| {{\exists }_{1},{r}_{1}\left( {{e}_{1},{E}_{1}}\right) \land {a}_{1}\left( {{E}_{1},{N}_{1}}\right) ,{\exists }_{{N}_{2},{r}_{2}\left( {{e}_{2},{E}_{2}}\right) \land {a}_{2}\left( {{E}_{2},{N}_{2}}\right) }\right) }\right. \)
RankQuery AnswersAccurate AnswersCorrectnessAnswer type
18885.108885.10✓Easy
267272.1067272.10✓Easy
343322.4843322.48✓Easy
46928.236928.23✓Hard
\ No newline at end of file