Natural Language to Logica: Towards Interactive and Explainable Data Analytics
- Ojaswa Gargc(Author),
- Shayan Mirjafaric(Author),
- Yilin Xiab(Author),
- ,
- Bertram Ludäscherb(Author),
- Evgeny Skvortsovc(Author)
- ,
- bUniversity of Illinois Urbana-Champaign,
- cGoogle LLC
Abstract
We propose to make data analysis more accessible and verifiable by generating Logica programs from natural language queries. Logica, a logic programming language that compiles to (embedded) SQL, combines the clarity of declarative logic rules with the scalability of robust SQL engines. We evaluate the translation of natural language to Logica using the Spider 1.0 SQL benchmark, demonstrating that Gemini 2.5 achieves accuracy comparable to the leading SQL generators. We also explore a 2-step translation via intermediate LogicLM configurations, i.e., using OLAP-style measures, dimensions, and filters. These configurations serve as another explainable intermediate layer that domain experts can easily validate, even with limited or no SQL, OLAP or logic programming experience. Our analysis reveals that approximately half of the Spider 1.0 queries can be expressed as OLAP queries with our approach. By employing Logica as an intermediate layer (rather than generating SQL directly), we create a transparent and verifiable path to database queries from natural language.
