Linear-time rule mining under formal guarantees

Jonathan Feldstein, Dominic Phillips, Efthymia TsamouraNeurIPS 2026

TL;DR

Learning explainable logical rules directly from relational data usually hits a brutal wall of exponential computational costs, forcing researchers to either write rules by hand or throw massive GPU clusters at neural approximations. This paper introduces SPECTRUM, an algorithm that learns logical rules in linear time with formal mathematical guarantees on rule quality and noise robustness. Running on a standard laptop CPU, it scales to millions of facts and outperforms GPU-heavy neural baselines in less than 1% of the runtime—slashing energy consumption by over 99.8%.

What Problem Does This Paper Address?

Neurosymbolic AI aims to marry the pattern-matching power of neural networks with the crisp, explainable reasoning of logic. Unlike neural network weights, however, the underlying logical rules—like "if Alice and Bob are friends, and Alice likes Star Wars, Bob probably likes Star Wars"—are typically handcrafted by human experts. Automating this process from raw data is known as structure learning.

Historically, structure learning has been crippled by combinatorics. As datasets grow in entities and relationships, searching for candidate rules and running exact logical inference to test them scales exponentially, choking traditional methods at around $10^3$ facts. Recent differentiable and neural network approaches push this boundary to $10^5$ facts, but they demand expensive, memory-hungry GPUs and tend to generate thousands of noisy, low-quality rules. The authors ask: can we learn compact, accurate logical theories at massive scale without exact inference or heavy hardware?

Methods

SPECTRUM (Structural Pattern Extraction and Cheap Tuning of Rules based on Utility Measure) sidesteps expensive logical inference entirely by treating relational databases as hypergraphs (nodes are entities like alice or starwars; edges are relationships like LIKES) and evaluating rules via fast subgraph counting.

Patterns of a rule body (top) and full rule (bottom) represented as subgraphs.

The pipeline achieves linear-time scaling in dataset size through three core components:

  • Rule Utility (Evaluation without Inference): The authors formulate logical equivalents of classification precision (how often a rule's conclusion holds when its premise holds) and recall (how many distinct facts a rule explains, using a logarithm to model diminishing returns for explaining the same fact twice). Crucially, precision is corrected for graph symmetries and divided by a Bayesian prior so common predicates don't get high scores by sheer luck, while recall is penalized by rule length (Occam's razor).
  • Parallel Pattern Mining: Finding all subgraphs is computationally intractable. Instead of naive random walks—which wastefully repeat paths and miss patterns—SPECTRUM runs bounded, non-repeating paths in parallel from each node, grafting unary and binary edges step-by-step. Leveraging the observation that network patterns follow a Zipf distribution, the algorithm automatically calculates the exact number of paths needed to guarantee utility estimates within a target error $\varepsilon$.
  • Greedy Rule-Set Optimisation: Candidate rules that beat random chance (prior-corrected precision $> 1$) are ranked, and SPECTRUM greedily builds a theory of up to $M$ rules that maximize joint theory utility. Because utility is model-agnostic, the resulting rules can be plugged into fuzzy logic, Markov Logic Networks, or Probabilistic Soft Logic (PSL).

Datasets

No new datasets are introduced; the authors evaluate SPECTRUM on seven established benchmarks:

  • Knowledge Graph Completion (KGC): Family ($6 \times 10^3$ facts), UMLS ($1 \times 10^3$), Kinship ($2 \times 10^3$), WN18RR ($1 \times 10^5$), and FB15K-237 ($3 \times 10^5$).
  • Large-scale PSL Rule Recovery: CAD ($2.4 \times 10^5$ facts) and Yelp ($2.2 \times 10^6$ facts), where learned rules are compared against domain-expert handcrafted theories.

Key Insights and Ideas

  • Exact inference is an unnecessary bottleneck: Counting subgraphs and normalizing against a random-chance Bayesian prior acts as a remarkably faithful proxy for predictive power, turning an exponential optimisation loop into linear-time lookups.
  • Less is more in rule generation: Neural baselines like NCRL generate $\mathcal{O}(10^3)$ rules per predicate, drowning predictions in low-quality noise. By strictly filtering out rules that don't beat the Bayesian prior, SPECTRUM stops early when no informative patterns remain—for example, returning a crisp 21-rule theory on CAD despite being allowed up to $M=380$ rules.
  • Provable resilience to missing data: Real-world databases are incomplete. The authors prove that if each fact is independently missing with probability $p$, utility estimates degrade gracefully within a bounded fractional error of $\mathcal{O}(L_{\max} p)$.

Key Results

Running on a 6-core laptop CPU (i7-10750H) with fixed hyperparameters across all tasks, SPECTRUM was benchmarked against AMIE3, RNNLogic, CTP, and NCRL running on 32 GB V100 GPUs:

  • Speed and Scale: SPECTRUM achieved 100–1000$\times$ speedups over baselines. It processed 2.2 million facts on Yelp in 17 seconds—over $28\times$ faster than any baseline processed just 2,000 facts on Kinship ($\ge 480$s). On FB15K-237 ($3 \times 10^5$ facts), SPECTRUM finished in 16.7s, whereas RNNLogic and CTP timed out after 24 hours and NCRL crashed out of GPU memory.
  • Accuracy: SPECTRUM achieved the highest Hit@10 on 4 of the 5 KGC datasets (e.g., 0.890 vs. NCRL's 0.687 on WN18RR; 0.952 vs. 0.853 on UMLS) and the best MRR on Family, UMLS, and FB15K-237 (falling behind neural methods mainly on Kinship).
  • Expert Rule Recovery & Energy: It recovered 21/21 expert-crafted rules on CAD (in 37s) and 24/26 on Yelp (in 17s), while reducing total hardware energy consumption by $>99.8\%$.

Limitations and Future Work

To achieve linear-time pattern mining, SPECTRUM restricts the shapes of rules it can discover. Learned rules must be body-connected, term-constrained, and involve only unary and binary predicates (where each variable appears in at most one unary and two binary predicates). While adding unary predicates allows richer structures than the strict binary chain rules of neural competitors, it remains less expressive than general Inductive Logic Programming. Because the utility framework itself is independent of the miner, the authors suggest future work could swap in more sophisticated mining algorithms to capture trees or higher-arity predicates without altering the rest of the pipeline.

Summary updated

Abstract

Probabilistic logical models are a core component of neurosymbolic AI and are important in their own right for tasks that require high explainability. Unlike neural networks, logical theories that underlie the model are often handcrafted using domain expertise, making their development costly and prone to errors. While there are algorithms that learn logical theories from data, they are generally prohibitively expensive, limiting their applicability in real-world settings. Here, we introduce precision and recall for logical rules and define their composition as rule utility -- a measure of the predictive power of logical theories that can be computed in linear time in the data size. We then present SPECTRUM, a linear-time framework for learning logical theories from relational data, that mines recurrent patterns in the data, and subsequently uses our utility measure to evaluate and rank the rules derived from these patterns. Finally, we prove theoretical guarantees on the utility of the learnt logical theory. As a result, we demonstrate across various tasks that SPECTRUM scales to databases with orders of magnitude more relations and entities, often learning more accurate logical theories on CPUs in < 1% of the runtime of state-of-the-art neural network approaches on GPUs.
BibTeX
@inproceedings{feldstein2026linear,
  author = {Jonathan Feldstein and Dominic Phillips and Efthymia Tsamoura},
  title = {{Linear-time rule mining under formal guarantees}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=xyPT9RQdve},
}
Figure