arXiv:2610.32627cs.AIOct 2026

Manuscript Offprint

arXiv:2610.32627

LGMT: A Tool for Testing the Logical Reasoning Reliability of LLMs

Zenghui Zhou, Xiaoke Fang, Zheng Zheng

Zenghui Zhou, Xiaoke Fang, Zheng Zheng

School of Automation Science and Electrical Engineering, Beihang University

Xueyuan Road, Haidian District, Beijing, 100191, China

{zhouzenghui, fangxk, zhengz}@buaa.edu.cn

Abstract—Large Language Models (LLMs) increasingly serve as reasoning components in modern software systems, yet a model that answers a logical query correctly can contradict itself when the same problem is restated in an equivalent form. Static benchmarks evaluate queries in isolation and therefore fail to expose such inconsistencies. To address this limitation, we present LGMT, an open-source tool that detects reasoning inconsistencies through metamorphic relations grounded in first-order logic. Given a source test case in premise-conclusion form, LGMT generates logically equivalent follow-up cases and checks whether the model's entailment predictions agree across the pair, without ground-truth labels. The tool provides 20 built-in metamorphic relations, supports custom ones verified by the Z3 theorem prover, and runs from a CLI or a web studio, including an offline mock mode requiring no API key. Across six widely used LLMs on a bundled benchmark of 3,091 metamorphic groups, LGMT reveals inconsistency rates ranging from 20.84% to 29.44%. LGMT is publicly available on GitHub at https://github.com/MaxwelsDonc/lgmt-tool, with a demonstration video at https://youtu.be/gou4opptu1U.

I. INTRODUCTION

Software systems increasingly rely on large language models (LLMs) to derive conclusions from domain rules, policies, and constraints [1]. For such components, answering isolated benchmark queries correctly is necessary but not sufficient: if a model reverses its judgment when the same problem is phrased in another logically equivalent way, its reasoning cannot be trusted in production. Standard reference-based benchmarks [2], [3] score each query independently against a static label and therefore remain blind to self-contradictions across equivalent formulations.

Metamorphic testing (MT) overcomes this limitation without relying on ground-truth labels: instead of checking individual outputs against an explicit oracle, it verifies whether relations among multiple executions, known as metamorphic relations (MRs), hold. In this paradigm, the original inputs are source test cases. Transforming them under an MR yields follow-up test cases, and together they form metamorphic groups. If a model answers the follow-up test case differently from the source test case under a logic-preserving MR, the divergence exposes a reasoning defect [4].

Translating this principle into a practical tool requires addressing four concrete engineering tasks: rewriting formal logical structures rather than surface text, realizing only the modified statements in natural language, executing paired queries reliably across thousands of metamorphic groups and heterogeneous model APIs, and tracing aggregate violation rates back to individual cases for root-cause diagnosis. Existing reasoning test generators such as LogicAsker [5] and NLP-oriented MT frameworks [6], [7] address only isolated stages. None provides an extensible, end-to-end tool.

We present LGMT, an open-source tool that addresses this gap. Practitioners can evaluate any candidate model through OpenAI-compatible endpoints, QA teams can supply custom domain rules in natural language or NL+FOL pairs, and researchers can register custom Python MRs that Z3 verifies for equivalence upon loading [8].

This paper makes three primary contributions.

  • End-to-end implementation. Cases are kept in paired natural-language (NL) and first-order-logic (FOL) forms. The tool rewrites the FOL with 20 built-in MRs, realizes only the changed statements in NL, queries the model on both cases, and reports each disagreement with its evidence.

• Extensibility. Custom MRs are Z3-verified at registration. LGMT runs from a CLI or Web Studio, ships as a Docker image, and works offline with a mock model and no API key.

• Bundled benchmark. 3,091 metamorphic groups derived from FOLIO, LogicNLI, and ProVerQA, with results for six LLMs. The full empirical study is in the companion paper [4].