LogicJitter
LogicJitter: Let LLMs play and uncover misinformation
Python package for automatically generating logic-based training data to improve LLM reasoning and misinformation detection.
Authors: Luca Herranz-Celotti · Marco Viviani
Published in: Computers and Electrical Engineering 136 (2026) 111215
Read the paper: LogicJitter on ScienceDirect
DOI: 10.1016/j.compeleceng.2026.111215
Overview
LogicJitter generates structured, rule-based logic games in natural language. Each sample includes valid and fallacious reasoning patterns plus optional distractors (random characters, controlled errors, problem revisions) designed to counter cognitive biases and logical fallacies.
The dataset is virtually unbounded, perfectly balanced (50/50 true/false), and requires no human or LLM labeling.
Logic games
| Game | Description |
|---|---|
| Guided Maths | Scratchpad-style arithmetic (sum, product, polynomial) |
| Causal Clauses | Causal graphs with connectivity and fork/collider questions |
| Context-Free Grammars | String membership and grammar comparison |
| CLEVR | Textual spatial-reasoning scenes from CLEVR-style templates |
Augmentation presets
| Preset | Components |
|---|---|
full |
Games + Errors + Characters + Revisions (GECR) |
g |
Games only |
ge |
Games + Errors |
gec |
Games + Errors + Characters |
Installation
pip install logicjitter
Optional: set a custom data directory for generated datasets and CLEVR downloads:
export LOGICJITTER_DATA_DIR=/path/to/data
Quick start
Generate a single logic game
from logicjitter import LogicJitter
lj = LogicJitter(multimodal=True, n_characters=3, seed=42)
print(lj.get_logic_game())
print(lj.get_logic_game(game_type="causal"))
print(lj.get_logic_game(game_type="maths"))
Build a HuggingFace dataset
from logicjitter import create_logicjitter_dataset
ds = create_logicjitter_dataset(
n_samples=1000,
preset="full",
seed=42,
output_dir="./data",
)
print(len(ds), ds[0]["ntp"])
Command line
After pip install logicjitter, use the logicjitter-generate command. While developing
from a local clone, run pip install -e . first so the CLI is registered.
# Print demo samples (python -m works even without the console script)
python -m logicjitter --demo --n-samples 5 --preset full --no-multimodal
# Same via the installed entry point
logicjitter-generate --demo --n-samples 5 --preset full --no-multimodal
# Generate and save a dataset
logicjitter-generate --n-samples 1000 --preset full --output-dir ./data
Adding your own logic game
Each built-in game is a function with this signature:
def get_my_problem(error: bool = False, game_pieces: dict | None = None) -> dict:
return {
"problem": "...", # statement shown in the sample
"right_answers": ["yes"], # phrases a correct character may say
"wrong_answers": ["no"], # phrases an incorrect character may say
"game_pieces": {...}, # optional state for problem revisions
}
When error=True, bake a mistake into the statement. When game_pieces is passed back
on a revision round, update the underlying facts (e.g. change a number) while keeping
the same characters.
Register the game and generate samples:
from logicjitter import LogicJitter
lj = LogicJitter(multimodal=False, seed=0)
lj.register_game("parity", get_parity_problem)
print(lj.get_logic_game(game_type="parity"))
See examples/custom_parity_game.py for a complete,
runnable toy example (even/odd sums).
Package layout
logicjitter/
├── pyproject.toml
├── README.md
└── src/logicjitter/
├── __init__.py # LogicJitter, create_logicjitter_dataset
├── cli.py # logicjitter-generate entry point
├── dataset.py # HuggingFace dataset pipeline
├── paths.py # Package and cache paths
└── creation/ # Logic game generators
├── logicjitter_generator.py
├── arithmetics_dataset.py
├── causal_dataset.py
├── cfg_dataset.py
├── clevr_dataset.py
├── clevr_tools/
└── data/
Citation
@article{herranzcelotti2026logicjitter,
title = {LogicJitter: Let LLMs play and uncover misinformation},
author = {Herranz-Celotti, Luca and Viviani, Marco},
journal = {Computers and Electrical Engineering},
volume = {136},
pages = {111215},
year = {2026},
doi = {10.1016/j.compeleceng.2026.111215},
url = {https://www.sciencedirect.com/science/article/pii/S0045790626002879}
}
License
Published under CC BY 4.0.
Release files for logicjitter 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| logicjitter-0.1.0.tar.gz | 54.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| logicjitter-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 115.6 kB
Release files / logicjitter-0.1.0.tar.gz
| Download URL | logicjitter-0.1.0.tar.gz |
|---|---|
| Size | 54.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0011649c8f75966fdd888aa958b41f4e9b82b06c2c4dc7b405045471530e368c
|
|
BLAKE2b-256 checksum How to use checksums |
16c6b6c1b6a4ddfbd1a44b5f0db8b96589628929b4ab3bbaad49ea8b41f99854
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|
Release files / logicjitter-0.1.0-py3-none-any.whl
| Download URL | logicjitter-0.1.0-py3-none-any.whl |
|---|---|
| Size | 61.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ff20e74f705c211b7501ab9a0a2a0d62d956e975b0367627a47eda4bef2cf29f
|
|
BLAKE2b-256 checksum How to use checksums |
fc331f82fd65b81fa2b8c05a6d70fd337bd2ffb843e4f8644d707cadd78d1d16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|