Skip to main content
QUICK REVIEW

[Paper Review] Synthesizing Datalog Programs Using Numerical Relaxation

Xujie Si, Mukund Raghothaman|arXiv (Cornell University)|Jun 1, 2019
Machine Learning and AlgorithmsComputer Science12 references14 citations
TL;DR

This paper introduces Difflog, a numerical relaxation of Datalog that assigns real-valued weights to rules to enable continuous optimization for Datalog program synthesis. By minimizing the difference between predicted and target output values using a hybrid Newton-MCMC optimization, Difflog recovers discrete Datalog programs with significant improvements over state-of-the-art systems on 34 benchmarks, including complex recursive and higher-arity programs.

ABSTRACT

The problem of learning logical rules from examples arises in diverse fields, including program synthesis, logic programming, and machine learning. Existing approaches either involve solving computationally difficult combinatorial problems, or performing parameter estimation in complex statistical models. In this paper, we present Difflog, a technique to extend the logic programming language Datalog to the continuous setting. By attaching real-valued weights to individual rules of a Datalog program, we naturally associate numerical values with individual conclusions of the program. Analogous to the strategy of numerical relaxation in optimization problems, we can now first determine the rule weights which cause the best agreement between the training labels and the induced values of output tuples, and subsequently recover the classical discrete-valued target program from the continuous optimum. We evaluate Difflog on a suite of 34 benchmark problems from recent literature in knowledge discovery, formal verification, and database query-by-example, and demonstrate significant improvements in learning complex programs with recursive rules, invented predicates, and relations of arbitrary arity.

Motivation & Objective

  • To address the computational difficulty of synthesizing Datalog programs from examples, especially for complex programs with recursion and invented predicates.
  • To overcome limitations of existing combinatorial search and statistical learning methods that struggle with noise and scalability.
  • To enable efficient and robust synthesis by reformulating rule selection as a continuous optimization problem.
  • To leverage parallelism and stochastic sampling to accelerate synthesis beyond deterministic methods.
  • To demonstrate that continuous relaxation enables recovery of correct discrete Datalog programs with high accuracy and speed.

Proposed method

  • Extends Datalog with real-valued rule weights, creating a continuous semantics called Difflog where output tuples are assigned numerical values based on weighted rule derivations.
  • Reformulates program synthesis as minimizing the L2 loss between computed output values and target labels (1 for desirable, 0 for undesirable tuples).
  • Employs a hybrid optimization strategy combining Newton’s method for local convergence and MCMC-based simulated annealing to escape local minima and saddle points.
  • Uses the Viterbi semiring to instantiate the K-relation framework, enabling provenance-aware numerical inference.
  • After optimization, recovers a discrete Datalog program by thresholding rule weights, leveraging semantic correspondence between Difflog and classical Datalog.
  • Runs multiple independent optimization instances in parallel to enable stochastic speedup and improve robustness to initialization.

Experimental results

Research questions

  • RQ1Can numerical relaxation of Datalog rules improve the scalability and robustness of program synthesis for complex logical programs?
  • RQ2How does combining Newton’s method with MCMC-based sampling outperform pure optimization or sampling strategies in solving the non-convex optimization surface of rule selection?
  • RQ3To what extent can continuous optimization with stochastic sampling enable faster and more reliable recovery of correct Datalog programs compared to deterministic combinatorial search?
  • RQ4Does the relaxation-based approach maintain expressiveness for recursive rules, invented predicates, and arbitrary-arity relations?
  • RQ5Can the method achieve state-of-the-art performance on diverse benchmarks from knowledge discovery, formal verification, and database query-by-example?

Key findings

  • Difflog achieved 100% success rate on 32 of 34 benchmarks, with only 2 timeouts (on downcast and rv-check), outperforming Alps in median running time on 6 out of 10 program analysis benchmarks.
  • The hybrid optimization approach reduced timeouts by 31× compared to Newton-only and 54× compared to MCMC-only variants, demonstrating superior balance between exploration and exploitation.
  • Running time increased only modestly with more rule templates, and scaled linearly with training data size, indicating good practical scalability.
  • The best running time across 32 parallel runs was consistently faster than Alps, and the method exhibited stochastic speedup through parallel execution.
  • The approach successfully synthesized complex programs with recursion, invented predicates, and arbitrary-arity relations, confirming its expressive power and robustness.
  • The recovery of discrete Datalog programs from continuous optima was effective, with the final programs matching the desired output behavior on all successful benchmarks.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.