Csql : Mapping Documents into Causal Databases

Sridhar Mahadevan · 2026

Read Csql : Mapping Documents into Causal Databases by Sridhar Mahadevan (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2601-08109.txt.

Introduction

Sridhar Mahadevan describes Csql, a system that turns plain documents into a causal database. His 2026 arXiv paper, marked as a draft under revision, automates the conversion from unstructured text. The result can be queried with SQL, the standard database language.

A causal database differs from a normal one in its purpose. It is built to answer why questions through causal interventions and structured causal queries. Instead of only storing facts, it stores relations that support what-if reasoning. For data scientists, Csql points toward documents that can be asked direct causal questions, not just searched for keywords.

Catalog record

CREATORSridhar Mahadevan
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE73 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2601-08109

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Csql : Mapping Documents into Causal Databases Thanks: Draft under revision. Sridhar Mahadevan Abstract We describe a novel system, Csql , that automatically converts a collection of unstructured text documents into an SQL-queryable causal database (CDB). A CDB differs from a traditional DB: it is designed to answer “why” questions via causal interventions and structured causal queries. Csql builds on our earlier system, Democritus , which converts documents into thousands of local causal models derived from causal discourse [ Mahadevan 2025b ] . Unlike RAG-based systems or knowledge-graph–centric approaches, Csql supports causal analysis over document collections rather than purely associative retrieval. For example, given an article on the origins of human bipedal walking, Csql enables queries such as: “What are the strongest causal influences on bipedalism?” or “Which variables act as causal hubs with the largest downstream influence?” Beyond single-document case studies, we show that Csql can also ingest RAG/IE-compiled causal corpora at scale by compiling the Testing Causal Claims (TCC) dataset of economics papers into a causal database containing 265,656 claim instances spanning 45,319 papers, 44 years, and 1,575 reported method strings, thereby enabling corpus-level causal queries and longitudinal analyses in SQL. Conceptually, Csql converts document collections into causally grounded relational databases, enabling causal analysis via standard SQL. In contrast to prior work that relies on hand-designed ontologies, fixed schemas, or domain-specific information extraction pipelines, Csql induces its schema directly from language (or from language-compiled causal artifacts). Viewed abstractly, Csql functions as a compiler from unstructured documents into a causal database equipped with a principled algebra of queries, and can be applied broadly across many domains ranging from business, economics, humanities, and science. K eywords Causality \cdot Natural Language \cdot Databases \cdot SQL \cdot AI \cdot Machine Learning 1 Introduction We introduce Csql , a causal knowledge discovery system that automatically converts collections of documents into SQL-queryable causal databases (CDB). Unlike retrieval-augmented generation (RAG) systems or knowledge-graph–centric approaches, which yield traditional databases, Csql supports causal analysis over document collections rather than purely associative retrieval. Csql also differs fundamentally from traditional causal inference methods [ Imbens and Rubin 2015 , Pearl 2009 ] , which typically focus on narrow, domain-specific studies grounded in numerical or experimental data. In contrast, Csql operates directly on large collections of unstructured text. A central feature of Csql is that it induces its relational schema directly from language. Unlike prior approaches that rely on hand-designed ontologies, fixed schemas, or domain-specific information extraction pipelines, Csql automatically constructs a causally grounded database whose structure emerges from discourse itself. Viewed abstractly, Csql functions as a compiler from unstructured documents into a causal database equipped with a principled algebra of queries. This design enables broad applicability across domains ranging from science and public policy to economics and history. Property RAG Systems Knowledge Graphs IE Pipelines Csql Primary goal Answer generation Structured facts Entity / relation extraction Causal analysis Input Text chunks Curated triples Annotated text Unstructured documents Schema None (implicit) Predefined ontology Fixed schema Induced from discourse Causality support None Implicit / informal Pairwise only Weighted causal relations Uncertainty None Rare / ad hoc None Aggregated model support Conflicting claims Not supported Manual resolution Not supported Preserved and quantified Compositionality Prompt-based Limited graph traversal Limited SQL joins and aggregations Counterfactuals No No No Supported via causal structure Output format Generated text Graph database Triples / tables Relational causal database Execution model Neural inference Symbolic querying Batch extraction Deterministic SQL Table 1: Comparison of Csql with RAG systems, knowledge graphs, and traditional information extraction (IE) pipelines. Csql differs by compiling causal discourse into an SQL-queryable causal database with explicit uncertainty and support for causal analysis. Table 1 contrasts traditional RAG or Knowledge Graph built databases with causal databases constructed by Csql . Csql builds directly on our previous work on Democritus , which introduced an end-to-end system for discovering and evaluating causal structure from language. Given a document, Democritus automatically constructs thousands of local causal models, evaluates them for plausibility, and aggregates them into a ranked causal analysis expressed in natural language. Csql takes the output of Democritus one step further by compiling these causal artifacts into an SQL-queryable database, thereby enabling systematic causal querying over entire document collections. Csql relies on recent advances in categorical causality [ Mahadevan 2025a , Fritz 2020 ] and geometric deep learning [ Fong et al. 2019 , Mahadevan 2024 , Gavranović et al. 2024 ] , together with large language models (LLMs) used as discourse compilers. LLMs can generate rich causal narratives—enumerating subtopics, posing causal questions, and articulating mechanisms across domains ranging from macroeconomics to neuroscience. However, LLM-based document summarization alone cannot produce a causally structured, queryable database. Csql fills this gap by transforming causal discourse into an explicit relational representation. For example, given a newspaper article—such as a recent Washington Post story on whether eating dark chocolate may elongate life, 1 1 1 https://www.washingtonpost.com/wellness/2025/12/26/dark-chocolate-health-benefits — Csql can construct a causal database that supports queries such as: “What are the strongest causal influences on dark chocolate consumption?” or “Which variables act as downstream causal hubs in this discourse?” More broadly, Csql is designed to support probing, comparative analysis of causal claims not only within individual documents, but across an entire frame of causal discourse induced from a document collection. A crucial design choice in Csql is the construction of this frame of discourse. Rather than restricting analysis to the input documents alone, the system treats each document as a seed for a broader causal neighborhood. Democritus first performs topic discovery over the input text and then expands these topics using a language model to construct a local discourse manifold. Causal claims are generated and evaluated relative to this expanded context. As a result, Csql reasons not only about what a document explicitly states, but about how its claims are situated within a larger landscape of causal discourse. 2 The Origin of Bipedal Walking: A Running Example We will illustrate the construction of Csql through a running example based on The Washington Post article on the origins of bipedal walking in human ancestors, dating back to 7 million years ago (see Figure 1 ). 2 2 2 urlhttps://www.washingtonpost.com/science/2026/01/02/human-ancestor-biped/ . The process of constructing a CSQL database involves first preprocessing the PDF document containing this article using our previous Democritus [ Mahadevan 2025b ] system. Democritus is a system for building large causal DAG models from carefully curated queries to a large language models (LLM) [ OpenAI 2025 , OpenAI 2024 , Anthropic 2024 , Dubey et al. 2024 , Mistral AI 2024 ] . Democritus can construct a rich library of DAG models from a text document in PDF format, evaluate and rank order these claims quantitatively, and then produce a natural language executive summary. Example local causal models automatically constructed from this article are shown in Figure 2 . Figure 1: An article in The Washington Post on the origins of human bipedal walking. Figure 2: Two causal models constructed from The Washington Post article on the origins of bipedal walking by human ancestors 7 million years ago. Democritus constructs thousands of such models automatically from the PDF document, which are then converted by Csql into a causal database. Democritus constructs a detailed

Read the complete text