Tensor Logic: Domingos treats Datalog rules as Einstein sums over Boolean tensors

Tensor Logic: The Language of AI

Pedro Domingos

cs.AI, cs.LG, cs.NE, cs.PL, stat.ML

2025-10-14

Domingos writes neural, symbolic, and probabilistic AI as tensor equations: a Datalog rule is an einsum plus a step, with temperature-tuned reasoning in embedding space.

What problem this solves

AI still lacks a native language. LISP and Prolog carried symbolic work and then stalled on scale and learning. PyTorch and TensorFlow graft autodiff and GPUs onto Python, and help not at all with automated reasoning or knowledge acquisition. Neurosymbolic stacks often inherit both sides’ weaknesses. Graphical models are a lingua franca for probabilistic AI, boxed in by inference cost.

Pedro Domingos at the University of Washington argues the unification has to happen in the math, not as another glue layer. A relation is a compact encoding of a sparse Boolean tensor. A Datalog rule is an Einstein sum over Boolean tensors, followed by an elementwise step. The two formalisms are the same operation on different atomic types.

Method

A tensor logic program is a set of tensor equations. The left-hand side names the tensor being computed. The right-hand side is a sequence of tensor joins, a projection onto the left-hand indices, and an optional univariate nonlinearity. Indices live in square brackets; repeated indices are summed, as in einsum. Missing entries default to 0, and equations that share a left-hand side add, matching several rules deriving the same predicate.

A few equations that can be recited:

Inference is the tensor analogue of forward and backward chaining. Learning is almost free: the derivative of an equation w.r.t. one right-hand tensor is the product of the others, so the gradient of a program is another tensor logic program. When structure varies by example, backpropagation through structure applies. Tensor decomposition is predicate invention.

The distinctive proposal is reasoning in embedding space. With random unit embeddings, a relation embeds as a superposition of tuple outer products; querying is a dot product whose error falls with dimension, in the spirit of a Bloom filter. With learned embeddings, the Gram matrix lets similar objects borrow inferences in proportion to similarity: analogy made explicit. A sigmoid with temperature T=0 collapses the Gram matrix to identity and reasoning to deduction; raising T turns the same program analogical. Domingos contrasts this with LLMs, which can hallucinate at T=0. Intermediate tensors can be read out at any step.

For scale he sketches two routes: dense blocks on GPU, sparse blocks handed to a database engine as relations; or Tucker-decompose sparse tensors into dense ones and run everything on GPU, controlling error with dimension and a step function.

Results

This is a manifesto. There are no benchmarks, no runtime numbers, no comparison table. What is shown is expressiveness: MLPs, CNNs, RNNs, GNNs, transformers, Datalog, kernel machines, and Bayesian networks all write as the same kind of equation. The RNN encoding is Turing-complete, so the language is. The embedding scheme quotes an error standard deviation of √(N/D) for set membership (N the set size, D the embedding dimension). Query accuracy on a real knowledge base is not measured.

The paper does not report wall-clock, memory, or task scores against PyTorch, Prolog, or any neurosymbolic system. tensor-logic.org is named as a follow-up venue. No compiler or GPU kernel is evaluated in the text.

Why it matters

If the observation holds, einsum is no longer an implementation trick of deep learning. It is the shared primitive of neural, symbolic, and probabilistic work. Prior knowledge can be written as rules and differentiated in place. Temperature becomes a knob between deduction and analogy, with inspectable intermediates.

Today it is closer to a design language than to a PyTorch replacement. Immunity to hallucination is an argument, not a measurement, until someone runs it. The people who should track this are working on neurosymbolic systems, auditable reasoning, or Python-glue fatigue. Production trainers do not yet have a stack to run.

Limitations

The hole is the empty experimental section. Unification at the syntax layer does not make training dynamics, numerics, or sparse GPU kernels easier. The “low-T, no hallucination” claim leans on near-orthogonality of random unit vectors; learned embeddings are highly correlated, and the error analysis may not carry. Tucker densification explodes with rank; the paper only says to set the dimension “appropriately.” Backward chaining fills missing subqueries with 0, which is not the failure semantics of logic programs. Domingos himself notes that new languages climb a steep hill; Python compatibility and absorbing NumPy/PyTorch are a proposed path, not a shipping product.

Terms

Source

What people are saying

Related papers

All paper explainers