cd /news/ai-agents/datalog-for-llms · home › topics › ai-agents › article
[ARTICLE · art-176054] src=arxiv.org ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Datalog for LLMs?

A November 22, 2026 arXiv paper by Bruno Rucy Carneiro Alves De Lima proposes giving LLM agents a Datalog REPL over a dynamic Datalog engine so derived facts persist across questions instead of being recomputed. Across chains of questions over three knowledge graphs and two models, agents reused a relation the REPL kept in 179 of 180 cases, while SQL and Python agents wrote 23 to 82% more output tokens; with Claude Haiku 5.5, a seven-question chain at 13 million facts took a median of 48 and 56 seconds versus 31 seconds with the REPL. The paper reports that with thinking enabled, the models answer as accurately in Datalog as in SQL or Python.

recommendation

Give knowledge-graph agents a persistent Datalog REPL that keeps derived relations across questions instead of re-evaluating each query from scratch; the source measured 179/180 relation reuse and 23-82% fewer output tokens than SQL or Python agents.

more in playbook: Designing agent systems
read2 min views3 publishedNov 25, 2026
Datalog for LLMs?
Image: source
  [Submitted on 22 Nov 2026]


[View PDF](https://arxiv.org/pdf/2611.29709)

Abstract:An LLM agent that answers questions about a knowledge graph writes a program per question, and its tools evaluate each from scratch. We give the agent a Datalog REPL, a session over a dynamic Datalog engine, in which rules are inserted and retracted like facts while derived facts stay current. Prompt caching reuses the model's processing of what a session shares, and the Datalog REPL reuses the evaluation of it. On chains of questions over three knowledge graphs, agents reuse a relation that the REPL keeps in 179 of 180 cases, with two models, and write fewer output tokens: SQL and Python agents write 23 to 82% more. With SQL tables or a Python namespace, Claude Haiku 5.5 stores almost nothing for later questions, and a chain of seven questions at 13 million facts takes it a median of 48 and 56 s, against 31 s with the REPL. Claude Opus 5.5 matches the REPL by storing tables in SQL, and when the data changes it stores views, which are evaluated again at every read. A relation that the REPL keeps is read like a table and stays current like a view. Datalog is a niche language beside SQL and Python, and with thinking enabled the models answer as accurately with it.

Submission history #

From: Bruno Rucy Carneiro Alves De Lima [

[view email](https://arxiv.org/show-email/670e86a3/2611.29709)]

**[v1]** Sun, 22 Nov 2026 19:20:27 UTC (347 KB)

Additional Features

References & Citations

...

Bibliographic Explorer

(What is the Explorer?) Connected Papers

(What is Connected Papers?) Litmaps

(What is Litmaps?) scite Smart Citations

(What are Smart Citations?) alphaXiv

(What is alphaXiv?) CatalyzeX Code Finder for Papers

(What is CatalyzeX?) DagsHub

(What is DagsHub?) Gotit.pub

(What is GotitPub?) Hugging Face

(What is Huggingface?) ScienceCast

(What is ScienceCast?) Influence Flower

(What are Influence Flowers?) CORE Recommender

(What is CORE?) arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.

Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them.

Have an idea for a project that will add value for arXiv's community? Learn more about arXivLabs.

── more in #ai-agents 4 stories · sorted by recency
── more on @bruno rucy carneiro alves de lima 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/datalog-for-llms] indexed:0 read:2min 2026-11-25 · —