About LLMs as Planners, Not Reasoners
Gemini-Prolog is a hybrid question-answering system that combines Large Language Models (LLMs) with structured symbolic reasoning using Wikidata and Prolog. Instead of relying solely on retrieval-augmented generation (RAG), the pipeline dynamically constructs a temporary knowledge base from Wikidata, converts it into Prolog facts, generates a logical query via an LLM, executes it with SWI-Prolog, and formats the final answer with the LLM. The system emphasizes using the LLM as a planner for query generation and final output, while Prolog handles deterministic reasoning. It includes a question classifier to decide when to use symbolic reasoning and a fallback mechanism that reverts to a direct LLM answer if the logic pipeline fails. Built as an open-source project on GitHub, it requires Python 3.10+, SWI-Prolog, and Google GenAI API access.
Key Features
Pros & Cons
- Combines LLM flexibility with deterministic symbolic reasoning via Prolog
- Builds a structured knowledge base on the fly, not relying on pre-indexed documents
- Fallback mechanism ensures robust answers even when logic pipeline fails
- Open-source and extensible, allowing customization and experimentation
- Clear separation of roles: LLM for planning, Prolog for execution
- Requires SWI-Prolog installation and Google GenAI API access
- No temporal reasoning support
- Knowledge base size limited by expansion depth (may miss relevant data)
- Relies on LLM to generate correct Prolog queries, which can be error-prone
- Wikidata noise and incomplete or ambiguous data can affect results
- Not a fully general QA system; limited to factual queries compatible with symbolic reasoning